GMTSP65 ; SLC OIFO/GS - Post Install GMTS*2.7*65 ; 04/09/2004
;;2.7;Health Summary;**65**;Oct 20, 1995
Q
POST ; Post-Install
D HOME^%ZIS N ENV S ENV=$$ENV Q:'ENV D REM,CI,RDV
Q
CI ; Component Install
N GMTSIN,GMTSLIM,GMTSINST,GMTSTL,GMTSINST,GMTSTOT,GMTSBLD
N GMTSCPS,GMTSCP,GMTSCI
S GMTSCPS="RXNV"
F GMTSCI=1:1 Q:'$L($P(GMTSCPS,";",GMTSCI)) D
. S GMTSCP=$P(GMTSCPS,";",GMTSCI) K GMTSIN
. D ARRAY Q:'$D(GMTSIN)
. I $L($G(GMTSIN("TIM"))),+($G(GMTSIN(0)))>0 S GMTSLIM(+($G(GMTSIN(0))),"TIM")=$G(GMTSIN("TIM"))
. I $L($G(GMTSIN("OCC"))),+($G(GMTSIN(0)))>0 S GMTSLIM(+($G(GMTSIN(0))),"OCC")=$G(GMTSIN("OCC"))
. S GMTSINST=$$ADD^GMTSXPD1(.GMTSIN),GMTSTOT=+($G(GMTSTOT))+($G(GMTSINST))
; Rebuild Ad Hoc Health Summary Type
D:+($G(GMTSTOT))>0 BUILD^GMTSXPD3
D LIM
I +$$ROK("GMTSXPS1")>0 D
. N GMTSHORT
. S GMTSHORT=1,GMTSINST="",GMTSBLD="GMTS*2.7*65"
. D SEND^GMTSXPS1
Q
REM ; Remove Component
N DA,DIK,GMTST,GMTSC,GMTSD
S (GMTST,GMTSD)=0
; From Health Summary Type File 142
F S GMTST=$O(^GMT(142,"AE",243,GMTST)) Q:+GMTST=0 D
. S GMTSC=0 F S GMTSC=$O(^GMT(142,"AE",243,GMTST,GMTSC)) Q:+GMTSC=0 D
. . Q:$P($G(^GMT(142,GMTST,1,GMTSC,0)),"^",2)'=243 S GMTSD=GMTSD+1
. . K ^GMT(142,GMTST,1,GMTSC),^GMT(142,GMTST,1,"B",GMTSC),^GMT(142,GMTST,1,"C",243)
I GMTSD>1 K ^GMT(142,"AE",243)
; From Health Summary Component File 142.1
S DA=243,DIK="^GMT(142.1," D ^DIK
; From PDX Segment File 394.1
; Previous RXNV Component
S DA=+($O(^VAT(394.71,"C","RXNV",0))) I +DA>0 S DIK="^VAT(394.71," D ^DIK
; Previous NVM Component
S DA=+($O(^VAT(394.71,"C","NVM",0))) I +DA>0 S DIK="^VAT(394.71," D ^DIK
; Previous HOTC Component
S DA=+($O(^VAT(394.71,"C","HOTC",0))) I +DA>0 S DIK="^VAT(394.71," D ^DIK
; Previous "Non-va Medications" Component
S DA=+($O(^VAT(394.71,"B","Non-va Medications",0))) I +DA>0 S DIK="^VAT(394.71," D ^DIK
Q
RDV ; Remote Data View - Outpatient Meds
N COM,TYP,HDR,TTL,TIM,DA,DIK,DIE,DIC,DA
S COM=$O(^GMT(142.1,"C","RXNV",0)) Q:+COM'>0
S TYP=$O(^GMT(142,"B","REMOTE OUTPATIENT MEDS (6M)",0)) Q:+TYP=0
S HDR=$P($G(^GMT(142.1,+COM,0)),"^",9) Q:'$L(HDR)
S TTL=$P($G(^GMT(142.1,+COM,0)),"^",1) Q:'$L(TTL) S TIM="6M"
S DA(1)=+TYP,(DIE,DIK,DIC)="^GMT(142,"_DA(1)_",1,",DA=15 D ^DIK
D BMES^XPDUTL(" Adding the '"_TTL_"' Health Summary Component")
D MES^XPDUTL(" to the 'REMOTE OUTPATIENT MEDS (6M)' Remote Data View Health")
D MES^XPDUTL(" Summary Type"),MES^XPDUTL("")
K ^GMT(142,"AE",243,5000014,15),^GMT(142,5000014,1,"B",15,15),^GMT(142,5000014,1,"C",243,15)
S ^GMT(142,DA(1),1,DA,0)="15^"_COM_"^^"_TIM_"^"_HDR
S ^GMT(142,DA(1),1,"B",DA,DA)="",^GMT(142,DA(1),1,"C",COM,DA)=""
K DA S DA=+TYP,DIK="^GMT(142," D IX1^DIK
Q
ARRAY ; Build Array
K GMTSIN N GMTSI,GMTSTXT,GMTSEX,GMTSFLD,GMTSUB,GMTSVAL,GMTSPDX S GMTSPDX=1,GMTSCP=$G(GMTSCP) Q:'$L(GMTSCP)
F GMTSI=1:1 D Q:'$L(GMTSTXT)
. S GMTSTXT="",GMTSEX="S GMTSTXT=$T("_GMTSCP_"+"_GMTSI_")" X GMTSEX S:$L(GMTSTXT,";")'>3 GMTSTXT="" Q:'$L(GMTSTXT)
. S GMTSFLD=$P(GMTSTXT,";",2),GMTSUB=$P(GMTSTXT,";",3),GMTSVAL=$P(GMTSTXT,";",4)
. S:$E(GMTSFLD,1)=1&(+GMTSFLD<2) GMTSVAL=$P(GMTSTXT,";",4,5)
. S:$E(GMTSFLD,1)=" "!('$L(GMTSFLD)) GMTSTXT="" Q:GMTSTXT=""
. S:$L(GMTSFLD)&('$L(GMTSUB)) GMTSIN(GMTSFLD)=GMTSVAL Q:$L(GMTSFLD)&('$L(GMTSUB)) S:$L(GMTSFLD)&($L(GMTSUB)) GMTSIN(GMTSFLD,GMTSUB)=GMTSVAL
. S:$G(GMTSFLD)=7&(+($G(GMTSUB))>0) GMTSPDX=0
K:+($G(GMTSPDX))=0 GMTSIN("PDX")
Q
LIM ; Limits
N GMTSI,GMTST,GMTSO,GMTSA S GMTSI=0 F S GMTSI=$O(GMTSLIM(GMTSI)) Q:+GMTSI=0 D
. S GMTSA=$P($G(^GMT(142.1,+($G(GMTSI)),0)),"^",3),GMTST=$G(GMTSLIM(+GMTSI,"TIM")) S:'$L(GMTST) GMTST=$S(GMTSA="Y ":"1Y ",1:"")
. S GMTSA=$P($G(^GMT(142.1,+($G(GMTSI)),0)),"^",5),GMTSO=$G(GMTSLIM(+GMTSI,"OCC")) S:'$L(GMTSO) GMTSO=$S(GMTSA="Y ":"10 ",1:"")
. D TO^GMTSXPD3(GMTSI,GMTST,GMTSO)
Q
ENV(X) ; Environment check
D HOME^%ZIS S U="^"
I $$GET1^DIQ(200,+($G(DUZ)),.01)="" W !!," User (DUZ) not defined",! Q 0
Q 1
ROK(X) ; Routine OK
S X=$G(X) Q:'$L(X) 0
N GMTSEX,GMTSTXT S GMTSEX="S GMTSTXT=$T(+1^"_X_")" X GMTSEX
Q:'$L(GMTSTXT) 0
Q 1
;
RXNV ; Non VA Meds Component Data
;0;;243
;.01;;NON VA MEDICATIONS
;1;;MAIN;GMTSPSHO
;1.1;;1
;1.1;1;PSOHCSUM
;2;;Y
;3;;RXNV
;3.5;;2
;3.5;1;This component displays the non-VA medications taken or
;3.5;2;reported as used by a patient.
;4;;Y
;5;;
;6;;
;7;;0
;8;;
;9;;Non VA Meds
;10;;
;11;;
;12;;
;13;;PS
;14;;
;PDX;;1
;TIM;;1Y
;OCC;;10
;
Q
;
GMTSP65 ; SLC OIFO/GS - Post Install GMTS*2.7*65 ; 04/09/2004
+1 ;;2.7;Health Summary;**65**;Oct 20, 1995
+2 QUIT
POST ; Post-Install
+1 DO HOME^%ZIS
NEW ENV
SET ENV=$$ENV
IF 'ENV
QUIT
DO REM
DO CI
DO RDV
+2 QUIT
CI ; Component Install
+1 NEW GMTSIN,GMTSLIM,GMTSINST,GMTSTL,GMTSINST,GMTSTOT,GMTSBLD
+2 NEW GMTSCPS,GMTSCP,GMTSCI
+3 SET GMTSCPS="RXNV"
+4 FOR GMTSCI=1:1
IF '$LENGTH($PIECE(GMTSCPS,";",GMTSCI))
QUIT
Begin DoDot:1
+5 SET GMTSCP=$PIECE(GMTSCPS,";",GMTSCI)
KILL GMTSIN
+6 DO ARRAY
IF '$DATA(GMTSIN)
QUIT
+7 IF $LENGTH($GET(GMTSIN("TIM")))
IF +($GET(GMTSIN(0)))>0
SET GMTSLIM(+($GET(GMTSIN(0))),"TIM")=$GET(GMTSIN("TIM"))
+8 IF $LENGTH($GET(GMTSIN("OCC")))
IF +($GET(GMTSIN(0)))>0
SET GMTSLIM(+($GET(GMTSIN(0))),"OCC")=$GET(GMTSIN("OCC"))
+9 SET GMTSINST=$$ADD^GMTSXPD1(.GMTSIN)
SET GMTSTOT=+($GET(GMTSTOT))+($GET(GMTSINST))
End DoDot:1
+10 ; Rebuild Ad Hoc Health Summary Type
+11 IF +($GET(GMTSTOT))>0
DO BUILD^GMTSXPD3
+12 DO LIM
+13 IF +$$ROK("GMTSXPS1")>0
Begin DoDot:1
+14 NEW GMTSHORT
+15 SET GMTSHORT=1
SET GMTSINST=""
SET GMTSBLD="GMTS*2.7*65"
+16 DO SEND^GMTSXPS1
End DoDot:1
+17 QUIT
REM ; Remove Component
+1 NEW DA,DIK,GMTST,GMTSC,GMTSD
+2 SET (GMTST,GMTSD)=0
+3 ; From Health Summary Type File 142
+4 FOR
SET GMTST=$ORDER(^GMT(142,"AE",243,GMTST))
IF +GMTST=0
QUIT
Begin DoDot:1
+5 SET GMTSC=0
FOR
SET GMTSC=$ORDER(^GMT(142,"AE",243,GMTST,GMTSC))
IF +GMTSC=0
QUIT
Begin DoDot:2
+6 IF $PIECE($GET(^GMT(142,GMTST,1,GMTSC,0)),"^",2)'=243
QUIT
SET GMTSD=GMTSD+1
+7 KILL ^GMT(142,GMTST,1,GMTSC),^GMT(142,GMTST,1,"B",GMTSC),^GMT(142,GMTST,1,"C",243)
End DoDot:2
End DoDot:1
+8 IF GMTSD>1
KILL ^GMT(142,"AE",243)
+9 ; From Health Summary Component File 142.1
+10 SET DA=243
SET DIK="^GMT(142.1,"
DO ^DIK
+11 ; From PDX Segment File 394.1
+12 ; Previous RXNV Component
+13 SET DA=+($ORDER(^VAT(394.71,"C","RXNV",0)))
IF +DA>0
SET DIK="^VAT(394.71,"
DO ^DIK
+14 ; Previous NVM Component
+15 SET DA=+($ORDER(^VAT(394.71,"C","NVM",0)))
IF +DA>0
SET DIK="^VAT(394.71,"
DO ^DIK
+16 ; Previous HOTC Component
+17 SET DA=+($ORDER(^VAT(394.71,"C","HOTC",0)))
IF +DA>0
SET DIK="^VAT(394.71,"
DO ^DIK
+18 ; Previous "Non-va Medications" Component
+19 SET DA=+($ORDER(^VAT(394.71,"B","Non-va Medications",0)))
IF +DA>0
SET DIK="^VAT(394.71,"
DO ^DIK
+20 QUIT
RDV ; Remote Data View - Outpatient Meds
+1 NEW COM,TYP,HDR,TTL,TIM,DA,DIK,DIE,DIC,DA
+2 SET COM=$ORDER(^GMT(142.1,"C","RXNV",0))
IF +COM'>0
QUIT
+3 SET TYP=$ORDER(^GMT(142,"B","REMOTE OUTPATIENT MEDS (6M)",0))
IF +TYP=0
QUIT
+4 SET HDR=$PIECE($GET(^GMT(142.1,+COM,0)),"^",9)
IF '$LENGTH(HDR)
QUIT
+5 SET TTL=$PIECE($GET(^GMT(142.1,+COM,0)),"^",1)
IF '$LENGTH(TTL)
QUIT
SET TIM="6M"
+6 SET DA(1)=+TYP
SET (DIE,DIK,DIC)="^GMT(142,"_DA(1)_",1,"
SET DA=15
DO ^DIK
+7 DO BMES^XPDUTL(" Adding the '"_TTL_"' Health Summary Component")
+8 DO MES^XPDUTL(" to the 'REMOTE OUTPATIENT MEDS (6M)' Remote Data View Health")
+9 DO MES^XPDUTL(" Summary Type")
DO MES^XPDUTL("")
+10 KILL ^GMT(142,"AE",243,5000014,15),^GMT(142,5000014,1,"B",15,15),^GMT(142,5000014,1,"C",243,15)
+11 SET ^GMT(142,DA(1),1,DA,0)="15^"_COM_"^^"_TIM_"^"_HDR
+12 SET ^GMT(142,DA(1),1,"B",DA,DA)=""
SET ^GMT(142,DA(1),1,"C",COM,DA)=""
+13 KILL DA
SET DA=+TYP
SET DIK="^GMT(142,"
DO IX1^DIK
+14 QUIT
ARRAY ; Build Array
+1 KILL GMTSIN
NEW GMTSI,GMTSTXT,GMTSEX,GMTSFLD,GMTSUB,GMTSVAL,GMTSPDX
SET GMTSPDX=1
SET GMTSCP=$GET(GMTSCP)
IF '$LENGTH(GMTSCP)
QUIT
+2 FOR GMTSI=1:1
Begin DoDot:1
+3 SET GMTSTXT=""
SET GMTSEX="S GMTSTXT=$T("_GMTSCP_"+"_GMTSI_")"
XECUTE GMTSEX
IF $LENGTH(GMTSTXT,";")'>3
SET GMTSTXT=""
IF '$LENGTH(GMTSTXT)
QUIT
+4 SET GMTSFLD=$PIECE(GMTSTXT,";",2)
SET GMTSUB=$PIECE(GMTSTXT,";",3)
SET GMTSVAL=$PIECE(GMTSTXT,";",4)
+5 IF $EXTRACT(GMTSFLD,1)=1&(+GMTSFLD<2)
SET GMTSVAL=$PIECE(GMTSTXT,";",4,5)
+6 IF $EXTRACT(GMTSFLD,1)=" "!('$LENGTH(GMTSFLD))
SET GMTSTXT=""
IF GMTSTXT=""
QUIT
+7 IF $LENGTH(GMTSFLD)&('$LENGTH(GMTSUB))
SET GMTSIN(GMTSFLD)=GMTSVAL
IF $LENGTH(GMTSFLD)&('$LENGTH(GMTSUB))
QUIT
IF $LENGTH(GMTSFLD)&($LENGTH(GMTSUB))
SET GMTSIN(GMTSFLD,GMTSUB)=GMTSVAL
+8 IF $GET(GMTSFLD)=7&(+($GET(GMTSUB))>0)
SET GMTSPDX=0
End DoDot:1
IF '$LENGTH(GMTSTXT)
QUIT
+9 IF +($GET(GMTSPDX))=0
KILL GMTSIN("PDX")
+10 QUIT
LIM ; Limits
+1 NEW GMTSI,GMTST,GMTSO,GMTSA
SET GMTSI=0
FOR
SET GMTSI=$ORDER(GMTSLIM(GMTSI))
IF +GMTSI=0
QUIT
Begin DoDot:1
+2 SET GMTSA=$PIECE($GET(^GMT(142.1,+($GET(GMTSI)),0)),"^",3)
SET GMTST=$GET(GMTSLIM(+GMTSI,"TIM"))
IF '$LENGTH(GMTST)
SET GMTST=$SELECT(GMTSA="Y ":"1Y ",1:"")
+3 SET GMTSA=$PIECE($GET(^GMT(142.1,+($GET(GMTSI)),0)),"^",5)
SET GMTSO=$GET(GMTSLIM(+GMTSI,"OCC"))
IF '$LENGTH(GMTSO)
SET GMTSO=$SELECT(GMTSA="Y ":"10 ",1:"")
+4 DO TO^GMTSXPD3(GMTSI,GMTST,GMTSO)
End DoDot:1
+5 QUIT
ENV(X) ; Environment check
+1 DO HOME^%ZIS
SET U="^"
+2 IF $$GET1^DIQ(200,+($GET(DUZ)),.01)=""
WRITE !!," User (DUZ) not defined",!
QUIT 0
+3 QUIT 1
ROK(X) ; Routine OK
+1 SET X=$GET(X)
IF '$LENGTH(X)
QUIT 0
+2 NEW GMTSEX,GMTSTXT
SET GMTSEX="S GMTSTXT=$T(+1^"_X_")"
XECUTE GMTSEX
+3 IF '$LENGTH(GMTSTXT)
QUIT 0
+4 QUIT 1
+5 ;
RXNV ; Non VA Meds Component Data
+1 ;0;;243
+2 ;.01;;NON VA MEDICATIONS
+3 ;1;;MAIN;GMTSPSHO
+4 ;1.1;;1
+5 ;1.1;1;PSOHCSUM
+6 ;2;;Y
+7 ;3;;RXNV
+8 ;3.5;;2
+9 ;3.5;1;This component displays the non-VA medications taken or
+10 ;3.5;2;reported as used by a patient.
+11 ;4;;Y
+12 ;5;;
+13 ;6;;
+14 ;7;;0
+15 ;8;;
+16 ;9;;Non VA Meds
+17 ;10;;
+18 ;11;;
+19 ;12;;
+20 ;13;;PS
+21 ;14;;
+22 ;PDX;;1
+23 ;TIM;;1Y
+24 ;OCC;;10
+25 ;
+26 QUIT
+27 ;