LA7VCIN9 ;ihs/cmi/maw - Process Incoming UI Msgs, continued ; 22-Oct-2013 09:22 ; MAW
;;5.2;AUTOMATED LAB INSTRUMENTS;**1033**;NOV 01, 1997
; This routine is a continuation of LA7CVIN1 and is only called from there.
; It is called to process TQ1 and SPM segments for "CH" subscript tests.
Q
;
TQ1 ;-- process the TQ1 segment
; timing start time
S LA7STT=$$HL7TFM^XLFDT($$P^LA7VHLU(.LA7SEG,8,LA7FS),"L")
; timing stop time
S LA7STP=$$HL7TFM^XLFDT($$P^LA7VHLU(.LA7SEG,9,LA7FS),"L")
S ^LAH(LA7LWL,1,LA7ISQN,"IHSTQ1")=LA7STT_U_LA7STP
Q
;
SPM ;-- process the SPM segment
; specimen type
S LA7SPTYP=$$P^LA7VHLU(.LA7SEG,5,LA7FS) ;specimen type
S LA7SPTSN=$P(LA7SPTYP,LA7CS) ;snomed code
S LA7SPTHL=$P(LA7SPTYP,LA7CS,2)
S LA7SPTYI=$O(^LAB(61,"C",LA7SPTSN,0)) ;get the ien of the topography field file
I '$G(LA7SPTYI) S LA7SPTYI=$O(^LAB(61,"AHL7",LA7SPTHL,0)) ;get ien from HL7 code
; specimen collection date/time
S LA7SPCDT=$$P^LA7VHLU(.LA7SEG,18,LA7FS)
S LA7SPCST=$$HL7TFM^XLFDT($P(LA7SPCDT,LA7CS),"L")
; specimen reject reason
S LA7SPRJR=$P($$P^LA7VHLU(.LA7SEG,22,LA7FS),LA7CS,2)
S ^LAH(LA7LWL,1,LA7ISQN,"IHSSPM")=$G(LA7SPTYI)_U_LA7SPCST_U_LA7SPRJR
I LA7RSTAT="X" D ;MU this is a cancelled test lets call auto cancellation
. D NOTPERF^BLRRLTDR(LA7UID,LA7SPRJR)
; specimen condition
S LA7SPCND=$$P^LA7VHLU(.LA7SEG,25,LA7FS) ;specimen condition
Q:$G(LA7SPCND)=""
S LA7SPCSN=$P(LA7SPCND,LA7CS) ;code
S LA7SPCNI=$O(^LAHM(62.93,"ABB",LA7SPCSN,0)) ;get the ien based on code passed in
S $P(^LAH(LA7LWL,1,LA7ISQN,"IHSSPM"),U,4)=LA7SPCNI
Q
LA7VCIN9 ;ihs/cmi/maw - Process Incoming UI Msgs, continued ; 22-Oct-2013 09:22 ; MAW
+1 ;;5.2;AUTOMATED LAB INSTRUMENTS;**1033**;NOV 01, 1997
+2 ; This routine is a continuation of LA7CVIN1 and is only called from there.
+3 ; It is called to process TQ1 and SPM segments for "CH" subscript tests.
+4 QUIT
+5 ;
TQ1 ;-- process the TQ1 segment
+1 ; timing start time
+2 SET LA7STT=$$HL7TFM^XLFDT($$P^LA7VHLU(.LA7SEG,8,LA7FS),"L")
+3 ; timing stop time
+4 SET LA7STP=$$HL7TFM^XLFDT($$P^LA7VHLU(.LA7SEG,9,LA7FS),"L")
+5 SET ^LAH(LA7LWL,1,LA7ISQN,"IHSTQ1")=LA7STT_U_LA7STP
+6 QUIT
+7 ;
SPM ;-- process the SPM segment
+1 ; specimen type
+2 ;specimen type
SET LA7SPTYP=$$P^LA7VHLU(.LA7SEG,5,LA7FS)
+3 ;snomed code
SET LA7SPTSN=$PIECE(LA7SPTYP,LA7CS)
+4 SET LA7SPTHL=$PIECE(LA7SPTYP,LA7CS,2)
+5 ;get the ien of the topography field file
SET LA7SPTYI=$ORDER(^LAB(61,"C",LA7SPTSN,0))
+6 ;get ien from HL7 code
IF '$GET(LA7SPTYI)
SET LA7SPTYI=$ORDER(^LAB(61,"AHL7",LA7SPTHL,0))
+7 ; specimen collection date/time
+8 SET LA7SPCDT=$$P^LA7VHLU(.LA7SEG,18,LA7FS)
+9 SET LA7SPCST=$$HL7TFM^XLFDT($PIECE(LA7SPCDT,LA7CS),"L")
+10 ; specimen reject reason
+11 SET LA7SPRJR=$PIECE($$P^LA7VHLU(.LA7SEG,22,LA7FS),LA7CS,2)
+12 SET ^LAH(LA7LWL,1,LA7ISQN,"IHSSPM")=$GET(LA7SPTYI)_U_LA7SPCST_U_LA7SPRJR
+13 ;MU this is a cancelled test lets call auto cancellation
IF LA7RSTAT="X"
Begin DoDot:1
+14 DO NOTPERF^BLRRLTDR(LA7UID,LA7SPRJR)
End DoDot:1
+15 ; specimen condition
+16 ;specimen condition
SET LA7SPCND=$$P^LA7VHLU(.LA7SEG,25,LA7FS)
+17 IF $GET(LA7SPCND)=""
QUIT
+18 ;code
SET LA7SPCSN=$PIECE(LA7SPCND,LA7CS)
+19 ;get the ien based on code passed in
SET LA7SPCNI=$ORDER(^LAHM(62.93,"ABB",LA7SPCSN,0))
+20 SET $PIECE(^LAH(LA7LWL,1,LA7ISQN,"IHSSPM"),U,4)=LA7SPCNI
+21 QUIT