VistA-WorldVistAEHR/r/LAB_SERVICE-LR-LS/LREPIRP4.m

37 lines
1.3 KiB
Mathematica

LREPIRP4 ;DALOI/CKA-EMERGING PATHOGENS HL7 REPORT CONVERSION ;5/13/03
;;5.2;LAB SERVICE;**281**;Sep 27, 1994
; Reference to ^DIC(21 supported by IA #2504
;This routine builds the ^XTMP global for REF #s 2,15,16,17
;^XTMP("LREPIREP"_LRDATE,LRTYPE,DFN,#)
Q
OBX ;RESULTS
I $P(LRTMP,HLFS,3)="ST" D
.S TST=$P(LRTMP,HLFS,4),TSTNM=$P(TST,LRCS,5)
.;S:TSTNM="" TSTNM=$P(TST,LRCS,5)
.S OV=$P(LRTMP,HLFS,6)
I $P(LRTMP,HLFS,3)="CE" D
.S TSTNM=""
.S OV=$P($P(LRTMP,HLFS,6),LRCS,2)
S ENTRY=$P(LRTMP,HLFS,5)
S FD=$$CDT($P(LRTMP,HLFS,15)),RR=$P(LRTMP,HLFS,8)
S UN=$P(LRTMP,HLFS,7),AF=""
S ^XTMP("LREPIREP"_LRDATE,LRTYPE,DFN,LRCNT)=LRNAME_$E(LRSP,1,25-$L(LRNAME))_SSN_" "_LRACCDT_$E(LRSP,1,16-$L(LRACCDT))_TSTNM_" "_OV
S LRCNT=LRCNT+1
Q
PV1 ;
S TYPE=$P(LRTMP,HLFS,3)
S ENC=$S(TYPE="O":"Accession ",1:"Admission ")_"Date "
S TYPE=$S(TYPE="U":"Update",TYPE="I":"Inpatient ",1:"Outpatient")
S MSG=TYPE_" "_ENC_$$CDT($P(LRTMP,HLFS,45))
Q:$P(LRTMP,HLFS,46)=""
S MSG=" Discharge Date "_$$CDT($P(LRTMP,HLFS,46))
S MSG=MSG_" Discharge Disposition "_$P($P(LRTMP,HLFS,37),LRCS,2)
S ^TMP($J,"RPT",LRTYPE,DFN,"PV1",LRPV1)=MSG
K TYPE
Q
CDT(DATE) ;CONVERTS THE DATE AND TIME
S X=$E(DATE,5,6)_"-"_$E(DATE,7,8)_"-"_$E(DATE,1,4)
S:$E(DATE,9,12)'="" X=X_"@"_$E(DATE,9,12)
S:X="--" X=""
Q X