BQIRFCE ;PRXM/HC/ALA-FACE Sheet ; 06 Jul 2006 12:57 PM
;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
;
Q
;
EN(DATA,DFN) ; EP -- BQI PATIENT FACE SHEET
;Description
; Generates a Patient Face Sheet for a given DFN
;
;Input
; DFN - Patient Internal ID
;
;Output
; DATA - Name of global in which data is stored(^TMP("BQIRFCE"))
;
NEW UID,X,BQII,HSTEXT,HSPATH,HSFN,Y,IOSL,IOST,IOM,I,N,RHIFLAG,RHI
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIRFCE",UID))
K @DATA
;
S BQII=0
;
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIRFCE D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
;
S RHI=""
S IOSL=999,IOM=80,IOST="P-OTHER80"
S IOST(0)=$$FIND1^DIC(3.2,,"X",IOST)
D CHKRHI^AG
I $D(RHIFLAG)&(RHIFLAG="A") S RHI="This patient has Restricted Health Information"
;
D HDR
;
I $$TMPFL^BQIUL1("W",UID,DFN) G DONE
;
K AG
D ^AGDATCK
I AG("DTOT")>0 D ^BQIRFCRQ
S AGVQQFS=1
U IO D START^AGFACE
U IO W $C(9)
;
K AGVQQFS
;
I $$TMPFL^BQIUL1("C") G DONE
I $$TMPFL^BQIUL1("R",UID,DFN) G DONE
;
S BQII=BQII+1,@DATA@(BQII)=RHI_"^"
F U IO R HSTEXT:.1 Q:HSTEXT[$C(9) D
. S HSTEXT=$$STRIP^XLFSTR(HSTEXT,"^"),HSTEXT=$$CTRL^BQIUL1(HSTEXT)
. I HSTEXT="" S HSTEXT=" "
. S BQII=BQII+1,@DATA@(BQII)=HSTEXT_$C(13)_$C(10)
S BQII=BQII+1,@DATA@(BQII)=$C(30)
;
I $$TMPFL^BQIUL1("C") G DONE
I $$TMPFL^BQIUL1("D",UID,DFN) G DONE
;
DONE ;
;
S BQII=BQII+1,@DATA@(BQII)=$C(31)
Q
;
HDR ;
S @DATA@(BQII)="T00120RHI_MSG^T01024REPORT_TEXT"_$C(30)
Q
;
ERR ;
D ^%ZTER
NEW Y,ERRDTM
S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
S BMXSEC="Recording that an error occurred at "_ERRDTM
I $D(BQII),$D(DATA) S BQII=BQII+1,@DATA@(BQII)=$C(31)
I $$TMPFL^BQIUL1("C")
Q
BQIRFCE ;PRXM/HC/ALA-FACE Sheet ; 06 Jul 2006 12:57 PM
+1 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
+2 ;
+3 QUIT
+4 ;
EN(DATA,DFN) ; EP -- BQI PATIENT FACE SHEET
+1 ;Description
+2 ; Generates a Patient Face Sheet for a given DFN
+3 ;
+4 ;Input
+5 ; DFN - Patient Internal ID
+6 ;
+7 ;Output
+8 ; DATA - Name of global in which data is stored(^TMP("BQIRFCE"))
+9 ;
+10 NEW UID,X,BQII,HSTEXT,HSPATH,HSFN,Y,IOSL,IOST,IOM,I,N,RHIFLAG,RHI
+11 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+12 SET DATA=$NAME(^TMP("BQIRFCE",UID))
+13 KILL @DATA
+14 ;
+15 SET BQII=0
+16 ;
+17 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIRFCE D UNWIND^%ZTER"
+18 ;
+19 SET RHI=""
+20 SET IOSL=999
SET IOM=80
SET IOST="P-OTHER80"
+21 SET IOST(0)=$$FIND1^DIC(3.2,,"X",IOST)
+22 DO CHKRHI^AG
+23 IF $DATA(RHIFLAG)&(RHIFLAG="A")
SET RHI="This patient has Restricted Health Information"
+24 ;
+25 DO HDR
+26 ;
+27 IF $$TMPFL^BQIUL1("W",UID,DFN)
GOTO DONE
+28 ;
+29 KILL AG
+30 DO ^AGDATCK
+31 IF AG("DTOT")>0
DO ^BQIRFCRQ
+32 SET AGVQQFS=1
+33 USE IO
DO START^AGFACE
+34 USE IO
WRITE $CHAR(9)
+35 ;
+36 KILL AGVQQFS
+37 ;
+38 IF $$TMPFL^BQIUL1("C")
GOTO DONE
+39 IF $$TMPFL^BQIUL1("R",UID,DFN)
GOTO DONE
+40 ;
+41 SET BQII=BQII+1
SET @DATA@(BQII)=RHI_"^"
+42 FOR
USE IO
READ HSTEXT:.1
IF HSTEXT[$CHAR(9)
QUIT
Begin DoDot:1
+43 SET HSTEXT=$$STRIP^XLFSTR(HSTEXT,"^")
SET HSTEXT=$$CTRL^BQIUL1(HSTEXT)
+44 IF HSTEXT=""
SET HSTEXT=" "
+45 SET BQII=BQII+1
SET @DATA@(BQII)=HSTEXT_$CHAR(13)_$CHAR(10)
End DoDot:1
+46 SET BQII=BQII+1
SET @DATA@(BQII)=$CHAR(30)
+47 ;
+48 IF $$TMPFL^BQIUL1("C")
GOTO DONE
+49 IF $$TMPFL^BQIUL1("D",UID,DFN)
GOTO DONE
+50 ;
DONE ;
+1 ;
+2 SET BQII=BQII+1
SET @DATA@(BQII)=$CHAR(31)
+3 QUIT
+4 ;
HDR ;
+1 SET @DATA@(BQII)="T00120RHI_MSG^T01024REPORT_TEXT"_$CHAR(30)
+2 QUIT
+3 ;
ERR ;
+1 DO ^%ZTER
+2 NEW Y,ERRDTM
+3 SET Y=$$NOW^XLFDT()
XECUTE ^DD("DD")
SET ERRDTM=Y
+4 SET BMXSEC="Recording that an error occurred at "_ERRDTM
+5 IF $DATA(BQII)
IF $DATA(DATA)
SET BQII=BQII+1
SET @DATA@(BQII)=$CHAR(31)
+6 IF $$TMPFL^BQIUL1("C")
+7 QUIT