XDRRMRG2 ;SF-IRMFO/GB,JLI - GET PATIENT HEALTH SUMMARY ;06/26/98 13:35
;;7.3;TOOLKIT;**23,29**;Apr 25, 1995
;;
ASK(QLIST,ABORT) ; Report-specific questions
N DIC,Y,DTOUT,DUOUT
; Which patient?
; S DIC="^SPNL(154,"
; S DIC("S")="I $P(^(0),U,3)=""A""" ; Select only from active patients
; S DIC(0)="AEQM"
; S DIC("A")="Select SCD Patient: "
; S DIC("?")="Select the patient for whom you want the Health Summary"
; D ^DIC I $D(DTOUT)!($D(DUOUT))!(Y<0) S ABORT=1 Q
; S QLIST("DFN")=+Y ; IEN's are DINUM'd to the ^DPT
K DIC
; Which Health Summary Type?
S DIC="^GMT(142,"
S DIC(0)="AEQM"
S DIC("A")="Select Health Summary Type Name: "
;S DIC("?")="Choose one, if you aren't sure, experiment!"
D ^DIC I $D(DTOUT)!($D(DUOUT))!(Y<0) S ABORT=1 Q
S QLIST("TYPE")=+Y
ASKX Q
;
GATHER(DFN,FDATE,TDATE,HIUSERS,QLIST) ; No need to gather
Q
;
PRINT(QLIST) ;Call to print health summary
D ENX^GMTSDVR(QLIST("DFN"),QLIST("TYPE"))
PRINTX Q
;
PRINT2 ;Prints the record pair using the Browser of to a device.
N XDRIOP
W ! S DIR(0)="Y",DIR("A",1)="Would you like to use the FM Browser to"
S DIR("A")="view the record pair"
S DIR("B")="YES",DIR("?")="You may use FM Browser to view the record pair else you will be prompted to select a device for each record."
D ^DIR S:Y=1 XDRIOP=1 Q:$D(DIRUT)
K ^TMP("XDRRMRG1",$J),^TMP("XDRRMRG",$J)
;S IOP="XDRBROWSER1" D ^%ZIS Q:POP ;Old code, delete after testing
REC1 S:$D(XDRIOP) IOP="XDRBROWSER1" S:'$D(XDRIOP) %ZIS="QM"
S %ZIS("A")="DEVICE FOR FIRST RECORD: "
W ! D ^%ZIS Q:POP
I $D(IO("Q")) D G REC2 ;Will queue to TaskMan
. S ZTRTN="QUEUE^XDRRMRG2",ZTIO=ION,ZTDESC="XDR Health Summary for first patient."
. S DFN=DFNFRX,TYPE=QLIST("TYPE"),ZTSAVE("DFN")="",ZTSAVE("TYPE")=""
. D ^%ZTLOAD W:$D(ZTSK) !!,"Queued as task "_ZTSK,!
. Q
U IO(0) W:$D(XDRIOP) " Getting first entry ",!
D ENX^GMTSDVR(DFNFRX,QLIST("TYPE"))
U IO D ^%ZISC
S ^TMP("XDRRMRG",$J,"ENTER <PF1>S TO VIEW OTHER- "_$E($G(DFNFR(1)),1,30)_" "_$G(DFNFR(2))_" ("_DFNFRX_")")="^TMP(""XDRRMRG1"",$J,1)"
M ^TMP("XDRRMRG1",$J,1)=^TMP("DDB",$J)
;S IOP="XDRBROWSER1" D ^%ZIS Q:POP ;old code delete after testing
REC2 S:$D(XDRIOP) IOP="XDRBROWSER1" S:'$D(XDRIOP) %ZIS="QM"
S %ZIS("A")="DEVICE FOR SECOND RECORD: "
W ! D ^%ZIS Q:POP
I $D(IO("Q")) D G PRINTX ;Will queue to TaskMan
. S ZTRTN="QUEUE^XDRRMRG2",ZTIO=ION,ZTDESC="XDR Health Summary for second patient."
. S DFN=DFNTOX,TYPE=QLIST("TYPE"),ZTSAVE("DFN")="",ZTSAVE("TYPE")=""
. D ^%ZTLOAD W:$D(ZTSK) !!,"Queued as task "_ZTSK,!
. Q
U IO(0) W:$D(XDRIOP) " Getting second entry ",!
D ENX^GMTSDVR(DFNTOX,QLIST("TYPE"))
D ^%ZISC U IO(0)
S ^TMP("XDRRMRG",$J,"ENTER <PF1>S TO VIEW OTHER- "_$E($G(DFNTO(1)),1,30)_" "_$G(DFNTO(2))_" ("_DFNTOX_")")="^TMP(""XDRRMRG1"",$J,2)"
M ^TMP("XDRRMRG1",$J,2)=^TMP("DDB",$J)
D DOCLIST^DDBR($NA(^TMP("XDRRMRG",$J)),"R")
K ^TMP("XDRRMRG1",$J),^TMP("XDRRMRG",$J)
PRINT2X Q
;
QUEUE ;Will process the print task for patients' health summaries.
D ENX^GMTSDVR(DFN,TYPE)
QUEUEX Q
;
COUNT(XDRFILE,FROM,TO) ;
N X,I,FIL1,FIL2,NOD,PIECE,X1,X2,N1,N2
S N1=0,N2=0
S FIL2=^DIC(XDRFILE,0,"GL")
S FIL1=FIL2_"FROM)"
S FIL2=FIL2_"TO)"
F I=0:0 S I=$O(^DD(XDRFILE,I)) Q:I'>0 S X=^(I,0) D
. S NOD=$P($P(X,U,4),";")
. S PIECE=$P($P(X,U,4),";",2)
. I PIECE>0 D
. . S X1=$P($G(@FIL1@(NOD)),U,PIECE)
. . S X2=$P($G(@FIL2@(NOD)),U,PIECE)
. . I X1'="",X2="" S N1=N1+1
. . I X2'="",X1="" S N2=N2+1
COUNTX Q $S(N1>N2:2,N2>N1:1,1:0)
;
LABIEN(FILE,REC) ;REM - Resolve LABs DFNFR and DFNTO.
S NAMREC=""
S FILDIC=$G(^DIC(FILE,0,"GL")) Q:FILDIC="" NAMREC
S FILREC=FILDIC_"REC)"
S NAMREC=+$P(@FILREC@(0),U,3)
LABIENX Q NAMREC
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXDRRMRG2 3748 printed Nov 22, 2024@17:49:46 Page 2
XDRRMRG2 ;SF-IRMFO/GB,JLI - GET PATIENT HEALTH SUMMARY ;06/26/98 13:35
+1 ;;7.3;TOOLKIT;**23,29**;Apr 25, 1995
+2 ;;
ASK(QLIST,ABORT) ; Report-specific questions
+1 NEW DIC,Y,DTOUT,DUOUT
+2 ; Which patient?
+3 ; S DIC="^SPNL(154,"
+4 ; S DIC("S")="I $P(^(0),U,3)=""A""" ; Select only from active patients
+5 ; S DIC(0)="AEQM"
+6 ; S DIC("A")="Select SCD Patient: "
+7 ; S DIC("?")="Select the patient for whom you want the Health Summary"
+8 ; D ^DIC I $D(DTOUT)!($D(DUOUT))!(Y<0) S ABORT=1 Q
+9 ; S QLIST("DFN")=+Y ; IEN's are DINUM'd to the ^DPT
+10 KILL DIC
+11 ; Which Health Summary Type?
+12 SET DIC="^GMT(142,"
+13 SET DIC(0)="AEQM"
+14 SET DIC("A")="Select Health Summary Type Name: "
+15 ;S DIC("?")="Choose one, if you aren't sure, experiment!"
+16 DO ^DIC
IF $DATA(DTOUT)!($DATA(DUOUT))!(Y<0)
SET ABORT=1
QUIT
+17 SET QLIST("TYPE")=+Y
ASKX QUIT
+1 ;
GATHER(DFN,FDATE,TDATE,HIUSERS,QLIST) ; No need to gather
+1 QUIT
+2 ;
PRINT(QLIST) ;Call to print health summary
+1 DO ENX^GMTSDVR(QLIST("DFN"),QLIST("TYPE"))
PRINTX QUIT
+1 ;
PRINT2 ;Prints the record pair using the Browser of to a device.
+1 NEW XDRIOP
+2 WRITE !
SET DIR(0)="Y"
SET DIR("A",1)="Would you like to use the FM Browser to"
+3 SET DIR("A")="view the record pair"
+4 SET DIR("B")="YES"
SET DIR("?")="You may use FM Browser to view the record pair else you will be prompted to select a device for each record."
+5 DO ^DIR
if Y=1
SET XDRIOP=1
if $DATA(DIRUT)
QUIT
+6 KILL ^TMP("XDRRMRG1",$JOB),^TMP("XDRRMRG",$JOB)
+7 ;S IOP="XDRBROWSER1" D ^%ZIS Q:POP ;Old code, delete after testing
REC1 if $DATA(XDRIOP)
SET IOP="XDRBROWSER1"
if '$DATA(XDRIOP)
SET %ZIS="QM"
+1 SET %ZIS("A")="DEVICE FOR FIRST RECORD: "
+2 WRITE !
DO ^%ZIS
if POP
QUIT
+3 ;Will queue to TaskMan
IF $DATA(IO("Q"))
Begin DoDot:1
+4 SET ZTRTN="QUEUE^XDRRMRG2"
SET ZTIO=ION
SET ZTDESC="XDR Health Summary for first patient."
+5 SET DFN=DFNFRX
SET TYPE=QLIST("TYPE")
SET ZTSAVE("DFN")=""
SET ZTSAVE("TYPE")=""
+6 DO ^%ZTLOAD
if $DATA(ZTSK)
WRITE !!,"Queued as task "_ZTSK,!
+7 QUIT
End DoDot:1
GOTO REC2
+8 USE IO(0)
if $DATA(XDRIOP)
WRITE " Getting first entry ",!
+9 DO ENX^GMTSDVR(DFNFRX,QLIST("TYPE"))
+10 USE IO
DO ^%ZISC
+11 SET ^TMP("XDRRMRG",$JOB,"ENTER <PF1>S TO VIEW OTHER- "_$EXTRACT($GET(DFNFR(1)),1,30)_" "_$GET(DFNFR(2))_" ("_DFNFRX_")")="^TMP(""XDRRMRG1"",$J,1)"
+12 MERGE ^TMP("XDRRMRG1",$JOB,1)=^TMP("DDB",$JOB)
+13 ;S IOP="XDRBROWSER1" D ^%ZIS Q:POP ;old code delete after testing
REC2 if $DATA(XDRIOP)
SET IOP="XDRBROWSER1"
if '$DATA(XDRIOP)
SET %ZIS="QM"
+1 SET %ZIS("A")="DEVICE FOR SECOND RECORD: "
+2 WRITE !
DO ^%ZIS
if POP
QUIT
+3 ;Will queue to TaskMan
IF $DATA(IO("Q"))
Begin DoDot:1
+4 SET ZTRTN="QUEUE^XDRRMRG2"
SET ZTIO=ION
SET ZTDESC="XDR Health Summary for second patient."
+5 SET DFN=DFNTOX
SET TYPE=QLIST("TYPE")
SET ZTSAVE("DFN")=""
SET ZTSAVE("TYPE")=""
+6 DO ^%ZTLOAD
if $DATA(ZTSK)
WRITE !!,"Queued as task "_ZTSK,!
+7 QUIT
End DoDot:1
GOTO PRINTX
+8 USE IO(0)
if $DATA(XDRIOP)
WRITE " Getting second entry ",!
+9 DO ENX^GMTSDVR(DFNTOX,QLIST("TYPE"))
+10 DO ^%ZISC
USE IO(0)
+11 SET ^TMP("XDRRMRG",$JOB,"ENTER <PF1>S TO VIEW OTHER- "_$EXTRACT($GET(DFNTO(1)),1,30)_" "_$GET(DFNTO(2))_" ("_DFNTOX_")")="^TMP(""XDRRMRG1"",$J,2)"
+12 MERGE ^TMP("XDRRMRG1",$JOB,2)=^TMP("DDB",$JOB)
+13 DO DOCLIST^DDBR($NAME(^TMP("XDRRMRG",$JOB)),"R")
+14 KILL ^TMP("XDRRMRG1",$JOB),^TMP("XDRRMRG",$JOB)
PRINT2X QUIT
+1 ;
QUEUE ;Will process the print task for patients' health summaries.
+1 DO ENX^GMTSDVR(DFN,TYPE)
QUEUEX QUIT
+1 ;
COUNT(XDRFILE,FROM,TO) ;
+1 NEW X,I,FIL1,FIL2,NOD,PIECE,X1,X2,N1,N2
+2 SET N1=0
SET N2=0
+3 SET FIL2=^DIC(XDRFILE,0,"GL")
+4 SET FIL1=FIL2_"FROM)"
+5 SET FIL2=FIL2_"TO)"
+6 FOR I=0:0
SET I=$ORDER(^DD(XDRFILE,I))
if I'>0
QUIT
SET X=^(I,0)
Begin DoDot:1
+7 SET NOD=$PIECE($PIECE(X,U,4),";")
+8 SET PIECE=$PIECE($PIECE(X,U,4),";",2)
+9 IF PIECE>0
Begin DoDot:2
+10 SET X1=$PIECE($GET(@FIL1@(NOD)),U,PIECE)
+11 SET X2=$PIECE($GET(@FIL2@(NOD)),U,PIECE)
+12 IF X1'=""
IF X2=""
SET N1=N1+1
+13 IF X2'=""
IF X1=""
SET N2=N2+1
End DoDot:2
End DoDot:1
COUNTX QUIT $SELECT(N1>N2:2,N2>N1:1,1:0)
+1 ;
LABIEN(FILE,REC) ;REM - Resolve LABs DFNFR and DFNTO.
+1 SET NAMREC=""
+2 SET FILDIC=$GET(^DIC(FILE,0,"GL"))
if FILDIC=""
QUIT NAMREC
+3 SET FILREC=FILDIC_"REC)"
+4 SET NAMREC=+$PIECE(@FILREC@(0),U,3)
LABIENX QUIT NAMREC