HMPPDL ;ASMR/PB - Get a users default patient list for HMP ; 07/31/2015
;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**;Jul 31, 2015;Build 63
;Per VA Directive 6402, this routine should not be modified.
;
; External References DBIA#
; ------------------------------
; $$BROKER^XWBLID 2190
; $$GET^XPAR 2263
; CLINPTS2^ORQPTQ2 4207
; BYWARD^ORWPT 4904
; PROVPTS^ORQPTQ2 4207
; SPECPTS^ORQPTQ2 4207
; $$UP^XLFSTR 10104
; $$FMTE^XLDFT 10103
; $$GET1^DIQ 2056
;
Q
;
DEFLIST(Y,DUZ) ; return current user's default patient list
I $$BROKER^XWBLIB S Y=$NA(^TMP("OR",$J,"PATIENTS")) ; GUI = global. ICR 2190
I '$$BROKER^XWBLIB S ^TMP("OR",$J,"PATIENTS",0)="" ;ICR 2190
Q:'$D(DUZ) ;DUZ is required in order to get the list of patients for the user
N FROM,IEN,BEG,END,API,ORSRV,ORQDAT,ORQCNT,ORGUI
;S ORSRV=$G(^VA(200,DUZ,5)) I +ORSRV>0 S ORSRV=$P(ORSRV,U) ; get the users Network Identifier for the user
S ORSRV=$$GET1^DIQ(200,DUZ_",",29,"I") ; get the users Network Identifier for the user ICR 2056
S FROM=$$GET^XPAR("USR^SRV.`"_+$G(ORSRV),"ORLP DEFAULT LIST SOURCE",1,"Q") ; gets the users default preference for patient list source. ICR 2263
;FROM - T:Team/Personal List, W:Ward List, C:Clinic List, P:Provider List, S:Specialty List; M:Combination List.
;FROM must be defined
Q:'$L($G(FROM))
I FROM="T" S IEN=$$GET^XPAR("USR^SRV.`"_+$G(ORSRV),"ORLP DEFAULT TEAM",1,"Q") D:+$G(IEN)>0 TEAMPTS^ORQPTQ1(.Y,IEN) ;returns the list of patients assigned to a team. ICR 2263
I FROM="W" S IEN=$$GET^XPAR("USR^SRV.`"_+$G(ORSRV),"ORLP DEFAULT WARD",1,"Q") D:+$G(IEN)>0 BYWARD^ORWPT(.Y,IEN) ;returns the list of patients on a ward ICR 4904 ICR 2263
I FROM="P" S IEN=$$GET^XPAR("USR^SRV.`"_+$G(ORSRV),"ORLP DEFAULT PROVIDER",1,"Q") D:+$G(IEN)>0 PROVPTS^ORQPTQ2(.Y,IEN) ;returns the list of patients assigned to a provider ICR 4207 ICR 2263
I FROM="S" S IEN=$$GET^XPAR("USR^SRV.`"_+$G(ORSRV),"ORLP DEFAULT SPECIALTY",1,"Q") D:+$G(IEN)>0 SPECPTS^ORQPTQ2(.Y,IEN) ;returns the list of patients assigned to a specialty ICR 4207 ICR 2263
I FROM="C" D
.S API="ORLP DEFAULT CLINIC "_$$UP^XLFSTR($$DOW^XLFDT(DT)),IEN=$$GET^XPAR("USR^SRV.`"_+$G(ORSRV),API,1,"Q") I +$G(IEN)>0 D ;returns a list of patients for the clinic based on the user's default start and end dates ICR 2263, ICR 10104
..S BEG=$$UP^XLFSTR($$GET^XPAR("USR^SRV.`"_+$G(ORSRV)_"^DIV^SYS^PKG","ORLP DEFAULT CLINIC START DATE",1,"E")) ;returns the user's default start date ICR 2263, ICR 10104
..I BEG="T+0" S BEG=$$FMTE^XLFDT(DT,BEG) ;ICR 10103
..S END=$$UP^XLFSTR($$GET^XPAR("USR^SRV.`"_+$G(ORSRV)_"^DIV^SYS^PKG","ORLP DEFAULT CLINIC STOP DATE",1,"E")) ;returns the user's default end date ICR 2263, ICR 10104
..I END="T+0" S END=$$FMTE^XLFDT(DT,END) ;ICR 10103
..D CLINPTS2^ORQPTQ2(.Y,+$G(IEN),BEG,END) ;returns the patient list ICR 4207
;The code below will pull a list of patients for the user based on the combinations of lists set up for the user in
;OR(100.24, OE/RR PT SEL COMBO FILE. This file stores the users combinations use to pull a combined list of patients from multiple files.
;The COMBINATION ITEM multiple stores the file's IEN and the file root for the files that store the patient list.
;The user can create lists from the WARD LOCATIONS (#42), NEW PERSON (#200), FACILITY TREATING SPECIALTY (#45.7), OE/RR LIST (#101.21) and the HOSPITAL LOCATION(#44)
;or any combinations of these files. Each list is stored in a separate row in the COMBINATION ITEM multiple. The code
;loops through this multiple and the pulls the lists based on the entries.
I FROM="M" D
.;S IEN=$D(^OR(100.24,DUZ,0)) I +$G(IEN)>0 S IEN=DUZ D
.S IEN=$$GET1^DIQ(100.24,DUZ_",",.01,"I") I +$G(IEN)>0 S IEN=DUZ D ;ICR 2056
..S BEG=$$UP^XLFSTR($$GET^XPAR("USR^SRV.`"_+$G(ORSRV)_"^DIV^SYS^PKG","ORLP DEFAULT CLINIC START DATE",1,"E")) ;returns the user's default start date ICR 10104
..I BEG="T+0" S BEG=$$FMTE^XLFDT(DT,BEG)
..S END=$$UP^XLFSTR($$GET^XPAR("USR^SRV.`"_+$G(ORSRV)_"^DIV^SYS^PKG","ORLP DEFAULT CLINIC STOP DATE",1,"E")) ;returns the user's default end date ICR 10104
..I END="T+0" S END=$$FMTE^XLFDT(DT,END)
..D COMBPTS^ORQPTQ6(0,+$G(IEN),BEG,END) ; first parameter "0"= GUI RPC call. Returns the lists patients for each entry in the COMBINATION ITEM multiple
I ($$BROKER^XWBLIB)&(FROM'="M") D ; Combinations already written to global. ICR 2190
.S ORQDAT="",ORQCNT=0
.F S ORQCNT=$O(Y(ORQCNT)) Q:ORQCNT="" S ORQDAT=Y(ORQCNT) D
..S ^TMP("OR",$J,"PATIENTS",ORQCNT,0)=ORQDAT
I ('$$BROKER^XWBLIB) S Y=FROM_";"_+$G(IEN)_";"_$G(BEG)_";"_$G(END) ; ICR 2190
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHMPPDL 4748 printed Nov 22, 2024@17:04:38 Page 2
HMPPDL ;ASMR/PB - Get a users default patient list for HMP ; 07/31/2015
+1 ;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**;Jul 31, 2015;Build 63
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 ; External References DBIA#
+5 ; ------------------------------
+6 ; $$BROKER^XWBLID 2190
+7 ; $$GET^XPAR 2263
+8 ; CLINPTS2^ORQPTQ2 4207
+9 ; BYWARD^ORWPT 4904
+10 ; PROVPTS^ORQPTQ2 4207
+11 ; SPECPTS^ORQPTQ2 4207
+12 ; $$UP^XLFSTR 10104
+13 ; $$FMTE^XLDFT 10103
+14 ; $$GET1^DIQ 2056
+15 ;
+16 QUIT
+17 ;
DEFLIST(Y,DUZ) ; return current user's default patient list
+1 ; GUI = global. ICR 2190
IF $$BROKER^XWBLIB
SET Y=$NAME(^TMP("OR",$JOB,"PATIENTS"))
+2 ;ICR 2190
IF '$$BROKER^XWBLIB
SET ^TMP("OR",$JOB,"PATIENTS",0)=""
+3 ;DUZ is required in order to get the list of patients for the user
if '$DATA(DUZ)
QUIT
+4 NEW FROM,IEN,BEG,END,API,ORSRV,ORQDAT,ORQCNT,ORGUI
+5 ;S ORSRV=$G(^VA(200,DUZ,5)) I +ORSRV>0 S ORSRV=$P(ORSRV,U) ; get the users Network Identifier for the user
+6 ; get the users Network Identifier for the user ICR 2056
SET ORSRV=$$GET1^DIQ(200,DUZ_",",29,"I")
+7 ; gets the users default preference for patient list source. ICR 2263
SET FROM=$$GET^XPAR("USR^SRV.`"_+$GET(ORSRV),"ORLP DEFAULT LIST SOURCE",1,"Q")
+8 ;FROM - T:Team/Personal List, W:Ward List, C:Clinic List, P:Provider List, S:Specialty List; M:Combination List.
+9 ;FROM must be defined
+10 if '$LENGTH($GET(FROM))
QUIT
+11 ;returns the list of patients assigned to a team. ICR 2263
IF FROM="T"
SET IEN=$$GET^XPAR("USR^SRV.`"_+$GET(ORSRV),"ORLP DEFAULT TEAM",1,"Q")
if +$GET(IEN)>0
DO TEAMPTS^ORQPTQ1(.Y,IEN)
+12 ;returns the list of patients on a ward ICR 4904 ICR 2263
IF FROM="W"
SET IEN=$$GET^XPAR("USR^SRV.`"_+$GET(ORSRV),"ORLP DEFAULT WARD",1,"Q")
if +$GET(IEN)>0
DO BYWARD^ORWPT(.Y,IEN)
+13 ;returns the list of patients assigned to a provider ICR 4207 ICR 2263
IF FROM="P"
SET IEN=$$GET^XPAR("USR^SRV.`"_+$GET(ORSRV),"ORLP DEFAULT PROVIDER",1,"Q")
if +$GET(IEN)>0
DO PROVPTS^ORQPTQ2(.Y,IEN)
+14 ;returns the list of patients assigned to a specialty ICR 4207 ICR 2263
IF FROM="S"
SET IEN=$$GET^XPAR("USR^SRV.`"_+$GET(ORSRV),"ORLP DEFAULT SPECIALTY",1,"Q")
if +$GET(IEN)>0
DO SPECPTS^ORQPTQ2(.Y,IEN)
+15 IF FROM="C"
Begin DoDot:1
+16 ;returns a list of patients for the clinic based on the user's default start and end dates ICR 2263, ICR 10104
SET API="ORLP DEFAULT CLINIC "_$$UP^XLFSTR($$DOW^XLFDT(DT))
SET IEN=$$GET^XPAR("USR^SRV.`"_+$GET(ORSRV),API,1,"Q")
IF +$GET(IEN)>0
Begin DoDot:2
+17 ;returns the user's default start date ICR 2263, ICR 10104
SET BEG=$$UP^XLFSTR($$GET^XPAR("USR^SRV.`"_+$GET(ORSRV)_"^DIV^SYS^PKG","ORLP DEFAULT CLINIC START DATE",1,"E"))
+18 ;ICR 10103
IF BEG="T+0"
SET BEG=$$FMTE^XLFDT(DT,BEG)
+19 ;returns the user's default end date ICR 2263, ICR 10104
SET END=$$UP^XLFSTR($$GET^XPAR("USR^SRV.`"_+$GET(ORSRV)_"^DIV^SYS^PKG","ORLP DEFAULT CLINIC STOP DATE",1,"E"))
+20 ;ICR 10103
IF END="T+0"
SET END=$$FMTE^XLFDT(DT,END)
+21 ;returns the patient list ICR 4207
DO CLINPTS2^ORQPTQ2(.Y,+$GET(IEN),BEG,END)
End DoDot:2
End DoDot:1
+22 ;The code below will pull a list of patients for the user based on the combinations of lists set up for the user in
+23 ;OR(100.24, OE/RR PT SEL COMBO FILE. This file stores the users combinations use to pull a combined list of patients from multiple files.
+24 ;The COMBINATION ITEM multiple stores the file's IEN and the file root for the files that store the patient list.
+25 ;The user can create lists from the WARD LOCATIONS (#42), NEW PERSON (#200), FACILITY TREATING SPECIALTY (#45.7), OE/RR LIST (#101.21) and the HOSPITAL LOCATION(#44)
+26 ;or any combinations of these files. Each list is stored in a separate row in the COMBINATION ITEM multiple. The code
+27 ;loops through this multiple and the pulls the lists based on the entries.
+28 IF FROM="M"
Begin DoDot:1
+29 ;S IEN=$D(^OR(100.24,DUZ,0)) I +$G(IEN)>0 S IEN=DUZ D
+30 ;ICR 2056
SET IEN=$$GET1^DIQ(100.24,DUZ_",",.01,"I")
IF +$GET(IEN)>0
SET IEN=DUZ
Begin DoDot:2
+31 ;returns the user's default start date ICR 10104
SET BEG=$$UP^XLFSTR($$GET^XPAR("USR^SRV.`"_+$GET(ORSRV)_"^DIV^SYS^PKG","ORLP DEFAULT CLINIC START DATE",1,"E"))
+32 IF BEG="T+0"
SET BEG=$$FMTE^XLFDT(DT,BEG)
+33 ;returns the user's default end date ICR 10104
SET END=$$UP^XLFSTR($$GET^XPAR("USR^SRV.`"_+$GET(ORSRV)_"^DIV^SYS^PKG","ORLP DEFAULT CLINIC STOP DATE",1,"E"))
+34 IF END="T+0"
SET END=$$FMTE^XLFDT(DT,END)
+35 ; first parameter "0"= GUI RPC call. Returns the lists patients for each entry in the COMBINATION ITEM multiple
DO COMBPTS^ORQPTQ6(0,+$GET(IEN),BEG,END)
End DoDot:2
End DoDot:1
+36 ; Combinations already written to global. ICR 2190
IF ($$BROKER^XWBLIB)&(FROM'="M")
Begin DoDot:1
+37 SET ORQDAT=""
SET ORQCNT=0
+38 FOR
SET ORQCNT=$ORDER(Y(ORQCNT))
if ORQCNT=""
QUIT
SET ORQDAT=Y(ORQCNT)
Begin DoDot:2
+39 SET ^TMP("OR",$JOB,"PATIENTS",ORQCNT,0)=ORQDAT
End DoDot:2
End DoDot:1
+40 ; ICR 2190
IF ('$$BROKER^XWBLIB)
SET Y=FROM_";"_+$GET(IEN)_";"_$GET(BEG)_";"_$GET(END)
+41 QUIT