1 | C0COVREL ; CCDCCR/ELN - CCR/CCD PROCESSING FOR LAB,RAD,TIU RESULTS ; 10/12/15
|
---|
2 | ;;1.2;C0C;;May 11, 2012;Build 47
|
---|
3 | LIST ; LIST THE HL7 MESSAGE; ALSO, EXTRACT THE RESULT VARIABLES TO C0CLB
|
---|
4 | N C0CI,C0CJ,C0COBT,C0CHB,C0CVAR,C0CLB2,C0CLB,C0CLI,C0CLOBX,C0CTAB,C0CTYP
|
---|
5 | I '$D(C0CLB) S C0CLB=$NA(^TMP("C0CCCR",$J,"RESULTS")) ; BASE GLB FOR LABS VARS
|
---|
6 | I '$D(C0CQT) S C0CQT=0
|
---|
7 | I '$D(DFN) S DFN=1 ; DEFAULT TEST PATIENT
|
---|
8 | I '$D(^TMP("C0CCCR","LABTBL",0)) D SETTBL^C0COVREU ;INITIALIZE LAB TABLE
|
---|
9 | I ^TMP("C0CCCR","LABTBL",0)'="V3" D SETTBL^C0COVREU ;NEED NEWEST VERSION
|
---|
10 | I '$D(^TMP("HLS",$J,1)) D GHL7^C0COVREU ; GET HL7 MGS IF NOT ALREADY DONE
|
---|
11 | S C0CTAB=$NA(^TMP("C0CCCR","LABTBL")) ; BASE OF OBX TABLE
|
---|
12 | S C0CHB=$NA(^TMP("HLS",$J))
|
---|
13 | S C0CI=""
|
---|
14 | S @C0CLB@(0)=0 ; INITALIZE RESULTS VARS COUNT
|
---|
15 | F S C0CI=$O(@C0CHB@(C0CI)) Q:C0CI="" D ; FOR ALL RECORDS IN HL7 MSG
|
---|
16 | . K C0CVAR,XV,C0CX1,C0CX2 ; CLEAR OUT VARIABLE VALUES
|
---|
17 | . S C0CTYP=$P(@C0CHB@(C0CI),"|",1)
|
---|
18 | . D LTYP^C0COVREU(@C0CHB@(C0CI),C0CTYP,.C0CVAR,C0CQT)
|
---|
19 | . M XV=C0CVAR ;
|
---|
20 | . I C0CTYP="OBR" D ; BEGINNING OF NEW SECTION
|
---|
21 | . . S @C0CLB@(0)=@C0CLB@(0)+1 ; INCREMENT COUNT
|
---|
22 | . . S C0CLI=@C0CLB@(0) ; INDEX FOR THIS RESULT
|
---|
23 | . . ;M @C0CLB@(C0CLI)=C0CVAR ; PERSIST THE OBR VARS
|
---|
24 | . . S XV("RESULTOBJECTID")="RESULT_"_C0CLI
|
---|
25 | . . S C0CX1=XV("RESULTSOURCEACTORID") ; SOURCE FROM OBR
|
---|
26 | . . S XV("RESULTSOURCEACTORID")="ACTORPROVIDER_"_$P($P(C0CX1,"^",1),"-",1)
|
---|
27 | . . S C0CX1=XV("RESULTASSESSMENTDATETIME") ;DATE TIME IN HL7 FORMAT
|
---|
28 | . . S C0CX2=$$HL7TFM^XLFDT(C0CX1,"L") ;FM DT LOCAL
|
---|
29 | . . S XV("RESULTASSESSMENTDATETIME")=$$FMDTOUTC^C0CUTIL(C0CX2,"DT") ;UTC TIME
|
---|
30 | . . M @C0CLB@(C0CLI)=XV ; PERSIST THE OBR VARS
|
---|
31 | . . S C0CLOBX=0 ; MARK THE BEGINNING OF A NEW SECTION
|
---|
32 | . I C0CTYP="OBX" D ; SPECIAL CASE FOR OBX
|
---|
33 | . . ; RESULTTESTCODEVALUE AND RESULTTESTDESCRIPTIONTEXT
|
---|
34 | . . I C0CVAR("C3")="LN" D ; PRIMARY CODE IS LOINC
|
---|
35 | . . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C1") ; THE LOINC CODE VALUE
|
---|
36 | . . . S XV("RESULTTESTCODINGSYSTEM")="LOINC" ; DISPLAY NAME FOR LOINC
|
---|
37 | . . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C2") ; DESCRIPTION TEXT
|
---|
38 | . . E I C0CVAR("C6")="LN" D ; SECONDARY CODE IS LOINC
|
---|
39 | . . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C4") ; THE LOINC CODE VALUE
|
---|
40 | . . . S XV("RESULTTESTCODINGSYSTEM")="LOINC" ; DISPLAY NAME FOR LOINC
|
---|
41 | . . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C5") ; DESCRIPTION TEXT
|
---|
42 | . . E I C0CVAR("C6")'="" D ; NO LOINC CODES, USE SECONDARY IF PRESENT
|
---|
43 | . . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C4") ; SECONDARY CODE VALUE
|
---|
44 | . . . S XV("RESULTTESTCODINGSYSTEM")=C0CVAR("C6") ; SECONDARY CODE NAME
|
---|
45 | . . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C5") ; SECONDARY TEXT
|
---|
46 | . . E D ; NO SECONDARY, USE PRIMARY
|
---|
47 | . . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C1") ; PRIMARY CODE VALUE
|
---|
48 | . . . S XV("RESULTTESTCODINGSYSTEM")=C0CVAR("C3") ; PRIMARY DISPLAY NAME
|
---|
49 | . . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C2") ; USE PRIMARY TEXT
|
---|
50 | . . N C0CZG S C0CZG=XV("RESULTTESTNORMALDESCTEXT") ;
|
---|
51 | . . S XV("RESULTTESTNORMALDESCTEXT")=C0CZG
|
---|
52 | . . S C0CZG=XV("RESULTTESTVALUE")
|
---|
53 | . . S XV("RESULTTESTVALUE")=C0CZG
|
---|
54 | . I C0CTYP="OBX" D ; PROCESS TEST RESULTS
|
---|
55 | . . I C0CLOBX=0 D ; FIRST TEST RESULT FOR THIS SECTION
|
---|
56 | . . . S C0CLB2=$NA(@C0CLB@(C0CLI,"M","TEST")) ; INDENT FOR TEST RESULTS
|
---|
57 | . . S C0CLOBX=C0CLOBX+1 ; INCREMENT TEST COUNT
|
---|
58 | . . S @C0CLB2@(0)=C0CLOBX ; STORE THE TEST COUNT
|
---|
59 | . . S XV("RESULTTESTOBJECTID")="RESULTTEST_"_C0CLI_"_"_C0CLOBX
|
---|
60 | . . S C0CX1=XV("RESULTTESTSOURCEACTORID") ; TEST SOURCE
|
---|
61 | . . S C0CX2=$P($P(C0CX1,"^",1),"-",1) ; PULL OUT STATION NUMBER
|
---|
62 | . . S XV("RESULTTESTSOURCEACTORID")="ACTORORGANIZATION_"_C0CX2
|
---|
63 | . . S XV("RESULTTESTNORMALSOURCEACTORID")=XV("RESULTTESTSOURCEACTORID")
|
---|
64 | . . S C0CX1=XV("RESULTTESTDATETIME") ;DATE TIME IN HL7 FORMAT
|
---|
65 | . . S C0CX2=$$HL7TFM^XLFDT(C0CX1,"L") ;FM DT LOCAL
|
---|
66 | . . S XV("RESULTTESTDATETIME")=$$FMDTOUTC^C0CUTIL(C0CX2,"DT") ;UTC TIME
|
---|
67 | . . M @C0CLB2@(C0CLOBX)=XV ; PERSIST THE TEST RESULT VARIABLES
|
---|
68 | . I 'C0CQT D ;
|
---|
69 | . . W C0CI," ",C0CTYP,!
|
---|
70 | Q
|
---|