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

ORFSKT.m

Go to the documentation of this file.
ORFSKT ;SLC/AGP - GENERIC EDIT SKIN TEST ;Dec 22, 2022@14:03:10
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**405,597**;Dec 17, 1997;Build 3
 ;
 ; Reference to SKLIST^PXVRPC8 in ICR #7286
 ; Reference to GETSKCD^PXVRPC8 in ICR #7286
 ; Reference to SKSITES^PXVRPC8 in ICR #7286
 ; Reference to VSKIN^PXPXRM in ICR #4250
 ; Reference to ^AUPNVSIT( in ICR #1990
 ; Reference to ^AUPNVSK( in ICR #2354
 ;
 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)="ANATOMIC LOC^Anatomic Location^ptCBO^0^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="VISIT DATE TIME^Date placed^ptDateTime^1^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="ENCOUNTER PROVIDER^Administered by^ptCBOLongList^0^1^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="ORDERING PROVIDER^Ordered by^ptCBOLongList^1^1^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="CODES CPT^Procedure Codes^ptCBO^0^2^1^0^1^0^"
 .S CNT=CNT+1,RESULT(CNT)="CODES DX^Diagnosis Codes^ptCBO^1^2^1^0^1^0^"
 .S CNT=CNT+1,RESULT(CNT)="COMMENTS^Comment^ptEdit^0^3^2^0^0^0^1^1^"
 I TYPE=1 D  Q
 .S CNT=CNT+1,RESULT(CNT)="PLACEMENT IEN^Last Placement^ptLabel^0^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="VISIT DATE TIME^Read Date^ptDateTime^1^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="READING^Reading in millimeters (mm)^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)="ENCOUNTER PROVIDER^Read By^ptCBOLongList^2^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="CODES CPT^Procedure Codes^ptCBO^0^2^1^0^1^0^"
 .S CNT=CNT+1,RESULT(CNT)="CODES DX^Diagnosis Codes^ptCBO^1^2^1^0^1^0^"
 .S CNT=CNT+1,RESULT(CNT)="COMMENTS^Comment^ptEdit^0^3^3^0^0^0^1^1^"
 I TYPE=2 D  Q
 .S CNT=CNT+1,RESULT(CNT)="VISIT DATE TIME^Read Date^ptDateBox^0^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="LOCATION^Outside Location^ptCBO^1^0^1^0^0^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="ENCOUNTER PROVIDER^Documented By^ptCBOLongList^2^0^1^0^1^0^1^1^"
 .S CNT=CNT+1,RESULT(CNT)="READING^Reading in millimeters (mm)^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)="CODES CPT^Procedure Codes^ptCBO^0^2^1^0^1^"
 .;S CNT=CNT+1,RESULT(CNT)="CODES DX^Diagnosis Codes^ptCBO^1^2^1^0^1^"
 .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^"
 Q
 ;
BLD(RESULTS,LIST,INPUTS) ;
 N ADMINDATE,CAT,CNT,DATE,EXT,HASERR,I,ID,IDX,INT,NAME,NODE,NOTEARR,NOTEINP,PARM,PARR,PRMPTS,SKNAME,VIS,VISCNT
 N PIECE,X,DELSTR,DELSTR1,DELSTR2,DELSTR3,PLACEIEN
 N LOC,DATETIME,ENCTYPE,TYPE,VISITSTR
 ;
 S ID=$G(INPUTS("ID")),SKNAME=$G(INPUTS("NAME"))
 S TYPE=$G(INPUTS("DOCUMENTTYPE"))
 S VISITSTR=$G(INPUTS("VISITSTR"))
 S LOC=$P(VISITSTR,";"),DATETIME=$P(VISITSTR,";",2),ENCTYPE=$P(VISITSTR,";",3)
 ;
 S DELSTR="SK+"_U_ID_U_U_SKNAME
 ;S DELSTR1="COM"_U_1_U_"@",$P(DELSTR,U,10)=1
 ;S DELSTR2="COM"_U_2_U_"@",$P(DELSTR,U,24)=2
 S HASERR=0,CNT=0
 S PLACEIEN=""
 ;
 D BLDPRMPT^ORFEDT(.PRMPTS)
 D BLDPARR^ORFEDT(.PARR)
 ;
 S IDX=0 F  S IDX=$O(LIST(IDX)) Q:IDX'>0!(HASERR=1)  D
 .S NODE=LIST(IDX)
 .S NAME=$P(NODE,U),INT=$P(NODE,U,2),EXT=$P(NODE,U,3)
 .S PARM=$G(PARR(NAME))
 .I PARM="" Q
 .I PARM="pnumComment",$L(NODE,"^")>3 D  Q
 ..S RESULTS(CNT)="-1^Comment cannot contain a caret symbol"
 ..S HASERR=1
 .I NAME="PLACEMENT IEN" S PLACEIEN=INT
 .S PIECE=+$G(PRMPTS(PARM)) I PIECE=0 Q
 .D BLDSTRS(.RESULTS,.CNT,PARM,EXT,INT,PIECE,ID,SKNAME,TYPE,DATETIME,.DELSTR,.DELSTR1,.DELSTR2,.ADMINDATE,ENCTYPE,.PRMPTS,PLACEIEN)
 .I $P($G(RESULTS(CNT)),U)=-1 S HASERR=1
 ;
 I HASERR=1 Q
 S CNT=0
 S RESULTS(CNT)=1_U_$S(+$G(ADMINDATE)>0:ADMINDATE,1:DATETIME)
 D GETTEXT(.NOTEARR,.LIST,ID,SKNAME,TYPE,DATETIME,LOC,0)
 ;
 S I=0 F  S I=$O(NOTEARR(I)) Q:I'>0  S CNT=CNT+1,RESULTS(CNT)="NOTE"_U_NOTEARR(I)
 S CNT=CNT+1,RESULTS(CNT)="DATA"_U_DELSTR
 S CNT=CNT+1,RESULTS(CNT)="DATA1"_U_$G(DELSTR1)
 ;S CNT=CNT+1,RESULTS(CNT)="DATA2"_U_$G(DELSTR2)
 Q
 ;
BLDSTRS(RESULTS,CNT,PARM,EXT,INT,PIECE,ID,NAME,TYPE,DATETIME,DELSTR,DELSTR1,DELSTR2,ADMINDATE,ENCTYPE,PRMPTS,PLACEIEN) ;
 N ORTEMP,ORDATEPLACED,ORPLACEVISIT
 ;
 I PARM="pnumAdminDate" D  Q
 .S PIECE=+$G(PRMPTS(PARM))
 .S ORTEMP=$S(TYPE=1:"Reading",1:"Administration")
 .I INT>$$GETMAXDT^ORFIMM1() S RESULTS(CNT)="-1^"_ORTEMP_" Date/Time cannot be a future date/time." Q
 .;
 .; check if reading date/time is <= administration date/time
 .I TYPE=1,$G(PLACEIEN) D
 ..S ORPLACEVISIT=$P($G(^AUPNVSK(PLACEIEN,0)),U,3)
 ..S ORDATEPLACED=$P($G(^AUPNVSK(PLACEIEN,12)),U,1)
 ..I ORDATEPLACED="" S ORDATEPLACED=$P($G(^AUPNVSIT(+ORPLACEVISIT,0)),U,1)
 .I TYPE=1,$G(ORDATEPLACED),((INT<ORDATEPLACED)!(INT=ORDATEPLACED)) D  Q
 ..S RESULTS(CNT)="-1^Reading Date/Time cannot be before or equal to the Administration date/time."
 .;
 .S ADMINDATE=INT
 .I TYPE>0 S PIECE=8
 .S $P(DELSTR,U,PIECE)=INT
 ;
 I PARM="pnumImmOrderByIEN" S $P(DELSTR,U,PIECE)=INT Q
 I PARM="pnumProvider" D  Q
 .I TYPE=1 S PIECE=11
 .S $P(DELSTR,U,PIECE)=INT Q
 I PARM="pnumComment",EXT'="" D  Q
 .I $L(EXT)>245 S RESULTS(CNT)="-1^Comment cannot exceed 245 characters" Q
 .S DELSTR1="COM"_U_1_U_EXT
 .I TYPE=1 S $P(DELSTR,U,14)=1 Q
 .S $P(DELSTR,U,10)=1
 ;I PARM="pnumSkinResults" S $P(DELSTR,U,PIECE)=$S(INT="D":"Doubtful",1:EXT) Q
 I PARM="pnumSkinResults" S $P(DELSTR,U,PIECE)=INT Q
 I PARM="pnumSkinReading" S $P(DELSTR,U,PIECE)=EXT Q
 I PARM="pnumImmSite" S $P(DELSTR,U,PIECE)=EXT_";;"_INT Q
 I PARM="pnumReadingIEN" S $P(DELSTR,U,PIECE)=INT Q
 Q
 ;
BLDLAYOT(RESULTS,INPUTS,TYPE) ;
 N CNT,DATA,DATA1,DATA2,EXT,INT,NAME,NODE,LAYOUT,ORDATA,PARM,PARR,PRMPTS,PIECE,TEMP,X
 S DATA=$G(INPUTS(1)),DATA1=$G(INPUTS(2))
 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
 .I PARM="pnumAdminDate" D
 ..I TYPE=1 S PIECE=8
 ..S INT=$P(DATA,U,PIECE),EXT=INT
 .I PARM="pnumImmOrderByIEN" D
 ..S INT=+$P(DATA,U,PIECE)
 ..I INT>0 S EXT=$$GET1^DIQ(200,INT_",",.01)
 .I PARM="pnumProvider" D
 ..I TYPE=1 S PIECE=11
 ..S INT=+$P(DATA,U,PIECE)
 ..I INT>0 S EXT=$$GET1^DIQ(200,INT_",",.01)
 .I PARM="pnumComment" D
 ..S EXT=$P(DATA1,U,3)
 ..S:EXT="@" EXT="" S INT=EXT
 .I PARM="pnumSkinResults" S INT=$P(DATA,U,PIECE)
 .;.S EXT=$S(INT="D":"Unknown",1:TEMP)
 .I PARM="pnumSkinReading" S EXT=$P(DATA,U,PIECE)
 .I PARM="pnumImmSite" S TEMP=$P(DATA,U,PIECE) S EXT=$P(TEMP,";"),INT=$P(TEMP,";",3)
 .I PARM="pnumReadingIEN" S INT=$P(DATA,U,PIECE) Q:INT'>0
 .;.D VSKIN^PXPXRM(INT,.ORDATA)
 .;.S EXT="Skin Test: "_$P(ORDATA("SKIN TEST"),U,2)_" placed on: "_$TR($$FMTE^XLFDT(ORDATA("D/T PLACEMENT RECORDED"),"2ZM"),"@"," ")
 .S CNT=CNT+1,RESULTS(CNT)=NAME_U_INT_U_EXT
 Q
 ;
CHKPLACE(PATIENT,ID) ;
 N FOUND,I,ORARRAY
 D SKLIST^PXVRPC8(.ORARRAY,PATIENT,ID,"",1)
 S FOUND=0,I=0
 F  S I=$O(ORARRAY(I)) Q:I'>0!(FOUND=1)  D
 .I $P($G(ORARRAY(I)),U)="PLACEMENT" S FOUND=1
 Q FOUND
 ;
GET(RESULT,DATAARR,DEFAULTS) ;
 N ADMINBY,CNT,DATETIME,ENCTYPE,ID,LAYOUT,LOC,NAME,NEEDOVER,NODE,ORDERBY,PARR,PATIENT,PLACE,PRMPTS,TYPE,VIMMDOC,VSTSTR,X
 S ID=DATAARR("ID"),NAME=DATAARR("NAME"),TYPE=DATAARR("DOCUMENTTYPE"),DATETIME=DATAARR("DATETIME"),PATIENT=DATAARR("PATIENTID")
 S ENCTYPE=DATAARR("ENCOUNTERTYPE")
 S VSTSTR=DATAARR("VISITSTR"),LOC=$P(VSTSTR,";")
 S VIMMDOC=$S($D(DATAARR("VIMMTYPE")):$G(DATAARR("VIMMTYPE")),1:"")
 S PLACE=$G(DATAARR("PLACEMENT IEN"))_U_$G(DATAARR("PLACEMENTTEST"))_U_$G(DATAARR("PLACEMENTNAME"))_U_$G(DATAARR("PLACEMENTDATE"))
 S ADMINBY=$G(DATAARR("USERIEN"))_U_$G(DATAARR("USERNAME"))
 S ORDERBY=$G(DATAARR("ENCOUNTERPROVIDERIEN"))_U_$G(DATAARR("ENCOUNTERPROVIDERNAME"))
 S CNT=0
 I TYPE=1,'$D(DEFAULTS),'$$CHKPLACE(PATIENT,ID) S RESULT(CNT)="-1^No Skin Test Placement on file" Q
 D BLDPRMPT^ORFEDT(.PRMPTS)
 D BLDPARR^ORFEDT(.PARR)
 D GETPOSS(ID,NAME,TYPE,DATETIME,ENCTYPE,LOC,VIMMDOC,PLACE,.CNT,.RESULT,.DEFAULTS,PATIENT)
 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 S CNT=CNT+1,RESULT(CNT)="LAYOUT^2^4"
 I TYPE=1 S CNT=CNT+1,RESULT(CNT)="LAYOUT^3^4"
 I TYPE=2 S CNT=CNT+1,RESULT(CNT)="LAYOUT^3^3"
 I TYPE=4 S CNT=CNT+1,RESULT(CNT)="LAYOUT^1^1"
 S X=0 F  S X=$O(LAYOUT(X)) Q:X'>0  D
 .S NODE=LAYOUT(X)
 .S CNT=CNT+1,RESULT(CNT)=NODE_$$GETDEF($P(NODE,U),TYPE,.DEFAULTS)
 Q
 ;
GETCODES(RESULT,CNT,DEFAULTS,ID,TYPE,DATETIME) ;
 N CODETEMP,CODECNT,CODEDCNT,CODETYPE,CPTTEMP,DXTEMP,DATALIST,NODE,X
 S CODECNT=0,CODEDCNT=0
 D GETSKCD^PXVRPC8(.DATALIST,ID,DATETIME)
 S X=0 F  S X=$O(DATALIST(X)) Q:X'>0  D
 .S NODE=DATALIST(X)
 .I TYPE=0,$P(NODE,U,5)="R" Q
 .I TYPE=1,$P(NODE,U,5)="P" Q
 .S CODETEMP=$P(NODE,U,2)_" ("_$P(NODE,U,4)_")"
 .S CODETYPE=$S($P(NODE,U)["CPT":"CODES CPT",1:"CODES DX")
 .I CODETYPE="CODES CPT" S CODECNT=CODECNT+1,CPTTEMP=$P(NODE,U,3)_U_CODETEMP
 .I CODETYPE="CODES DX" S CODEDCNT=CODEDCNT+1,DXTEMP=$P(NODE,U,3)_U_CODETEMP
 .S CNT=CNT+1,RESULT(CNT)="DATA"_U_CODETYPE_U_$P(NODE,U,3)_U_CODETEMP_U_$P(NODE,U,2)_U_$P(NODE,U,4)
 I CODECNT=1 S DEFAULTS("CODES CPT")=0_U_1_U_CPTTEMP
 I CODEDCNT=1 S DEFAULTS("CODES DX")=0_U_1_U_DXTEMP
 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'="VISIT DATE TIME" S RESULT=U
 .I RESULT'="" Q
 .S RESULT=1_U_1_U_U
 S RESULT=$G(DEFAULT(NAME))
 I RESULT="" S RESULT=U
 Q RESULT
 ;
GETPOSS(ID,NAME,TYPE,DATETIME,ENCTYPE,LOC,VIMMDOC,PLACE,CNT,RESULT,DEFAULTS,PATIENT) ;
 N CODECNT,NOTEARR,TEMP,X
 I TYPE=0 D  Q
 .S CODECNT=0
 .D GETSITE(.RESULT,.CNT,.DEFAULTS)
 .I "AID"[ENCTYPE,'$D(DEFAULTS("VISIT DATE TIME")) D
 ..S DEFAULTS("VISIT DATE TIME")=U_DATETIME
 ..I DATETIME>$$GETMAXDT^ORFIMM1() S DEFAULTS("VISIT DATE TIME")=U_$$NOW^XLFDT()
 .I "AID"'[ENCTYPE,'$D(DEFAULTS("VISIT DATE TIME")) S DEFAULTS("VISIT DATE TIME")=U_$$NOW^XLFDT()
 .D GETCODES(.RESULT,.CNT,.DEFAULTS,ID,TYPE,$P(DEFAULTS("VISIT DATE TIME"),U,2))
 I TYPE=1 D  Q
 .D GETMEAS(.RESULT,.CNT,.DEFAULTS)
 .D GETINTP(.RESULT,.CNT,.DEFAULTS)
 .D GETDATE(.DEFAULTS,ID,PATIENT,PLACE)
 .I "AID"[ENCTYPE,'$D(DEFAULTS("VISIT DATE TIME")) D
 ..S DEFAULTS("VISIT DATE TIME")=U_DATETIME
 ..I DATETIME>$$GETMAXDT^ORFIMM1() S DEFAULTS("VISIT DATE TIME")=U_$$NOW^XLFDT()
 .I "AID"'[ENCTYPE,'$D(DEFAULTS("VISIT DATE TIME")) S DEFAULTS("VISIT DATE TIME")=U_$$NOW^XLFDT()
 .D GETCODES(.RESULT,.CNT,.DEFAULTS,ID,TYPE,$P(DEFAULTS("VISIT DATE TIME"),U,2))
 I TYPE=2 D  Q
 .D GETMEAS(.RESULT,.CNT,.DEFAULTS)
 .D GETINTP(.RESULT,.CNT,.DEFAULTS)
 .D GETLOC(.RESULT,.CNT,.DEFAULTS)
 .I '$D(DEFAULTS("VISIT DATE TIME")) S DEFAULTS("VISIT DATE TIME")=U
 I TYPE=4 D  Q
 .S TEMP=$S(VIMMDOC["Admin":0,VIMMDOC["Read":1,VIMMDOC["Hist":2,1:-1)
 .D GETTEXT(.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)
 Q
 ;
GETSITE(RESULT,CNT,DEFAULTS) ;
 N DATALIST,X
 D SKSITES^PXVRPC8(.DATALIST)
 S X=0 F  S X=$O(DATALIST(X)) Q:X'>0  D
 .S CNT=CNT+1,RESULT(CNT)="DATA^ANATOMIC LOC"_U_DATALIST(X)
 Q
 ;
GETMEAS(RESULT,CNT,DEFAULTS) ;
 N X
 F X=0:1:50 S CNT=CNT+1,RESULT(CNT)="DATA^READING"_U_X_U_X
 Q
 ;
GETINTP(RESULT,CNT,DEFAULTS) ;
 S CNT=CNT+1,RESULT(CNT)="DATA^RESULTS^P^Positive"
 S CNT=CNT+1,RESULT(CNT)="DATA^RESULTS^N^Negative"
 S CNT=CNT+1,RESULT(CNT)="DATA^RESULTS^D^Unknown"
 Q
 ;
GETDATE(DEFAULT,ID,PATIENT,NODE) ;
 ;N DATALIST,TEMP,X
 N ORDATA,TEMP
 ;D SKLIST^PXVRPC8(.DATALIST,PATIENT,ID,"",1)
 ;S TEMP=""
 ;S X=0 F  S X=$O(DATALIST(X)) Q:X'>0!(TEMP'="")  D
 ;.S NODE=$G(DATALIST(X)) Q:NODE=""  Q:$P(NODE,U)'="PLACEMENT"
 I $P($G(DEFAULT("PLACEMENT IEN")),U)>0,$P(NODE,U,3)="" D  Q
 .D VSKIN^PXPXRM($P($G(DEFAULT("PLACEMENT IEN")),U),.ORDATA)
 .S TEMP="Skin Test: "_$P(ORDATA("SKIN TEST"),U,2)_" placed on: "_$TR($$FMTE^XLFDT(ORDATA("D/T PLACEMENT RECORDED"),"2ZM"),"@"," ")
 .S DEFAULT("PLACEMENT IEN")=$P($G(DEFAULT("PLACEMENT IEN")),U)_U_TEMP
 S TEMP="Skin Test: "_$P(NODE,U,3)_" placed on: "_$TR($$FMTE^XLFDT($P(NODE,U,4),"2ZM"),"@"," ")
 S DEFAULT("PLACEMENT IEN")=$P(NODE,U)_U_TEMP
 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
 ;
GETTEXT(OUTPUT,LIST,ID,NAME,TYPE,DATETIME,LOC,FORMAT) ;
 ;scheduling ICR 10040
 N I,J,NODE,TEMP,TEMPARR,XLOC,VISCNT
 I FORMAT=0 D BLDDEFLS^ORFEDT(.LIST,.TEMPARR)
 I FORMAT=1 M TEMPARR=LIST
 S I=0
 ;determine label depending on admin vs historical
 S I=I+1,OUTPUT(I)="Skin Test: "_NAME
 S TEMP=$S(TYPE=2:"Historical Date Read On",TYPE=0:"Date Administered",1:"Read on")
 S TEMP=TEMP_": "_$TR($$FMTE^XLFDT($P($G(TEMPARR("VISIT DATE TIME")),U,2),"2ZM"),"@"," ")
 S I=I+1,OUTPUT(I)=TEMP
 ;
 I $P($G(TEMPARR("ANATOMIC LOC")),U,2)'="" S I=I+1,OUTPUT(I)="Site: "_$P($G(TEMPARR("ANATOMIC LOC")),U,2)
 ;I $P($G(TEMPARR("ADMIN SITE")),U,2)'="" S I=I+1,OUTPUT(I)="Site: "_$P($G(TEMPARR("ADMIN SITE")),U,2)
 S XLOC=""
 I +LOC=LOC S LOC=$$GET1^DIQ(44,LOC,.01)
 I TYPE["Hist",$P($G(TEMPARR("LOCATION")),U,2)="" S TEMP="Outside Location: " S XLOC=$P($G(TEMPARR("LOCATION")),U,2)
 I TYPE["Ad" S TEMP="Location: ",XLOC=LOC
 S TEMP=TEMP_XLOC
 I XLOC'="" S I=I+1,OUTPUT(I)=$$LJ^XLFSTR(TEMP,60)
 I $P($G(TEMPARR("ORDERING PROVIDER")),U,2)'="" S I=I+1,OUTPUT(I)="Order By: "_$P(TEMPARR("ORDERING PROVIDER"),U,2)
 S I=I+1,OUTPUT(I)=$S(TYPE=2:"Documented By: ",TYPE=0:"Administered by: ",1:"Read By: ")_$P($G(TEMPARR("ENCOUNTER PROVIDER")),U,2)
 I $P($G(TEMPARR("READING")),U,2)'="" S I=I+1,OUTPUT(I)="Reading: "_$P($G(TEMPARR("READING")),U,2)_" mm"
 I $P($G(TEMPARR("RESULTS")),U,2)'="" S I=I+1,OUTPUT(I)="Interpretation: "_$P($G(TEMPARR("RESULTS")),U,2)
 I $P($G(TEMPARR("COMMENTS")),U,2)'="" D FORMAT^ORFIMM1(.OUTPUT,.I,$P(TEMPARR("COMMENTS"),U,2),"Comment: ")
 Q
 ;
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)
 . ;S IMMVISDT=$P(IMMVISENTRY,"/",2)
 . ;I IMMVISDT S IMMVIS=IMMVIS_U_IMMVISDT
 . ;S PXSEQ=PXSEQ+1
 . ;S @ROOT@("VIS",PXSEQ,0)=IMMVIS
 Q RESULT