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

ORFIMM.m

Go to the documentation of this file.
ORFIMM ;SLC/AGP - GENERIC EDIT IMMUNIZATION ;May 18, 2023@16:44:45
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**405,597,588**;Dec 17, 1997;Build 29
 ;
 ; Reference to READENT^PXAPIIM in ICR #6387
 ; Reference to READVALS^PXAPIIM in ICR #6387
 ; Reference to IMMSITE^PXVRPC2 in ICR #7283
 ; Reference to IMMSRC^PXVRPC2 in ICR #7283
 ; Reference to IMAN^PXVRPC1 in ICR #7282
 ; Reference to GETICR^PXVRPC5 in ICR #7285
 ; Reference to IMMGRP^PXAPIIM in ICR #6387
 ; Reference to IMMRPC^PXVRPC4 in ICR #7284
 ; Reference to ^AUTTIMM( in ICR #1990
 ;
 Q
 ;
LAYOUT(TYPE,RESULT) ;
 N CNT
 S CNT=0
 ;                          1     2        3     4   5     6       7        8       9          10      11       12                    13
 ;                         NAME^CAPTION^CONTROL^COL^ROW^COLSPAN^NEEDSORT^REQUIRED^ABOVELINE^ENABLED^SET DEFAULT^Default Internal value^Default External Value"
 I TYPE=0 D  Q
 .S CNT=CNT+1,RESULT(CNT)="LOT NUMBER^Lot Number^ptCBO^0^0^1^1^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="EXPIRATION DATE^Expiration Date^ptLabel^1^0^1^0^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="MANUFACTURER^Manufacturer^ptLabel^2^0^1^0^0^0^1^"
 .S CNT=CNT+1,RESULT(CNT)="VISIT DATE TIME^Administration Date^ptDateTime^0^1^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="ENCOUNTER PROVIDER^Administered by^ptCBOLongList^1^1^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="ORDERED BY POLICY^Administering by Policy^ptCheckBox^2^1^1^0^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="ORDERING PROVIDER^Ordered by^ptCBOLongList^3^1^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="ADMIN ROUTE^Route^ptCBO^0^2^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="ADMIN SITE^Anatomic Location^ptCBO^1^2^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="SERIES^Series^ptCBO^2^2^1^1^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="DOSE^Dosage in mL^ptEdit^3^2^1^1^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="VIS OFFERED^Vaccine Information Statement^ptCheckListBox^0^3^2^0^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="CODES CPT^Procedure Codes^ptCBO^2^3^1^0^1^0^"
 .S CNT=CNT+1,RESULT(CNT)="CODES DX^Diagnosis Codes^ptCBO^3^3^1^0^0^1^"
 .S CNT=CNT+1,RESULT(CNT)="COMMENTS^Comment^ptEdit^0^4^4^0^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="OVERRIDE REASON^Override Reason^ptEdit^0^5^4^0^1^0^"
 I TYPE=1 D  Q
 .S CNT=CNT+1,RESULT(CNT)="INFO SOURCE^Information Source^ptCBO^0^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="VISIT DATE TIME^Administration Date^ptDateBox^1^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="LOCATION^Outside Location^ptCBOFreeText^2^0^1^0^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="SERIES^Series^ptCBO^3^0^1^1^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="LOT NUMBER^Lot Number^ptEdit^0^1^1^0^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="EXPIRATION DATE^Expiration Date^ptDate^1^1^1^0^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="MANUFACTURER^Manufacturer^ptCBO^2^1^1^0^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="ADMIN ROUTE^Route^ptCBO^0^2^1^0^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="ADMIN SITE^Anatomic Location^ptCBO^1^2^1^0^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="DOSE^Dosage in ml^ptEdit^2^2^1^0^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="COMMENTS^Comment^ptEdit^0^3^4^0^0^0^1^1^"
 I TYPE=2 D  Q
 .S CNT=CNT+1,RESULT(CNT)="CONTRAINDICATED^Contraindication/Precaution Reason^ptCBO^0^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="STOP^Cancel Series and stop forecasting^ptCBO^1^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="WARN UNTIL DATE^Choose reschedule date^ptDate^2^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="COMMENTS^Comment^ptEdit^0^1^3^0^0^0^1^1^"
 I TYPE=3 D  Q
 .S CNT=CNT+1,RESULT(CNT)="REFUSAL^Reason for Refusal^ptCBO^0^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="STOP^Cancel Series and stop forecasting^ptCBO^1^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="WARN UNTIL DATE^Choose reschedule date^ptDate^2^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="GRPLIST^Immunizations in group^ptListBox^0^1^1^0^0^0^1^"
 .S CNT=CNT+1,RESULT(CNT)="CVXONLY^Limit Refusal to ^ptCBO^0^1^2^0^1^0^"
 .S CNT=CNT+1,RESULT(CNT)="COMMENTS^Comment^ptEdit^0^2^3^0^0^0^1^1^"
 I TYPE=4 D  Q
 .S CNT=CNT+1,RESULT(CNT)="DISPLAY^Details^ptMemo^0^0^1^0^1^0^0^1^"
 I TYPE=5 D  Q
 .S CNT=CNT+1,RESULT(CNT)="PLACEMENT IEN^Last Placement^ptLabel^0^0^2^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="READING^Measurements^ptCBO^0^1^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="RESULTS^Interpretation^ptCBO^1^1^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="VISIT DATE TIME^Read Date^ptDateTime^0^2^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="ENCOUNTER PROVIDER^Read By^ptCBOLongList^1^2^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="COMMENTS^Comment^ptEdit^0^3^2^0^0^0^1^1^"
 Q
 ;
BLDLAYOT(RESULTS,INPUTS,TYPE) ;
 N CNT,DATA,DATA1,DATA2,EXT,INT,NAME,NODE,LAYOUT,PARM,PARR,PIECE,PRMPTS,TEMP,X
 S DATA=$G(INPUTS(1)),DATA1=$G(INPUTS(2)),DATA2=$G(INPUTS(3))
 D LAYOUT(TYPE,.LAYOUT)
 D BLDPRMPT^ORFEDT(.PRMPTS)
 D BLDPARR^ORFEDT(.PARR)
 S X=0,CNT=0 F  S X=$O(LAYOUT(X)) Q:X'>0  D
 .S NODE=$G(LAYOUT(X))
 .S NAME=$P(NODE,U)
 .S INT="",EXT=""
 .S PARM=$G(PARR(NAME)) I PARM="" Q
 .S PIECE=+PRMPTS(PARM) I PIECE=0 Q
 .S TEMP=$P(DATA,U,PIECE)
 .I PARM="pnumImmRoute" S EXT=$P(TEMP,";"),INT=$P(TEMP,";",3)
 .I PARM="pnumImmSite" S EXT=$P(TEMP,";"),INT=$P(TEMP,";",3)
 .I PARM="pnumImmLot" S EXT=$P(TEMP,";"),INT=$P(TEMP,";",2)
 .I PARM="pnumImmManufacturer" S EXT=TEMP
 .I PARM="pnumExpirationDate" S INT=TEMP I +INT>0 S EXT=$$FMTE^XLFDT(INT)
 .I PARM="pnumImmDosage" S EXT=$P(TEMP,";"),INT=EXT
 .I PARM="pnumImmOrderByIEN" S INT=TEMP I INT>0 S EXT=$$GET1^DIQ(200,INT_",",.01)
 .I PARM="pnumAdminByPolicy" S INT=TEMP
 .I PARM="pnumImmSeries" S INT=TEMP
 .I PARM="pnumProvider" S INT=TEMP I INT>0 S EXT=$$GET1^DIQ(200,INT_",",.01)
 .I PARM="pnumComment" S TEMP=$P(DATA1,U,3) S EXT=TEMP,INT=TEMP
 .I PARM="pnumImmOverride" S TEMP=$P(DATA2,U,3) S EXT=TEMP,INT=TEMP
 .I PARM="pnumDataSource" S EXT=$P(TEMP,";"),INT=$P(TEMP,";",2)
 .I PARM="pnumIMMVIS" S INT=$$VIS(TEMP)
 .I PARM="pnumImmContra" S INT=+$P(DATA,U,2),EXT=$P(DATA,U,4)
 .I PARM="pnumWarnDate" D
 . . S INT=TEMP
 . . S CNT=CNT+1
 . . S RESULTS(CNT)="STOP"_U_$S(INT>1:0_U_"No",1:1_U_"Yes")
 .I PARM="pnumImmRefused" S INT=+$P(DATA,U,2),EXT=$P(DATA,U,4)
 .I PARM="pnumAdminDate" S INT=TEMP,EXT=TEMP
 .I PARM="pnumRefusedGroup" S INT=TEMP  ;S INT='$P(DATA,U,9)
 .I INT="@" S INT=""
 .I EXT="@" S EXT=""
 .S CNT=CNT+1,RESULTS(CNT)=NAME_U_INT_U_EXT
 Q
 ;
GET(RESULT,DATAARR,DEFAULTS) ;
 N ADMINBY,CNT,DATETIME,ENCTYPE,ERRMSG,FROMCVR,HASDEF,ID,IDX,LAYOUT,LOC,LOCLIST,NAME
 N NEEDOVER,NODE,ORDERBY,PAT,PARR,PRMPTS,SERMAX,SERREQ,TEMP,TYPE,VIMMDOC,VSTSTR
 S HASDEF=$S($D(DEFAULTS):1,1:0)
 S ID=DATAARR("ID"),NAME=DATAARR("NAME"),TYPE=DATAARR("DOCUMENTTYPE"),DATETIME=DATAARR("DATETIME"),NEEDOVER=DATAARR("NEEDSOVERRIDE")
 S VSTSTR=DATAARR("VISITSTR"),LOC=$P(VSTSTR,";")
 S VIMMDOC=$S($D(DATAARR("VIMMTYPE")):$G(DATAARR("VIMMTYPE")),1:"")
 S FROMCVR=+$G(DATAARR("FROMCOVER"))
 S PAT=$G(DATAARR("PATIENTID"))
 S ENCTYPE=$G(DATAARR("ENCOUNTERTYPE"))
 S ADMINBY=$G(DATAARR("USERIEN"))_U_$G(DATAARR("USERNAME"))
 S ORDERBY=$G(DATAARR("ENCOUNTERPROVIDERIEN"))_U_$G(DATAARR("ENCOUNTERPROVIDERNAME"))
 S CNT=0,SERREQ=0,SERMAX=0
 S ERRMSG=""
 I TYPE=0,FROMCVR=1 S ERRMSG=$$REMONLY(ID,TYPE)
 I ERRMSG'="" S RESULT(0)=-1_U_ERRMSG
 D BLDPRMPT^ORFEDT(.PRMPTS)
 D BLDPARR^ORFEDT(.PARR)
 D GETPOSS(ID,NAME,TYPE,DATETIME,ENCTYPE,LOC,VIMMDOC,PAT,.CNT,.RESULT,.DEFAULTS,.SERMAX,.SERREQ,.LOCLIST)
 I '$D(DEFAULTS("ENCOUNTER PROVIDER")) S DEFAULTS("ENCOUNTER PROVIDER")=ADMINBY
 I '$D(DEFAULTS("ORDERING PROVIDER")) S DEFAULTS("ORDERING PROVIDER")=ORDERBY
 D LAYOUT(TYPE,.LAYOUT)
 I TYPE=0 D
 .I $G(DEFAULTS("OVERRIDE REASON"))="",NEEDOVER S DEFAULTS("OVERRIDE REASON")=""
 .S CNT=CNT+1,RESULT(CNT)="LAYOUT^4^6"
 I TYPE=1 S CNT=CNT+1,RESULT(CNT)="LAYOUT^4^4"
 I TYPE=2 S CNT=CNT+1,RESULT(CNT)="LAYOUT^3^2"
 I TYPE=3 S CNT=CNT+1,RESULT(CNT)="LAYOUT^3^3"
 I TYPE=4 S CNT=CNT+1,RESULT(CNT)="LAYOUT^1^1"
 I TYPE=5 S CNT=CNT+1,RESULT(CNT)="LAYOUT^2^4"
 S IDX=0 F  S IDX=$O(LAYOUT(IDX)) Q:IDX'>0  D
 .S NODE=LAYOUT(IDX)
 .I $P(NODE,U)="SERIES",TYPE=0 D
 ..I SERREQ=1 S $P(NODE,U,8)=1
 ..I SERMAX>0 S $P(NODE,U,9)=1
 .I $P(NODE,U)="CVXONLY" S $P(NODE,U,2)=$P(NODE,U,2)_NAME
 .I $P(NODE,U)="ADMIN SITE",$D(LOCLIST)>1 S $P(NODE,U,9)=1
 .I $P(NODE,U)="ORDERING PROVIDER",+$$GETDEF("ORDERED BY POLICY",TYPE,.DEFAULTS) S $P(NODE,U,11)=0
 .I $P(NODE,U)="DOSE",HASDEF=1,$G(DEFAULTS("DOSE UNIT"))'="",$P(DEFAULTS("DOSE UNIT"),U)'="mL",DEFAULTS("COMMENTS")["Dosage:" D
 ..S $P(NODE,U,10)=0
 .S TEMP=$$GETDEF($P(NODE,U),TYPE,.DEFAULTS)
 .S CNT=CNT+1,RESULT(CNT)=NODE_TEMP
 .I $P(NODE,U)="DOSE",$P($G(DEFAULTS("DOSE UNIT")),U)'="" S $P(RESULT(CNT),U,2)="Dosage in "_$P(DEFAULTS("DOSE UNIT"),U)
 Q
 ;
GETDEF(NAME,TYPE,DEFAULT) ;
 N CNT,EXT,INT,RESULT,TEMP
 S RESULT=""
 I '$D(DEFAULT(NAME)) D  Q RESULT
 .I NAME'["CODES" S RESULT=U
 .I NAME="OVERRIDE REASON" S RESULT=0_U_1_U Q
 .I RESULT'="" Q
 .S RESULT=1_U_1_U_U
 I NAME="VIS OFFERED" D  Q RESULT
 .I $D(DEFAULT(NAME))=1 S RESULT=DEFAULT(NAME) Q
 .S INT="",EXT=""
 .S CNT=0 F  S CNT=$O(DEFAULT(NAME,CNT)) Q:CNT'>0  D
 ..S TEMP=$G(DEFAULT(NAME,CNT)) I TEMP="" Q
 ..S INT=$S(INT'="":";"_$P(TEMP,U),1:$P(TEMP,U))
 ..S EXT=$S(EXT'="":";"_$P(TEMP,U),1:$P(TEMP,U))
 . S RESULT=INT_U_EXT
 I NAME="OVERRIDE REASON" D  Q RESULT
 .S TEMP=DEFAULT("OVERRIDE REASON")
 .I NEEDOVER=1 S RESULT=1_U_1_U_TEMP
 I NAME="GRPLIST" D  Q RESULT
 .I DEFAULT("GRPLIST")="NONE" S RESULT=0_U Q
 .S RESULT=1_U
 I NAME="CVXONLY" D  Q RESULT
 .S RESULT=$S(DEFAULT("GRPLIST")="NONE":0,1:1)_U_1_U
 .S RESULT=RESULT_$G(DEFAULT("CVXONLY"))
 ;.I +$$GETDEF("ORDERED BY POLICY",TYPE,.DEFAULTS) S RESULT=U Q
 ;.S RESULT=ENCOPIEN_U_ENCOPNAM Q
 S RESULT=$G(DEFAULT(NAME))
 I RESULT="" S RESULT=U
 Q RESULT
 ;
GETPOSS(ID,NAME,TYPE,DATETIME,ENCTYPE,LOC,VIMMDOC,PAT,CNT,RESULT,DEFAULTS,SERMAX,SERREQ,LOCLIST) ;
 N NOTEARR,TEMP,X
 I TYPE=0 D  Q
 .;S CODECNT=0
 .D GETDETLS^ORFIMM2(.RESULT,.CNT,.DEFAULTS,ID,DATETIME,ENCTYPE,LOC,.SERREQ,.SERMAX)
 .D GETROUTE^ORFIMM1(.RESULT,.CNT,.DEFAULTS,.LOCLIST)
 .D GETSITE(.RESULT,.CNT,.DEFAULTS,.LOCLIST)
 .D GETSERS(.RESULT,.CNT,.DEFAULTS,SERREQ,SERMAX)
 I TYPE=1 D  Q
 .D GETINFO(.RESULT,.CNT,.DEFAULTS)
 .D GETSITE(.RESULT,.CNT,.DEFAULTS)
 .D GETROUTE^ORFIMM1(.RESULT,.CNT,.DEFAULTS)
 .D GETSERS(.RESULT,.CNT,.DEFAULTS,SERREQ,SERMAX)
 .D GETMANF(.RESULT,.CNT,.DEFAULTS)
 .D GETLOC(.RESULT,.CNT,.DEFAULTS)
 .D GETDLOC(.RESULT,.CNT,.DEFAULTS)
 I TYPE=2 D  Q
 .D GETCONT(.RESULT,.CNT,.DEFAULTS,ID,DATETIME,ENCTYPE,$G(LOC))
 .D GETSTOP^ORFIMM1(.RESULT,.CNT,.DEFAULTS,ID,DATETIME,ENCTYPE)
 I TYPE=3 D  Q
 .D GETREFUS(.RESULT,.CNT,.DEFAULTS,LOC)
 .D GETSTOP^ORFIMM1(.RESULT,.CNT,.DEFAULTS,ID,DATETIME,ENCTYPE)
 .D GETGROUP(.RESULT,.CNT,.DEFAULTS,ID,DATETIME,ENCTYPE)
 .D GETCVX(.RESULT,.CNT,.DEFAULTS,ID,DATETIME,ENCTYPE)
 I TYPE=4 D  Q
 .S TEMP=$S(VIMMDOC["Admin":0,VIMMDOC["Hist":1,VIMMDOC["Contr":2,VIMMDOC["Ref":3,1:-1)
 .D GETTEXT^ORFIMM1(.NOTEARR,.DEFAULTS,ID,NAME,TEMP,DATETIME,LOC,1)
 .S X=0 F  S X=$O(NOTEARR(X)) Q:X'>0  D
 ..S CNT=CNT+1,RESULT(CNT)="DATA WORD PROCESSING"_U_"DISPLAY"_U_NOTEARR(X)
 I TYPE=5 D
 .D GETREAD(.RESULT,.CNT,.DEFAULTS,PAT)
 .I "AID"[ENCTYPE S DEFAULTS("VISIT DATE TIME")=U_DATETIME
 .I "AID"'[ENCTYPE S DEFAULTS("VISIT DATE TIME")=U_$$NOW^XLFDT()
 Q
 ;
GETREAD(RESULT,CNT,DEFAULTS,PAT) ;
 N ORARR,X,TEMP
 D READENT^PXAPIIM(.ORARR,PAT)
 I ORARR(1)="" Q
 S DEFAULTS("PLACEMENT IEN")=$P(ORARR(1),U)_U_$P(ORARR(1),U,2)_" placed on: "_$TR($$FMTE^XLFDT($P(ORARR(1),U,3),"2ZM"),"@"," ")
 K ORARR D READVALS^PXAPIIM(.ORARR)
 F X=$P(ORARR("RANGE"),":"):1:$P(ORARR("RANGE"),":",2) S CNT=CNT+1,RESULT(CNT)="DATA^READING"_U_X_U_X
 S TEMP="" F  S TEMP=$O(ORARR("CODES",TEMP)) Q:TEMP=""  D
 .S CNT=CNT+1,RESULT(CNT)="DATA^RESULTS^"_$P(TEMP,":")_U_$P(TEMP,":",2)
 Q
 ;
GETSITE(RESULT,CNT,DEFAULT,LOCLIST) ;
 N DATALST,ID,X
 D IMMSITE^PXVRPC2(.DATALST,"S:A")
 ;S CNT=CNT+1,RESULT(CNT)="DATA"_U_"ADMIN SITE"_U_"NUMBER"_U_4
 S X=0 F  S X=$O(DATALST(X)) Q:X'>0  D
 .I DATALST(X)'[U Q
 .S CNT=CNT+1,RESULT(CNT)="DATA"_U_"ADMIN SITE"_U_DATALST(X)
 .I $D(LOCLIST)>1 D
 ..S ID=0 F  S ID=$O(LOCLIST(ID)) Q:ID'>0  D
 ...I ID'=+DATALST(X) Q
 ...S CNT=CNT+1,RESULT(CNT)="LINE"_U_"ADMIN SITE"_U_DATALST(X)
 Q
 ;
GETSERS(RESULT,CNT,DEFAULT,SERREQ,SERMAX) ;
 N DATALST,X
 D GETSET^ORWPCE2(.DATALST,9000010.11,.04,1)
 ;S CNT=CNT+1,RESULT(CNT)="DATA"_U_"SERIES"_U_"NUMBER"_U_2
 S X="" F  S X=$O(DATALST(X)) Q:X=""  D
 .I $P(DATALST(X),U)="@",SERREQ=1 Q
 .I SERMAX>0,+DATALST(X)>0,+DATALST(X)'>SERMAX S CNT=CNT+1,RESULT(CNT)="LINE"_U_"SERIES"_U_DATALST(X)
 .S CNT=CNT+1,RESULT(CNT)="DATA"_U_"SERIES"_U_DATALST(X)
 Q
 ;
GETINFO(RESULT,CNT,DEFAULTS) ;
 N DATALIST,ORNAME,ORNODE,X
 D IMMSRC^PXVRPC2(.DATALIST,"S:AH")
 S X=0 F  S X=$O(DATALIST(X)) Q:X'>0  D
 .S ORNODE=$G(DATALIST(X))
 .S ORNAME=$P(ORNODE,U,2)
 .I ORNAME["-" S ORNAME=$$TRIM^XLFSTR($P(ORNAME,"-",2))
 .S $P(ORNODE,U,2)=ORNAME
 .S CNT=CNT+1,RESULT(CNT)="DATA"_U_"INFO SOURCE"_U_ORNODE
 Q
 ;
GETLOC(RESULT,CNT,DEFAULTS) ;
 N DATALIST,X
 D HISTLOC^ORQQPX(.DATALIST)
 S X=0 F  S X=$O(^TMP("OR",$J,"LOC",X)) Q:X'>0  D
 .S CNT=CNT+1,RESULT(CNT)="DATA"_U_"LOCATION"_U_^TMP("OR",$J,"LOC",X)
 Q
 ;
GETDLOC(RESULT,CNT,DEFAULTS) ;
 N DATALIST,X
 D GETDEFOL^ORQQPX(.DATALIST)
 S X=0 F  S X=$O(DATALIST(X)) Q:X'>0  D
 .S CNT=CNT+1,RESULT(CNT)="DATA DEFAULT"_U_"LOCATION"_U_DATALIST(X)
 Q
 ;
GETMANF(RESULT,CNT,DEFAULTS) ;
 N DATALIST,X
 D IMAN^PXVRPC1(.DATALIST,"S:B","",1)
 ;S CNT=CNT+1,RESULT(CNT)="DATA"_U_"INFO SOURCE"_U_"NUMBER"_U_4
 S X=0 F  S X=$O(^TMP("PXVLST",$J,X)) Q:X'>0  D
 .I +$P(^TMP("PXVLST",$J,X),U)=-1 Q
 .S CNT=CNT+1,RESULT(CNT)="DATA"_U_"MANUFACTURER"_U_^TMP("PXVLST",$J,X)
 Q
 ;
GETREFUS(RESULT,CNT,DEFAULTS,LOC) ;
 N DATALIST,X
 D GETICR^PXVRPC5(.DATALIST,920.5,"S:A","",LOC)
 S X=0 F  S X=$O(DATALIST(X)) Q:X'>0  D
 .S $P(DATALIST(X),U)=+$P(DATALIST(X),U)
 .S CNT=CNT+1,RESULT(CNT)="DATA"_U_"REFUSAL"_U_DATALIST(X)
 Q
 ;
GETGROUP(RESULT,CNT,DEFAULTS,ID,DATETIME,ENCTYPE) ;
 N GRP,IEN,OCNT,ORGRPS
 S OCNT=CNT
 D IMMGRP^PXAPIIM(.ORGRPS,ID)
 S GRP="" F  S GRP=$O(ORGRPS("VG",GRP)) Q:GRP=""  D
 .S IEN=0 F  S IEN=$O(ORGRPS("VG",GRP,IEN)) Q:IEN'>0  D
 ..S CNT=CNT+1,RESULT(CNT)="DATA"_U_"GRPLIST"_U_IEN_U_ORGRPS("VG",GRP,IEN)
 ..;S CNT=CNT+1,RESULT(CNT)="DATA WORD PROCESSING"_U_"GRPLIST"_U_ORGRPS("VG",GRP,IEN)
 I OCNT=CNT S DEFAULTS("GRPLIST")="NONE" Q
 S DEFAULTS("GRPLIST")="POPULATED"
 Q
 ;
GETCVX(RESULT,CNT,DEFAULTS,ID,DATETIME,ENCTYPE) ;
 S CNT=CNT+1,RESULT(CNT)="DATA"_U_"CVXONLY"_U_0_U_"No   (Refusal of all immunizations in this group)"
 S CNT=CNT+1,RESULT(CNT)="DATA"_U_"CVXONLY"_U_1_U_"Yes  (Refusal of only this specific formulation of vaccine)"
 I $G(DEFAULTS("CVXONLY"))="" S DEFAULTS("CVXONLY")=0_U_"No   (Refusal of all immunizations in this group)"
 Q
 ;
GETCONT(RESULT,CNT,DEFAULTS,ID,DATETIME,ENCTYPE,LOC) ;
 N DATALST,NODE,X
 D IMMRPC^PXVRPC4(.DATALST,ID,DATETIME,"L:"_$G(LOC))
 S X=0 F  S X=$O(^TMP("PXVIMMRPC",$J,X)) Q:X'>0  D
 .S NODE=^TMP("PXVIMMRPC",$J,X)
 .I $P(NODE,U)'="CONTRA" Q
 .S $P(NODE,U,3)=$S($P(NODE,U,7)="P":$P(NODE,U,3)_" (PRECAUTION)",$P(NODE,U,7)="C":$P(NODE,U,3)_" (CONTRAINDICATED)",1:$P(NODE,U,3))
 .S $P(NODE,U,2)=+$P(NODE,U,2)
 .S CNT=CNT+1,RESULT(CNT)="DATA"_U_"CONTRAINDICATED"_U_$P(NODE,U,2,$L(NODE,U))
 Q
 ;
REMONLY(ID,TYPE) ;
 N NAME,IDX,ORERR,ORVALUE,RESULT
 S RESULT=""
 D GETLST^XPAR(.ORVALUE,"ALL","OR IMM REMINDER DIALOG","I",.ORERR)
 S IDX=0 F  S IDX=$O(ORVALUE(IDX)) Q:IDX'>0!(RESULT'="")  D
 . I ORVALUE(IDX)=ID D
 ..S NAME=$P($G(^AUTTIMM(ID,0)),U) S RESULT=NAME_" administration can only be documented through a Reminder Dialog"
 Q RESULT
 ;
VIS(VALUE) ;
 N IMMVIS,IMMVISDT,IMMVISENTRY,PXSEQ,PXX,RESULT,X
 S PXSEQ=0,RESULT=""
 F PXX=1:1:$L(VALUE,";") D
 . S IMMVISENTRY=$$TRIM^XLFSTR($P(VALUE,";",PXX))
 . S IMMVIS=$P(IMMVISENTRY,"/",1)
 . I 'IMMVIS Q
 . S RESULT=$S(RESULT="":IMMVIS,1:RESULT_";"_IMMVIS)
 Q RESULT