DVBCTRN1 ;ALB/JLU;AMIE link routine;12/21/92
;;2.7;AMIE;**12,193**;Apr 10, 1995;Build 84
NSFT K DVBCHK
I $S('$D(DVBCDFN):1,DVBCDFN']"":1,1:0) S DVBCHK="-1^Patient's DFN not defined OR is null" Q
I $S('$D(DVBCXM):1,DVBCXM']"":1,1:0) S DVBCHK="-2^Exam not defined OR is null" Q
S DVBCDFN1=$O(^DVB(396.3,"B",DVBCDFN,0))
I 'DVBCDFN1 S DVBCHK="-3^No 2507 request for this patient" Q
;for loop to handle multiple exams with same name
N FOUND,STOP,TOXM
S (DVBCXM1,FOUND,STOP)=0
F S DVBCXM1=$O(^DVB(396.6,"B",$E(DVBCXM,1,30),DVBCXM1)) Q:(DVBCXM1="")!(+$G(DVBCHK)<0) D
.Q:($P(^DVB(396.6,DVBCXM1,0),"^"))'=DVBCXM
.S FOUND=1 ;an entry does exist for exam passed in DVBCXM
.S DVBCOXM=$O(^DVB(396.4,"APS",DVBCDFN,DVBCXM1,"O",0))
.I STOP,DVBCOXM'="" S DVBCHK="-8^More than one open exam" Q
.I STOP,DVBCOXM="" Q
.; ^ multiple exams with same name but different pointer values.
.I $O(^DVB(396.4,"APS",DVBCDFN,DVBCXM1,"O",DVBCOXM)) S DVBCHK="-8^More than one open exam" Q
.I DVBCOXM'="" S STOP=1,TOXM=DVBCOXM
.; ^open exam found
I +$G(DVBCHK)<0 Q
I 'FOUND S DVBCHK="-4^No Exam by that name in the 2507 Exam file" Q
I 'STOP S DVBCHK="-6^No open Exam for data given" Q
S DVBCOXM=TOXM
I '$D(^DVB(396.4,DVBCOXM,0)) S DVBCHK="-7^Exam cross reference is bad" Q
S DVBCX=$P(^DVB(396.4,DVBCOXM,0),U,2)
I '$$OREQ($P(^DVB(396.3,DVBCX,0),"^",18)) S DVBCHK="-5^No open requests for data given" Q
S DVBCHK="396.3:"_DVBCX_":"_396.4_":"_DVBCOXM_";^Soft Link entry"
Q
;
OREQ(DVBX) ;
;This function will check to see if there is an open request.
;DVBCX should contain the REQUEST STATUS.
;
;AJF; 2507 Request Status Conversion
S DVBX=$$RSTAT^DVBCUTL8(DVBX)
I $S(DVBX'="P"&(DVBX'="S")&(DVBX'="T")&(DVBX'="NT"):1,1:0) Q 0
Q 1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDVBCTRN1 1764 printed Dec 13, 2024@01:49 Page 2
DVBCTRN1 ;ALB/JLU;AMIE link routine;12/21/92
+1 ;;2.7;AMIE;**12,193**;Apr 10, 1995;Build 84
NSFT KILL DVBCHK
+1 IF $SELECT('$DATA(DVBCDFN):1,DVBCDFN']"":1,1:0)
SET DVBCHK="-1^Patient's DFN not defined OR is null"
QUIT
+2 IF $SELECT('$DATA(DVBCXM):1,DVBCXM']"":1,1:0)
SET DVBCHK="-2^Exam not defined OR is null"
QUIT
+3 SET DVBCDFN1=$ORDER(^DVB(396.3,"B",DVBCDFN,0))
+4 IF 'DVBCDFN1
SET DVBCHK="-3^No 2507 request for this patient"
QUIT
+5 ;for loop to handle multiple exams with same name
+6 NEW FOUND,STOP,TOXM
+7 SET (DVBCXM1,FOUND,STOP)=0
+8 FOR
SET DVBCXM1=$ORDER(^DVB(396.6,"B",$EXTRACT(DVBCXM,1,30),DVBCXM1))
if (DVBCXM1="")!(+$GET(DVBCHK)<0)
QUIT
Begin DoDot:1
+9 if ($PIECE(^DVB(396.6,DVBCXM1,0),"^"))'=DVBCXM
QUIT
+10 ;an entry does exist for exam passed in DVBCXM
SET FOUND=1
+11 SET DVBCOXM=$ORDER(^DVB(396.4,"APS",DVBCDFN,DVBCXM1,"O",0))
+12 IF STOP
IF DVBCOXM'=""
SET DVBCHK="-8^More than one open exam"
QUIT
+13 IF STOP
IF DVBCOXM=""
QUIT
+14 ; ^ multiple exams with same name but different pointer values.
+15 IF $ORDER(^DVB(396.4,"APS",DVBCDFN,DVBCXM1,"O",DVBCOXM))
SET DVBCHK="-8^More than one open exam"
QUIT
+16 IF DVBCOXM'=""
SET STOP=1
SET TOXM=DVBCOXM
+17 ; ^open exam found
End DoDot:1
+18 IF +$GET(DVBCHK)<0
QUIT
+19 IF 'FOUND
SET DVBCHK="-4^No Exam by that name in the 2507 Exam file"
QUIT
+20 IF 'STOP
SET DVBCHK="-6^No open Exam for data given"
QUIT
+21 SET DVBCOXM=TOXM
+22 IF '$DATA(^DVB(396.4,DVBCOXM,0))
SET DVBCHK="-7^Exam cross reference is bad"
QUIT
+23 SET DVBCX=$PIECE(^DVB(396.4,DVBCOXM,0),U,2)
+24 IF '$$OREQ($PIECE(^DVB(396.3,DVBCX,0),"^",18))
SET DVBCHK="-5^No open requests for data given"
QUIT
+25 SET DVBCHK="396.3:"_DVBCX_":"_396.4_":"_DVBCOXM_";^Soft Link entry"
+26 QUIT
+27 ;
OREQ(DVBX) ;
+1 ;This function will check to see if there is an open request.
+2 ;DVBCX should contain the REQUEST STATUS.
+3 ;
+4 ;AJF; 2507 Request Status Conversion
+5 SET DVBX=$$RSTAT^DVBCUTL8(DVBX)
+6 IF $SELECT(DVBX'="P"&(DVBX'="S")&(DVBX'="T")&(DVBX'="NT"):1,1:0)
QUIT 0
+7 QUIT 1