BEDDEHR ;VNGT/HS/BEE-EHR Utility Routine ; 08 Nov 2011 12:00 PM
;;2.0;BEDD DASHBOARD;**3**;Jun 04, 2014;Build 12
;
Q
;
CHGPAT(DFN,DUZ) ;EP - Change the patient in EHR to the selected patient
;
NEW Z,SUB,FND
;
;Data validation
;GDIT/HS/BEE 07/10/2018;CR#10213 - BEDD*2.0*3 - Allow DFN=0 (clear patient)
;I $G(DFN)="" Q 0
I $G(DUZ)="" Q 0
S:$G(U)="" U="^"
;
;Return list of subscribers to patient context
D GETSUBSC^CIANBEVT(.SUB,"CONTEXT.PATIENT")
;
;Try to find the user's EHR session
S FND=0 F Z=0:0 S Z=$O(@SUB@(Z)) Q:'Z D
. NEW DZ,UID
. S DZ=$P($G(@SUB@(Z)),U,4)
. I DZ'=DUZ Q
. S UID=$P($G(@SUB@(Z)),U) Q:UID=""
. ;
. ;Change the context
. D QUEUE^CIANBEVT("CONTEXT.PATIENT",+DFN,UID)
. S FND=1
Q FND
;
CHGENC(ENC,DUZ) ;EP - Change the Encounter in EHR to the selected visit
;
NEW Z,SUB,FND
;
;Data validation
I $G(ENC)="" Q 0
I $G(DUZ)="" Q 0
S:$G(U)="" U="^"
;
;Return list of subscribers to encounter context
D GETSUBSC^CIANBEVT(.SUB,"CONTEXT.ENCOUNTER")
;
;Try to find the user's EHR session
S FND=0 F Z=0:0 S Z=$O(@SUB@(Z)) Q:'Z D
. NEW DZ,UID
. S DZ=$P($G(@SUB@(Z)),U,4)
. I DZ'=DUZ Q
. S UID=$P($G(@SUB@(Z)),U) Q:UID=""
. ;
. ;Change the context
. D QUEUE^CIANBEVT("CONTEXT.ENCOUNTER",+ENC,UID)
. S FND=1
Q FND
BEDDEHR ;VNGT/HS/BEE-EHR Utility Routine ; 08 Nov 2011 12:00 PM
+1 ;;2.0;BEDD DASHBOARD;**3**;Jun 04, 2014;Build 12
+2 ;
+3 QUIT
+4 ;
CHGPAT(DFN,DUZ) ;EP - Change the patient in EHR to the selected patient
+1 ;
+2 NEW Z,SUB,FND
+3 ;
+4 ;Data validation
+5 ;GDIT/HS/BEE 07/10/2018;CR#10213 - BEDD*2.0*3 - Allow DFN=0 (clear patient)
+6 ;I $G(DFN)="" Q 0
+7 IF $GET(DUZ)=""
QUIT 0
+8 IF $GET(U)=""
SET U="^"
+9 ;
+10 ;Return list of subscribers to patient context
+11 DO GETSUBSC^CIANBEVT(.SUB,"CONTEXT.PATIENT")
+12 ;
+13 ;Try to find the user's EHR session
+14 SET FND=0
FOR Z=0:0
SET Z=$ORDER(@SUB@(Z))
IF 'Z
QUIT
Begin DoDot:1
+15 NEW DZ,UID
+16 SET DZ=$PIECE($GET(@SUB@(Z)),U,4)
+17 IF DZ'=DUZ
QUIT
+18 SET UID=$PIECE($GET(@SUB@(Z)),U)
IF UID=""
QUIT
+19 ;
+20 ;Change the context
+21 DO QUEUE^CIANBEVT("CONTEXT.PATIENT",+DFN,UID)
+22 SET FND=1
End DoDot:1
+23 QUIT FND
+24 ;
CHGENC(ENC,DUZ) ;EP - Change the Encounter in EHR to the selected visit
+1 ;
+2 NEW Z,SUB,FND
+3 ;
+4 ;Data validation
+5 IF $GET(ENC)=""
QUIT 0
+6 IF $GET(DUZ)=""
QUIT 0
+7 IF $GET(U)=""
SET U="^"
+8 ;
+9 ;Return list of subscribers to encounter context
+10 DO GETSUBSC^CIANBEVT(.SUB,"CONTEXT.ENCOUNTER")
+11 ;
+12 ;Try to find the user's EHR session
+13 SET FND=0
FOR Z=0:0
SET Z=$ORDER(@SUB@(Z))
IF 'Z
QUIT
Begin DoDot:1
+14 NEW DZ,UID
+15 SET DZ=$PIECE($GET(@SUB@(Z)),U,4)
+16 IF DZ'=DUZ
QUIT
+17 SET UID=$PIECE($GET(@SUB@(Z)),U)
IF UID=""
QUIT
+18 ;
+19 ;Change the context
+20 DO QUEUE^CIANBEVT("CONTEXT.ENCOUNTER",+ENC,UID)
+21 SET FND=1
End DoDot:1
+22 QUIT FND