GMPLUTL2 ; ISL/MKB,KER,JER -- PL Utilities (OE/TIU) ;16-Sep-2015 16:24;DU
;;2.0;Problem List;**10,18,21,26,35,1003,36,1004**;Aug 25, 1994;Build 10
;; IHS/MSC/MGH Updated for MU2
; External References
; DBIA 348 ^DPT( file #2
; DBIA 3990 $$ICDDX^ICDCODE
; DBIA 10040 ^SC( file #44
; DBIA 10060 ^VA(200
; DBIA 2716 $$GETSTAT^DGMSTAPI
; DBIA 3457 $$GETCUR^DGNTAPI
; DBIA 10062 7^VADPT
; DBIA 10062 DEM^VADPT
; DBIA 10118 EN^VALM
; DBIA 10116 CLEAR^VALM1
; DBIA 10103 $$HTFM^XLFDT
;
LIST(GMPL,GMPDFN,GMPSTAT,GMPCOMM) ; Returns list of Problems for Patient
D LIST^GMPLUTL3
Q
;
DETAIL(IFN,GMPL) ; Returns Detailed Data for Problem
;
; Input IFN Pointer to Problem file #9000011
;
; Output GMPL Array, passed by reference
; GMPL("DATA NAME") = External Format of Value
;
; GMPL("DIAGNOSIS") ICD Code
; GMPL("ICDD") ICD Description
; GMPL("PATIENT") Patient Name
; GMPL("MODIFIED") Date Last Modified
; GMPL("NARRATIVE") Provider Narrative
; GMPL("ENTERED") Date Entered ^ Entered by
; GMPL("STATUS") Status
; GMPL("PRIORITY") Priority Acute/Chronic
; GMPL("ONSET") Date of Onset
; GMPL("PROVIDER") Responsible Provider
; GMPL("RECORDED") Date Recorded ^ Recorded by
; GMPL("CONDITION") Patient Condition (#1.02)
; GMPL("RESOLVED") Date Resolved (#1.07)
; GMPL("CLINIC") Hospital Location
; GMPL("SERVICE") Service (#1.06)
; GMPL("FACILITY") Facility ID ^ Facility Name (#.06)
; GMPL("SC") Service Connected SC/NSC/""
; GMPL("SCTC") SNOMED-CT Concept Code
; GMPL("SCTD") SNOMED-CT Designation Code
; GMPL("SCTT") SNOMED-CT Preferred Text
; GMPL("VHATC") VHAT Concept Code
; GMPL("VHATD") VHAT Designation Code
; GMPL("VHATT") VHAT Preferred Text
;
; GMPL("ICD9MLTP") = #
; GMPL("ICD9MLTP",CNT) = ICD-9-CM Code^ICD-9-CM Description
;
; GMPL("EXPOSURE") = #
; GMPL("EXPOSURE",X)="AGENT ORANGE"
; GMPL("EXPOSURE",X)="RADIATION"
; GMPL("EXPOSURE",X)="ENV CONTAMINANTS"
; GMPL("EXPOSURE",X)="HEAD AND/OR NECK CANCER"
; GMPL("EXPOSURE",X)="MILITARY SEXUAL TRAUMA"
; GMPL("EXPOSURE",X)="COMBAT VET"
; GMPL("EXPOSURE",X)="SHAD"
;
; GMPL("COMMENT") = #
; GMPL("COMMENT",CNT) = Date ^ Author ^ Text of Note
;
N GMPL0,GMPL1,GMPL800,GMPL803,GMPLP,X,I,FAC,CNT,NIFN Q:'$D(^AUPNPROB(IFN,0))
S GMPLP=+($$PTR^GMPLUTL4)
S GMPL0=$G(^AUPNPROB(IFN,0)),GMPL1=$G(^(1)),GMPL800=$G(^(800)),GMPL803=$G(^(803,0))
S GMPL("DIAGNOSIS")=$P($$ICDDX^ICDCODE(+GMPL0),U,2)
S GMPL("FACILITY")=$$RESOLVE(IFN,".06","IE")
S GMPL("ICDD")=$$ICDDESC(GMPL("DIAGNOSIS"),$P(GMPL0,U,8))
S GMPL("PATIENT")=$P($G(^DPT(+$P(GMPL0,U,2),0)),U)
S GMPL("MODIFIED")=$$EXTDT^GMPLX($P(GMPL0,U,3))
;IHS/MSC/MGH changed for MU stage 2
;S GMPL("NARRATIVE")=$$PROBTEXT^GMPLX(IFN)
S GMPL("NARRATIVE")=$$GET1^DIQ(9000011,IFN,.05)
S GMPL("ENTERED")=$$EXTDT^GMPLX($P(GMPL0,U,8))_U_$P($G(^VA(200,+$P(GMPL1,U,3),0)),U)
S X=$P(GMPL0,U,12),GMPL("STATUS")=$S(X="A":"ACTIVE",1:"INACTIVE")
S X=$S(X'="A":"",1:$P(GMPL1,U,14)),GMPL("PRIORITY")=$S(X="A":"ACUTE",X="C":"CHRONIC",1:"")
S GMPL("ONSET")=$$EXTDT^GMPLX($P(GMPL0,U,13))
S GMPL("CONDITION")=$$RESOLVE(IFN,"1.02","E")
S GMPL("PROVIDER")=$P($G(^VA(200,+$P(GMPL1,U,5),0)),U)
S GMPL("RECORDED")=$$EXTDT^GMPLX($P(GMPL1,U,9))_U_$P($G(^VA(200,+$P(GMPL1,U,4),0)),U)
S GMPL("RESOLVED")=$$EXTDT^GMPLX($P(GMPL1,U,7))
S GMPL("CLINIC")=$P($G(^SC(+$P(GMPL1,U,8),0)),U)
S GMPL("SERVICE")=$$RESOLVE(IFN,1.06,"E")
S GMPL("SCTC")=$P(GMPL800,U),GMPL("SCTD")=$P(GMPL800,U,2)
I $L($G(GMPL("SCTC"))) S GMPL("SCTT")=$$SCTTEXT(GMPL("SCTC"),$P(GMPL0,U,8),"SCT")
S GMPL("VHATC")=$P(GMPL800,U,3),GMPL("VHATD")=$P(GMPL800,U,4)
I $L($G(GMPL("VHATC"))) S GMPL("VHATT")=$$SCTTEXT(GMPL("VHATC"),$P(GMPL0,U,8),"VHAT")
I $L($G(GMPL803))>0 D
. N DA,ICDDESC S (CNT,DA)=0,GMPL("ICD9MLTP")=0 F S DA=$O(^AUPNPROB(IFN,803,DA)) Q:'+DA D
. . S X=$G(^AUPNPROB(IFN,803,DA,0)),ICDDESC=$$ICDDESC^GMPLUTL2($P(X,U))
. . S CNT=CNT+1,GMPL("ICD9MLTP",CNT)=$P(X,U)_U_$G(ICDDESC)
. S GMPL("ICD9MLTP")=CNT
E S GMPL("ICD9MLTP")=""
S GMPL("SC")=$S($P(GMPL1,U,10):"YES",$P(GMPL1,U,10)=0:"NO",1:"UNKNOWN")
S GMPL("EXPOSURE")=0
I $P(GMPL1,U,11) S X=GMPL("EXPOSURE")+1,GMPL("EXPOSURE",X)="AGENT ORANGE",GMPL("EXPOSURE")=X
I $P(GMPL1,U,12) S X=GMPL("EXPOSURE")+1,GMPL("EXPOSURE",X)="RADIATION",GMPL("EXPOSURE")=X
I $P(GMPL1,U,13) S X=GMPL("EXPOSURE")+1,GMPL("EXPOSURE",X)="ENV CONTAMINANTS",GMPL("EXPOSURE")=X
I $P(GMPL1,U,15) S X=GMPL("EXPOSURE")+1,GMPL("EXPOSURE",X)="HEAD AND/OR NECK CANCER",GMPL("EXPOSURE")=X
I $P(GMPL1,U,16) S X=GMPL("EXPOSURE")+1,GMPL("EXPOSURE",X)="MILITARY SEXUAL TRAUMA",GMPL("EXPOSURE")=X
I $P(GMPL1,U,17) S X=GMPL("EXPOSURE")+1,GMPL("EXPOSURE",X)="COMBAT VET",GMPL("EXPOSURE")=X
I $P(GMPL1,U,18)&(GMPLP'>0) S X=GMPL("EXPOSURE")+1,GMPL("EXPOSURE",X)="SHAD",GMPL("EXPOSURE")=X
S (FAC,CNT)=0,GMPL("COMMENT")=0
F FAC=0:0 S FAC=$O(^AUPNPROB(IFN,11,FAC)) Q:+FAC'>0 D
. F NIFN=0:0 S NIFN=$O(^AUPNPROB(IFN,11,FAC,11,NIFN)) Q:NIFN'>0 D
. . S X=$G(^AUPNPROB(IFN,11,FAC,11,NIFN,0))
. . S CNT=CNT+1,GMPL("COMMENT",CNT)=$$EXTDT^GMPLX($P(X,U,5))_U_$P($G(^VA(200,+$P(X,U,6),0)),U)_U_$P(X,U,3)
S GMPL("COMMENT")=CNT D AUDIT
Q
;
RESOLVE(IEN,FIELD,FORMAT) ; Call GET1^DIQ to resolve field values
; Input: IEN = Record #
; FIELD = Field # in PROBLEMS file #9000011
; FORMAT = "I"nternal, "E"xternal, or "IE" -> both
; Output: GMPLY = value as specified by format
N GMPLY
S IEN=IEN_","
S GMPLY=$$GET1^DIQ(9000011,IEN,FIELD,FORMAT)
S:FORMAT="IE" GMPLY=GMPLY_U_$$GET1^DIQ(9000011,IEN,FIELD,"E")
Q GMPLY
AUDIT ; 14 Sep 99 - MA - Add audit trail to OE Problem List.
; Called from DETAIL, requires IFN and sets GMPL("AUDIT")
N IDT,AIFN,X0,X1,FLD,CNT
S CNT=0,GMPL("AUDIT")=CNT
F IDT=0:0 S IDT=$O(^GMPL(125.8,"AD",IFN,IDT)) Q:IDT'>0 D
. F AIFN=0:0 S AIFN=$O(^GMPL(125.8,"AD",IFN,IDT,AIFN)) Q:AIFN'>0 D
.. S X0=$G(^GMPL(125.8,AIFN,0)),X1=$G(^(1)) Q:'$L(X0)
.. S FLD=$$FLDNAME(+$P(X0,U,2))
.. S CNT=CNT+1
.. S GMPL("AUDIT",CNT,0)=$P(X0,U,2)_U_FLD_U_$P(X0,U,3,8)
.. ; = pointer#^fld name^date mod^who mod^old^new^reason^prov
.. S:$L(X1) GMPL("AUDIT",CNT,1)=X1
S GMPL("AUDIT")=CNT
Q
;
FLDNAME(NUM) ; Returns field name for display
N NAME,NM1,NM2,I,J S J=0,NAME=""
S NM1=".01^.05^.12^.13^1.01^1.02^1.04^1.05^1.06^1.07^1.08^1.09^1.1^1.11^1.12^1.13^1.14^1.15^1.16^1.17^1.18^80001^80002^80003^80004^80005^302^1101"
F I=1:1:$L(NM1,U) I +$P(NM1,U,I)=+NUM S J=I Q
G:J'>0 FNQ
S NM2="DIAGNOSIS^PROVIDER NARRATIVE^STATUS^DATE OF ONSET^PROBLEM^CONDITION^RECORDING PROVIDER^RESPONSIBLE PROVIDER"
S NM2=NM2_"^SERVICE^DATE RESOLVED^CLINIC^DATE RECORDED^SERVICE CONNECTED^AGENT ORANGE EXP^RADIATION EXP^ENV CONTAMINANTS EXP"
S NM2=NM2_"^IMMEDIACY^HEAD & NECK CANCER^MIL SEX TRAUMA^COMBAT VET^SHIPBOARD HAZARD EXP^SNOMED CT CONCEPT^SNOMED CT DESIGNATION"
S NM2=NM2_"^VHAT CONCEPT^VHAT DESIGNATION^SNOMED CT/ICD MAP STATUS^SECONDARY DIAGNOSIS^NOTE"
S NAME=$P(NM2,U,J)
FNQ Q NAME
;
ADD(DFN,LOC,GMPROV) ; -- Interactive LMgr action to add new problem
N X,Y,GMPDFN,GMPVA,GMPVAMC,GMPSC,GMPAGTOR,GMPION,GMPGULF,GMPHNC,GMPMST,GMPCV,GMPSHD
N GMPARAM,GMPLVIEW,GMPLUSER,GMPCLIN,GMPLSLST,GMPQUIT,VALMCC,GMPSAVED
Q:'DFN Q:'LOC D SETVARS
S GMPLSLST=$P($G(^VA(200,DUZ,125)),U,2),VALMCC=0
I 'GMPLSLST,GMPCLIN,$D(^GMPL(125,"C",+GMPCLIN)) S GMPLSLST=$O(^(+GMPCLIN,0))
I GMPLSLST D Q
. S $P(GMPLSLST,U,2)=$P($G(^GMPL(125,+GMPLSLST,0)),U)
. D EN^VALM("GMPL LIST MENU")
F D ADD^GMPL1 Q:$D(GMPQUIT) K DUOUT,DTOUT,GMPSAVED W !!,">>> Please enter another problem, or press <return> to exit."
Q
;
SETVARS ; -- Define GMP* variables used in ADD and EDIT
N VA,VADM,VAEL,VASV,X
Q:'DFN D DEM^VADPT,7^VADPT
S GMPDFN=DFN_U_VADM(1)_U_$E(VADM(1))_VA("BID")_$S(VADM(6):U_+VADM(6),1:"")
S AUPNSEX=$P(VADM(5),U),GMPVA=1,GMPSC=VAEL(3),GMPAGTOR=VASV(2),GMPION=VASV(3)
S X=$P($G(^DPT(DFN,.322)),U,10),GMPGULF=$S(X="Y":1,X="N":0,1:"")
S GMPCV=0 I +$G(VASV(10)) S:DT'>$P($G(VASV(10,1)),U) GMPCV=1 ;CV
S GMPSHD=+$G(VASV(14,1)) ;SHAD
S X=$$GETCUR^DGNTAPI(DFN,"HNC"),X=+($G(HNC("STAT"))),GMPHNC=$S(X=4:1,X=5:1,X=1:0,X=6:0,1:"")
S X=$P($$GETSTAT^DGMSTAPI(DFN),"^",2),GMPMST=$S(X="Y":1,X="N":0,1:"")
S GMPLVIEW("VIEW")=$S($P($G(^SC(+$G(LOC),0)),U,3)="C":"C",1:"S")
S GMPCLIN="" I $G(LOC),GMPLVIEW("VIEW")="C" S GMPCLIN=+LOC_U_$P(^SC(+LOC,0),U)
S X=$$PARAM,GMPARAM("VER")=+$P(X,U,2),GMPARAM("CLU")=+$P(X,U,4),GMPARAM("REV")=+$P(X,U,5)
S:+GMPROV=DUZ GMPLUSER=1 S GMPVAMC=+$G(DUZ(2)),GMPLIST(0)=0
Q
;
EDIT(DFN,LOC,GMPROV,GMPIFN) ; Interactive LMgr action to edit a problem
N GMPARAM,GMPDFN,GMPVA,GMPSC,GMPAGTOR,GMPION,GMPGULF,GMPHNC,GMPMST,GMPCV,GMPSHD
N GMPLVIEW,GMPCLIN,GMPLJUMP,GMPQUIT,GMPLUSER,GMPLVAMC,AUPNSEX
L +^AUPNPROB(GMPIFN,0):1 I '$T W $C(7),!!,$$LOCKED^GMPLX,! H 2 Q
D SETVARS,EN^VALM("GMPL EDIT PROBLEM")
L -^AUPNPROB(GMPIFN,0)
Q
;
REMOVE(GMPIFN,GMPROV,TEXT,PLY) ; -- Remove problem GMPIFN
N GMPVAMC,CHANGE
S GMPVAMC=+$G(DUZ(2)),PLY=-1,PLY(0)=""
I '$L($G(^AUPNPROB(GMPIFN,0))) S PLY(0)="Invalid problem" Q
I '$D(^VA(200,+$G(GMPROV),0)) S PLY(0)="Invalid provider" Q
I $L($G(TEXT)) S GMPFLD(10,"NEW",1)=TEXT D NEWNOTE^GMPLSAVE
S CHANGE=GMPIFN_"^1.02^"_$$HTFM^XLFDT($H)_U_DUZ_U_$P($G(^AUPNPROB(GMPIFN,1)),U,2)_"^H^Deleted^"_+$G(GMPROV),$P(^AUPNPROB(GMPIFN,1),U,2)="H",PLY=GMPIFN
D AUDIT^GMPLX(CHANGE,""),DTMOD^GMPLX(GMPIFN)
Q
;
PARAM() ; -- Returns parameter values from 125.99
Q $G(^GMPL(125.99,1,0))
;
VAF(DFN,SILENT) ; -- print PL VA Form chart copy
;
N VA,VADM,VAERR,GMPDFN,GMPVAMC,X,GMPARAM,GMPRT,GMPQUIT,GMPLCURR
Q:'$G(DFN) D DEM^VADPT S GMPDFN=DFN_U_VADM(1)_U_$E(VADM(1))_VA("BID")
S GMPVAMC=+$G(DUZ(2)),GMPARAM("QUIET")=1
S X=$G(^GMPL(125.99,1,0)),GMPARAM("VER")=+$P(X,U,2),GMPARAM("PRT")=+$P(X,U,3),GMPARAM("CLU")=+$P(X,U,4),GMPARAM("REV")=$S($P(X,U,5)="R":1,1:0) K X
D VAF^GMPLPRNT I '$G(SILENT) D Q:$G(GMPQUIT)
. I GMPRT'>0 W !!,"No problems available." S GMPQUIT=1 Q
. D DEVICE^GMPLPRNT Q:$G(GMPQUIT) D CLEAR^VALM1
D PRT^GMPLPRNT
Q
SCTTEXT(GMPLCODE,GMPDT,GMPSYS) ; Get Preferred Text for SCT Code
N %DT,GMPY,LEX,LEXY S GMPY="",GMPDT=$G(GMPDT,DT),GMPSYS=$G(GMPSYS,"SCT")
S LEXY=$$CODE^LEXTRAN(GMPLCODE,GMPSYS,GMPDT)
I '+LEXY G SCTTEXQ
S GMPY=$G(LEX("P"))
SCTTEXQ Q GMPY
ICDDESC(GMPLCODE,GMPDT) ; Get description for ICD9 Code
N ICDD,GMPY,ICDY S GMPY="",GMPDT=$G(GMPDT,DT)
S ICDY=$$ICDD^ICDCODE(GMPLCODE,"ICDD",GMPDT)
I 'ICDY G ICDDESQ
S GMPY=$G(ICDD(1))
ICDDESQ Q GMPY
GMPLUTL2 ; ISL/MKB,KER,JER -- PL Utilities (OE/TIU) ;16-Sep-2015 16:24;DU
+1 ;;2.0;Problem List;**10,18,21,26,35,1003,36,1004**;Aug 25, 1994;Build 10
+2 ;; IHS/MSC/MGH Updated for MU2
+3 ; External References
+4 ; DBIA 348 ^DPT( file #2
+5 ; DBIA 3990 $$ICDDX^ICDCODE
+6 ; DBIA 10040 ^SC( file #44
+7 ; DBIA 10060 ^VA(200
+8 ; DBIA 2716 $$GETSTAT^DGMSTAPI
+9 ; DBIA 3457 $$GETCUR^DGNTAPI
+10 ; DBIA 10062 7^VADPT
+11 ; DBIA 10062 DEM^VADPT
+12 ; DBIA 10118 EN^VALM
+13 ; DBIA 10116 CLEAR^VALM1
+14 ; DBIA 10103 $$HTFM^XLFDT
+15 ;
LIST(GMPL,GMPDFN,GMPSTAT,GMPCOMM) ; Returns list of Problems for Patient
+1 DO LIST^GMPLUTL3
+2 QUIT
+3 ;
DETAIL(IFN,GMPL) ; Returns Detailed Data for Problem
+1 ;
+2 ; Input IFN Pointer to Problem file #9000011
+3 ;
+4 ; Output GMPL Array, passed by reference
+5 ; GMPL("DATA NAME") = External Format of Value
+6 ;
+7 ; GMPL("DIAGNOSIS") ICD Code
+8 ; GMPL("ICDD") ICD Description
+9 ; GMPL("PATIENT") Patient Name
+10 ; GMPL("MODIFIED") Date Last Modified
+11 ; GMPL("NARRATIVE") Provider Narrative
+12 ; GMPL("ENTERED") Date Entered ^ Entered by
+13 ; GMPL("STATUS") Status
+14 ; GMPL("PRIORITY") Priority Acute/Chronic
+15 ; GMPL("ONSET") Date of Onset
+16 ; GMPL("PROVIDER") Responsible Provider
+17 ; GMPL("RECORDED") Date Recorded ^ Recorded by
+18 ; GMPL("CONDITION") Patient Condition (#1.02)
+19 ; GMPL("RESOLVED") Date Resolved (#1.07)
+20 ; GMPL("CLINIC") Hospital Location
+21 ; GMPL("SERVICE") Service (#1.06)
+22 ; GMPL("FACILITY") Facility ID ^ Facility Name (#.06)
+23 ; GMPL("SC") Service Connected SC/NSC/""
+24 ; GMPL("SCTC") SNOMED-CT Concept Code
+25 ; GMPL("SCTD") SNOMED-CT Designation Code
+26 ; GMPL("SCTT") SNOMED-CT Preferred Text
+27 ; GMPL("VHATC") VHAT Concept Code
+28 ; GMPL("VHATD") VHAT Designation Code
+29 ; GMPL("VHATT") VHAT Preferred Text
+30 ;
+31 ; GMPL("ICD9MLTP") = #
+32 ; GMPL("ICD9MLTP",CNT) = ICD-9-CM Code^ICD-9-CM Description
+33 ;
+34 ; GMPL("EXPOSURE") = #
+35 ; GMPL("EXPOSURE",X)="AGENT ORANGE"
+36 ; GMPL("EXPOSURE",X)="RADIATION"
+37 ; GMPL("EXPOSURE",X)="ENV CONTAMINANTS"
+38 ; GMPL("EXPOSURE",X)="HEAD AND/OR NECK CANCER"
+39 ; GMPL("EXPOSURE",X)="MILITARY SEXUAL TRAUMA"
+40 ; GMPL("EXPOSURE",X)="COMBAT VET"
+41 ; GMPL("EXPOSURE",X)="SHAD"
+42 ;
+43 ; GMPL("COMMENT") = #
+44 ; GMPL("COMMENT",CNT) = Date ^ Author ^ Text of Note
+45 ;
+46 NEW GMPL0,GMPL1,GMPL800,GMPL803,GMPLP,X,I,FAC,CNT,NIFN
IF '$DATA(^AUPNPROB(IFN,0))
QUIT
+47 SET GMPLP=+($$PTR^GMPLUTL4)
+48 SET GMPL0=$GET(^AUPNPROB(IFN,0))
SET GMPL1=$GET(^(1))
SET GMPL800=$GET(^(800))
SET GMPL803=$GET(^(803,0))
+49 SET GMPL("DIAGNOSIS")=$PIECE($$ICDDX^ICDCODE(+GMPL0),U,2)
+50 SET GMPL("FACILITY")=$$RESOLVE(IFN,".06","IE")
+51 SET GMPL("ICDD")=$$ICDDESC(GMPL("DIAGNOSIS"),$PIECE(GMPL0,U,8))
+52 SET GMPL("PATIENT")=$PIECE($GET(^DPT(+$PIECE(GMPL0,U,2),0)),U)
+53 SET GMPL("MODIFIED")=$$EXTDT^GMPLX($PIECE(GMPL0,U,3))
+54 ;IHS/MSC/MGH changed for MU stage 2
+55 ;S GMPL("NARRATIVE")=$$PROBTEXT^GMPLX(IFN)
+56 SET GMPL("NARRATIVE")=$$GET1^DIQ(9000011,IFN,.05)
+57 SET GMPL("ENTERED")=$$EXTDT^GMPLX($PIECE(GMPL0,U,8))_U_$PIECE($GET(^VA(200,+$PIECE(GMPL1,U,3),0)),U)
+58 SET X=$PIECE(GMPL0,U,12)
SET GMPL("STATUS")=$SELECT(X="A":"ACTIVE",1:"INACTIVE")
+59 SET X=$SELECT(X'="A":"",1:$PIECE(GMPL1,U,14))
SET GMPL("PRIORITY")=$SELECT(X="A":"ACUTE",X="C":"CHRONIC",1:"")
+60 SET GMPL("ONSET")=$$EXTDT^GMPLX($PIECE(GMPL0,U,13))
+61 SET GMPL("CONDITION")=$$RESOLVE(IFN,"1.02","E")
+62 SET GMPL("PROVIDER")=$PIECE($GET(^VA(200,+$PIECE(GMPL1,U,5),0)),U)
+63 SET GMPL("RECORDED")=$$EXTDT^GMPLX($PIECE(GMPL1,U,9))_U_$PIECE($GET(^VA(200,+$PIECE(GMPL1,U,4),0)),U)
+64 SET GMPL("RESOLVED")=$$EXTDT^GMPLX($PIECE(GMPL1,U,7))
+65 SET GMPL("CLINIC")=$PIECE($GET(^SC(+$PIECE(GMPL1,U,8),0)),U)
+66 SET GMPL("SERVICE")=$$RESOLVE(IFN,1.06,"E")
+67 SET GMPL("SCTC")=$PIECE(GMPL800,U)
SET GMPL("SCTD")=$PIECE(GMPL800,U,2)
+68 IF $LENGTH($GET(GMPL("SCTC")))
SET GMPL("SCTT")=$$SCTTEXT(GMPL("SCTC"),$PIECE(GMPL0,U,8),"SCT")
+69 SET GMPL("VHATC")=$PIECE(GMPL800,U,3)
SET GMPL("VHATD")=$PIECE(GMPL800,U,4)
+70 IF $LENGTH($GET(GMPL("VHATC")))
SET GMPL("VHATT")=$$SCTTEXT(GMPL("VHATC"),$PIECE(GMPL0,U,8),"VHAT")
+71 IF $LENGTH($GET(GMPL803))>0
Begin DoDot:1
+72 NEW DA,ICDDESC
SET (CNT,DA)=0
SET GMPL("ICD9MLTP")=0
FOR
SET DA=$ORDER(^AUPNPROB(IFN,803,DA))
IF '+DA
QUIT
Begin DoDot:2
+73 SET X=$GET(^AUPNPROB(IFN,803,DA,0))
SET ICDDESC=$$ICDDESC^GMPLUTL2($PIECE(X,U))
+74 SET CNT=CNT+1
SET GMPL("ICD9MLTP",CNT)=$PIECE(X,U)_U_$GET(ICDDESC)
End DoDot:2
+75 SET GMPL("ICD9MLTP")=CNT
End DoDot:1
+76 IF '$TEST
SET GMPL("ICD9MLTP")=""
+77 SET GMPL("SC")=$SELECT($PIECE(GMPL1,U,10):"YES",$PIECE(GMPL1,U,10)=0:"NO",1:"UNKNOWN")
+78 SET GMPL("EXPOSURE")=0
+79 IF $PIECE(GMPL1,U,11)
SET X=GMPL("EXPOSURE")+1
SET GMPL("EXPOSURE",X)="AGENT ORANGE"
SET GMPL("EXPOSURE")=X
+80 IF $PIECE(GMPL1,U,12)
SET X=GMPL("EXPOSURE")+1
SET GMPL("EXPOSURE",X)="RADIATION"
SET GMPL("EXPOSURE")=X
+81 IF $PIECE(GMPL1,U,13)
SET X=GMPL("EXPOSURE")+1
SET GMPL("EXPOSURE",X)="ENV CONTAMINANTS"
SET GMPL("EXPOSURE")=X
+82 IF $PIECE(GMPL1,U,15)
SET X=GMPL("EXPOSURE")+1
SET GMPL("EXPOSURE",X)="HEAD AND/OR NECK CANCER"
SET GMPL("EXPOSURE")=X
+83 IF $PIECE(GMPL1,U,16)
SET X=GMPL("EXPOSURE")+1
SET GMPL("EXPOSURE",X)="MILITARY SEXUAL TRAUMA"
SET GMPL("EXPOSURE")=X
+84 IF $PIECE(GMPL1,U,17)
SET X=GMPL("EXPOSURE")+1
SET GMPL("EXPOSURE",X)="COMBAT VET"
SET GMPL("EXPOSURE")=X
+85 IF $PIECE(GMPL1,U,18)&(GMPLP'>0)
SET X=GMPL("EXPOSURE")+1
SET GMPL("EXPOSURE",X)="SHAD"
SET GMPL("EXPOSURE")=X
+86 SET (FAC,CNT)=0
SET GMPL("COMMENT")=0
+87 FOR FAC=0:0
SET FAC=$ORDER(^AUPNPROB(IFN,11,FAC))
IF +FAC'>0
QUIT
Begin DoDot:1
+88 FOR NIFN=0:0
SET NIFN=$ORDER(^AUPNPROB(IFN,11,FAC,11,NIFN))
IF NIFN'>0
QUIT
Begin DoDot:2
+89 SET X=$GET(^AUPNPROB(IFN,11,FAC,11,NIFN,0))
+90 SET CNT=CNT+1
SET GMPL("COMMENT",CNT)=$$EXTDT^GMPLX($PIECE(X,U,5))_U_$PIECE($GET(^VA(200,+$PIECE(X,U,6),0)),U)_U_$PIECE(X,U,3)
End DoDot:2
End DoDot:1
+91 SET GMPL("COMMENT")=CNT
DO AUDIT
+92 QUIT
+93 ;
RESOLVE(IEN,FIELD,FORMAT) ; Call GET1^DIQ to resolve field values
+1 ; Input: IEN = Record #
+2 ; FIELD = Field # in PROBLEMS file #9000011
+3 ; FORMAT = "I"nternal, "E"xternal, or "IE" -> both
+4 ; Output: GMPLY = value as specified by format
+5 NEW GMPLY
+6 SET IEN=IEN_","
+7 SET GMPLY=$$GET1^DIQ(9000011,IEN,FIELD,FORMAT)
+8 IF FORMAT="IE"
SET GMPLY=GMPLY_U_$$GET1^DIQ(9000011,IEN,FIELD,"E")
+9 QUIT GMPLY
AUDIT ; 14 Sep 99 - MA - Add audit trail to OE Problem List.
+1 ; Called from DETAIL, requires IFN and sets GMPL("AUDIT")
+2 NEW IDT,AIFN,X0,X1,FLD,CNT
+3 SET CNT=0
SET GMPL("AUDIT")=CNT
+4 FOR IDT=0:0
SET IDT=$ORDER(^GMPL(125.8,"AD",IFN,IDT))
IF IDT'>0
QUIT
Begin DoDot:1
+5 FOR AIFN=0:0
SET AIFN=$ORDER(^GMPL(125.8,"AD",IFN,IDT,AIFN))
IF AIFN'>0
QUIT
Begin DoDot:2
+6 SET X0=$GET(^GMPL(125.8,AIFN,0))
SET X1=$GET(^(1))
IF '$LENGTH(X0)
QUIT
+7 SET FLD=$$FLDNAME(+$PIECE(X0,U,2))
+8 SET CNT=CNT+1
+9 SET GMPL("AUDIT",CNT,0)=$PIECE(X0,U,2)_U_FLD_U_$PIECE(X0,U,3,8)
+10 ; = pointer#^fld name^date mod^who mod^old^new^reason^prov
+11 IF $LENGTH(X1)
SET GMPL("AUDIT",CNT,1)=X1
End DoDot:2
End DoDot:1
+12 SET GMPL("AUDIT")=CNT
+13 QUIT
+14 ;
FLDNAME(NUM) ; Returns field name for display
+1 NEW NAME,NM1,NM2,I,J
SET J=0
SET NAME=""
+2 SET NM1=".01^.05^.12^.13^1.01^1.02^1.04^1.05^1.06^1.07^1.08^1.09^1.1^1.11^1.12^1.13^1.14^1.15^1.16^1.17^1.18^80001^80002^80003^80004^80005^302^1101"
+3 FOR I=1:1:$LENGTH(NM1,U)
IF +$PIECE(NM1,U,I)=+NUM
SET J=I
QUIT
+4 IF J'>0
GOTO FNQ
+5 SET NM2="DIAGNOSIS^PROVIDER NARRATIVE^STATUS^DATE OF ONSET^PROBLEM^CONDITION^RECORDING PROVIDER^RESPONSIBLE PROVIDER"
+6 SET NM2=NM2_"^SERVICE^DATE RESOLVED^CLINIC^DATE RECORDED^SERVICE CONNECTED^AGENT ORANGE EXP^RADIATION EXP^ENV CONTAMINANTS EXP"
+7 SET NM2=NM2_"^IMMEDIACY^HEAD & NECK CANCER^MIL SEX TRAUMA^COMBAT VET^SHIPBOARD HAZARD EXP^SNOMED CT CONCEPT^SNOMED CT DESIGNATION"
+8 SET NM2=NM2_"^VHAT CONCEPT^VHAT DESIGNATION^SNOMED CT/ICD MAP STATUS^SECONDARY DIAGNOSIS^NOTE"
+9 SET NAME=$PIECE(NM2,U,J)
FNQ QUIT NAME
+1 ;
ADD(DFN,LOC,GMPROV) ; -- Interactive LMgr action to add new problem
+1 NEW X,Y,GMPDFN,GMPVA,GMPVAMC,GMPSC,GMPAGTOR,GMPION,GMPGULF,GMPHNC,GMPMST,GMPCV,GMPSHD
+2 NEW GMPARAM,GMPLVIEW,GMPLUSER,GMPCLIN,GMPLSLST,GMPQUIT,VALMCC,GMPSAVED
+3 IF 'DFN
QUIT
IF 'LOC
QUIT
DO SETVARS
+4 SET GMPLSLST=$PIECE($GET(^VA(200,DUZ,125)),U,2)
SET VALMCC=0
+5 IF 'GMPLSLST
IF GMPCLIN
IF $DATA(^GMPL(125,"C",+GMPCLIN))
SET GMPLSLST=$ORDER(^(+GMPCLIN,0))
+6 IF GMPLSLST
Begin DoDot:1
+7 SET $PIECE(GMPLSLST,U,2)=$PIECE($GET(^GMPL(125,+GMPLSLST,0)),U)
+8 DO EN^VALM("GMPL LIST MENU")
End DoDot:1
QUIT
+9 FOR
DO ADD^GMPL1
IF $DATA(GMPQUIT)
QUIT
KILL DUOUT,DTOUT,GMPSAVED
WRITE !!,">>> Please enter another problem, or press <return> to exit."
+10 QUIT
+11 ;
SETVARS ; -- Define GMP* variables used in ADD and EDIT
+1 NEW VA,VADM,VAEL,VASV,X
+2 IF 'DFN
QUIT
DO DEM^VADPT
DO 7^VADPT
+3 SET GMPDFN=DFN_U_VADM(1)_U_$EXTRACT(VADM(1))_VA("BID")_$SELECT(VADM(6):U_+VADM(6),1:"")
+4 SET AUPNSEX=$PIECE(VADM(5),U)
SET GMPVA=1
SET GMPSC=VAEL(3)
SET GMPAGTOR=VASV(2)
SET GMPION=VASV(3)
+5 SET X=$PIECE($GET(^DPT(DFN,.322)),U,10)
SET GMPGULF=$SELECT(X="Y":1,X="N":0,1:"")
+6 ;CV
SET GMPCV=0
IF +$GET(VASV(10))
IF DT'>$PIECE($GET(VASV(10,1)),U)
SET GMPCV=1
+7 ;SHAD
SET GMPSHD=+$GET(VASV(14,1))
+8 SET X=$$GETCUR^DGNTAPI(DFN,"HNC")
SET X=+($GET(HNC("STAT")))
SET GMPHNC=$SELECT(X=4:1,X=5:1,X=1:0,X=6:0,1:"")
+9 SET X=$PIECE($$GETSTAT^DGMSTAPI(DFN),"^",2)
SET GMPMST=$SELECT(X="Y":1,X="N":0,1:"")
+10 SET GMPLVIEW("VIEW")=$SELECT($PIECE($GET(^SC(+$GET(LOC),0)),U,3)="C":"C",1:"S")
+11 SET GMPCLIN=""
IF $GET(LOC)
IF GMPLVIEW("VIEW")="C"
SET GMPCLIN=+LOC_U_$PIECE(^SC(+LOC,0),U)
+12 SET X=$$PARAM
SET GMPARAM("VER")=+$PIECE(X,U,2)
SET GMPARAM("CLU")=+$PIECE(X,U,4)
SET GMPARAM("REV")=+$PIECE(X,U,5)
+13 IF +GMPROV=DUZ
SET GMPLUSER=1
SET GMPVAMC=+$GET(DUZ(2))
SET GMPLIST(0)=0
+14 QUIT
+15 ;
EDIT(DFN,LOC,GMPROV,GMPIFN) ; Interactive LMgr action to edit a problem
+1 NEW GMPARAM,GMPDFN,GMPVA,GMPSC,GMPAGTOR,GMPION,GMPGULF,GMPHNC,GMPMST,GMPCV,GMPSHD
+2 NEW GMPLVIEW,GMPCLIN,GMPLJUMP,GMPQUIT,GMPLUSER,GMPLVAMC,AUPNSEX
+3 LOCK +^AUPNPROB(GMPIFN,0):1
IF '$TEST
WRITE $CHAR(7),!!,$$LOCKED^GMPLX,!
HANG 2
QUIT
+4 DO SETVARS
DO EN^VALM("GMPL EDIT PROBLEM")
+5 LOCK -^AUPNPROB(GMPIFN,0)
+6 QUIT
+7 ;
REMOVE(GMPIFN,GMPROV,TEXT,PLY) ; -- Remove problem GMPIFN
+1 NEW GMPVAMC,CHANGE
+2 SET GMPVAMC=+$GET(DUZ(2))
SET PLY=-1
SET PLY(0)=""
+3 IF '$LENGTH($GET(^AUPNPROB(GMPIFN,0)))
SET PLY(0)="Invalid problem"
QUIT
+4 IF '$DATA(^VA(200,+$GET(GMPROV),0))
SET PLY(0)="Invalid provider"
QUIT
+5 IF $LENGTH($GET(TEXT))
SET GMPFLD(10,"NEW",1)=TEXT
DO NEWNOTE^GMPLSAVE
+6 SET CHANGE=GMPIFN_"^1.02^"_$$HTFM^XLFDT($HOROLOG)_U_DUZ_U_$PIECE($GET(^AUPNPROB(GMPIFN,1)),U,2)_"^H^Deleted^"_+$GET(GMPROV)
SET $PIECE(^AUPNPROB(GMPIFN,1),U,2)="H"
SET PLY=GMPIFN
+7 DO AUDIT^GMPLX(CHANGE,"")
DO DTMOD^GMPLX(GMPIFN)
+8 QUIT
+9 ;
PARAM() ; -- Returns parameter values from 125.99
+1 QUIT $GET(^GMPL(125.99,1,0))
+2 ;
VAF(DFN,SILENT) ; -- print PL VA Form chart copy
+1 ;
+2 NEW VA,VADM,VAERR,GMPDFN,GMPVAMC,X,GMPARAM,GMPRT,GMPQUIT,GMPLCURR
+3 IF '$GET(DFN)
QUIT
DO DEM^VADPT
SET GMPDFN=DFN_U_VADM(1)_U_$EXTRACT(VADM(1))_VA("BID")
+4 SET GMPVAMC=+$GET(DUZ(2))
SET GMPARAM("QUIET")=1
+5 SET X=$GET(^GMPL(125.99,1,0))
SET GMPARAM("VER")=+$PIECE(X,U,2)
SET GMPARAM("PRT")=+$PIECE(X,U,3)
SET GMPARAM("CLU")=+$PIECE(X,U,4)
SET GMPARAM("REV")=$SELECT($PIECE(X,U,5)="R":1,1:0)
KILL X
+6 DO VAF^GMPLPRNT
IF '$GET(SILENT)
Begin DoDot:1
+7 IF GMPRT'>0
WRITE !!,"No problems available."
SET GMPQUIT=1
QUIT
+8 DO DEVICE^GMPLPRNT
IF $GET(GMPQUIT)
QUIT
DO CLEAR^VALM1
End DoDot:1
IF $GET(GMPQUIT)
QUIT
+9 DO PRT^GMPLPRNT
+10 QUIT
SCTTEXT(GMPLCODE,GMPDT,GMPSYS) ; Get Preferred Text for SCT Code
+1 NEW %DT,GMPY,LEX,LEXY
SET GMPY=""
SET GMPDT=$GET(GMPDT,DT)
SET GMPSYS=$GET(GMPSYS,"SCT")
+2 SET LEXY=$$CODE^LEXTRAN(GMPLCODE,GMPSYS,GMPDT)
+3 IF '+LEXY
GOTO SCTTEXQ
+4 SET GMPY=$GET(LEX("P"))
SCTTEXQ QUIT GMPY
ICDDESC(GMPLCODE,GMPDT) ; Get description for ICD9 Code
+1 NEW ICDD,GMPY,ICDY
SET GMPY=""
SET GMPDT=$GET(GMPDT,DT)
+2 SET ICDY=$$ICDD^ICDCODE(GMPLCODE,"ICDD",GMPDT)
+3 IF 'ICDY
GOTO ICDDESQ
+4 SET GMPY=$GET(ICDD(1))
ICDDESQ QUIT GMPY