GMTSPST4 ;BHAM/RMS - TIU OBJECT FOR REMOTE MEDS VIA RDI ;06/28/17 10:31
;;2.7;Health Summary;**94,135**;Oct 20, 1995;Build 2
;
;Reference to ORRDI1 supported by DBIA 4659
;Reference to ^XTMP("ORRDI","PSOO" supported by DBIA 4660
;Reference to ^XTMP("ORRDI","OUTAGE INFO" supported by DBIA 5440
;
RDI(DFN,TARGET) ;
;OBJECT METHOD IS: S X=$$RDI^GMTSPST4(DFN,"^TMP($J,""GMTSRDI"")")
K @TARGET
N GMTSHDR,GMTSRET,GMTSMED,GMTSLINE,GMTSQTY,GMTSSIG,GMTSSTAT,GMTSRDI,GMTSDOWN,GMTSISSU
G:'$G(DFN) RDIOUT
S GMTSHDR=$$HAVEHDR^ORRDI1 I '+$G(GMTSHDR) D G RDIOUT
. S @TARGET@(1,0)="Remote Data from HDR not available"
D G:$G(GMTSDOWN) RDIOUT
. I $D(^XTMP("ORRDI","OUTAGE INFO","DOWN")) H $$GET^XPAR("ALL","ORRDI PING FREQ")/2
. I $D(^XTMP("ORRDI","OUTAGE INFO","DOWN")) S GMTSDOWN=1 D
.. S @TARGET@(1,0)="WARNING: Connection to Remote Data Currently Down"
D ;RDI/HDR CALL ENCAPSULATION
. D SAVDEV^%ZISUTL("GMTSHFS")
. S GMTSRET=$$GET^ORRDI1(DFN,"PSOO")
. D USE^%ZISUTL("GMTSHFS")
. D RMDEV^%ZISUTL("GMTSHFS")
I +GMTSRET=-1 D G RDIOUT
. S @TARGET@(1,0)="Connection to Remote Data Not Available"
I '$D(^XTMP("ORRDI","PSOO",DFN)) D G RDIOUT
. S @TARGET@(1,0)="No Remote Data available for this patient"
OBJ S GMTSLINE=5
S GMTSMED=0 F S GMTSMED=$O(^XTMP("ORRDI","PSOO",DFN,GMTSMED)) Q:'+GMTSMED D
. S GMTSSTAT=$G(^XTMP("ORRDI","PSOO",DFN,GMTSMED,5,0))
. Q:"ACTIVE^SUSPENDED^HOLD"'[GMTSSTAT
. ; GMTS*2.7*135 Commented out the next line
. ;Q:$G(^XTMP("ORRDI","PSOO",DFN,GMTSMED,7,0))']"" ;Special case #1 for DoD data, quit if there is no expiration date listed
. D Q:GMTSISSU<$$FMADD^XLFDT(DT,-366) ;Special case #2 for DoD data; quit if the ISSUE DATE is more than a year ago. (May still show beyond expiration for Controlled Substances)
.. N %DT,X,Y
.. S X=$G(^XTMP("ORRDI","PSOO",DFN,GMTSMED,8,0))
.. D ^%DT
.. S GMTSISSU=+Y
. S @TARGET@(GMTSLINE,0)=$G(^XTMP("ORRDI","PSOO",DFN,GMTSMED,2,0)) D INC
. S GMTSSIG=$G(^XTMP("ORRDI","PSOO",DFN,GMTSMED,14,0)) D ;
.. I $L(GMTSSIG)>60 D D INC Q
... N WORDS,COUNT
... S WORDS=$L(GMTSSIG," ")
... S @TARGET@(GMTSLINE,0)="Sig: "
... F COUNT=1:1:WORDS D
.... S @TARGET@(GMTSLINE,0)=$G(@TARGET@(GMTSLINE,0))_$P(GMTSSIG," ",COUNT)_" "
.... I $L(@TARGET@(GMTSLINE,0))>60 D INC S @TARGET@(GMTSLINE,0)=" "
.. S @TARGET@(GMTSLINE,0)="Sig: "_GMTSSIG D INC
. S GMTSQTY=$G(^XTMP("ORRDI","PSOO",DFN,GMTSMED,6,0)) S @TARGET@(GMTSLINE,0)="Quantity: "_+$P(GMTSQTY,";")_" Days Supply: "_$P($P(GMTSQTY,";",2),"D",2) D INC
. S @TARGET@(GMTSLINE,0)="Rx Expiration Date: "_$G(^XTMP("ORRDI","PSOO",DFN,GMTSMED,7,0)) D INC
. S @TARGET@(GMTSLINE,0)="Last filled "_$G(^XTMP("ORRDI","PSOO",DFN,GMTSMED,9,0))_" at "_$G(^XTMP("ORRDI","PSOO",DFN,GMTSMED,1,0))
. S @TARGET@(GMTSLINE,0)=@TARGET@(GMTSLINE,0)_" ("_$S(GMTSSTAT["ACT":"Active",GMTSSTAT["SUSP":"Active/Suspended",GMTSSTAT["HOLD":"Hold",1:"Status Unknown")_")" D INC
. S @TARGET@(GMTSLINE,0)=" " D INC
I GMTSLINE=5 D G RDIOUT
. S @TARGET@(1,0)="No Active Remote Medications for this patient"
S @TARGET@(1,0)="Active Medications from Remote Data"
S @TARGET@(2,0)="NOTE: Remote meds display is limited to those items matched to"
S @TARGET@(3,0)="National Drug File at the originating site."
S @TARGET@(4,0)=" "
RDIOUT Q "~@"_$NA(@TARGET)
INC S GMTSLINE=$G(GMTSLINE)+1
Q
;-----------------------------
ENHS ;ENTRY POINT OF REMOTE DATA MEDICATIONS AS A HEALTH SUMMARY
N GMTSHS,GMTSWRT
Q:'$G(DFN)
S GMTSHS=$$RDI(DFN,"^TMP($J,""GMTSRDI"")")
S GMTSWRT=0 F S GMTSWRT=$O(^TMP($J,"GMTSRDI",GMTSWRT)) Q:'+GMTSWRT D
. D CKP^GMTSUP Q:$D(GMTSQIT)
. W !,^TMP($J,"GMTSRDI",GMTSWRT,0)
. D CKP^GMTSUP Q:$D(GMTSQIT)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSPST4 3718 printed Dec 13, 2024@01:59:41 Page 2
GMTSPST4 ;BHAM/RMS - TIU OBJECT FOR REMOTE MEDS VIA RDI ;06/28/17 10:31
+1 ;;2.7;Health Summary;**94,135**;Oct 20, 1995;Build 2
+2 ;
+3 ;Reference to ORRDI1 supported by DBIA 4659
+4 ;Reference to ^XTMP("ORRDI","PSOO" supported by DBIA 4660
+5 ;Reference to ^XTMP("ORRDI","OUTAGE INFO" supported by DBIA 5440
+6 ;
RDI(DFN,TARGET) ;
+1 ;OBJECT METHOD IS: S X=$$RDI^GMTSPST4(DFN,"^TMP($J,""GMTSRDI"")")
+2 KILL @TARGET
+3 NEW GMTSHDR,GMTSRET,GMTSMED,GMTSLINE,GMTSQTY,GMTSSIG,GMTSSTAT,GMTSRDI,GMTSDOWN,GMTSISSU
+4 if '$GET(DFN)
GOTO RDIOUT
+5 SET GMTSHDR=$$HAVEHDR^ORRDI1
IF '+$GET(GMTSHDR)
Begin DoDot:1
+6 SET @TARGET@(1,0)="Remote Data from HDR not available"
End DoDot:1
GOTO RDIOUT
+7 Begin DoDot:1
+8 IF $DATA(^XTMP("ORRDI","OUTAGE INFO","DOWN"))
HANG $$GET^XPAR("ALL","ORRDI PING FREQ")/2
+9 IF $DATA(^XTMP("ORRDI","OUTAGE INFO","DOWN"))
SET GMTSDOWN=1
Begin DoDot:2
+10 SET @TARGET@(1,0)="WARNING: Connection to Remote Data Currently Down"
End DoDot:2
End DoDot:1
if $GET(GMTSDOWN)
GOTO RDIOUT
+11 ;RDI/HDR CALL ENCAPSULATION
Begin DoDot:1
+12 DO SAVDEV^%ZISUTL("GMTSHFS")
+13 SET GMTSRET=$$GET^ORRDI1(DFN,"PSOO")
+14 DO USE^%ZISUTL("GMTSHFS")
+15 DO RMDEV^%ZISUTL("GMTSHFS")
End DoDot:1
+16 IF +GMTSRET=-1
Begin DoDot:1
+17 SET @TARGET@(1,0)="Connection to Remote Data Not Available"
End DoDot:1
GOTO RDIOUT
+18 IF '$DATA(^XTMP("ORRDI","PSOO",DFN))
Begin DoDot:1
+19 SET @TARGET@(1,0)="No Remote Data available for this patient"
End DoDot:1
GOTO RDIOUT
OBJ SET GMTSLINE=5
+1 SET GMTSMED=0
FOR
SET GMTSMED=$ORDER(^XTMP("ORRDI","PSOO",DFN,GMTSMED))
if '+GMTSMED
QUIT
Begin DoDot:1
+2 SET GMTSSTAT=$GET(^XTMP("ORRDI","PSOO",DFN,GMTSMED,5,0))
+3 if "ACTIVE^SUSPENDED^HOLD"'[GMTSSTAT
QUIT
+4 ; GMTS*2.7*135 Commented out the next line
+5 ;Q:$G(^XTMP("ORRDI","PSOO",DFN,GMTSMED,7,0))']"" ;Special case #1 for DoD data, quit if there is no expiration date listed
+6 ;Special case #2 for DoD data; quit if the ISSUE DATE is more than a year ago. (May still show beyond expiration for Controlled Substances)
Begin DoDot:2
+7 NEW %DT,X,Y
+8 SET X=$GET(^XTMP("ORRDI","PSOO",DFN,GMTSMED,8,0))
+9 DO ^%DT
+10 SET GMTSISSU=+Y
End DoDot:2
if GMTSISSU<$$FMADD^XLFDT(DT,-366)
QUIT
+11 SET @TARGET@(GMTSLINE,0)=$GET(^XTMP("ORRDI","PSOO",DFN,GMTSMED,2,0))
DO INC
+12 ;
SET GMTSSIG=$GET(^XTMP("ORRDI","PSOO",DFN,GMTSMED,14,0))
Begin DoDot:2
+13 IF $LENGTH(GMTSSIG)>60
Begin DoDot:3
+14 NEW WORDS,COUNT
+15 SET WORDS=$LENGTH(GMTSSIG," ")
+16 SET @TARGET@(GMTSLINE,0)="Sig: "
+17 FOR COUNT=1:1:WORDS
Begin DoDot:4
+18 SET @TARGET@(GMTSLINE,0)=$GET(@TARGET@(GMTSLINE,0))_$PIECE(GMTSSIG," ",COUNT)_" "
+19 IF $LENGTH(@TARGET@(GMTSLINE,0))>60
DO INC
SET @TARGET@(GMTSLINE,0)=" "
End DoDot:4
End DoDot:3
DO INC
QUIT
+20 SET @TARGET@(GMTSLINE,0)="Sig: "_GMTSSIG
DO INC
End DoDot:2
+21 SET GMTSQTY=$GET(^XTMP("ORRDI","PSOO",DFN,GMTSMED,6,0))
SET @TARGET@(GMTSLINE,0)="Quantity: "_+$PIECE(GMTSQTY,";")_" Days Supply: "_$PIECE($PIECE(GMTSQTY,";",2),"D",2)
DO INC
+22 SET @TARGET@(GMTSLINE,0)="Rx Expiration Date: "_$GET(^XTMP("ORRDI","PSOO",DFN,GMTSMED,7,0))
DO INC
+23 SET @TARGET@(GMTSLINE,0)="Last filled "_$GET(^XTMP("ORRDI","PSOO",DFN,GMTSMED,9,0))_" at "_$GET(^XTMP("ORRDI","PSOO",DFN,GMTSMED,1,0))
+24 SET @TARGET@(GMTSLINE,0)=@TARGET@(GMTSLINE,0)_" ("_$SELECT(GMTSSTAT["ACT":"Active",GMTSSTAT["SUSP":"Active/Suspended",GMTSSTAT["HOLD":"Hold",1:"Status Unknown")_")"
DO INC
+25 SET @TARGET@(GMTSLINE,0)=" "
DO INC
End DoDot:1
+26 IF GMTSLINE=5
Begin DoDot:1
+27 SET @TARGET@(1,0)="No Active Remote Medications for this patient"
End DoDot:1
GOTO RDIOUT
+28 SET @TARGET@(1,0)="Active Medications from Remote Data"
+29 SET @TARGET@(2,0)="NOTE: Remote meds display is limited to those items matched to"
+30 SET @TARGET@(3,0)="National Drug File at the originating site."
+31 SET @TARGET@(4,0)=" "
RDIOUT QUIT "~@"_$NAME(@TARGET)
INC SET GMTSLINE=$GET(GMTSLINE)+1
+1 QUIT
+2 ;-----------------------------
ENHS ;ENTRY POINT OF REMOTE DATA MEDICATIONS AS A HEALTH SUMMARY
+1 NEW GMTSHS,GMTSWRT
+2 if '$GET(DFN)
QUIT
+3 SET GMTSHS=$$RDI(DFN,"^TMP($J,""GMTSRDI"")")
+4 SET GMTSWRT=0
FOR
SET GMTSWRT=$ORDER(^TMP($JOB,"GMTSRDI",GMTSWRT))
if '+GMTSWRT
QUIT
Begin DoDot:1
+5 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
+6 WRITE !,^TMP($JOB,"GMTSRDI",GMTSWRT,0)
+7 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
End DoDot:1
+8 QUIT