PSOQ0595 ;HINES/RMS - TIU OBJECT FOR REMOTE MEDS VIA RDI ; 30 Nov 2007 7:54 AM
;;7.0;OUTPATIENT PHARMACY;**294**;DEC 1997;Build 13
;
;Reference to CKP^GMTSUP supported by DBIA 4231
;References to ORRDI1 supported by DBIA 4659
RDI(DFN,TARGET) ;
;OBJECT METHOD IS: S X=$$RDI^PSOQ0595(DFN,"^TMP($J,""PSOQRDI"")")
K @TARGET
N PSOQHDR,PSOQRET,PSOQMED,PSOQLINE,PSOQQTY,PSOQSIG,PSOQSTAT,PSOQRDI,PSOQDOWN
G:'$G(DFN) RDIOUT
S PSOQHDR=$$HAVEHDR^ORRDI1 I '+$G(PSOQHDR) D G RDIOUT
. S @TARGET@(1,0)="Remote Data from HDR not available"
D G:$G(PSOQDOWN) RDIOUT
. I $D(^XTMP("ORRDI","OUTAGE INFO","DOWN")) H $$GET^XPAR("ALL","ORRDI PING FREQ")/2
. I $D(^XTMP("ORRDI","OUTAGE INFO","DOWN")) S PSOQDOWN=1 D
.. S @TARGET@(1,0)="WARNING: Connection to Remote Data Currently Down"
D ;RDI/HDR CALL ENCAPSULATION
. D SAVDEV^%ZISUTL("PSOQHFS")
. S PSOQRET=$$GET^ORRDI1(DFN,"PSOO")
. D USE^%ZISUTL("PSOQHFS")
. D RMDEV^%ZISUTL("PSOQHFS")
I PSOQRET=-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 PSOQLINE=3
S PSOQMED=0 F S PSOQMED=$O(^XTMP("ORRDI","PSOO",DFN,PSOQMED)) Q:'+PSOQMED D
. S PSOQSTAT=$G(^XTMP("ORRDI","PSOO",DFN,PSOQMED,5,0))
. Q:"ACTIVE^SUSPENDED"'[PSOQSTAT
. S @TARGET@(PSOQLINE,0)=$G(^XTMP("ORRDI","PSOO",DFN,PSOQMED,2,0)) D INC
. S PSOQSIG=$G(^XTMP("ORRDI","PSOO",DFN,PSOQMED,14,0)) D ;
.. I $L(PSOQSIG)>60 D D INC Q
... N WORDS,COUNT
... S WORDS=$L(PSOQSIG," ")
... S @TARGET@(PSOQLINE,0)="Sig: "
... F COUNT=1:1:WORDS D
.... S @TARGET@(PSOQLINE,0)=$G(@TARGET@(PSOQLINE,0))_$P(PSOQSIG," ",COUNT)_" "
.... I $L(@TARGET@(PSOQLINE,0))>60 D INC S @TARGET@(PSOQLINE,0)=" "
.. S @TARGET@(PSOQLINE,0)="Sig: "_PSOQSIG D INC
. S PSOQQTY=$G(^XTMP("ORRDI","PSOO",DFN,PSOQMED,6,0)) S @TARGET@(PSOQLINE,0)="Quantity: "_+$P(PSOQQTY,";")_" Days Supply: "_$P($P(PSOQQTY,";",2),"D",2) D INC
. S @TARGET@(PSOQLINE,0)=$G(^XTMP("ORRDI","PSOO",DFN,PSOQMED,10,0))_" refills remaining until "_$G(^XTMP("ORRDI","PSOO",DFN,PSOQMED,7,0)) D INC
. S @TARGET@(PSOQLINE,0)="Last filled "_$G(^XTMP("ORRDI","PSOO",DFN,PSOQMED,9,0))_" at "_$G(^XTMP("ORRDI","PSOO",DFN,PSOQMED,1,0))_" ("_$S(PSOQSTAT["ACT":"Active",PSOQSTAT["SUSP":"Active/Suspended",1:"Status Unknown")_")" D INC
. S @TARGET@(PSOQLINE,0)=" " D INC
I PSOQLINE=3 D G RDIOUT
. S @TARGET@(1,0)="No Active Remote Medications for this patient"
S @TARGET@(1,0)="Active Medications from Remote Data",@TARGET@(2,0)=" "
RDIOUT Q "~@"_$NA(@TARGET)
INC S PSOQLINE=$G(PSOQLINE)+1 Q
;-----------------------------
ENHS ;ENTRY POINT OF REMOTE DATA MEDICATIONS AS A HEALTH SUMMARY
N PSOQHS,PSOQWRT
Q:'$G(DFN)
S PSOQHS=$$RDI(DFN,"^TMP($J,""PSOQRDI"")")
S PSOQWRT=0 F S PSOQWRT=$O(^TMP($J,"PSOQRDI",PSOQWRT)) Q:'+PSOQWRT D
. D CKP^GMTSUP Q:$D(GMTSQIT)
. W !,^TMP($J,"PSOQRDI",PSOQWRT,0)
. D CKP^GMTSUP Q:$D(GMTSQIT)
Q
PSOQ0595 ;HINES/RMS - TIU OBJECT FOR REMOTE MEDS VIA RDI ; 30 Nov 2007 7:54 AM
+1 ;;7.0;OUTPATIENT PHARMACY;**294**;DEC 1997;Build 13
+2 ;
+3 ;Reference to CKP^GMTSUP supported by DBIA 4231
+4 ;References to ORRDI1 supported by DBIA 4659
RDI(DFN,TARGET) ;
+1 ;OBJECT METHOD IS: S X=$$RDI^PSOQ0595(DFN,"^TMP($J,""PSOQRDI"")")
+2 KILL @TARGET
+3 NEW PSOQHDR,PSOQRET,PSOQMED,PSOQLINE,PSOQQTY,PSOQSIG,PSOQSTAT,PSOQRDI,PSOQDOWN
+4 IF '$GET(DFN)
GOTO RDIOUT
+5 SET PSOQHDR=$$HAVEHDR^ORRDI1
IF '+$GET(PSOQHDR)
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 PSOQDOWN=1
Begin DoDot:2
+10 SET @TARGET@(1,0)="WARNING: Connection to Remote Data Currently Down"
End DoDot:2
End DoDot:1
IF $GET(PSOQDOWN)
GOTO RDIOUT
+11 ;RDI/HDR CALL ENCAPSULATION
Begin DoDot:1
+12 DO SAVDEV^%ZISUTL("PSOQHFS")
+13 SET PSOQRET=$$GET^ORRDI1(DFN,"PSOO")
+14 DO USE^%ZISUTL("PSOQHFS")
+15 DO RMDEV^%ZISUTL("PSOQHFS")
End DoDot:1
+16 IF PSOQRET=-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 PSOQLINE=3
+1 SET PSOQMED=0
FOR
SET PSOQMED=$ORDER(^XTMP("ORRDI","PSOO",DFN,PSOQMED))
IF '+PSOQMED
QUIT
Begin DoDot:1
+2 SET PSOQSTAT=$GET(^XTMP("ORRDI","PSOO",DFN,PSOQMED,5,0))
+3 IF "ACTIVE^SUSPENDED"'[PSOQSTAT
QUIT
+4 SET @TARGET@(PSOQLINE,0)=$GET(^XTMP("ORRDI","PSOO",DFN,PSOQMED,2,0))
DO INC
+5 ;
SET PSOQSIG=$GET(^XTMP("ORRDI","PSOO",DFN,PSOQMED,14,0))
Begin DoDot:2
+6 IF $LENGTH(PSOQSIG)>60
Begin DoDot:3
+7 NEW WORDS,COUNT
+8 SET WORDS=$LENGTH(PSOQSIG," ")
+9 SET @TARGET@(PSOQLINE,0)="Sig: "
+10 FOR COUNT=1:1:WORDS
Begin DoDot:4
+11 SET @TARGET@(PSOQLINE,0)=$GET(@TARGET@(PSOQLINE,0))_$PIECE(PSOQSIG," ",COUNT)_" "
+12 IF $LENGTH(@TARGET@(PSOQLINE,0))>60
DO INC
SET @TARGET@(PSOQLINE,0)=" "
End DoDot:4
End DoDot:3
DO INC
QUIT
+13 SET @TARGET@(PSOQLINE,0)="Sig: "_PSOQSIG
DO INC
End DoDot:2
+14 SET PSOQQTY=$GET(^XTMP("ORRDI","PSOO",DFN,PSOQMED,6,0))
SET @TARGET@(PSOQLINE,0)="Quantity: "_+$PIECE(PSOQQTY,";")_" Days Supply: "_$PIECE($PIECE(PSOQQTY,";",2),"D",2)
DO INC
+15 SET @TARGET@(PSOQLINE,0)=$GET(^XTMP("ORRDI","PSOO",DFN,PSOQMED,10,0))_" refills remaining until "_$GET(^XTMP("ORRDI","PSOO",DFN,PSOQMED,7,0))
DO INC
+16 SET @TARGET@(PSOQLINE,0)="Last filled "_$GET(^XTMP("ORRDI","PSOO",DFN,PSOQMED,9,0))_" at "_$GET(^XTMP("ORRDI","PSOO",DFN,PSOQMED,1,0))_" ("_$SELECT(PSOQSTAT["ACT":"Active",PSOQSTAT["SUSP":"Active/Suspended",1:"Status Unknown")_")"
DO INC
+17 SET @TARGET@(PSOQLINE,0)=" "
DO INC
End DoDot:1
+18 IF PSOQLINE=3
Begin DoDot:1
+19 SET @TARGET@(1,0)="No Active Remote Medications for this patient"
End DoDot:1
GOTO RDIOUT
+20 SET @TARGET@(1,0)="Active Medications from Remote Data"
SET @TARGET@(2,0)=" "
RDIOUT QUIT "~@"_$NAME(@TARGET)
INC SET PSOQLINE=$GET(PSOQLINE)+1
QUIT
+1 ;-----------------------------
ENHS ;ENTRY POINT OF REMOTE DATA MEDICATIONS AS A HEALTH SUMMARY
+1 NEW PSOQHS,PSOQWRT
+2 IF '$GET(DFN)
QUIT
+3 SET PSOQHS=$$RDI(DFN,"^TMP($J,""PSOQRDI"")")
+4 SET PSOQWRT=0
FOR
SET PSOQWRT=$ORDER(^TMP($JOB,"PSOQRDI",PSOQWRT))
IF '+PSOQWRT
QUIT
Begin DoDot:1
+5 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+6 WRITE !,^TMP($JOB,"PSOQRDI",PSOQWRT,0)
+7 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
End DoDot:1
+8 QUIT