Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: GMPLHIST

GMPLHIST.m

Go to the documentation of this file.
GMPLHIST ; SLC/MKB/KER/TC -- Problem List Historical data ;02/26/15  09:09
 ;;2.0;Problem List;**7,26,31,35,36,42,46,45**;Aug 25, 1994;Build 53
 ;
 ; External References
 ;   DBIA 10060  ^VA(200
 ;
DT ; Add historical data (audit trail) to DT list
 ;   Called from ^GMPLDISP, requires AIFN and adds to GMPDT()
 N NODE,DATE,FLD,PROV,OLD,OLDVAL,NEW,NEWVAL,ROOT,CHNGE,GMPLCSYS,PREVAUTH
 S NODE=$G(^GMPL(125.8,AIFN,0)) Q:NODE=""
 S DATE=$$EXTDT^GMPLX($P(NODE,U,3)),FLD=+$P(NODE,U,2),PROV=+$P(NODE,U,8)
 S:'PROV PROV=$P(NODE,U,4)
 S PROV=$S(PROV=".5":"NTRT",1:$P($G(^VA(200,PROV,0)),U))
 S FLD=FLD_U_$$FLDNAME(+FLD)
 S OLD=$P(NODE,U,5),NEW=$P(NODE,U,6),LCNT=LCNT+1
 I +FLD=1101 D  Q
 . N REASON
 . S REASON=" removed by "
 . S:OLD="C" REASON=" changed by "
 . S NODE=$G(^GMPL(125.8,AIFN,1))
 . S PREVAUTH=$P(NODE,U,6)
 . S GMPDT(LCNT,0)=$J(DATE,10)_": Previous NOTE "_$$EXTDT^GMPLX($P(NODE,U,5))_" from "_$P($G(^VA(200,+PREVAUTH,0)),U)_REASON_PROV_":"
 . S LCNT=LCNT+1,GMPDT(LCNT,0)="            "_$P(NODE,U,3)
 I +FLD=1.02 D  Q
 . S CHNGE=$S(NEW="H":"removed",OLD="T":"verified",1:"placed back on list")
 . S GMPDT(LCNT,0)=$J(DATE,10)_": PROBLEM "_CHNGE_" by "_PROV
 S GMPDT(LCNT,0)=$J(DATE,10)_": "_$P(FLD,U,2)_$S(OLD]"":" changed",1:" added")_" by "_PROV,LCNT=LCNT+1
 I +FLD=.01 D  Q
 . N CSYSOLD,CSYSNEW
 . S CSYSOLD=$$CSI^ICDEX(80,OLD),CSYSNEW=$$CSI^ICDEX(80,NEW)
 . S GMPDT(LCNT,0)=$J("from ",17)_$S(CSYSOLD=30:"(ICD-10-CM ",1:"(ICD-9-CM ")_$P($$ICDDATA^ICDXCODE(CSYSOLD,OLD,DT,"I"),U,2)_")"_" to "_$S(CSYSNEW=30:"(ICD-10-CM ",1:"(ICD-9-CM ")_$P($$ICDDATA^ICDXCODE(CSYSNEW,NEW,DT,"I"),U,2)_")"
 I +FLD=.12 S GMPDT(LCNT,0)=$J("from ",17)_$S(OLD="A":"ACTIVE",OLD="I":"INACTIVE",1:"UNKNOWN")_" to "_$S(NEW="A":"ACTIVE",NEW="I":"INACTIVE",1:"UNKNOWN") Q
 I (+FLD=.13)!(+FLD=1.07) S GMPDT(LCNT,0)=$J("from ",17)_$$EXTDT^GMPLX(OLD)_" to "_$$EXTDT^GMPLX(NEW) Q
 I +FLD=1.14 S GMPDT(LCNT,0)=$J("from ",17)_$S(OLD="A":"ACUTE",OLD="C":"CHRONIC",1:"UNSPECIFIED")_" to "_$S(NEW="A":"ACUTE",NEW="C":"CHRONIC",1:"UNSPECIFIED") Q
 I +FLD=80005 S GMPDT(LCNT,0)=$J("from ",17)_$S(OLD=1:"PENDING",OLD=2:"COMPLETED",1:"N/A")_" to "_$S(NEW=1:"PENDING",NEW="2":"COMPLETED",1:"N/A") Q
 I +FLD=302 D  Q
 . I NEW]"" D
 . . I OLD="" S GMPDT(LCNT,0)=$J(" as ",17)_NEW
 . . E  S GMPDT(LCNT,0)=$J("from ",17)_OLD_$$PAD^GMPLX(OLD,6)_" to "_NEW
 . E  S GMPDT(LCNT,0)=$J(OLD_$$PAD^GMPLX(OLD,6),23)_" removed."
 I (+FLD>1.09)&(+FLD<=1.18) S GMPDT(LCNT,0)=$J("from ",17)_$S(+OLD:"YES",OLD=0:"NO",1:"UNKNOWN")_" to "_$S(+NEW:"YES",NEW=0:"NO",1:"UNKNOWN") Q
 I (+FLD=80001)!(+FLD=80002) S GMPDT(LCNT,0)=$J("from ",17)_OLD_" to "_NEW
 I "^.05^1.01^1.04^1.05^1.06^1.08^"[(U_+FLD_U) D
 . S ROOT=$S(+FLD=.05:"AUTNPOV(",+FLD=1.01:"LEX(757.01,",(+FLD=1.04)!(+FLD=1.05):"VA(200,",+FLD=1.06:"DIC(49,",+FLD=1.08:"SC(",1:"") Q:ROOT=""
 . S OLDVAL=$S(OLD="":"",1:$P($G(@(U_ROOT_OLD_",0)")),U))
 . S NEWVAL=$S(NEW="":"",1:$P($G(@(U_ROOT_NEW_",0)")),U))
 . S GMPDT(LCNT,0)=$J("from ",17)_$S(OLDVAL'="":OLDVAL_$$PAD^GMPLX(OLDVAL,6),1:"UNSPECIFIED")
 . S LCNT=LCNT+1,GMPDT(LCNT,0)=$J("to ",17)_$S(NEWVAL'="":NEWVAL,1:"UNSPECIFIED")
 Q
 ;
FLDNAME(NUM) ; Returns Field Name for Display
 N NAME,NM1,NM2,I,J S J=0,NAME="" D NUM(.NM1),ALP(.NM2) S:+($G(NM1(+NUM)))=+NUM J=+NUM
 S:$L($G(NM2(+J))) NAME=$G(NM2(+J))
 Q NAME
ALP(X) ; Alpha Field Names
 S X(.01)="DIAGNOSIS",X(.02)="PATIENT NAME",X(.03)="DATE LAST MODIFIED",X(.04)="CLASS",X(.05)="PROVIDER NARRATIVE"
 S X(.06)="FACILITY",X(.07)="NUMBER",X(.08)="DATE ENTERED",X(.12)="STATUS",X(.13)="DATE OF ONSET",X(1.01)="PROBLEM",X(1.02)="CONDITION"
 S X(1.03)="ENTERED BY",X(1.04)="RECORDING PROVIDER",X(1.05)="RESPONSIBLE PROVIDER",X(1.06)="SERVICE",X(1.07)="DATE RESOLVED"
 S X(1.08)="CLINIC",X(1.09)="DATE RECORDED",X(1.1)="SERVICE CONNECTED",X(1.11)="AGENT ORANGE EXP",X(1.12)="RADIATION EXP",X(1.13)="ENV CONTAMINANTS EXP"
 S X(1.14)="IMMEDIACY",X(1.15)="HEAD/NECK CANCER",X(1.16)="MIL SEXUAL TRAUMA",X(1.17)="COMBAT VET",X(1.18)="SHAD",X(80001)="SNOMED CT CONCEPT",X(80002)="SNOMED CT DESIGNATION"
 S X(80003)="VHAT CONCEPT",X(80004)="VHAT DESIGNATION",X(80005)="MAP STATUS"
 S X(302)="SECONDARY DIAGNOSIS",X(1101)="NOTE"
 Q
NUM(X) ; Numeric Field Designations
 N FN F FN=.01:.01:.08 S X(+FN)=+FN
 F FN=.12:.01:.13 S X(+FN)=+FN
 F FN=1.01:.01:1.18 S X(+FN)=+FN
 F FN=80001:1:80005 S X(+FN)=+FN
 S X(1101)=1101,X(302)=302
 Q