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

PXVRPC4.m

Go to the documentation of this file.
  1. PXVRPC4 ;BPFO/LMT - PCE RPCs for Immunization(s) ;Jan 18, 2023@15:08:57
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;**215,216,217,233**;Aug 12, 1996;Build 3
  1. ;
  1. ; Reference to ^DIA(9999999.14,"C") in ICR #2602
  1. ; Reference to NAME in file .85 in ICR #6062
  1. ; Reference to EXCLUDED^ORWPCE2 in ICR #7399
  1. ;
  1. IMMRPC(PXRTRN,PXIMM,PXDATE,PXLOC) ; Entry point for RPC
  1. ;
  1. ; Returns an Immunization object
  1. ;
  1. ;Input:
  1. ; PXRTRN - Return value passed by reference (Required)
  1. ; PXIMM - Pointer to #9999999.14 (Required)
  1. ; PXDATE - Immunization status and Codes will be based off this date
  1. ; (Optional; Defaults to NOW)
  1. ; PXLOC - Used to determine Institution (used when filtering Lot and Defaults) (Optional)
  1. ; Possible values are:
  1. ; "I:X": Institution (#4) IEN #X
  1. ; "V:X": Visit (#9000010) IEN #X
  1. ; "L:X": Hospital Location (#44) IEN #X
  1. ; If PXLOC is not passed in OR could not make determination based off
  1. ; input, then default to DUZ(2), and if DUZ(2) is not defined,
  1. ; default to Default Institution.
  1. ;
  1. ;Returns:
  1. ; ^TMP("PXVIMMRPC",$J,0)
  1. ; 1: 1 - Immunization was found. The "1" node will be returned, but
  1. ; the other nodes are optional.
  1. ; -1 - Immunization was not found; no other nodes will be returned
  1. ; ^TMP("PXVIMMRPC",$J,1)
  1. ; Note: Status (in the 5th piece) is determined as follows:
  1. ; - If PXDATE is today, the status is based off the Inactive Flag (#.07)
  1. ; - If PXDATE is different than today, we will look when an update was
  1. ; last made to the Immunization file (based off the Audits).
  1. ; If there have not been any changes since PXDATE, we will get the
  1. ; status based off the Inactive Flag, otherwise, we will get the
  1. ; status for that date by calling GETSTAT^XTID.
  1. ; 1: "IMM"
  1. ; 2: #9999999.14 IEN
  1. ; 3: Name (#.01)
  1. ; 4: CVX Code (#.03)
  1. ; 5: Status (1: Active; 0: Inactive)
  1. ; 6: Selectable for Historic (#8803)
  1. ; 7: Mnemonic (#8801)
  1. ; 8: Acronym (#8802)
  1. ; 9: Max # In Series (#.05)
  1. ; 10: Combination Immunization (Y/N) (#.2)
  1. ; 11: Reading Required (#.51)
  1. ; 12: Series Required (calculated)
  1. ; ^TMP("PXVIMMRPC",$J,x)
  1. ; 1: "VIS"
  1. ; 2: #920 IEN
  1. ; 3: Name (#920,#.01)
  1. ; 4: Edition Date (#920,#.02)
  1. ; 5: Edition Status (#920,#.03)
  1. ; 6: Language (#920, #.04)
  1. ; 7: 2D Bar Code (#100)
  1. ; 8: VIS URL (#101)
  1. ; ^TMP("PXVIMMRPC",$J,x)
  1. ; 1: "CDC"
  1. ; 2: CDC Product Name (#9999999.145, #.01)
  1. ; ^TMP("PXVIMMRPC",$J,x)
  1. ; 1: "GROUP"
  1. ; 2: Vaccine Group Name (#9999999.147, #.01)
  1. ; ^TMP("PXVIMMRPC",$J,x)
  1. ; 1: "SYNONYM"
  1. ; 2: Synonym (#9999999.141, #.01)
  1. ; ^TMP("PXVIMMRPC",$J,x)
  1. ; Note: Only active codes (based off PXDATE) are returned.
  1. ; 1: "CS"
  1. ; 2: Coding System (#9999999.143, #.01)
  1. ; 3: Code (#9999999.1431,#.01)
  1. ; 4: Variable pointer. e.g., IEN;ICPT(
  1. ; 5: Short Description
  1. ; ^TMP("PXVIMMRPC",$J,x)
  1. ; Note: Only active lots for the given division are returned.
  1. ; Also, the Expiration date must be >= PXDATE
  1. ; 1: "LOT"
  1. ; 2: #9999999.41 IEN
  1. ; 3: Lot Number (#9999999.41, #.01)
  1. ; 4: Manufacturer (#9999999.04, #.01)
  1. ; 5: Expiration Date (#9999999.41, #.09)
  1. ; 6: Doses Unused (#9999999.41, #.12)
  1. ; 7: Low Supply Alert (#9999999.41, #.15)
  1. ; 8: NDC Code (#9999999.41, #.18)
  1. ; ^TMP("PXVIMMRPC",$J,x)
  1. ; Note: Only active contraindications are returned
  1. ; 1: "CONTRA"
  1. ; 2: #920.4 variable pointer: IEN;PXV(920.4,
  1. ; 3: Name (#920.4, #.01)
  1. ; 4: Status (1:Active, 0:Inactive)
  1. ; 5: Code|Coding System (#920.4, #.02 and .05)
  1. ; 6: NIP004 (#920.4, #.04)
  1. ; 7: Contraindication/Precaution (#920.4, #.06)
  1. ; 8: Allergy-Related (1:Yes, 0:No)
  1. ; 9: Default Warn Until Date ("Forever" means it should be forever)
  1. ; ^TMP("PXVIMMRPC",$J,x)
  1. ; 1: "DEF"
  1. ; 2: Default Route (#920.051, #1302)
  1. ; 3: Default Site (#920.051, #1303)
  1. ; 4: Default Dose (#920.051, #1312)
  1. ; 5: Default Dose Units (#920.051, #1313)
  1. ; 6: Default Dose Units (external format) (#920.051, #1313)
  1. ; 7: Default Non-Standard Dose Units (#920.051, #1314)
  1. ; ^TMP("PXVIMMRPC",$J,x)
  1. ; 1: "DEFC"
  1. ; 2: Default Comments (#920.051, #81101)
  1. ;
  1. N PXCNT,PXCODESYS,PXFLD,PXI,PXIMMARR,PXIMMSUB,PXNODE,PXSUB
  1. ;
  1. S PXSUB="PXVIMMRPC"
  1. S PXRTRN=$NA(^TMP(PXSUB,$J))
  1. K ^TMP(PXSUB,$J)
  1. ;
  1. D GETIMM(.PXIMMARR,$G(PXIMM),$G(PXDATE),$G(PXLOC))
  1. S PXIMMSUB="PXVIMM"
  1. ;
  1. S PXCNT=0
  1. ;
  1. I '$D(^TMP(PXIMMSUB,$J)) D Q
  1. . S ^TMP(PXSUB,$J,PXCNT)="-1"
  1. ;
  1. S ^TMP(PXSUB,$J,PXCNT)=1
  1. S PXCNT=PXCNT+1
  1. S ^TMP(PXSUB,$J,PXCNT)="IMM"_U_$G(^TMP(PXIMMSUB,$J,0))
  1. ;
  1. F PXFLD="VIS","LOT","CDC","GROUP","SYNONYM","CONTRA","DEF","DEFC" D
  1. . I '$D(^TMP(PXIMMSUB,$J,PXFLD)) Q
  1. . S PXI=0 F S PXI=$O(^TMP(PXIMMSUB,$J,PXFLD,PXI)) Q:'PXI D
  1. . . S PXNODE=$G(^TMP(PXIMMSUB,$J,PXFLD,PXI,0))
  1. . . I PXNODE="" Q
  1. . . S PXCNT=PXCNT+1
  1. . . S ^TMP(PXSUB,$J,PXCNT)=PXFLD_U_PXNODE
  1. ;
  1. S PXFLD="CS"
  1. I $D(^TMP(PXIMMSUB,$J,PXFLD)) D
  1. . S PXCODESYS=""
  1. . F S PXCODESYS=$O(^TMP(PXIMMSUB,$J,PXFLD,PXCODESYS)) Q:PXCODESYS="" D
  1. . . S PXI=0
  1. . . F S PXI=$O(^TMP(PXIMMSUB,$J,PXFLD,PXCODESYS,PXI)) Q:'PXI D
  1. . . . S PXNODE=$G(^TMP(PXIMMSUB,$J,PXFLD,PXCODESYS,PXI,0))
  1. . . . I PXNODE="" Q
  1. . . . S PXCNT=PXCNT+1
  1. . . . S ^TMP(PXSUB,$J,PXCNT)=PXFLD_U_PXCODESYS_U_PXNODE
  1. ;
  1. K ^TMP(PXIMMSUB,$J)
  1. ;
  1. Q
  1. ;
  1. GETIMM(PXRTRN,PXIMM,PXDATE,PXLOC) ; Entry point for API
  1. ;
  1. N PXAUDIT,PXDIV,PXI,PXINST,PXNODE,PXNODE0,PXNODETMP,PXSUB,PXSERIESREQ
  1. ;
  1. S PXSUB="PXVIMM"
  1. K ^TMP(PXSUB,$J)
  1. S PXRTRN=$NA(^TMP(PXSUB,$J))
  1. ;
  1. I '$G(PXIMM) Q
  1. I '$D(^AUTTIMM(PXIMM,0)) Q
  1. I '$G(PXDATE) S PXDATE=$$NOW^XLFDT()
  1. S PXINST=$$INST^PXVUTIL($G(PXLOC))
  1. ;
  1. S PXAUDIT=0
  1. I $$GET1^DID(9999999.14,.07,"","AUDIT")="YES, ALWAYS" S PXAUDIT=1
  1. ;
  1. S PXNODE0=^AUTTIMM(PXIMM,0)
  1. S PXNODETMP=PXIMM_U_$P(PXNODE0,U,1)_U_$P(PXNODE0,U,3)
  1. S PXNODETMP=PXNODETMP_U_$$GETSTAT(PXIMM,PXDATE,$$GETCSTAT(PXDATE,PXAUDIT),PXAUDIT)
  1. S PXNODE=$P($G(^AUTTIMM(PXIMM,6)),U,1)
  1. S PXNODETMP=PXNODETMP_U_PXNODE
  1. S PXNODE=$G(^AUTTIMM(PXIMM,88))
  1. S PXNODETMP=PXNODETMP_U_$P(PXNODE,U,1)
  1. S PXNODETMP=PXNODETMP_U_$P(PXNODE,U,2)
  1. S PXNODETMP=PXNODETMP_U_$P(PXNODE0,U,5)_U_$P(PXNODE0,U,20)
  1. S PXNODE=$P($G(^AUTTIMM(PXIMM,.5)),U,1)
  1. S PXNODETMP=PXNODETMP_U_PXNODE
  1. S PXSERIESREQ=0
  1. I $P(PXNODE0,U,5)>0,$$ISMAPTOADMCPT^PXVRPC4A(PXIMM) S PXSERIESREQ=1
  1. S PXNODETMP=PXNODETMP_U_PXSERIESREQ
  1. S ^TMP(PXSUB,$J,0)=PXNODETMP
  1. ;
  1. I $D(^AUTTIMM(PXIMM,3)) D GETCS(PXSUB,PXIMM,PXDATE)
  1. I $D(^AUTTIMM(PXIMM,4)) D GETVIS(PXSUB,PXIMM)
  1. F PXI=5,7,10 I $D(^AUTTIMM(PXIMM,PXI)) D GETSUBS(PXSUB,PXIMM,PXI)
  1. D GETLOT(PXSUB,PXIMM,PXDATE,PXINST)
  1. D GETCONT(PXSUB,PXIMM,PXINST) ; Get Contraindications
  1. D GETDEF(PXSUB,PXIMM,PXINST) ; Get Defaults
  1. ;
  1. Q
  1. ;
  1. GETCS(PXSUB,PXIMM,PXDATE) ;
  1. ;
  1. N PXCNT,PXCODE,PXCODESYS,PXCODESYSLEX,PXLEX,PXLEXADATE,PXLEXARY,PXLEXIDATE,PXLEXNODE,PXLEXSUB,PXX,PXY,PXCODELEX
  1. ;
  1. S PXDATE=$P(PXDATE,".",1)
  1. S PXCNT=0
  1. ;
  1. S PXX=0
  1. F S PXX=$O(^AUTTIMM(PXIMM,3,PXX)) Q:'PXX D
  1. . S PXCODESYS=$G(^AUTTIMM(PXIMM,3,PXX,0))
  1. . I PXCODESYS="" Q
  1. . ;
  1. . ; do this for the CPT admin mappings (e.g., CPTAI1, etc.)
  1. . S PXCODESYSLEX=PXCODESYS
  1. . I $E(PXCODESYSLEX,1,3)="CPT" S PXCODESYSLEX="CPT"
  1. . ;
  1. . S PXY=0 F S PXY=$O(^AUTTIMM(PXIMM,3,PXX,1,PXY)) Q:'PXY D
  1. . . S PXCODE=$G(^AUTTIMM(PXIMM,3,PXX,1,PXY,0))
  1. . . I PXCODE="" Q
  1. . . ;
  1. . . ; do this for the CPT admin mappings (e.g., 91301-0011A)
  1. . . S PXCODELEX=PXCODE
  1. . . I PXCODESYSLEX="CPT",PXCODELEX["-" S PXCODELEX=$P(PXCODELEX,"-",2)
  1. . . ;
  1. . . K PXLEXARY
  1. . . S PXLEX=$$PERIOD^LEXU(PXCODELEX,PXCODESYSLEX,.PXLEXARY)
  1. . . ;
  1. . . I $P(PXLEX,U,1)=-1 D Q
  1. . . . I PXCODESYSLEX?1(1"CPT",1"10D") Q
  1. . . . S PXCNT=PXCNT+1
  1. . . . S ^TMP(PXSUB,$J,"CS",PXCODESYS,PXCNT,0)=PXCODE
  1. . . ;
  1. . . S PXLEXADATE=$O(PXLEXARY((PXDATE+.00001)),-1)
  1. . . I PXLEXADATE="" Q
  1. . . S PXLEXNODE=$G(PXLEXARY(PXLEXADATE))
  1. . . S PXLEXIDATE=$P(PXLEXNODE,U,1)
  1. . . I PXLEXIDATE,PXDATE>PXLEXIDATE Q
  1. . . S PXCNT=PXCNT+1
  1. . . S ^TMP(PXSUB,$J,"CS",PXCODESYS,PXCNT,0)=PXCODE_U_$P(PXLEXNODE,U,3)_U_$P(PXLEXNODE,U,4)
  1. ;
  1. Q
  1. ;
  1. GETVIS(PXSUB,PXIMM) ;
  1. ;
  1. N PXBAR,PXCNT,PXLANG,PXNODE,PXURL,PXVIS,PXX
  1. ;
  1. S PXCNT=0
  1. S PXX=0
  1. F S PXX=$O(^AUTTIMM(PXIMM,4,PXX)) Q:'PXX D
  1. . S PXVIS=+$G(^AUTTIMM(PXIMM,4,PXX,0))
  1. . I PXVIS'>0 Q
  1. . I '$D(^AUTTIVIS(PXVIS,0)) Q
  1. . S PXNODE=$G(^AUTTIVIS(PXVIS,0))
  1. . I PXNODE="" Q
  1. . S PXLANG=$P(PXNODE,U,4)
  1. . I PXLANG'="" S PXLANG=$$GET1^DIQ(.85,PXLANG_",","NAME") ;ICR 6062
  1. . S PXBAR=$P($G(^AUTTIVIS(PXVIS,100)),U,1)
  1. . S PXURL=$G(^AUTTIVIS(PXVIS,101))
  1. . S PXCNT=PXCNT+1
  1. . S ^TMP(PXSUB,$J,"VIS",PXCNT,0)=PXVIS_U_$P(PXNODE,U,1,3)_U_PXLANG_U_PXBAR_U_PXURL
  1. Q
  1. ;
  1. GETSUBS(PXSUB,PXIMM,PXMULT) ;
  1. ;
  1. N PXCNT,PXFLD,PXNODE,PXX
  1. ;
  1. S PXFLD=$S(PXMULT=5:"CDC",PXMULT=7:"GROUP",PXMULT=10:"SYNONYM",1:"")
  1. I PXFLD="" Q
  1. S PXCNT=0
  1. S PXX=0 F S PXX=$O(^AUTTIMM(PXIMM,PXMULT,PXX)) Q:'PXX D
  1. . S PXNODE=$G(^AUTTIMM(PXIMM,PXMULT,PXX,0)) Q:PXNODE=""
  1. . S PXCNT=PXCNT+1
  1. . S ^TMP(PXSUB,$J,PXFLD,PXCNT,0)=PXNODE
  1. Q
  1. ;
  1. GETLOT(PXSUB,PXIMM,PXDATE,PXINST) ;
  1. ;
  1. N PXCNT,PXEXPDATE,PXLOT,PXMAN,PXNDC,PXNODE,PXSTAT,PXTEMP
  1. ;
  1. S PXCNT=0
  1. S PXLOT=0
  1. F S PXLOT=$O(^AUTTIML("C",PXIMM,PXLOT)) Q:'PXLOT D
  1. . S PXNODE=$G(^AUTTIML(PXLOT,0))
  1. . I PXNODE="" Q
  1. . S PXEXPDATE=$P(PXNODE,U,9)
  1. . S PXSTAT=$$LOTSTAT^PXVXR(PXLOT,PXDATE)
  1. . I 'PXSTAT Q
  1. . ; check if selectable for this facility
  1. . I $G(PXINST),'$$IMMSEL^PXVXR(PXLOT,PXINST) Q
  1. . S PXMAN=$P(PXNODE,U,2)
  1. . I PXMAN S PXMAN=$P($G(^AUTTIMAN(PXMAN,0)),U,1)
  1. . S PXNDC=$P(PXNODE,U,18)
  1. . S PXCNT=PXCNT+1
  1. . S PXTEMP=PXLOT_U_$P(PXNODE,U,1)_U_PXMAN_U_PXEXPDATE_U_$P(PXNODE,U,12)_U_$P(PXNODE,U,15)_U_PXNDC
  1. . S ^TMP(PXSUB,$J,"LOT",PXCNT,0)=PXTEMP
  1. Q
  1. ;
  1. GETCONT(PXSUB,PXIMM,PXINST) ; Get Contraindications
  1. ;
  1. N PXCNT,PXI,PXTMP
  1. ;
  1. D GETICR^PXVRPC5(.PXTMP,920.4,"I:"_PXIMM,$G(PXINST))
  1. S PXCNT=0
  1. S PXI=0
  1. F S PXI=$O(PXTMP(PXI)) Q:'PXI D
  1. . S PXCNT=PXCNT+1
  1. . S ^TMP(PXSUB,$J,"CONTRA",PXCNT,0)=$G(PXTMP(PXI))
  1. ;
  1. Q
  1. ;
  1. GETDEF(PXSUB,PXIMM,PXINST) ; Get defaults
  1. ;
  1. N PXDFLTS,PXNODE,PXROUTE,PXSITE,PXDOSE,PXUNITS,PXEUNITS,PXNUNITS
  1. ;
  1. I '$G(PXINST) S PXINST=$$KSP^XUPARAM("INST")
  1. ;
  1. D IMMDEF^PXAPIIM(.PXDFLTS,PXIMM,PXINST)
  1. ;I '$D(PXDFLTS) Q
  1. ;
  1. S PXNODE=$G(PXDFLTS(13))
  1. S PXROUTE=$P(PXNODE,U,2)
  1. S PXSITE=$P(PXNODE,U,3)
  1. S PXDOSE=$P(PXNODE,U,12)
  1. S PXUNITS=$P(PXNODE,U,13)
  1. S PXNUNITS=$P(PXNODE,U,14)
  1. ;
  1. I PXDOSE D
  1. . S PXDOSE=$$EXTERNAL^DILFD(9000010.11,1312,"",PXDOSE)
  1. I PXUNITS D
  1. . S PXEUNITS=$$EXTERNAL^DILFD(9000010.11,1313,"",PXUNITS)
  1. ;
  1. S ^TMP(PXSUB,$J,"DEF",1,0)=PXROUTE_U_PXSITE_U_PXDOSE_U_PXUNITS_U_$G(PXEUNITS)_U_PXNUNITS
  1. ;
  1. S PXNODE=$G(PXDFLTS(811))
  1. I PXNODE'="" S ^TMP(PXSUB,$J,"DEFC",1,0)=PXNODE
  1. ;
  1. Q
  1. ;
  1. GETUNITS(PXIMM,PXLOC) ;
  1. N PXRSLT,PXSUB,PXINST
  1. I '$G(PXIMM) Q ""
  1. S PXINST=$$INST^PXVUTIL("L:"_+$G(PXLOC))
  1. S PXSUB="PXVRPC4UNITS"
  1. K ^TMP(PXSUB,$J)
  1. D GETDEF(PXSUB,PXIMM,$G(PXINST))
  1. S PXRSLT=$P($G(^TMP(PXSUB,$J,"DEF",1,0)),U,4,5)
  1. I $P(PXRSLT,U,2)="" S $P(PXRSLT,U,2)=$P($G(^TMP(PXSUB,$J,"DEF",1,0)),U,6)
  1. K ^TMP(PXSUB,$J)
  1. Q PXRSLT
  1. ;
  1. IMMSHORT(PXRSLT,PXFILTER,PXDATE,PXOREXC,PXLOC) ;
  1. ;
  1. ; Return short list of immunizations
  1. ;
  1. ;Input:
  1. ; PXRSLT - Return value passed by reference (Required)
  1. ; PXFILTER - Filter (Optional; Defaults to "B")
  1. ; Possible values are:
  1. ; "A": Only return active entries
  1. ; "H": Only return entries marked as Selectable for Historic
  1. ; "B": Return both active entries and those marked as Selectable for Historic
  1. ; PXDATE - Date (optional; defaults to NOW)
  1. ; Used for determining immunization status (both for filtering and for return value)
  1. ; and lot status.
  1. ; PXOREXC - Should entries defined in ORWPCE EXCLUDE IMMUNIZATIONS be excluded? (optional)
  1. ; PXLOC - Used when excluding entries listed in ORWPCE EXCLUDE IMMUNIZATIONS. (Optional)
  1. ; This is the location used when getting the parameter value at the Location level.
  1. ; Also used to get division when checking if there is a linked lot.
  1. ;
  1. ;Returns:
  1. ; PXRTRN(x)
  1. ; Note: Status (in the 5th piece) is determined as follows:
  1. ; - If PXDATE is today, the status is based off the Inactive Flag (#.07)
  1. ; - If PXDATE is different than today, we will look when an update was
  1. ; last made to the Immunization file (based off the Audits).
  1. ; If there have not been any changes since PXDATE, we will get the
  1. ; status based off the Inactive Flag, otherwise, we will get the
  1. ; status for that date by calling GETSTAT^XTID.
  1. ; 1: "IMM"
  1. ; 2: #9999999.14 IEN
  1. ; 3: Name (#.01)
  1. ; 4: CVX Code (#.03)
  1. ; 5: Status (1: Active; 0: Inactive)
  1. ; 6: Selectable for Historic (#8803)
  1. ; 7: Mnemonic (#8801)
  1. ; 8: Acronym (#8802)
  1. ; 9: Active Lot linked to this Immunization? (1:Yes; 0:No)
  1. ; PXRTRN(x)
  1. ; 1: "CDC"
  1. ; 2: CDC Product Name (#9999999.145, #.01)
  1. ; PXRTRN(x)
  1. ; 1: "GROUP"
  1. ; 2: Vaccine Group Name (#9999999.147, #.01)
  1. ;
  1. N PXAUDIT,PXCNT,PXGETCSTAT,PXIEN,PXINST,PXLOT,PXLST,PXNODE,PXNODE88,PXSELHIST,PXSTAT,PXX
  1. ;
  1. I $G(PXFILTER)'?1(1"A",1"H",1"B") S PXFILTER="B"
  1. I '$G(PXDATE) S PXDATE=$$NOW^XLFDT()
  1. S PXINST=$$INST^PXVUTIL("L:"_+$G(PXLOC))
  1. S PXAUDIT=0
  1. I $$GET1^DID(9999999.14,.07,"","AUDIT")="YES, ALWAYS" S PXAUDIT=1
  1. S PXGETCSTAT=$$GETCSTAT(PXDATE,PXAUDIT)
  1. ;
  1. S PXCNT=0
  1. S PXIEN=0
  1. F S PXIEN=$O(^AUTTIMM(PXIEN)) Q:PXIEN'>0 D
  1. . I $G(PXOREXC),$$EXCLUDED(.PXLST,PXIEN,1,$G(PXLOC)) Q
  1. . S PXSELHIST=$P($G(^AUTTIMM(PXIEN,6)),U)
  1. . S PXSTAT=$$GETSTAT(PXIEN,PXDATE,PXGETCSTAT,PXAUDIT)
  1. . I PXFILTER="A",'PXSTAT Q
  1. . I PXFILTER="H",PXSELHIST'="Y" Q
  1. . I PXFILTER="B",'PXSTAT,PXSELHIST'="Y" Q
  1. . ;
  1. . S PXCNT=PXCNT+1
  1. . S PXNODE=$G(^AUTTIMM(PXIEN,0))
  1. . S PXNODE88=$G(^AUTTIMM(PXIEN,88))
  1. . ;
  1. . S PXLOT=""
  1. . I PXSTAT D
  1. . . K ^TMP("PXVLOT",$J)
  1. . . D GETLOT("PXVLOT",PXIEN,PXDATE,PXINST)
  1. . . S PXLOT=0
  1. . . I $O(^TMP("PXVLOT",$J,"LOT",0)) S PXLOT=1
  1. . . K ^TMP("PXVLOT",$J)
  1. . ;
  1. . S PXRSLT(PXCNT)="IMM"_U_PXIEN_U_$P(PXNODE,U,1)_U_$P(PXNODE,U,3)_U_PXSTAT_U_PXSELHIST_U_$P(PXNODE88,U,1)_U_$P(PXNODE88,U,2)_U_PXLOT
  1. . ;
  1. . S PXX=0
  1. . F S PXX=$O(^AUTTIMM(PXIEN,5,PXX)) Q:PXX'>0 D
  1. . . S PXNODE=$G(^AUTTIMM(PXIEN,5,PXX,0))
  1. . . I PXNODE="" Q
  1. . . S PXCNT=PXCNT+1
  1. . . S PXRSLT(PXCNT)="CDC"_U_PXNODE
  1. . ;
  1. . S PXX=0
  1. . F S PXX=$O(^AUTTIMM(PXIEN,7,PXX)) Q:PXX'>0 D
  1. . . S PXNODE=$P($G(^AUTTIMM(PXIEN,7,PXX,0)),U,1)
  1. . . I PXNODE="" Q
  1. . . S PXCNT=PXCNT+1
  1. . . S PXRSLT(PXCNT)="GROUP"_U_PXNODE
  1. Q
  1. ;
  1. GETSTAT(PXIMM,PXDATE,PXCURR,PXAUDIT) ;
  1. ;
  1. N PXLASTEDIT
  1. ;
  1. I PXCURR Q '$P($G(^AUTTIMM(PXIMM,0)),U,7)
  1. ;
  1. I PXAUDIT D
  1. . S PXLASTEDIT=$P($$LAST^DIAUTL(9999999.14,PXIMM,".07"),U,1)
  1. . I PXDATE>PXLASTEDIT S PXCURR=1
  1. I PXCURR Q '$P($G(^AUTTIMM(PXIMM,0)),U,7)
  1. ;
  1. Q $P($$GETSTAT^XTID(9999999.14,"",PXIMM_",",$G(PXDATE)),U,1)
  1. ;
  1. GETCSTAT(PXDATE,PXAUDIT) ;
  1. ;
  1. ; Should we get current status of IMM entries or should we call GETSTAT^XTID
  1. ; to get status as of a specific date?
  1. ; Since GETSTAT^XTID is slow, we try to avoid it when possible.
  1. ;
  1. ; Returns: 0 - Call GETSTAT^XTID
  1. ; 1 - Get current status
  1. ;
  1. N PXLASTEDITDT,PXRSLT
  1. ;
  1. S PXRSLT=0
  1. ;
  1. I '$G(PXDATE) D Q PXRSLT
  1. . S PXRSLT=1
  1. ;
  1. I $P(PXDATE,".",1)=DT D Q PXRSLT
  1. . S PXRSLT=1
  1. ;
  1. ; If Inactive Flag is being audited (which should be the case)
  1. ; then get current status, if file has not been updated since PXDATE
  1. I PXAUDIT D
  1. . S PXLASTEDITDT=$O(^DIA(9999999.14,"C",""),-1) ;ICR #2602
  1. . I PXDATE>PXLASTEDITDT S PXRSLT=1
  1. ;
  1. Q PXRSLT
  1. ;
  1. ;
  1. IMMADMCODES(PXRSLT,PXVISIT,PXPCELIST,PXRETCPTDEL) ;
  1. ;
  1. ; Returns Immunization Admin CPT codes
  1. ;
  1. ;Input:
  1. ; PXRSLT - Return value passed by reference (Required)
  1. ; PXVISIT - Visit IEN (Optional)
  1. ; PXPCELIST - PCE Array in format passed to PX SAVE DATA rpc (Required)
  1. ; PXRETCPTDEL - Should API return other mapped CPT codes (i.e., not admin) to delete (Optional)
  1. ;
  1. ;Returns:
  1. ; PXRSLT(n) = array of CPT codes to add/delete from Visit in format passed to PX SAVE DATA rpc
  1. ;
  1. D IMMADMCODES^PXVRPC4A(.PXRSLT,.PXVISIT,.PXPCELIST,$G(PXRETCPTDEL))
  1. Q
  1. ;
  1. ; Check if PXIEN should be excluded based off ORWPCE EXCLUDE XXX parameter
  1. EXCLUDED(PXLST,PXIEN,PXTYPE,PXLOC) ;
  1. ;
  1. N PXI,PXTMP,PXX
  1. ;
  1. I '$D(PXLST) D
  1. . D EXCLUDED^ORWPCE2(.PXTMP,$G(PXLOC),PXTYPE)
  1. . S PXI=0
  1. . F S PXI=$O(PXTMP(PXI)) Q:'PXI D
  1. . . S PXX=$P($G(PXTMP(PXI)),U,2)
  1. . . I PXX S PXLST(PXX)=""
  1. ;
  1. I $D(PXLST(PXIEN)) Q 1
  1. ;
  1. Q 0