LA7VQIN5 ;VA/DALOI/JMC - Process Incoming UI Msgs, continued ;JUL 06, 2010 3:14 PM
;;5.2;AUTOMATED LAB INSTRUMENTS;**46,64,1027**;NOV 01, 1997;Build 9
; This routine is a continuation of LA7VIN1 and is only called from there.
; It is called to process OBX segments for "CH" subscript tests.
Q
;
OBX ;
;
N LA76241,LA76304,LA7EII,LA7I,LA7LIMIT,LA7OBM,LA7SUBFL,LA7TEST,LA7TREEN,LA7UNITS,LA7VAL,LA7VTYP,LA7X,LA7XFORM,LA7Y
;
K LA7RMK,^TMP("LA7TREE",$J)
;
S LA7SUBFL=63.04
;
; OBX Set ID
S LA7SOBX=$$P^LA7VHLU(.LA7SEG,2,LA7FS)
;
; Value type - type of data from Table 0125
S LA7VTYP=$P($$P^LA7VHLU(.LA7SEG,3,LA7FS),LA7CS)
;
; Determine test result codes - check for primary and alternate codes
; For DoD/CHCS interface - do NOT process test codes using 99LRT as coding system per DoD/July 2002.
S LA7X=$$P^LA7VHLU(.LA7SEG,4,LA7FS),(LA7RNLT,LA7RLNC)=""
S LA7TEST=$P(LA7X,LA7CS)
S LA7TEST(0)=$$UNESC^LA7VHLU3($P(LA7X,LA7CS,2),LA7FS_LA7ECH)
I LA7TEST(0)["^" S LA7TEST(0)=$TR(LA7TEST(0),"^","~")
S LA7TEST(0,1)=$P(LA7X,LA7CS,3)
S LA7TEST(2)=$P(LA7X,LA7CS,4)
S LA7TEST(2,0)=$$UNESC^LA7VHLU3($P(LA7X,LA7CS,5),LA7FS_LA7ECH)
I LA7TEST(2,0)["^" S LA7TEST(2,0)=$TR(LA7TEST(2,0),"^","~")
S LA7TEST(2,1)=$P(LA7X,LA7CS,6)
F I=3,6 D
. S LA7Y=$P(LA7X,LA7CS,I-2)
. I $P(LA7X,LA7CS,I)="LN" D Q
. . I $$GET1^DIQ(95.3,+LA7Y_",",.01)=LA7Y S LA7RLNC=+LA7Y
. I $P(LA7X,LA7CS,I)="99VA64" D Q
. . I $$FIND1^DIC(64,"","OMX",LA7Y) S LA7RNLT=LA7Y
. I $P(LA7X,LA7CS,I)="99LRT" D Q
. . I LA7TEST(0)="",LA7TEST(2,0)'="" S LA7TEST(0)=LA7TEST(2,0)
. . I LA7TEST(2,0)="",LA7TEST(0)'="" S LA7TEST(2,0)=LA7TEST(0)
. . I I=3 S (LA7TEST,LA7TEST(0),LA7TEST(0,1))="" Q
. . I I=6 S (LA7TEST(2),LA7TEST(2,0),LA7TEST(2,1))="" Q
I LA7TEST="",LA7TEST(2)'="" D
. S LA7TEST=LA7TEST(2),LA7TEST(0)=LA7TEST(2,0),LA7TEST(0,1)=LA7TEST(2,1)
. S (LA7TEST(2),LA7TEST(2,0),LA7TEST(2,1))=""
;
; No test code in message
I LA7TEST="",LA7TEST(2)="" D Q
. N LA7OBX
. S LA7OBX=LA7SEG(0)
. D CREATE^LA7LOG(15)
;
; Test code not found in auto inst file, also check alternate codes,
; and log error if none found.
I LA7MTYP="ORU" D Q:LA7TEST=""
. I LA7TEST'="",$D(^LAB(62.4,LA7624,3,"AC",LA7TEST)) Q
. I LA7TEST(2)'="",$D(^LAB(62.4,LA7624,3,"AC",LA7TEST(2))) D Q
. . S LA7TEST=LA7TEST(2),LA7TEST(0)=LA7TEST(2,0),LA7TEST(0,1)=LA7TEST(2,1)
. D CREATE^LA7LOG(16) S LA7TEST=""
;
; Units - trim leading/trailing spaces
S LA7UNITS=$$P^LA7VHLU(.LA7SEG,7,LA7FS)
I LA7UNITS]"" S LA7UNITS=$$TRIM^XLFSTR(LA7UNITS,"LR"," ")
;
; Observation result status - Table 0085
S LA7ORS=$$P^LA7VHLU(.LA7SEG,12,LA7FS)
I $G(LA7ORS)="" S LA7ORS="F" ;ihs/cmi/maw 8/27/2010 if Quest does not send a status flag
;
; Responsible observer
S LA7RO=$$XCNTFM^LA7VHLU4($$P^LA7VHLU(.LA7SEG,17,LA7FS),LA7ECH)
;
; Observation method
S LA7X=$$P^LA7VHLU(.LA7SEG,18,LA7FS),LA7OBM=""
I $P(LA7X,LA7CS,3)="99VA64_2" S LA7OBM=$P($P(LA7X,LA7CS,1),".",2)
;
; Equipment instance identifier
S LA7EII=$$P^LA7VHLU(.LA7SEG,19,LA7FS)
I LA7EII'="" D
. S LA7EII=$$UNESC^LA7VHLU3(LA7EII,LA7FS_LA7ECH)
. S LA7EII=$TR(LA7EII,"^",";")
;
; Process ORU message results for all tests which use this test code.
I LA7MTYP="ORU" D Q
. S LA76241=0
. F S LA76241=$O(^LAB(62.4,LA7624,3,"AC",LA7TEST,LA76241)) Q:'LA76241 D PROCESS
;
I LA7MTYP="ORM",$G(LA7696)>0 D ORESULTS^LA7VQN5A
;
Q
;
;
PROCESS ; Process results for a given test code
S LA7VAL=$$P^LA7VHLU(.LA7SEG,6,LA7FS)
Q:$G(LA7VAL)="DNR" ;cmi/anch/maw 8/16/2007 don't process DNR's for IHS ref lab
I LA7VTYP="CE",$P(LA7VAL,LA7CS,2)'="" S LA7VAL=$P(LA7VAL,LA7CS,2)
E S LA7VAL=$P(LA7VAL,LA7CS)
;
F LA7I=0,1,2 S LA76241(LA7I)=$G(^LAB(62.4,LA7624,3,LA76241,LA7I))
;
; Chem test fields incorrect
I (LA76241(0)="")!(LA76241(1)="") D Q
. D CREATE^LA7LOG(18)
;
; Setup LA7RMK(0) variable in case comments (NTE) sent with test results.
S LA7RMK(0,+LA76241(0))=+$P(LA76241(2),"^",7)_"^"_$P(LA76241(2),"^",8)
;
S LA76304=+$P(LA76241(1),"(",2) ;lab data field
; No dataname for this result
I LA76304'>1 D Q
. D CREATE^LA7LOG(18)
;
; Set flag for new results alert
I "CDW"'[LA7ORS S ^TMP("LA7-ORU",$J,LA76248,LA76249)=""
;
; Set flag to send amended results bulletin
I "CDW"[LA7ORS D
. S LA7I=$O(^TMP("LA7 AMENDED RESULTS",$J,""),-1),LA7I=LA7I+1
. S X=LA7LWL_"^"_LA7ISQN_"^"_LA76304_"^"_LA76248_"^"_LA76249_"^"_LA7ORS_"^"_LA7TEST_"^"_$S(LA7TEST(0)'="":LA7TEST(0),1:LA7TEST(2,0))_"^"_$$P^LA7VHLU(.LA7SEG,9,LA7FS)
. S ^TMP("LA7 AMENDED RESULTS",$J,LA7I)=X
. I LA7UID'="" S ^LAH("LA7 AMENDED RESULTS",LA7UID,LA76304,LA7LWL,LA7ISQN)=X
;
; NOTE - this array can be set from inside PARAM 1
K LA7XFORM
; execute PARAM 1 if not a LEDI interface
I LA7INTYP'=10 X $P(LA76241(0),"^",2)
I $P(LA76241(2),"^",3)=0 Q
I $P(LA76241(2),"^",3)=2,"CFUX"'[LA7ORS Q
;
; No value found
I LA7VAL="" D Q
. D CREATE^LA7LOG(17)
;
; Transform result based on fields in file 62.4
D XFORM^LA7VQN5A
Q:LA7VAL=""
;
; Check if result passes input transform on data name
D CHKDIE^LA7VQN5A
Q:LA7VAL=""
;
; Set flag to not store comments if it wasn't explicitly ordered.
I $G(LA7LIMIT)=1 D
. N LA76804
. K LA7LIMIT,LA7TREEN,^TMP("LA7TREE",$J)
. ; Store all tests accessioned in ^TMP
. S LA76804=0
. F S LA76804=$O(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,4,LA76804)) Q:'LA76804 D UNWIND^LA7UTIL(LA76804)
. I '$D(^TMP("LA7TREE",$J,+LA76241(0))) S LA7LIMIT=1 ;wasn't ordered
I $G(LA7LIMIT) D Q
. S $P(LA7RMK(0,+LA76241(0)),"^",1)=0
. K LA7LIMIT,^TMP("LA7TREE",$J)
K ^TMP("LA7TREE",$J)
;
; Check point of care interface for matching specimen type
; for this test in #62.4
I LA7INTYP>19,LA7INTYP<30 D Q:'LA761
. N LA70070
. S LA761="",LA7X=$P(LA76241(2),"^",13) Q:'LA7X
. S LA70070=$$GET1^DIQ(61,LA7X_",","LEDI HL7:HL7 ABBR")
. I LA70070=LA7SPEC S LA761=LA7X
;
; Set data node=test value
S $P(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^")=LA7VAL
;
; Store reference ranges
D REFRNG^LA7VQN5A($$P^LA7VHLU(.LA7SEG,8,LA7FS))
;
; Store order/result codes/observation method
S LA7X=$P(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",3)
I LA7ONLT S $P(LA7X,"!",1)=LA7ONLT
I LA7RNLT S $P(LA7X,"!",2)=LA7RNLT
I LA7RLNC S $P(LA7X,"!",3)=LA7RLNC
I LA7OBM S $P(LA7X,"!",4)=LA7OBM
S $P(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",3)=LA7X
;
; Store abnormal flags
D ABFLAG^LA7VQN5A($$P^LA7VHLU(.LA7SEG,9,LA7FS))
;
; Store units
I LA7UNITS'="" D
. S LA7X=$P($G(^LAH(LA7LWL,1,LA7ISQN,LA76304)),"^",5)
. S $P(LA7X,"!",7)=LA7UNITS
. S $P(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",5)=LA7X
;
; Store responsible observer on POC interfaces
I LA7RO'="",LA7INTYP>19,LA7INTYP<30 D
. I $P(LA7RO,"^",2) S $P(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",4)=$P(LA7RO,"^",2)
;
; Store specimen type
I $G(LA761) D
. S X=$P(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",5)
. S $P(X,"!")=LA761
. S $P(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",5)=X
;
; Store where test was performed.
D PRDID^LA7VQN5A($$P^LA7VHLU(.LA7SEG,16,LA7FS),LA7SFAC,LA7CS)
;
; Store equipment instance identifier
I LA7EII'="" D EII^LA7VQN5A
;
; If results for LEDI interface (LA7INTYP=10) and site keeps file #60
; in sync with reference lab then compare message's units and normals
; with site's to detect changes(LA7FLAG=1) and notify site.
I LA7INTYP=10,$G(LA761),$G(^LAB(60,+$P(LA76241(0),"^"),1,LA761,.1)) D
. N LA760,LA7FLAG,LA7I,LA7Y,LA7X
. S LA760=+$P(LA76241(0),"^"),LA7Y=^LAB(60,LA760,1,LA761,0),LA7FLAG=0
. S LA7X=$P(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",5)
. I $P(LA7Y,"^",7)'=$P(LA7X,"!",7) S LA7FLAG=1
. I 'LA7FLAG,$P(LA7Y,"^",2)=$P(LA7X,"!",2),$P(LA7Y,"^",3)=$P(LA7X,"!",3) Q
. I 'LA7FLAG D
. . N AGE,DOB,PNM,SEX
. . N LRDPF,LRNG,LRNGS,LRNG2,LRNG3,LRNG4,LRNG5,LRTREA,LRWRD,LRX,LRY
. . I $G(LRDFN) D DEM^LRX,KVAR^VADPT
. . S LRNG=LA7Y D NORM^LRVER5
. . S LA7Y=$TR(LRNG,$C(34),""),LA7X=$TR(LA7X,$C(34),"")
. . I $P(LA7Y,"^",2)=$P(LA7X,"!",2),$P(LA7Y,"^",3)=$P(LA7X,"!",3) Q
. . S LA7FLAG=1
. I 'LA7FLAG Q
. S LA7I=$O(^TMP("LA7 UNITS/NORMALS CHANGED",$J,""),-1),LA7I=LA7I+1
. S X=LA7LWL_"^"_LA7ISQN_"^"_LA76304_"^"_LA76248_"^"_LA76249_"^"_LA7ORS_"^"_LA7TEST_"^"_$S(LA7TEST(0)'="":LA7TEST(0),1:LA7TEST(2,0))_"^"_$$P^LA7VHLU(.LA7SEG,9,LA7FS)_"^"_LA760
. S ^TMP("LA7 UNITS/NORMALS CHANGED",$J,LA7I)=X
;
; If LEDI interface and order status change store which results
; associated with ordered test. Used to determine if order status
; changed bulletin needs to be generated.
I LA7INTYP=10,LA7SAC?1(1"A",1"G") D
. S LA7I=$G(LA7SAC(0)) Q:'LA7I
. S ^TMP("LA7 ORDER STATUS",$J,LA7I,+LA76241(0))=""
Q
LA7VQIN5 ;VA/DALOI/JMC - Process Incoming UI Msgs, continued ;JUL 06, 2010 3:14 PM
+1 ;;5.2;AUTOMATED LAB INSTRUMENTS;**46,64,1027**;NOV 01, 1997;Build 9
+2 ; This routine is a continuation of LA7VIN1 and is only called from there.
+3 ; It is called to process OBX segments for "CH" subscript tests.
+4 QUIT
+5 ;
OBX ;
+1 ;
+2 NEW LA76241,LA76304,LA7EII,LA7I,LA7LIMIT,LA7OBM,LA7SUBFL,LA7TEST,LA7TREEN,LA7UNITS,LA7VAL,LA7VTYP,LA7X,LA7XFORM,LA7Y
+3 ;
+4 KILL LA7RMK,^TMP("LA7TREE",$JOB)
+5 ;
+6 SET LA7SUBFL=63.04
+7 ;
+8 ; OBX Set ID
+9 SET LA7SOBX=$$P^LA7VHLU(.LA7SEG,2,LA7FS)
+10 ;
+11 ; Value type - type of data from Table 0125
+12 SET LA7VTYP=$PIECE($$P^LA7VHLU(.LA7SEG,3,LA7FS),LA7CS)
+13 ;
+14 ; Determine test result codes - check for primary and alternate codes
+15 ; For DoD/CHCS interface - do NOT process test codes using 99LRT as coding system per DoD/July 2002.
+16 SET LA7X=$$P^LA7VHLU(.LA7SEG,4,LA7FS)
SET (LA7RNLT,LA7RLNC)=""
+17 SET LA7TEST=$PIECE(LA7X,LA7CS)
+18 SET LA7TEST(0)=$$UNESC^LA7VHLU3($PIECE(LA7X,LA7CS,2),LA7FS_LA7ECH)
+19 IF LA7TEST(0)["^"
SET LA7TEST(0)=$TRANSLATE(LA7TEST(0),"^","~")
+20 SET LA7TEST(0,1)=$PIECE(LA7X,LA7CS,3)
+21 SET LA7TEST(2)=$PIECE(LA7X,LA7CS,4)
+22 SET LA7TEST(2,0)=$$UNESC^LA7VHLU3($PIECE(LA7X,LA7CS,5),LA7FS_LA7ECH)
+23 IF LA7TEST(2,0)["^"
SET LA7TEST(2,0)=$TRANSLATE(LA7TEST(2,0),"^","~")
+24 SET LA7TEST(2,1)=$PIECE(LA7X,LA7CS,6)
+25 FOR I=3,6
Begin DoDot:1
+26 SET LA7Y=$PIECE(LA7X,LA7CS,I-2)
+27 IF $PIECE(LA7X,LA7CS,I)="LN"
Begin DoDot:2
+28 IF $$GET1^DIQ(95.3,+LA7Y_",",.01)=LA7Y
SET LA7RLNC=+LA7Y
End DoDot:2
QUIT
+29 IF $PIECE(LA7X,LA7CS,I)="99VA64"
Begin DoDot:2
+30 IF $$FIND1^DIC(64,"","OMX",LA7Y)
SET LA7RNLT=LA7Y
End DoDot:2
QUIT
+31 IF $PIECE(LA7X,LA7CS,I)="99LRT"
Begin DoDot:2
+32 IF LA7TEST(0)=""
IF LA7TEST(2,0)'=""
SET LA7TEST(0)=LA7TEST(2,0)
+33 IF LA7TEST(2,0)=""
IF LA7TEST(0)'=""
SET LA7TEST(2,0)=LA7TEST(0)
+34 IF I=3
SET (LA7TEST,LA7TEST(0),LA7TEST(0,1))=""
QUIT
+35 IF I=6
SET (LA7TEST(2),LA7TEST(2,0),LA7TEST(2,1))=""
QUIT
End DoDot:2
QUIT
End DoDot:1
+36 IF LA7TEST=""
IF LA7TEST(2)'=""
Begin DoDot:1
+37 SET LA7TEST=LA7TEST(2)
SET LA7TEST(0)=LA7TEST(2,0)
SET LA7TEST(0,1)=LA7TEST(2,1)
+38 SET (LA7TEST(2),LA7TEST(2,0),LA7TEST(2,1))=""
End DoDot:1
+39 ;
+40 ; No test code in message
+41 IF LA7TEST=""
IF LA7TEST(2)=""
Begin DoDot:1
+42 NEW LA7OBX
+43 SET LA7OBX=LA7SEG(0)
+44 DO CREATE^LA7LOG(15)
End DoDot:1
QUIT
+45 ;
+46 ; Test code not found in auto inst file, also check alternate codes,
+47 ; and log error if none found.
+48 IF LA7MTYP="ORU"
Begin DoDot:1
+49 IF LA7TEST'=""
IF $DATA(^LAB(62.4,LA7624,3,"AC",LA7TEST))
QUIT
+50 IF LA7TEST(2)'=""
IF $DATA(^LAB(62.4,LA7624,3,"AC",LA7TEST(2)))
Begin DoDot:2
+51 SET LA7TEST=LA7TEST(2)
SET LA7TEST(0)=LA7TEST(2,0)
SET LA7TEST(0,1)=LA7TEST(2,1)
End DoDot:2
QUIT
+52 DO CREATE^LA7LOG(16)
SET LA7TEST=""
End DoDot:1
IF LA7TEST=""
QUIT
+53 ;
+54 ; Units - trim leading/trailing spaces
+55 SET LA7UNITS=$$P^LA7VHLU(.LA7SEG,7,LA7FS)
+56 IF LA7UNITS]""
SET LA7UNITS=$$TRIM^XLFSTR(LA7UNITS,"LR"," ")
+57 ;
+58 ; Observation result status - Table 0085
+59 SET LA7ORS=$$P^LA7VHLU(.LA7SEG,12,LA7FS)
+60 ;ihs/cmi/maw 8/27/2010 if Quest does not send a status flag
IF $GET(LA7ORS)=""
SET LA7ORS="F"
+61 ;
+62 ; Responsible observer
+63 SET LA7RO=$$XCNTFM^LA7VHLU4($$P^LA7VHLU(.LA7SEG,17,LA7FS),LA7ECH)
+64 ;
+65 ; Observation method
+66 SET LA7X=$$P^LA7VHLU(.LA7SEG,18,LA7FS)
SET LA7OBM=""
+67 IF $PIECE(LA7X,LA7CS,3)="99VA64_2"
SET LA7OBM=$PIECE($PIECE(LA7X,LA7CS,1),".",2)
+68 ;
+69 ; Equipment instance identifier
+70 SET LA7EII=$$P^LA7VHLU(.LA7SEG,19,LA7FS)
+71 IF LA7EII'=""
Begin DoDot:1
+72 SET LA7EII=$$UNESC^LA7VHLU3(LA7EII,LA7FS_LA7ECH)
+73 SET LA7EII=$TRANSLATE(LA7EII,"^",";")
End DoDot:1
+74 ;
+75 ; Process ORU message results for all tests which use this test code.
+76 IF LA7MTYP="ORU"
Begin DoDot:1
+77 SET LA76241=0
+78 FOR
SET LA76241=$ORDER(^LAB(62.4,LA7624,3,"AC",LA7TEST,LA76241))
IF 'LA76241
QUIT
DO PROCESS
End DoDot:1
QUIT
+79 ;
+80 IF LA7MTYP="ORM"
IF $GET(LA7696)>0
DO ORESULTS^LA7VQN5A
+81 ;
+82 QUIT
+83 ;
+84 ;
PROCESS ; Process results for a given test code
+1 SET LA7VAL=$$P^LA7VHLU(.LA7SEG,6,LA7FS)
+2 ;cmi/anch/maw 8/16/2007 don't process DNR's for IHS ref lab
IF $GET(LA7VAL)="DNR"
QUIT
+3 IF LA7VTYP="CE"
IF $PIECE(LA7VAL,LA7CS,2)'=""
SET LA7VAL=$PIECE(LA7VAL,LA7CS,2)
+4 IF '$TEST
SET LA7VAL=$PIECE(LA7VAL,LA7CS)
+5 ;
+6 FOR LA7I=0,1,2
SET LA76241(LA7I)=$GET(^LAB(62.4,LA7624,3,LA76241,LA7I))
+7 ;
+8 ; Chem test fields incorrect
+9 IF (LA76241(0)="")!(LA76241(1)="")
Begin DoDot:1
+10 DO CREATE^LA7LOG(18)
End DoDot:1
QUIT
+11 ;
+12 ; Setup LA7RMK(0) variable in case comments (NTE) sent with test results.
+13 SET LA7RMK(0,+LA76241(0))=+$PIECE(LA76241(2),"^",7)_"^"_$PIECE(LA76241(2),"^",8)
+14 ;
+15 ;lab data field
SET LA76304=+$PIECE(LA76241(1),"(",2)
+16 ; No dataname for this result
+17 IF LA76304'>1
Begin DoDot:1
+18 DO CREATE^LA7LOG(18)
End DoDot:1
QUIT
+19 ;
+20 ; Set flag for new results alert
+21 IF "CDW"'[LA7ORS
SET ^TMP("LA7-ORU",$JOB,LA76248,LA76249)=""
+22 ;
+23 ; Set flag to send amended results bulletin
+24 IF "CDW"[LA7ORS
Begin DoDot:1
+25 SET LA7I=$ORDER(^TMP("LA7 AMENDED RESULTS",$JOB,""),-1)
SET LA7I=LA7I+1
+26 SET X=LA7LWL_"^"_LA7ISQN_"^"_LA76304_"^"_LA76248_"^"_LA76249_"^"_LA7ORS_"^"_LA7TEST_"^"_$SELECT(LA7TEST(0)'="":LA7TEST(0),1:LA7TEST(2,0))_"^"_$$P^LA7VHLU(.LA7SEG,9,LA7FS)
+27 SET ^TMP("LA7 AMENDED RESULTS",$JOB,LA7I)=X
+28 IF LA7UID'=""
SET ^LAH("LA7 AMENDED RESULTS",LA7UID,LA76304,LA7LWL,LA7ISQN)=X
End DoDot:1
+29 ;
+30 ; NOTE - this array can be set from inside PARAM 1
+31 KILL LA7XFORM
+32 ; execute PARAM 1 if not a LEDI interface
+33 IF LA7INTYP'=10
XECUTE $PIECE(LA76241(0),"^",2)
+34 IF $PIECE(LA76241(2),"^",3)=0
QUIT
+35 IF $PIECE(LA76241(2),"^",3)=2
IF "CFUX"'[LA7ORS
QUIT
+36 ;
+37 ; No value found
+38 IF LA7VAL=""
Begin DoDot:1
+39 DO CREATE^LA7LOG(17)
End DoDot:1
QUIT
+40 ;
+41 ; Transform result based on fields in file 62.4
+42 DO XFORM^LA7VQN5A
+43 IF LA7VAL=""
QUIT
+44 ;
+45 ; Check if result passes input transform on data name
+46 DO CHKDIE^LA7VQN5A
+47 IF LA7VAL=""
QUIT
+48 ;
+49 ; Set flag to not store comments if it wasn't explicitly ordered.
+50 IF $GET(LA7LIMIT)=1
Begin DoDot:1
+51 NEW LA76804
+52 KILL LA7LIMIT,LA7TREEN,^TMP("LA7TREE",$JOB)
+53 ; Store all tests accessioned in ^TMP
+54 SET LA76804=0
+55 FOR
SET LA76804=$ORDER(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,4,LA76804))
IF 'LA76804
QUIT
DO UNWIND^LA7UTIL(LA76804)
+56 ;wasn't ordered
IF '$DATA(^TMP("LA7TREE",$JOB,+LA76241(0)))
SET LA7LIMIT=1
End DoDot:1
+57 IF $GET(LA7LIMIT)
Begin DoDot:1
+58 SET $PIECE(LA7RMK(0,+LA76241(0)),"^",1)=0
+59 KILL LA7LIMIT,^TMP("LA7TREE",$JOB)
End DoDot:1
QUIT
+60 KILL ^TMP("LA7TREE",$JOB)
+61 ;
+62 ; Check point of care interface for matching specimen type
+63 ; for this test in #62.4
+64 IF LA7INTYP>19
IF LA7INTYP<30
Begin DoDot:1
+65 NEW LA70070
+66 SET LA761=""
SET LA7X=$PIECE(LA76241(2),"^",13)
IF 'LA7X
QUIT
+67 SET LA70070=$$GET1^DIQ(61,LA7X_",","LEDI HL7:HL7 ABBR")
+68 IF LA70070=LA7SPEC
SET LA761=LA7X
End DoDot:1
IF 'LA761
QUIT
+69 ;
+70 ; Set data node=test value
+71 SET $PIECE(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^")=LA7VAL
+72 ;
+73 ; Store reference ranges
+74 DO REFRNG^LA7VQN5A($$P^LA7VHLU(.LA7SEG,8,LA7FS))
+75 ;
+76 ; Store order/result codes/observation method
+77 SET LA7X=$PIECE(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",3)
+78 IF LA7ONLT
SET $PIECE(LA7X,"!",1)=LA7ONLT
+79 IF LA7RNLT
SET $PIECE(LA7X,"!",2)=LA7RNLT
+80 IF LA7RLNC
SET $PIECE(LA7X,"!",3)=LA7RLNC
+81 IF LA7OBM
SET $PIECE(LA7X,"!",4)=LA7OBM
+82 SET $PIECE(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",3)=LA7X
+83 ;
+84 ; Store abnormal flags
+85 DO ABFLAG^LA7VQN5A($$P^LA7VHLU(.LA7SEG,9,LA7FS))
+86 ;
+87 ; Store units
+88 IF LA7UNITS'=""
Begin DoDot:1
+89 SET LA7X=$PIECE($GET(^LAH(LA7LWL,1,LA7ISQN,LA76304)),"^",5)
+90 SET $PIECE(LA7X,"!",7)=LA7UNITS
+91 SET $PIECE(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",5)=LA7X
End DoDot:1
+92 ;
+93 ; Store responsible observer on POC interfaces
+94 IF LA7RO'=""
IF LA7INTYP>19
IF LA7INTYP<30
Begin DoDot:1
+95 IF $PIECE(LA7RO,"^",2)
SET $PIECE(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",4)=$PIECE(LA7RO,"^",2)
End DoDot:1
+96 ;
+97 ; Store specimen type
+98 IF $GET(LA761)
Begin DoDot:1
+99 SET X=$PIECE(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",5)
+100 SET $PIECE(X,"!")=LA761
+101 SET $PIECE(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",5)=X
End DoDot:1
+102 ;
+103 ; Store where test was performed.
+104 DO PRDID^LA7VQN5A($$P^LA7VHLU(.LA7SEG,16,LA7FS),LA7SFAC,LA7CS)
+105 ;
+106 ; Store equipment instance identifier
+107 IF LA7EII'=""
DO EII^LA7VQN5A
+108 ;
+109 ; If results for LEDI interface (LA7INTYP=10) and site keeps file #60
+110 ; in sync with reference lab then compare message's units and normals
+111 ; with site's to detect changes(LA7FLAG=1) and notify site.
+112 IF LA7INTYP=10
IF $GET(LA761)
IF $GET(^LAB(60,+$PIECE(LA76241(0),"^"),1,LA761,.1))
Begin DoDot:1
+113 NEW LA760,LA7FLAG,LA7I,LA7Y,LA7X
+114 SET LA760=+$PIECE(LA76241(0),"^")
SET LA7Y=^LAB(60,LA760,1,LA761,0)
SET LA7FLAG=0
+115 SET LA7X=$PIECE(^LAH(LA7LWL,1,LA7ISQN,LA76304),"^",5)
+116 IF $PIECE(LA7Y,"^",7)'=$PIECE(LA7X,"!",7)
SET LA7FLAG=1
+117 IF 'LA7FLAG
IF $PIECE(LA7Y,"^",2)=$PIECE(LA7X,"!",2)
IF $PIECE(LA7Y,"^",3)=$PIECE(LA7X,"!",3)
QUIT
+118 IF 'LA7FLAG
Begin DoDot:2
+119 NEW AGE,DOB,PNM,SEX
+120 NEW LRDPF,LRNG,LRNGS,LRNG2,LRNG3,LRNG4,LRNG5,LRTREA,LRWRD,LRX,LRY
+121 IF $GET(LRDFN)
DO DEM^LRX
DO KVAR^VADPT
+122 SET LRNG=LA7Y
DO NORM^LRVER5
+123 SET LA7Y=$TRANSLATE(LRNG,$CHAR(34),"")
SET LA7X=$TRANSLATE(LA7X,$CHAR(34),"")
+124 IF $PIECE(LA7Y,"^",2)=$PIECE(LA7X,"!",2)
IF $PIECE(LA7Y,"^",3)=$PIECE(LA7X,"!",3)
QUIT
+125 SET LA7FLAG=1
End DoDot:2
+126 IF 'LA7FLAG
QUIT
+127 SET LA7I=$ORDER(^TMP("LA7 UNITS/NORMALS CHANGED",$JOB,""),-1)
SET LA7I=LA7I+1
+128 SET X=LA7LWL_"^"_LA7ISQN_"^"_LA76304_"^"_LA76248_"^"_LA76249_"^"_LA7ORS_"^"_LA7TEST_"^"_$SELECT(LA7TEST(0)'="":LA7TEST(0),1:LA7TEST(2,0))_"^"_$$P^LA7VHLU(.LA7SEG,9,LA7FS)_"^"_LA760
+129 SET ^TMP("LA7 UNITS/NORMALS CHANGED",$JOB,LA7I)=X
End DoDot:1
+130 ;
+131 ; If LEDI interface and order status change store which results
+132 ; associated with ordered test. Used to determine if order status
+133 ; changed bulletin needs to be generated.
+134 IF LA7INTYP=10
IF LA7SAC?1(1"A",1"G")
Begin DoDot:1
+135 SET LA7I=$GET(LA7SAC(0))
IF 'LA7I
QUIT
+136 SET ^TMP("LA7 ORDER STATUS",$JOB,LA7I,+LA76241(0))=""
End DoDot:1
+137 QUIT