LA7VOBRA ;VA/DALOI/JMC - LAB OBR segment builder (cont'd); 13-Aug-2013 09:09 ; MKK
;;5.2;AUTOMATED LAB INSTRUMENTS;**46,1018,64,1027,68,1033**;NOV 01, 1997
;
Q
;
;
OBR2 ; Build OBR-2 sequence - placer's specimen id
;
S LA7ID=$$CHKDATA^LA7VHLU3(LA7ID,LA7FS_LA7ECH)
S $P(LA7Y,$E(LA7ECH,1),1)=LA7ID
I $G(LA7ID("NMSP"))'="" S $P(LA7Y,$E(LA7ECH,1),2)=LA7ID("NMSP")
I $G(LA7ID("SITE"))'="" D
. S LA7X=$$FACDNS^LA7VHLU2(LA7ID("SITE"),LA7FS,LA7ECH,1)
. S $P(LA7Y,$E(LA7ECH),3)=$P(LA7X,$E(LA7ECH),2)
. S $P(LA7Y,$E(LA7ECH),4)=$P(LA7X,$E(LA7ECH),3)
Q
;
;
OBR3 ; Build OBR-3 sequence - filler's specimen id
;
S LA7ID=$$CHKDATA^LA7VHLU3(LA7ID,LA7FS_LA7ECH)
S $P(LA7Y,$E(LA7ECH,1),1)=LA7ID
I $G(LA7ID("NMSP"))'="" S $P(LA7Y,$E(LA7ECH,1),2)=LA7ID("NMSP")
I $G(LA7ID("SITE"))'="" D
. S LA7X=$$FACDNS^LA7VHLU2(LA7ID("SITE"),LA7FS,LA7ECH,1)
. S $P(LA7Y,$E(LA7ECH),3)=$P(LA7X,$E(LA7ECH),2)
. S $P(LA7Y,$E(LA7ECH),4)=$P(LA7X,$E(LA7ECH),3)
Q
;
;
OBR4 ; Build OBR-4 sequence - Universal service ID
;
S LA764=0,LA7Y=""
; specify component position - primary/alternate
S LA7COMP=0
;
; Send non-VA test codes as first coding system
I LA7ALT'="" D
. N I
. F I=1:1:3 S $P(LA7Y,$E(LA7ECH),LA7COMP+I)=$$CHKDATA^LA7VHLU3($P(LA7ALT,"^",I),LA7FS_LA7ECH)
. S LA7COMP=LA7COMP+I
;
; Send NLT test codes as primary unless non-VA codes then send as alternate code
I LA7NLT'="" D
. S LA764=$O(^LAM("E",LA7NLT,0)),LA7Z=""
. I LA764 S LA7Z=$$GET1^DIQ(64,LA764_",",.01,"I")
. I LA7Z="" D
. . N LA7642
. . S LA764=$O(^LAM("E",$P(LA7NLT,".")_".0000",0))
. . I LA764 S LA7Z=$$GET1^DIQ(64,LA764_",",.01,"I")
. . S LA7642=$O(^LAB(64.2,"F","."_$P(LA7NLT,".",2),0))
. . I LA764,LA7642 S LA7Z=LA7Z_"~"_$$GET1^DIQ(64.2,LA7642_",",.01,"I")
. S $P(LA7Y,$E(LA7ECH),LA7COMP+1)=$$CHKDATA^LA7VHLU3(LA7NLT,LA7FS_LA7ECH)
. S $P(LA7Y,$E(LA7ECH),LA7COMP+2)=$$CHKDATA^LA7VHLU3(LA7Z,LA7FS_LA7ECH)
. S $P(LA7Y,$E(LA7ECH),LA7COMP+3)="99VA64"
. S LA7COMP=LA7COMP+3
;
; Send file #60 test name if available and no alternate
I LA7COMP<4,LA760 D
. S LA7TN=$$GET1^DIQ(60,LA760_",",.01)
. S $P(LA7Y,$E(LA7ECH),LA7COMP+1)=LA760
. S $P(LA7Y,$E(LA7ECH),LA7COMP+2)=$$CHKDATA^LA7VHLU3(LA7TN,LA7FS_LA7ECH)
. S $P(LA7Y,$E(LA7ECH),LA7COMP+3)="99VA60"
;
Q
;
;
OBR9 ; Build OBR-9 sequence - collection volume
;
; Collection volume
S $P(LA7Y,$E(LA7ECH,1))=LA7VOL
;
I LA764061 D
. S LA7IENS=LA764061_","
. D GETS^DIQ(64.061,LA7IENS,".01;1","E","LA7Y")
. ; Collection Volume units code
. S $P(LA7X,$E(LA7ECH,4),1)=$G(LA7Y(64.061,LA7IENS,.01,"E"))
. ; Collection Volume units text
. S $P(LA7X,$E(LA7ECH,4),2)=$$CHKDATA^LA7VHLU3($G(LA7Y(64.061,LA7IENS,1,"E")),LA7FS_LA7ECH)
. ; LOINC coding system
. S $P(LA7X,$E(LA7ECH,4),3)="LN"
. S $P(LA7Y,$E(LA7ECH,1),2)=LA7X
;
Q
;
;
OBR24 ; Build OBR-24 sequence - diagnostic service id
;
; Code non-MI subscripts
I $P(LA7SS,"^")'="MI" D Q
. S LA7X=$P(LA7SS,"^")
. S LA7Y=$S(LA7X="CH":"CH",LA7X="SP":"SP",LA7X="CY":"CP",LA7X="EM":"PAT",LA7X="AU":"PAT",LA7X="BB":"BLB",1:"LAB")
;
; Code MI subscripts
S LA7X=$P(LA7SS,"^",2)
S LA7Y=$S(LA7X=11:"MB",LA7X=14:"PAR",LA7X=18:"MYC",LA7X=22:"MCB",LA7X=33:"VR",1:"MB")
;
Q
;
;
OBR25 ; Build OBR-25 sequence - Result status
;
S LA7Y=""
;
I LA7FLAG="F" S LA7Y="F"
I LA7FLAG="P" S LA7Y="P"
I LA7FLAG="A" S LA7Y="A"
I LA7FLAG="C" S LA7Y="C"
;
Q
;
;
OBR26 ; Build OBR-26 sequence - Parent result
;
S LA7Y=""
;
; Move component into sub-component position
; Translate component character to sub-component character
S LA7C=$E(LA7ECH,1),LA7SC=$E(LA7ECH,4)
;
; Parent result observation identifier in 1st component
I LA7OBX3'="" S $P(LA7Y,$E(LA7ECH,1),1)=$TR(LA7OBX3,LA7C,LA7SC)
;
; Parent sub-id in 2nd component
I LA7OBX4'="" S $P(LA7Y,$E(LA7ECH,1),2)=$TR(LA7OBX4,LA7C,LA7SC)
;
; Parent test result in 3rd component
I LA7OBX5'="" S $P(LA7Y,$E(LA7ECH,1),3)=$TR(LA7OBX5,LA7C,LA7SC)
;
Q
;
;
OBR29 ; Build OBR-29 sequence - Parent
;
S LA7Y=""
;
I $G(LA7PON)'="" D
. S LA7Z=$$CHKDATA^LA7VHLU3(LA7PON,LA7FS_LA7ECH)
. S $P(LA7Y,$E(LA7ECH,1),1)=LA7Z
;
I $G(LA7FON)'="" D
. S LA7Z=$$CHKDATA^LA7VHLU3(LA7FON,LA7FS_LA7ECH)
. S $P(LA7Y,$E(LA7ECH,1),2)=LA7Z
;
Q
;
;
OBRPF ; Build OBR-18,19,20,21 Placer/Filler #1/#2
;
S (LA7Y,LA7Z)="",LA7I=0
F S LA7I=$O(LA7X(LA7I)) Q:'LA7I S $P(LA7Z,"^",LA7I)=LA7X(LA7I)
S LA7Y=$$CHKDATA^LA7VHLU3(LA7Z,LA7FS_LA7ECH)
Q
;
;
OBR32 ; Build OBR-32 sequence - Principle Result Interpreter field
;
S LA7X=$$XCN^LA7VHLU9(LA7DUZ,LA7DIV,LA7FS,LA7ECH,1,2)
S $P(LA7PRI,$E(LA7ECH))=$P(LA7X,$E(LA7ECH,4),1,9)
I LA7DIV S $P(LA7PRI,$E(LA7ECH),7)=$$FACDNS^LA7VHLU2(LA7DIV,LA7FS,LA7ECH,2)
Q
;
;
OBR33 ; Build OBR-32 sequence - Assistant Result Interpreter field
;
S LA7X=$$XCN^LA7VHLU9(LA7DUZ,LA7DIV,LA7FS,LA7ECH,1,2)
S $P(LA7ARI,$E(LA7ECH))=$P(LA7X,$E(LA7ECH,4),1,9)
I LA7DIV S $P(LA7ARI,$E(LA7ECH),7)=$$FACDNS^LA7VHLU2(LA7DIV,LA7FS,LA7ECH,2)
Q
;
OBR34 ; Build OBR-34 sequence - Technician field
;
S LA7X=$$XCN^LA7VHLU9(LA7DUZ,LA7DIV,LA7FS,LA7ECH,1,1)
S $P(LA7TECH,$E(LA7ECH))=$P(LA7X,$E(LA7ECH,4),1,9)
I LA7DIV S $P(LA7TECH,$E(LA7ECH),7)=$$FACDNS^LA7VHLU2(LA7DIV,LA7FS,LA7ECH,2)
Q
;
;
OBR35 ; Build OBR-35 sequence - Transcriptionist field
;
S LA7X=$$XCN^LA7VHLU9(LA7DUZ,LA7DIV,LA7FS,LA7ECH,1,1)
S $P(LA7TSPT,$E(LA7ECH))=$P(LA7X,$E(LA7ECH,4),1,9)
I LA7DIV S $P(LA7TSPT,$E(LA7ECH),7)=$$FACDNS^LA7VHLU2(LA7DIV,LA7FS,LA7ECH,2)
Q
;
;
OBR44 ; Build OBR-44
;
S (LA7X,LA7Y,LA7Z)=""
;
I LA7VAL="" Q
;
; Send NLT result code
S LA764=$O(^LAM("E",LA7VAL,0))
I LA764 S LA7X=$P($G(^LAM(LA764,0)),"^")
;
; If suffixed and not setup then construct from primary and suffix code.
I LA7X="" D
. N LA7642
. S LA764=$O(^LAM("E",$P(LA7VAL,".")_".0000",0))
. I LA764 S LA7X=$$GET1^DIQ(64,LA764_",",.01,"I")
. S LA7642=$O(^LAB(64.2,"F","."_$P(LA7VAL,".",2),0))
. I LA764,LA7642 S LA7X=LA7X_"~"_$$GET1^DIQ(64.2,LA7642_",",.01,"I")
;
I LA7X'="" S LA7X=$$CHKDATA^LA7VHLU3(LA7X,LA7FS_LA7ECH)
S $P(LA7Z,$E(LA7ECH,1),1)=LA7VAL
S $P(LA7Z,$E(LA7ECH,1),2)=LA7X
S $P(LA7Z,$E(LA7ECH,1),3)="99VA64"
;S LA7X=$$GET1^DID(64,"","","PACKAGE REVISION DATA")
;S $P(LA7Z,$E(LA7ECH,1),7)=LA7X
S LA7Y=LA7Z
;
; Check for and build CPT code in primary, move NLT to alternate
I LA764="" Q
I '$D(^LAM("AD",LA764,"CPT")) Q
S LA7X=$O(^LAM("AD",LA764,"CPT",0))
S LA781=+$P($G(^LAM(LA764,4,LA7X,0)),"^")
S LA7X=$$CPT^ICPTCOD(LA781,DT,1)
S LA7Z=$P(LA7X,"^",2)
S $P(LA7Z,$E(LA7ECH,1),2)=$$CHKDATA^LA7VHLU3($P(LA7X,"^",3),LA7FS_LA7ECH)
S $P(LA7Z,$E(LA7ECH,1),3)=$S($P(LA7X,"^",5)="C":"C4",$P(LA7X,"^",5)="HCPCS":"HCPCS",1:"L")
S LA7Y=LA7Z_$E(LA7ECH,1)_$P(LA7Y,$E(LA7ECH,1),1,3)
;S $P(LA7Y,$E(LA7ECH,1),8)=$P(LA7Y,$E(LA7ECH,1),7)
;S $P(LA7Y,$E(LA7ECH,1),7)=$P(LA7X,"^",6)
;
Q
LA7VOBRA ;VA/DALOI/JMC - LAB OBR segment builder (cont'd); 13-Aug-2013 09:09 ; MKK
+1 ;;5.2;AUTOMATED LAB INSTRUMENTS;**46,1018,64,1027,68,1033**;NOV 01, 1997
+2 ;
+3 QUIT
+4 ;
+5 ;
OBR2 ; Build OBR-2 sequence - placer's specimen id
+1 ;
+2 SET LA7ID=$$CHKDATA^LA7VHLU3(LA7ID,LA7FS_LA7ECH)
+3 SET $PIECE(LA7Y,$EXTRACT(LA7ECH,1),1)=LA7ID
+4 IF $GET(LA7ID("NMSP"))'=""
SET $PIECE(LA7Y,$EXTRACT(LA7ECH,1),2)=LA7ID("NMSP")
+5 IF $GET(LA7ID("SITE"))'=""
Begin DoDot:1
+6 SET LA7X=$$FACDNS^LA7VHLU2(LA7ID("SITE"),LA7FS,LA7ECH,1)
+7 SET $PIECE(LA7Y,$EXTRACT(LA7ECH),3)=$PIECE(LA7X,$EXTRACT(LA7ECH),2)
+8 SET $PIECE(LA7Y,$EXTRACT(LA7ECH),4)=$PIECE(LA7X,$EXTRACT(LA7ECH),3)
End DoDot:1
+9 QUIT
+10 ;
+11 ;
OBR3 ; Build OBR-3 sequence - filler's specimen id
+1 ;
+2 SET LA7ID=$$CHKDATA^LA7VHLU3(LA7ID,LA7FS_LA7ECH)
+3 SET $PIECE(LA7Y,$EXTRACT(LA7ECH,1),1)=LA7ID
+4 IF $GET(LA7ID("NMSP"))'=""
SET $PIECE(LA7Y,$EXTRACT(LA7ECH,1),2)=LA7ID("NMSP")
+5 IF $GET(LA7ID("SITE"))'=""
Begin DoDot:1
+6 SET LA7X=$$FACDNS^LA7VHLU2(LA7ID("SITE"),LA7FS,LA7ECH,1)
+7 SET $PIECE(LA7Y,$EXTRACT(LA7ECH),3)=$PIECE(LA7X,$EXTRACT(LA7ECH),2)
+8 SET $PIECE(LA7Y,$EXTRACT(LA7ECH),4)=$PIECE(LA7X,$EXTRACT(LA7ECH),3)
End DoDot:1
+9 QUIT
+10 ;
+11 ;
OBR4 ; Build OBR-4 sequence - Universal service ID
+1 ;
+2 SET LA764=0
SET LA7Y=""
+3 ; specify component position - primary/alternate
+4 SET LA7COMP=0
+5 ;
+6 ; Send non-VA test codes as first coding system
+7 IF LA7ALT'=""
Begin DoDot:1
+8 NEW I
+9 FOR I=1:1:3
SET $PIECE(LA7Y,$EXTRACT(LA7ECH),LA7COMP+I)=$$CHKDATA^LA7VHLU3($PIECE(LA7ALT,"^",I),LA7FS_LA7ECH)
+10 SET LA7COMP=LA7COMP+I
End DoDot:1
+11 ;
+12 ; Send NLT test codes as primary unless non-VA codes then send as alternate code
+13 IF LA7NLT'=""
Begin DoDot:1
+14 SET LA764=$ORDER(^LAM("E",LA7NLT,0))
SET LA7Z=""
+15 IF LA764
SET LA7Z=$$GET1^DIQ(64,LA764_",",.01,"I")
+16 IF LA7Z=""
Begin DoDot:2
+17 NEW LA7642
+18 SET LA764=$ORDER(^LAM("E",$PIECE(LA7NLT,".")_".0000",0))
+19 IF LA764
SET LA7Z=$$GET1^DIQ(64,LA764_",",.01,"I")
+20 SET LA7642=$ORDER(^LAB(64.2,"F","."_$PIECE(LA7NLT,".",2),0))
+21 IF LA764
IF LA7642
SET LA7Z=LA7Z_"~"_$$GET1^DIQ(64.2,LA7642_",",.01,"I")
End DoDot:2
+22 SET $PIECE(LA7Y,$EXTRACT(LA7ECH),LA7COMP+1)=$$CHKDATA^LA7VHLU3(LA7NLT,LA7FS_LA7ECH)
+23 SET $PIECE(LA7Y,$EXTRACT(LA7ECH),LA7COMP+2)=$$CHKDATA^LA7VHLU3(LA7Z,LA7FS_LA7ECH)
+24 SET $PIECE(LA7Y,$EXTRACT(LA7ECH),LA7COMP+3)="99VA64"
+25 SET LA7COMP=LA7COMP+3
End DoDot:1
+26 ;
+27 ; Send file #60 test name if available and no alternate
+28 IF LA7COMP<4
IF LA760
Begin DoDot:1
+29 SET LA7TN=$$GET1^DIQ(60,LA760_",",.01)
+30 SET $PIECE(LA7Y,$EXTRACT(LA7ECH),LA7COMP+1)=LA760
+31 SET $PIECE(LA7Y,$EXTRACT(LA7ECH),LA7COMP+2)=$$CHKDATA^LA7VHLU3(LA7TN,LA7FS_LA7ECH)
+32 SET $PIECE(LA7Y,$EXTRACT(LA7ECH),LA7COMP+3)="99VA60"
End DoDot:1
+33 ;
+34 QUIT
+35 ;
+36 ;
OBR9 ; Build OBR-9 sequence - collection volume
+1 ;
+2 ; Collection volume
+3 SET $PIECE(LA7Y,$EXTRACT(LA7ECH,1))=LA7VOL
+4 ;
+5 IF LA764061
Begin DoDot:1
+6 SET LA7IENS=LA764061_","
+7 DO GETS^DIQ(64.061,LA7IENS,".01;1","E","LA7Y")
+8 ; Collection Volume units code
+9 SET $PIECE(LA7X,$EXTRACT(LA7ECH,4),1)=$GET(LA7Y(64.061,LA7IENS,.01,"E"))
+10 ; Collection Volume units text
+11 SET $PIECE(LA7X,$EXTRACT(LA7ECH,4),2)=$$CHKDATA^LA7VHLU3($GET(LA7Y(64.061,LA7IENS,1,"E")),LA7FS_LA7ECH)
+12 ; LOINC coding system
+13 SET $PIECE(LA7X,$EXTRACT(LA7ECH,4),3)="LN"
+14 SET $PIECE(LA7Y,$EXTRACT(LA7ECH,1),2)=LA7X
End DoDot:1
+15 ;
+16 QUIT
+17 ;
+18 ;
OBR24 ; Build OBR-24 sequence - diagnostic service id
+1 ;
+2 ; Code non-MI subscripts
+3 IF $PIECE(LA7SS,"^")'="MI"
Begin DoDot:1
+4 SET LA7X=$PIECE(LA7SS,"^")
+5 SET LA7Y=$SELECT(LA7X="CH":"CH",LA7X="SP":"SP",LA7X="CY":"CP",LA7X="EM":"PAT",LA7X="AU":"PAT",LA7X="BB":"BLB",1:"LAB")
End DoDot:1
QUIT
+6 ;
+7 ; Code MI subscripts
+8 SET LA7X=$PIECE(LA7SS,"^",2)
+9 SET LA7Y=$SELECT(LA7X=11:"MB",LA7X=14:"PAR",LA7X=18:"MYC",LA7X=22:"MCB",LA7X=33:"VR",1:"MB")
+10 ;
+11 QUIT
+12 ;
+13 ;
OBR25 ; Build OBR-25 sequence - Result status
+1 ;
+2 SET LA7Y=""
+3 ;
+4 IF LA7FLAG="F"
SET LA7Y="F"
+5 IF LA7FLAG="P"
SET LA7Y="P"
+6 IF LA7FLAG="A"
SET LA7Y="A"
+7 IF LA7FLAG="C"
SET LA7Y="C"
+8 ;
+9 QUIT
+10 ;
+11 ;
OBR26 ; Build OBR-26 sequence - Parent result
+1 ;
+2 SET LA7Y=""
+3 ;
+4 ; Move component into sub-component position
+5 ; Translate component character to sub-component character
+6 SET LA7C=$EXTRACT(LA7ECH,1)
SET LA7SC=$EXTRACT(LA7ECH,4)
+7 ;
+8 ; Parent result observation identifier in 1st component
+9 IF LA7OBX3'=""
SET $PIECE(LA7Y,$EXTRACT(LA7ECH,1),1)=$TRANSLATE(LA7OBX3,LA7C,LA7SC)
+10 ;
+11 ; Parent sub-id in 2nd component
+12 IF LA7OBX4'=""
SET $PIECE(LA7Y,$EXTRACT(LA7ECH,1),2)=$TRANSLATE(LA7OBX4,LA7C,LA7SC)
+13 ;
+14 ; Parent test result in 3rd component
+15 IF LA7OBX5'=""
SET $PIECE(LA7Y,$EXTRACT(LA7ECH,1),3)=$TRANSLATE(LA7OBX5,LA7C,LA7SC)
+16 ;
+17 QUIT
+18 ;
+19 ;
OBR29 ; Build OBR-29 sequence - Parent
+1 ;
+2 SET LA7Y=""
+3 ;
+4 IF $GET(LA7PON)'=""
Begin DoDot:1
+5 SET LA7Z=$$CHKDATA^LA7VHLU3(LA7PON,LA7FS_LA7ECH)
+6 SET $PIECE(LA7Y,$EXTRACT(LA7ECH,1),1)=LA7Z
End DoDot:1
+7 ;
+8 IF $GET(LA7FON)'=""
Begin DoDot:1
+9 SET LA7Z=$$CHKDATA^LA7VHLU3(LA7FON,LA7FS_LA7ECH)
+10 SET $PIECE(LA7Y,$EXTRACT(LA7ECH,1),2)=LA7Z
End DoDot:1
+11 ;
+12 QUIT
+13 ;
+14 ;
OBRPF ; Build OBR-18,19,20,21 Placer/Filler #1/#2
+1 ;
+2 SET (LA7Y,LA7Z)=""
SET LA7I=0
+3 FOR
SET LA7I=$ORDER(LA7X(LA7I))
IF 'LA7I
QUIT
SET $PIECE(LA7Z,"^",LA7I)=LA7X(LA7I)
+4 SET LA7Y=$$CHKDATA^LA7VHLU3(LA7Z,LA7FS_LA7ECH)
+5 QUIT
+6 ;
+7 ;
OBR32 ; Build OBR-32 sequence - Principle Result Interpreter field
+1 ;
+2 SET LA7X=$$XCN^LA7VHLU9(LA7DUZ,LA7DIV,LA7FS,LA7ECH,1,2)
+3 SET $PIECE(LA7PRI,$EXTRACT(LA7ECH))=$PIECE(LA7X,$EXTRACT(LA7ECH,4),1,9)
+4 IF LA7DIV
SET $PIECE(LA7PRI,$EXTRACT(LA7ECH),7)=$$FACDNS^LA7VHLU2(LA7DIV,LA7FS,LA7ECH,2)
+5 QUIT
+6 ;
+7 ;
OBR33 ; Build OBR-32 sequence - Assistant Result Interpreter field
+1 ;
+2 SET LA7X=$$XCN^LA7VHLU9(LA7DUZ,LA7DIV,LA7FS,LA7ECH,1,2)
+3 SET $PIECE(LA7ARI,$EXTRACT(LA7ECH))=$PIECE(LA7X,$EXTRACT(LA7ECH,4),1,9)
+4 IF LA7DIV
SET $PIECE(LA7ARI,$EXTRACT(LA7ECH),7)=$$FACDNS^LA7VHLU2(LA7DIV,LA7FS,LA7ECH,2)
+5 QUIT
+6 ;
OBR34 ; Build OBR-34 sequence - Technician field
+1 ;
+2 SET LA7X=$$XCN^LA7VHLU9(LA7DUZ,LA7DIV,LA7FS,LA7ECH,1,1)
+3 SET $PIECE(LA7TECH,$EXTRACT(LA7ECH))=$PIECE(LA7X,$EXTRACT(LA7ECH,4),1,9)
+4 IF LA7DIV
SET $PIECE(LA7TECH,$EXTRACT(LA7ECH),7)=$$FACDNS^LA7VHLU2(LA7DIV,LA7FS,LA7ECH,2)
+5 QUIT
+6 ;
+7 ;
OBR35 ; Build OBR-35 sequence - Transcriptionist field
+1 ;
+2 SET LA7X=$$XCN^LA7VHLU9(LA7DUZ,LA7DIV,LA7FS,LA7ECH,1,1)
+3 SET $PIECE(LA7TSPT,$EXTRACT(LA7ECH))=$PIECE(LA7X,$EXTRACT(LA7ECH,4),1,9)
+4 IF LA7DIV
SET $PIECE(LA7TSPT,$EXTRACT(LA7ECH),7)=$$FACDNS^LA7VHLU2(LA7DIV,LA7FS,LA7ECH,2)
+5 QUIT
+6 ;
+7 ;
OBR44 ; Build OBR-44
+1 ;
+2 SET (LA7X,LA7Y,LA7Z)=""
+3 ;
+4 IF LA7VAL=""
QUIT
+5 ;
+6 ; Send NLT result code
+7 SET LA764=$ORDER(^LAM("E",LA7VAL,0))
+8 IF LA764
SET LA7X=$PIECE($GET(^LAM(LA764,0)),"^")
+9 ;
+10 ; If suffixed and not setup then construct from primary and suffix code.
+11 IF LA7X=""
Begin DoDot:1
+12 NEW LA7642
+13 SET LA764=$ORDER(^LAM("E",$PIECE(LA7VAL,".")_".0000",0))
+14 IF LA764
SET LA7X=$$GET1^DIQ(64,LA764_",",.01,"I")
+15 SET LA7642=$ORDER(^LAB(64.2,"F","."_$PIECE(LA7VAL,".",2),0))
+16 IF LA764
IF LA7642
SET LA7X=LA7X_"~"_$$GET1^DIQ(64.2,LA7642_",",.01,"I")
End DoDot:1
+17 ;
+18 IF LA7X'=""
SET LA7X=$$CHKDATA^LA7VHLU3(LA7X,LA7FS_LA7ECH)
+19 SET $PIECE(LA7Z,$EXTRACT(LA7ECH,1),1)=LA7VAL
+20 SET $PIECE(LA7Z,$EXTRACT(LA7ECH,1),2)=LA7X
+21 SET $PIECE(LA7Z,$EXTRACT(LA7ECH,1),3)="99VA64"
+22 ;S LA7X=$$GET1^DID(64,"","","PACKAGE REVISION DATA")
+23 ;S $P(LA7Z,$E(LA7ECH,1),7)=LA7X
+24 SET LA7Y=LA7Z
+25 ;
+26 ; Check for and build CPT code in primary, move NLT to alternate
+27 IF LA764=""
QUIT
+28 IF '$DATA(^LAM("AD",LA764,"CPT"))
QUIT
+29 SET LA7X=$ORDER(^LAM("AD",LA764,"CPT",0))
+30 SET LA781=+$PIECE($GET(^LAM(LA764,4,LA7X,0)),"^")
+31 SET LA7X=$$CPT^ICPTCOD(LA781,DT,1)
+32 SET LA7Z=$PIECE(LA7X,"^",2)
+33 SET $PIECE(LA7Z,$EXTRACT(LA7ECH,1),2)=$$CHKDATA^LA7VHLU3($PIECE(LA7X,"^",3),LA7FS_LA7ECH)
+34 SET $PIECE(LA7Z,$EXTRACT(LA7ECH,1),3)=$SELECT($PIECE(LA7X,"^",5)="C":"C4",$PIECE(LA7X,"^",5)="HCPCS":"HCPCS",1:"L")
+35 SET LA7Y=LA7Z_$EXTRACT(LA7ECH,1)_$PIECE(LA7Y,$EXTRACT(LA7ECH,1),1,3)
+36 ;S $P(LA7Y,$E(LA7ECH,1),8)=$P(LA7Y,$E(LA7ECH,1),7)
+37 ;S $P(LA7Y,$E(LA7ECH,1),7)=$P(LA7X,"^",6)
+38 ;
+39 QUIT