corrected Test code interpretation
This commit is contained in:
parent
4344dfb2a2
commit
3f2fbdaf9a
40
p/GPLLABS.m
40
p/GPLLABS.m
|
@ -37,18 +37,40 @@ EXTRACT(LABXML,DFN,LABOUTXML) ; EXTRACT LABS INTO PROVIDED XML TEMPLATE
|
|||
;
|
||||
LIST ; LIST THE HL7 MESSAGE
|
||||
;
|
||||
; N C0CI,C0CJ,C0COBT,C0CHB
|
||||
; N C0CI,C0CJ,C0COBT,C0CHB,C0CVAR
|
||||
; D EXTRACT^GPLLABS(,1,)
|
||||
S C0CTAB=$NA(^KBAI) ; BASE OF OBX TABLE
|
||||
S C0CHB=$NA(^TMP("HLS",$J))
|
||||
S C0CI=""
|
||||
F S C0CI=$O(@C0CHB@(C0CI)) Q:C0CI="" D ; FOR ALL RECORDS IN HL7 MSG
|
||||
. K C0CVAR,XV ; CLEAR OUT VARIABLE VALUES
|
||||
. S C0CTYP=$P(@C0CHB@(C0CI),"|",1)
|
||||
. D LTYP(@C0CHB@(C0CI),C0CTYP)
|
||||
. D LTYP(@C0CHB@(C0CI),C0CTYP,.C0CVAR)
|
||||
. M XV=C0CVAR ;
|
||||
. I C0CTYP="OBX" D ; SPECIAL CASE FOR OBX3
|
||||
. . ; RESULTTESTCODEVALUE
|
||||
. . ; RESULTTESTDESCRIPTIONTEXT
|
||||
. . I C0CVAR("C3")="LN" D ; PRIMARY CODE IS LOINC
|
||||
. . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C1") ; THE LOINC CODE VALUE
|
||||
. . . S XV("RESULTTESTCODINGSYSTEM")="LOINC" ; DISPLAY NAME FOR LOINC
|
||||
. . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C2") ; DESCRIPTION TEXT
|
||||
. . E I C0CVAR("C6")="LN" D ; SECONDARY CODE IS LOINC
|
||||
. . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C4") ; THE LOINC CODE VALUE
|
||||
. . . S XV("RESULTTESTCODINGSYSTEM")="LOINC" ; DISPLAY NAME FOR LOINC
|
||||
. . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C5") ; DESCRIPTION TEXT
|
||||
. . E I C0CVAR("C6")'="" D ; NO LOINC CODES, USE SECONDARY IF PRESENT
|
||||
. . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C4") ; SECONDARY CODE VALUE
|
||||
. . . S XV("RESULTTESTCODINGSYSTEM")=C0CVAR("C6") ; SECONDARY CODE NAME
|
||||
. . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C5") ; SECONDARY TEXT
|
||||
. . E D ; NO SECONDARY, USE PRIMARY
|
||||
. . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C1") ; PRIMARY CODE VALUE
|
||||
. . . S XV("RESULTTESTCODINGSYSTEM")=C0CVAR("C3") ; PRIMARY DISPLAY NAME
|
||||
. . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C2") ; USE PRIMARY TEXT
|
||||
. . ZWR XV
|
||||
. W C0CI," ",C0CTYP,!
|
||||
. ; S C0CI=$O(@C0CHB@(C0CI))
|
||||
Q
|
||||
LTYP(OSEG,OTYP) ;
|
||||
LTYP(OSEG,OTYP,OVARA) ;
|
||||
S OTAB=$NA(@C0CTAB@(OTYP)) ; TABLE FOR SEGMENT TYPE
|
||||
I 1 D ; FOR HL7 SEGMENT TYPE
|
||||
. S OI="" ; INDEX INTO FIELDS IN SEG
|
||||
|
@ -59,6 +81,7 @@ LTYP(OSEG,OTYP) ;
|
|||
. . I $P(OI,";",2)'="" D ; THIS IS DEFINING A SUB-VALUE
|
||||
. . . S OI2=$P(OTI,";",2) ; THE SUB-INDEX
|
||||
. . . S OV=$P(OV,"^",OI2) ; PULL OUT SUB-VALUE
|
||||
. . S OVARA(OVAR)=OV ; PASS BACK VARIABLE AND VALUE
|
||||
. . I OV'="" W OI_": "_$P(@OTAB@(OI),"^",3),": ",OVAR,": ",OV,!
|
||||
Q
|
||||
LOBX ;
|
||||
|
@ -167,13 +190,16 @@ SETTBL ;
|
|||
S X("OBX","OBX1")="1^00559^Set ID - OBX"
|
||||
S X("OBX","OBX2")="2^00676^Value Type"
|
||||
S X("OBX","OBX3")="3^00560^Observation Identifier"
|
||||
S X("OBX","OBX3;LOINC")="3;4^00560^Observation Identifier^RESULTTESTCODEVALUE"
|
||||
S X("OBX","OBX3;DESC")="3;5^00560^Observation Identifier^RESULTTESTDESCRIPTIONTEXT"
|
||||
S X("OBX","OBX3;VACODE")="3;6^00560^Observation Identifier"
|
||||
S X("OBX","OBX3;C1")="3;1^00560^Observation Identifier^C1"
|
||||
S X("OBX","OBX3;C2")="3;2^00560^Observation Identifier^C2"
|
||||
S X("OBX","OBX3;C3")="3;3^00560^Observation Identifier^C3"
|
||||
S X("OBX","OBX3;C4")="3;4^00560^Observation Identifier^C4"
|
||||
S X("OBX","OBX3;C5")="3;5^00560^Observation Identifier^C5"
|
||||
S X("OBX","OBX3;C6")="3;6^00560^Observation Identifier^C6"
|
||||
S X("OBX","OBX4")="4^00769^Observation Sub-Id"
|
||||
S X("OBX","OBX5")="5^00561^Observation Results^RESULTTESTVALUE"
|
||||
S X("OBX","OBX6")="6^00562^Units^RESULTTESTUNITS"
|
||||
S X("OBX","OBX7")="7^00563^Reference Range^"
|
||||
S X("OBX","OBX7")="7^00563^Reference Range^RESULTTESTNORMALDESCRIPTIONTEXT"
|
||||
S X("OBX","OBX8")="8^00564^Abnormal Flags"
|
||||
S X("OBX","OBX9")="9^00639^Probability"
|
||||
S X("OBX","OBX10")="10^00565^Nature of Abnormal Test"
|
||||
|
|
Loading…
Reference in New Issue