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

PXAIIMM.m

Go to the documentation of this file.
PXAIIMM ;ISL/PKR - Set the IMMUNIZATION nodes. ;Oct 29, 2021@10:12:47
 ;;1.0;PCE PATIENT CARE ENCOUNTER;**45,124,209,210,215,211,217**;Aug 12, 1996;Build 134
 ;
IMM ;Main entry point.
 ;
 K PXAERR
 S PXAERR(8)=PXAK
 S PXAERR(7)="IMMUNIZATION"
 ;
 N IND,PXAA
 S IND=""
 F  S IND=$O(@PXADATA@("IMMUNIZATION",PXAK,IND)) Q:IND=""  D
 . I IND?1(1"VIS",1"REMARKS") D  Q
 . . M PXAA(IND)=@PXADATA@("IMMUNIZATION",PXAK,IND)
 . S PXAA(IND)=@PXADATA@("IMMUNIZATION",PXAK,IND)
 ;
 ;Validate the data.
 N STOP
 D VAL^PXAIIMMV
 I $G(STOP) Q
 ;
SETVARA ;Set the after visit variables.
 N AFTER0,AFTER12,AFTER13,AFTER14,AFTER15,AFTER16,AFTER811,AFTER812
 S $P(AFTER0,U,1)=$G(PXAA("IMMUN"))
 I $G(PXAA("DELETE")) S $P(AFTER0,U,1)="@"
 S $P(AFTER0,U,2)=$G(PATIENT)
 S $P(AFTER0,U,3)=$G(PXAVISIT)
 S $P(AFTER0,U,4)=$G(PXAA("SERIES"))
 S $P(AFTER0,U,6)=$G(PXAA("REACTION"))
 S $P(AFTER0,U,7)=$G(PXAA("CONTRAINDICATED"))
 S $P(AFTER12,U,1)=$G(PXAA("EVENT D/T"))
 S $P(AFTER12,U,4)=$G(PXAA("ENC PROVIDER"))
 S $P(AFTER811,U,1)=$G(PXAA("COMMENT"))
 ;
 ;--PACKAGE AND SOURCE
 S $P(AFTER812,"^",2)=$S($G(PXAA("PKG"))'="":PXAA("PKG"),1:$G(PXAPKG))
 S $P(AFTER812,"^",3)=$S($G(PXAA("SOURCE"))'="":PXAA("SOURCE"),1:$G(PXASOURC))
 ;
 ;--Add new fields for VIMM 2.0 - PX*1*209/210/215
 S $P(AFTER12,U,2)=$G(PXAA("ORD PROVIDER"))
 S $P(AFTER12,U,7)=$G(PXAA("LOT NUM"))
 S $P(AFTER12,U,20)=$G(PXAA("WARNING ACK"))
 S $P(AFTER12,U,22)=$G(PXAA("ORD BY POLICY"))
 S $P(AFTER13,U)=$G(PXAA("INFO SOURCE"))
 S $P(AFTER13,U,2)=$G(PXAA("ADMIN ROUTE"))
 S $P(AFTER13,U,3)=$G(PXAA("ANATOMIC LOC"))
 ;Do not store diagnosis as of PX*1*211
 ;S $P(AFTER13,U,4)=$G(PXAA("DIAGNOSIS"))
 S $P(AFTER13,U,12)=$G(PXAA("DOSE"))
 S $P(AFTER13,U,13)=$G(PXAA("DOSE UNITS"))
 ;
 ; Reading fields (for smallpox)
 S $P(AFTER14,U,1)=$G(PXAA("RESULT"))
 S $P(AFTER14,U,2)=$G(PXAA("READING"))
 S $P(AFTER14,U,3)=$G(PXAA("D/T READ"))
 S $P(AFTER14,U,4)=$G(PXAA("READER"))
 S $P(AFTER15,U,1)=$G(PXAA("READING COMMENT"))
 ;
 S $P(AFTER16,U,1)=$G(PXAA("OVERRIDE REASON"))
 ;
 S ^TMP("PXK",$J,"IMM",PXAK,0,"AFTER")=AFTER0
 S ^TMP("PXK",$J,"IMM",PXAK,12,"AFTER")=AFTER12
 S ^TMP("PXK",$J,"IMM",PXAK,13,"AFTER")=AFTER13
 S ^TMP("PXK",$J,"IMM",PXAK,14,"AFTER")=AFTER14
 S ^TMP("PXK",$J,"IMM",PXAK,15,"AFTER")=AFTER15
 S ^TMP("PXK",$J,"IMM",PXAK,16,"AFTER")=AFTER16
 S ^TMP("PXK",$J,"IMM",PXAK,811,"AFTER")=AFTER811
 S ^TMP("PXK",$J,"IMM",PXAK,812,"AFTER")=AFTER812
 ;
 ; Add multiple data to PXK AFTER - PX*1*210
 N FLD,SEQ,SUB
 ;
 F FLD="VIS","REMARKS" D
 . ;
 . S SUB=$S(FLD="VIS":2,1:11)
 . ;
 . ; Delete multiple
 . I $G(PXAA(FLD))="@" D  Q
 . . S ^TMP("PXK",$J,"IMM",PXAK,SUB,0,"AFTER")="@"
 . ;
 . S SEQ=0
 . F  S SEQ=$O(PXAA(FLD,SEQ)) Q:'SEQ  D
 . . S ^TMP("PXK",$J,"IMM",PXAK,SUB,SEQ,"AFTER")=$G(PXAA(FLD,SEQ,0))
 ;
 ; Add DIAGNOSIS 2 thru 8 to OTHER DIAGNOSIS multiple
 ;Do not store diagnosis as of PX*1*211
 ;N DIAGNUM,DIAGSTR
 ;S SEQ=0
 ;F DIAGNUM=2:1:8 D
 ;. S DIAGSTR="DIAGNOSIS "_DIAGNUM
 ;. I $G(PXAA(DIAGSTR))'="" D
 ;. . S SEQ=SEQ+1
 ;. . S ^TMP("PXK",$J,"IMM",PXAK,3,SEQ,"AFTER")=PXAA(DIAGSTR)
 ;
SETVARB ;Set the before variables.
 N BEFOR0,BEFOR12,BEFOR13,BEFOR14,BEFOR15,BEFOR16,BEFOR811,BEFOR812
 N IENB,PXAAX,PXBCNT,PXBKY,PXBSKY,PXBSAM
 D IMM^PXBGIMM(PXAVISIT)
 ;
 S IENB=""
 I PXBCNT>0 D
 . S PXAAX("IMMUN")=$P($G(^AUTTIMM(PXAA("IMMUN"),0)),U,1)
 . S IENB=$O(PXBKY(PXAAX("IMMUN"),IENB))
 I $G(IENB) D
 . S BEFOR0=$G(^AUPNVIMM(IENB,0))
 . S BEFOR12=$G(^AUPNVIMM(IENB,12))
 . S BEFOR13=$G(^AUPNVIMM(IENB,13))
 . S BEFOR14=$G(^AUPNVIMM(IENB,14))
 . S BEFOR15=$G(^AUPNVIMM(IENB,15))
 . S BEFOR16=$G(^AUPNVIMM(IENB,16))
 . S BEFOR811=$G(^AUPNVIMM(IENB,811))
 . S BEFOR812=$G(^AUPNVIMM(IENB,812))
 E  S (BEFOR0,BEFOR11,BEFOR12,BEFOR13,BEFOR14,BEFOR15,BEFOR16,BEFOR811,BEFOR812)=""
 ;
 S ^TMP("PXK",$J,"IMM",PXAK,0,"BEFORE")=BEFOR0
 S ^TMP("PXK",$J,"IMM",PXAK,12,"BEFORE")=BEFOR12
 S ^TMP("PXK",$J,"IMM",PXAK,13,"BEFORE")=BEFOR13
 S ^TMP("PXK",$J,"IMM",PXAK,14,"BEFORE")=BEFOR14
 S ^TMP("PXK",$J,"IMM",PXAK,15,"BEFORE")=BEFOR15
 S ^TMP("PXK",$J,"IMM",PXAK,16,"BEFORE")=BEFOR16
 S ^TMP("PXK",$J,"IMM",PXAK,811,"BEFORE")=BEFOR811
 S ^TMP("PXK",$J,"IMM",PXAK,812,"BEFORE")=BEFOR812
 S ^TMP("PXK",$J,"IMM",PXAK,"IEN")=IENB
 ;
 ;Package and Data Source cannot be edited.
 S BEFOR812=^TMP("PXK",$J,"IMM",PXAK,812,"BEFORE")
 I BEFOR812'="" D
 . I AFTER812=BEFOR812 Q
 . I $P(BEFOR812,U,2)'="" S $P(AFTER812,U,2)=$P(BEFOR812,U,2)
 . I $P(BEFOR812,U,3)'="" S $P(AFTER812,U,3)=$P(BEFOR812,U,3)
 . S ^TMP("PXK",$J,"IMM",PXAK,812,"AFTER")=AFTER812
 ;
 ; Add multiple data to PXK BEFORE
 I $G(IENB) D
 . N IENSUB,SUB
 . F SUB=2,3,11 D
 . . S IENSUB=0
 . . F  S IENSUB=$O(^AUPNVIMM(IENB,SUB,IENSUB)) Q:'IENSUB  D
 . . . S ^TMP("PXK",$J,"IMM",PXAK,SUB,IENSUB,"BEFORE")=$G(^AUPNVIMM(IENB,SUB,IENSUB,0))
 ;
 Q