Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SDECWL1

SDECWL1.m

Go to the documentation of this file.
SDECWL1 ;ALB/SAT,CT - VISTA SCHEDULING RPCS ;MAY 12, 2020@12:25
 ;;5.3;Scheduling;**627,642,658,745**;Aug 13, 1993;Build 40
 ;
 Q
 ;
 ; Get SD WAIT LIST for all entries in the user's Institution
 ; where the Current Status is not C(losed).
WLGET(RET,WLIEN1,MAXREC,SDBEG,SDEND,DFN,LASTSUB,SDTOP,SVCL,DESDT,PRL,SVCR,SCVISIT,CLINIC,ORIGDT) ;Waitlist GET  ;alb/sat 658 add SVCL-ORIGDT
WLGETA ;
 ;
 N CLOSED,DES,FNUM,WLORIGDT,WLINST,WLINSTNM,WLTYPE,WLTEAM,WLPOS
 N ELIGIEN,ELIGNAME,FRULES,GLOREF
 N SDK,SDSUB,SDTMP,SVC,WLSSIEN,WLSSNAME,WLCLIEN,WLCLNAME
 N WLUSER,WLPRIO,WLREQBY,WLPROV,WLPROVNM,WLDAPTDT,WLCOMM,WLEESTAT,WLUSRNM
 N WLCLIENL,WLEDT,WLIEN,PTINFOLSTA,WLDISPD,WLDISPU,WLDISPUN,WLSVCCON
 N WLSTAT,COUNT,STR,SDRTMP,SDWAIT
 N PCITY,GAF,PPC,WLENPRI,WLASD,WLPC,WLDATA
 N SDI,SDJ,SDMTRC,SDSENS,X,Y,%DT
 S RET="^TMP(""SDEC"","_$J_")"
 K @RET
 S FNUM=$$FNUM^SDECWL,COUNT=0
 S MAXREC=+$G(MAXREC,50)
 D HDR
 S GLOREF=$NA(^SDWL(409.3,"C",DUZ(2)))
 S FRULES=1
 S WLIEN=0
 ;F  S WLIEN=$O(@GLOREF@(WLIEN)) Q:'WLIEN  D ONEPAT I MAXREC,COUNT'<MAXREC Q
 S SDBEG=$G(SDBEG)
 I SDBEG'="" S %DT="" S X=$P(SDBEG,"@",1) D ^%DT S SDBEG=Y I Y=-1 S SDBEG=3100101
 I SDBEG="" S SDBEG=3100101
 S SDEND=$G(SDEND)
 I SDEND'="" S %DT="" S X=$P(SDEND,"@",1) D ^%DT S SDEND=Y I Y=-1 S SDEND=$$FMADD^XLFDT($E($$NOW^XLFDT,1,12),-90)
 I SDEND="" S SDEND=$$FMADD^XLFDT($E($$NOW^XLFDT,1,12),-90)
 S DFN=$G(DFN)
 I DFN'="",'$D(^DPT(DFN,0)) S DFN=""
 S LASTSUB=$S(DFN="":$G(LASTSUB),1:"")
 S SDTOP=+$G(SDTOP)
 ;single IEN
 S WLIEN1=$G(WLIEN1)
 I +WLIEN1 I '$D(^SDWL(409.3,+WLIEN1,0))  S COUNT=COUNT+1 S @RET@(COUNT)="-1^Invalid Wait List ID." Q  ;S WLIEN1=""
 I +WLIEN1 D
 .S WLIEN=+WLIEN1
 .S FRULES=0  ;no rules - just return the single record
 .D ONEPAT
 I +WLIEN1 S @RET@(COUNT)=@RET@(COUNT)_$C(31) Q
 ;by patient
 I +DFN D
 .I 'SDTOP S WLIEN=0 F  S WLIEN=$O(^SDWL(409.3,"B",+DFN,WLIEN)) Q:WLIEN'>0  D ONEPAT  ;I MAXREC,COUNT'<MAXREC Q
 .I SDTOP S WLIEN=999999999 F  S WLIEN=$O(^SDWL(409.3,"B",+DFN,WLIEN),-1) Q:WLIEN'>0  D ONEPAT  ;I MAXREC,COUNT'<MAXREC Q
 ;alb/sat 658 start modifications
 ;validate ORIGDT
 S ORIGDT=$G(ORIGDT)
 ;validate CLINIC
 S CLINIC=$G(CLINIC)
 ;validate SVCL
 S SVCL=$G(SVCL)
 I SVCL'="" D
 .F SDI=$L(SVCL,"|"):-1:1 S SVC=$P(SVCL,"|",SDI) D
 ..I (SVC="")!('$D(^DIC(40.7,+SVC,0))) S SVCL=$$PD^SDECUTL(SVCL,SDI,"|")
 ;validate DESDT
 S DESDT=$G(DESDT)
 ;validate PRL
 S PRL=$G(PRL)
 I PRL'="" D
 .N PR
 .F SDI=$L(PRL,"|"):-1:1 S PR=$P(PRL,"|",SDI) D
 ..I "012345678"'[PR S PR=$E(PR,7)
 ..I "012345678"'[PR S PRL=$$PD^SDECUTL(PRL,SDI,"|")
 ;validate SVCR
 S SVCR=$G(SVCR) S:SVCR'="" SVCR=$$UP^XLFSTR(SVCR)
 I SVCR'="" S SVCR=$S(SVCR="Y":1,SVCR="N":0,SVCR="YES":1,SVCR="NO":0,1:"")
 ;validate SCVISIT
 S SCVISIT=$G(SCVISIT) S:SCVISIT'="" SCVISIT=$$UP^XLFSTR(SCVISIT)
 I SCVISIT'="" S SCVISIT=$S(SCVISIT="Y":"Y",SCVISIT="N":"N",SCVISIT="YES":"Y",SCVISIT="NO":"N",1:"")
 ;
 ;clinic
 I CLINIC'="" D  G WLX
 .S SDI=$S($P(LASTSUB,"|",1)'="":$P(LASTSUB,"|",1),1:1)
 .F SDI=SDI:1:$L(CLINIC,"|") S SDCL=$P(CLINIC,"|",SDI) D  I MAXREC,COUNT'<MAXREC Q
 ..Q:SDCL=""
 ..I DESDT'="" D  Q  ;GCC  DESDT desired dates by pipe
 ...S SDT=$S($P(LASTSUB,"|",2)'="":$P(LASTSUB,"|",2)-1,1:1)
 ...F SDT=SDT:1:$L(DESDT,"|") S DES=$P(DESDT,"|",SDT) D  I MAXREC,COUNT'<MAXREC Q
 ....Q:DES=""
 ....S WLIEN=$S($P(LASTSUB,"|",3)'="":$P(LASTSUB,"|",3),1:0)
 ....F  S WLIEN=$O(^SDWL(409.3,"GCC",SDCL,DES,WLIEN)) Q:WLIEN=""  D  I MAXREC,COUNT'<MAXREC S SDSUB=SDCL_"|"_SDT_"|"_WLIEN Q
 .....D ONEPAT
 ..;
 ..S SDT=$S($P(LASTSUB,"|",2)'="":$P(LASTSUB,"|",2)-1,ORIGDT'="":ORIGDT-1,1:SDBEG-1)  ;GC
 ..F  S SDT=$O(^SDWL(409.3,"GC",SDCL,SDT)) Q:SDT=""  Q:((ORIGDT'="")&(SDT>ORIGDT))  Q:(ORIGDT="")&(SDT>SDEND)  D  I MAXREC,COUNT'<MAXREC Q
 ...S WLIEN=$S($P(LASTSUB,"|",3)'="":$P(LASTSUB,"|",3),1:0)
 ...F  S WLIEN=$O(^SDWL(409.3,"GC",SDCL,SDT,WLIEN)) Q:WLIEN=""  D  I MAXREC,COUNT'<MAXREC S SDSUB=SDI_"|"_SDT_"|"_WLIEN Q
 ....D ONEPAT
 ;clinic stop/services
 I SVCL'="" D  G WLX
 .N PR1,SDT
 .S SDI=$S($P(LASTSUB,"|",1)'="":$P(LASTSUB,"|",1),1:1)
 .F SDI=SDI:1:$L(SVCL,"|") S SVC=$P(SVCL,"|",SDI) D  I MAXREC,COUNT'<MAXREC Q
 ..Q:SVC=""
 ..;I DESDTR'="" D  ;desired date range range <begin> ~ <end> not implemented
 ..I DESDT'="" D  Q  ;GSC  DESDT desired dates by pipe
 ...S SDT=$S($P(LASTSUB,"|",2)'="":$P(LASTSUB,"|",2)-1,1:1)
 ...F SDT=SDT:1:$L(DESDT,"|") S DES=$P(DESDT,"|",SDT) D  I MAXREC,COUNT'<MAXREC Q
 ....Q:DES=""
 ....S WLIEN=$S($P(LASTSUB,"|",3)'="":$P(LASTSUB,"|",3),1:0)
 ....F  S WLIEN=$O(^SDWL(409.3,"GSC",SVC,DES,WLIEN)) Q:WLIEN=""  D  I MAXREC,COUNT'<MAXREC S SDSUB=SVC_"|"_SDT_"|"_WLIEN Q
 .....D ONEPAT
 ..I PRL'="" D  Q   ;GSP
 ...S SDK=$S($P(LASTSUB,"|",2)'="":$P(LASTSUB,"|",2)-1,1:1)
 ...F SDK=SDK:1:$L(PRL,"|") S PR1=$P(PRL,"|",SDK) D  I MAXREC,COUNT'<MAXREC Q
 ....S SDT=$S($P(LASTSUB,"|",3)'="":$P(LASTSUB,"|",3)-1,1:SDBEG-1)
 ....F  S SDT=$O(^SDWL(409.3,"GSP",SVC,PR1,SDT)) Q:SDT=""  Q:SDT>SDEND  D  I MAXREC,COUNT'<MAXREC Q
 .....S WLIEN=$S($P(LASTSUB,"|",4)'="":$P(LASTSUB,"|",4),1:0)
 .....F  S WLIEN=$O(^SDWL(409.3,"GSP",SVC,PR1,SDT,WLIEN)) Q:WLIEN=""  D ONEPAT  I MAXREC,COUNT'<MAXREC S SDSUB=SVC_"|"_SDK_"|"_SDT_"|"_WLIEN Q
 ..I SVCR'="" D  Q  ;GSB - WL service connected
 ...S SDT=$S($P(LASTSUB,"|",2)'="":$P(LASTSUB,"|",2)-1,1:SDBEG-1)
 ...F  S SDT=$O(^SDWL(409.3,"GSB",SVC,$E(SVCR),SDT)) Q:SDT=""  Q:SDT>SDEND  D  I MAXREC,COUNT'<MAXREC Q
 ....S WLIEN=$S($P(LASTSUB,"|",3)'="":$P(LASTSUB,"|",3),1:0)
 ....F  S WLIEN=$O(^SDWL(409.3,"GSB",SVC,$E(SVCR),SDT,WLIEN)) Q:WLIEN=""  D ONEPAT  I MAXREC,COUNT'<MAXREC S SDSUB=SVC_"|"_SDT_"|"_WLIEN Q
 ..I SCVISIT'="" D  Q  ;GSA - Patient Service Connected
 ...S SDT=$S($P(LASTSUB,"|",2)'="":$P(LASTSUB,"|",2)-1,1:SDBEG-1)
 ...F  S SDT=$O(^SDWL(409.3,"GSA",SVC,$E(SCVISIT),SDT)) Q:SDT=""  Q:SDT>SDEND  D  I MAXREC,COUNT'<MAXREC Q
 ....S WLIEN=$S($P(LASTSUB,"|",3)'="":$P(LASTSUB,"|",3),1:0)
 ....F  S WLIEN=$O(^SDWL(409.3,"GSA",SVC,$E(SCVISIT),SDT,WLIEN)) Q:WLIEN=""  D ONEPAT  I MAXREC,COUNT'<MAXREC S SDSUB=SVC_"|"_SDT_"|"_WLIEN Q
 ..S SDT=$S($P(LASTSUB,"|",2)'="":$P(LASTSUB,"|",2)-1,1:SDBEG-1)  ;GS
 ..F  S SDT=$O(^SDWL(409.3,"GS",SVC,SDT)) Q:SDT=""  Q:SDT>SDEND  D  I MAXREC,COUNT'<MAXREC Q
 ...S WLIEN=$S($P(LASTSUB,"|",3)'="":$P(LASTSUB,"|",3),1:0)
 ...F  S WLIEN=$O(^SDWL(409.3,"GS",SVC,SDT,WLIEN)) Q:WLIEN=""  D  I MAXREC,COUNT'<MAXREC S SDSUB=SDI_"|"_SDT_"|"_WLIEN Q
 ....D ONEPAT
 ;all by date range
 I 'DFN D
 .I 'SDTOP D
 ..S SDJ=$S($P(LASTSUB,"|",1)'="":$P(LASTSUB,"|",1)-1,1:SDBEG-1)
 ..F  S SDJ=$O(^SDWL(409.3,"E","O",SDJ)) Q:SDJ'>0  Q:SDJ>SDEND  D  I MAXREC,COUNT'<MAXREC Q
 ...S WLIEN=$S($P(LASTSUB,"|",2)'="":$P(LASTSUB,"|",2),1:0) S LASTSUB=""
 ...F  S WLIEN=$O(^SDWL(409.3,"E","O",SDJ,WLIEN)) Q:WLIEN'>0  D  I MAXREC,COUNT'<MAXREC S SDSUB=SDJ_"|"_WLIEN Q
 ....S SDSUB=""
 ....D ONEPAT
 .I +SDTOP D
 ..S SDJ=$S($P(LASTSUB,"|",1)'="":$P(LASTSUB,"|",1)+1,1:SDEND+1)
 ..F  S SDJ=$O(^SDWL(409.3,"E","O",SDJ),-1) Q:SDJ'>0  Q:SDJ<SDBEG  D  I MAXREC,COUNT'<MAXREC Q
 ...S WLIEN=$S($P(LASTSUB,"|",2)'="":$P(LASTSUB,"|",2),1:999999999) S LASTSUB=""
 ...F  S WLIEN=$O(^SDWL(409.3,"E","O",SDJ,WLIEN),-1) Q:WLIEN'>0  D  I MAXREC,COUNT'<MAXREC S SDSUB=SDJ_"|"_WLIEN Q
 ....S SDSUB=""
 ....D ONEPAT
WLX S SDTMP=@RET@(COUNT) S SDTMP=$P(SDTMP,$C(30),1)
 S:$G(SDSUB)'="" $P(SDTMP,U,56)=SDSUB
 S @RET@(COUNT)=SDTMP_$C(30,31)
 Q
 ;
HDR ;Output header
 ;               1         2
 S SDRTMP="T00030DFN^T00030NAME"
 ;                       3         4         5         6            7         8
 S SDRTMP=SDRTMP_"^T00030HRN2^T00030DOB^T00030SSN^T00030GENDER^I00010IEN^D00030ORIGDT"
 ;                       9             10             11         12         13
 S SDRTMP=SDRTMP_"^T00030INSTIEN^T00030INSTNAME^T00030TYPE^T00030TEAM^T00030POS"
 ;                       14             15              16            17
 S SDRTMP=SDRTMP_"^T00030SRVSPIEN^T00030SRVSPNAME^T00030CLINIEN^T00030CLINNAME"
 ;                       18            19             20         21          22            23
 S SDRTMP=SDRTMP_"^T00030USERIEN^T00030USERNAME^T00030PRIO^T00030REQBY^T00030PROVIEN^T00030PROVNAME"
 ;                       24           25         26           27               28
 S SDRTMP=SDRTMP_"^T00030DAPTDT^T00250COMM^T00030EESTAT^T00030PTELEPHONE^T00030ENROLLMENT_PRIORITY"
 S SDRTMP=SDRTMP_"^T00250APPT_SCHED_DATE^T00010MULTIPLE APPOINTMENT RTC^T00010MULT APPT RTC INTERVAL"
 S SDRTMP=SDRTMP_"^T00010MULT APPT NUMBER"
 ;                                                                 36
 S SDRTMP=SDRTMP_"^T00030PRIGRP^T00030ELIGIEN^T00030ELIGNAME^T00030SVCCONN^T00030SVCCONNP"
 S SDRTMP=SDRTMP_"^T00030TYPEIEN^T00030TYPENAME^T00100PCONTACT^T00030WLDISPD^T00030WLDISPU^T00030WLDISPUN"
 ;                       44             45             46           47               48
 S SDRTMP=SDRTMP_"^T00030WLSVCCON^T00030PADDRES1^T00030PADDRES2^T00030PADDRES3^T00030PCITY"
 ;                       49           50             51          52        53         54
 S SDRTMP=SDRTMP_"^T00030PSTATE^T00030PCOUNTRY^T00030PZIP4^T00050GAF^T00030DATE^T00030MTRCDATES"
 S SDRTMP=SDRTMP_"^T00100SENSITIVE^T00030LASTSUB^T00030PRACE^T00030PRACEN^T00030PETH^T00030PETHN"
 S SDRTMP=SDRTMP_"^T00030APPTYPE^T00030PRHBLOC"   ;62
 S SDRTMP=SDRTMP_"^T00030HRN^T00030BADADD^T00030OPHONE^T00030NOK^T00030KNAME^T00030KREL^T00030KPHONE"  ;69
 S SDRTMP=SDRTMP_"^T00030KSTREET^T00030KSTREET2^T00030KSTREET3^T00030KCITY^T00030KSTATE^T00030KZIP"    ;75
 S SDRTMP=SDRTMP_"^T00030NOK2^T00030K2NAME^T00030K2REL^T00030K2PHONE"   ;79
 S SDRTMP=SDRTMP_"^T00030K2STREET^T00030K2STREET2^T00030K2STREET3^T00030K2CITY^T00030K2STATE^T00030K2ZIP^T00030PCOUNTY"  ;86
 S SDRTMP=SDRTMP_"^T00030PETH^T00030PRACE^T00030PMARITAL^T00030PRELIGION^T00030PTACTIVE"  ;91
 S SDRTMP=SDRTMP_"^T00030PTADDRESS1^T00030PTADDRESS2^T00030PTADDRESS3^T00030PTCITY^T00030PTSTATE^T00030PTZIP^T00030PTZIP+4"  ;98
 S SDRTMP=SDRTMP_"^T00030PTCOUNTRY^T00030PTCOUNTY^T00030PTMPPHONE^T00030PTSTART^T00030PTEND^T00030PCELL^T00030PPAGER^T00030PEMAIL"  ;106
 S SDRTMP=SDRTMP_"^T00030PF_FFF^T00030PF_VCD^T00030PFNATIONAL^T00030PFLOCAL^T00030SUBGRP^T00030CAT8G^T01000SIMILAR"  ;113
 S SDRTMP=SDRTMP_"^T00030CPHONE^T00030CLET"  ;115  added call phone & letter *745 5/14/20
 S @RET@(COUNT)=SDRTMP_$C(30)
 Q
ONEPAT ; Process one patient
 ;D GETS^DIQ(FNUM,WLIEN,"23;.01;.05;1;2;4;5;6;7;8;8.5;9;10,10.5;11;12;12.5;22;25;27","IE","WLDATA","WLMSG")
 N SDCL,SDI,WLSDOA,WLDAM,WLCLERK,WLCLERKN
 N APPTYPE,PRACE,PRACEN,PETH,PETHN,PRHBLOC
 K WLDATA
 S FRULES=$G(FRULES)
 D GETS^DIQ(FNUM,WLIEN,"**","IE","WLDATA","WLMSG")
 S WLSTAT=WLDATA(FNUM,WLIEN_",",23,"I")
 I FRULES I '+$G(CLOSED) Q:WLSTAT="C"  ; Ignore CLOSED records; CLOSED setup and used from SDEC54 only
 S WLORIGDT=WLDATA(FNUM,WLIEN_",",1,"I")
 I FRULES I ($P(WLORIGDT,".",1)<SDBEG)!($P(WLORIGDT,".",1)>SDEND) Q
 S DFN=WLDATA(FNUM,WLIEN_",",.01,"I")
 Q:DFN=""
 S WLCLIENL=WLDATA(FNUM,WLIEN_",",8,"I")
 S SDCL=WLDATA(FNUM,WLIEN_",",8.5,"I")
 I SDCL="" S SDCL=$$GET1^DIQ(409.32,WLCLIENL_",",.01,"I")
 Q:(SDCL'="")&($$GET1^DIQ(44,SDCL_",",50.01,"I")=1)  ;check OOS? in file 44
 S PRHBLOC=$S($$GET1^DIQ(44,SDCL_",",2500,"I")="Y":1,1:0)
 S GAF=$$GAF^SDECU2(DFN)
 D RACELST^SDECU2(DFN,.PRACE,.PRACEN)
 D ETH^SDECU2(DFN,.PETH,.PETHN)   ;get ethnicity
 S WLINST=WLDATA(FNUM,WLIEN_",",2,"I")
 S WLINSTNM=WLDATA(FNUM,WLIEN_",",2,"E")
 S WLTYPE=WLDATA(FNUM,WLIEN_",",4,"I")
 Q:"34"'[WLTYPE   ;only look for SERVICE/SPECIALITY or SPECIFIC CLINIC ;todo-need xref
 S WLTEAM=WLDATA(FNUM,WLIEN_",",5,"I")
 S WLPOS=WLDATA(FNUM,WLIEN_",",6,"I")
 S WLSSIEN=WLDATA(FNUM,WLIEN_",",7,"I")
 S WLSSNAME=WLDATA(FNUM,WLIEN_",",7,"E")
 S WLCLIEN=$P($G(^SDWL(409.32,+WLCLIENL,0)),U,1)
 S WLCLNAME=WLDATA(FNUM,WLIEN_",",8,"E")
 S APPTYPE=WLDATA(FNUM,WLIEN_",",8.7,"I")
 S WLUSER=WLDATA(FNUM,WLIEN_",",9,"I")
 S WLUSRNM=WLDATA(FNUM,WLIEN_",",9,"E")
 S WLEDT=$G(WLDATA(FNUM,WLIEN_",",9.5,"E"))   ;53
 S WLPRIO=WLDATA(FNUM,WLIEN_",",10,"I")
 S WLENPRI=WLDATA(FNUM,WLIEN_",",10.5,"E")   ;msc/sat
 S WLREQBY=WLDATA(FNUM,WLIEN_",",11,"I")
 S WLPROV=$S(WLREQBY=1:WLDATA(FNUM,WLIEN_",",12,"I"),1:"")     ;alb/sat 658 - only when REQBY is provider
 S WLPROVNM=$S(WLREQBY=1:WLDATA(FNUM,WLIEN_",",12,"E"),1:"")   ;alb/sat 658 - only when REQBY is provider
 S WLSDOA=WLDATA(FNUM,WLIEN_",",13,"E")    ;scheduled date of appt
 S WLDAM=WLDATA(FNUM,WLIEN_",",13.1,"E")   ;date appt. made
 S WLCLERK=WLDATA(FNUM,WLIEN_",",13.7,"I") ;appt clerk
 S WLCLERKN=WLDATA(FNUM,WLIEN_",",13.7,"E") ;appt clerk name
 S WLSVCCON=WLDATA(FNUM,WLIEN_",",15,"E")
 S WLDAPTDT=WLDATA(FNUM,WLIEN_",",22,"I")
 S WLCOMM=WLDATA(FNUM,WLIEN_",",25,"I")
 S WLEESTAT=WLDATA(FNUM,WLIEN_",",27,"I")
 S WLASD=""
 S:WLSDOA'="" $P(WLASD,"~~",1)=WLSDOA
 S:WLCLERK'="" $P(WLASD,"~~",12)=WLCLERK
 S:WLCLERKN'="" $P(WLASD,"~~",13)=WLCLERKN
 S:WLDAM'="" $P(WLASD,"~~",17)=WLDAM
 S WLPC=$$WLPC(.WLDATA,WLIEN)
 S WLDISPD=WLDATA(FNUM,WLIEN_",",19,"E")
 S WLDISPU=WLDATA(FNUM,WLIEN_",",20,"I")
 S WLDISPUN=WLDATA(FNUM,WLIEN_",",20,"E")
 S SDSENS=$$PTSEC^SDECUTL(DFN)
 S SDMTRC=""  ;S (SDI,SDMTRC)="" F  S SDI=$O(WLDATA(409.37,SDI)) Q:SDI=""  S SDMTRC=$S(SDMTRC'="":SDMTRC_"|",1:"")_WLDATA(409.37,SDI,.01,"E")
 S COUNT=COUNT+1
 ;     1     2    3    4    5    6    7       8          9        10         11       12       13
 S STR=DFN_U_""_U_""_U_""_U_""_U_""_U_WLIEN_U_WLORIGDT_U_WLINST_U_WLINSTNM_U_WLTYPE_U_WLTEAM_U_WLPOS
 ;           14        15         16        17         18       19        20       21        22
 S STR=STR_U_WLSSIEN_U_WLSSNAME_U_WLCLIEN_U_WLCLNAME_U_WLUSER_U_WLUSRNM_U_WLPRIO_U_WLREQBY_U_WLPROV
 S STR=STR_U_WLPROVNM_U_WLDAPTDT_U_WLCOMM_U_WLEESTAT_U_""_U_WLENPRI_U_WLASD_U_""_U_""_U_""                ;32
 S STR=STR_U_""_U_""_U_""_U_""_U_""_U_""_U_""_U_WLPC                                                           ;40
 S STR=STR_U_WLDISPD_U_WLDISPU_U_WLDISPUN_U_WLSVCCON_U_""_U_""_U_""_U_""_U_""                                  ;49
 ;           50   51   52    53      54   55       56   57      58       59     60      61
 S STR=STR_U_""_U_""_U_GAF_U_WLEDT_U_""_U_SDSENS_U_""_U_PRACE_U_PRACEN_U_PETH_U_PETHN_U_APPTYPE
 S STR=STR_U_PRHBLOC   ;62
 D WLDEMO^SDECWL3(.STR,DFN)
 ;S STR=STR_U_0_U_""  ; SET DEFAULT SDCALL TO 0 AND SDECLET TO NULL UNTIL FURTHER TESTING
 ;COMMENT OUT NEXT LINE INTIL FURTHER TESTING ; PWC *745
 S SDWAIT=$$CALLWL^SDECAR1A(DFN,WLIEN),STR=STR_U_$P(SDWAIT,U,1)_U_$P(SDWAIT,U,2)    ;SDCALL_U_SDECLET 114^115 COMPUTE CLAL AND LETTER DATA  CT - *745 5/12/20
 S @RET@(COUNT)=STR_$C(30)
 Q
 ;
WLPC(WLDATA,ASDIEN) ;
 N PC,PC1,PCIEN
 S PC=""
 S PCIEN="" F  S PCIEN=$O(WLDATA(409.344,PCIEN)) Q:PCIEN=""  D
 .Q:$P(PCIEN,",",2)'=ASDIEN
 .S PC1=""
 .S $P(PC1,"~~",1)=WLDATA(409.344,PCIEN,.01,"E")    ;DATE ENTERED
 .S $P(PC1,"~~",2)=WLDATA(409.344,PCIEN,2,"I")      ;PC ENTERED BY USER IEN
 .S $P(PC1,"~~",3)=WLDATA(409.344,PCIEN,2,"E")      ;PC ENTERED BY USER NAME
 .S $P(PC1,"~~",4)=WLDATA(409.344,PCIEN,3,"E")      ;ACTION
 .S $P(PC1,"~~",5)=WLDATA(409.344,PCIEN,4,"E")      ;PATIENT PHONE
 .S PC=$S(PC'="":PC_"::",1:"")_PC1
 Q PC