source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RASETU.m@ 1635

Last change on this file since 1635 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.3 KB
RevLine 
[613]1RASETU ;HISC/DAD-Determine Order Status for an Exam Set ;6/17/97 11:17
2 ;;5.0;Radiology/Nuclear Medicine;**15**;Mar 16, 1998
3 ;
4 ;Routine reads through all cases generated from a single order
5 ;to gather information about the case statuses needed to determine
6 ;what status the order should be updated to
7 ;Input: RADFN=Patient ien <-> RAOIFN=order IEN
8 ;Output: RASTATUS array with status info about exam set passed back
9 ; format: min status_"^"_max status_"^"_$S(All_Statuses=0:1,1:0)
10EN1(RAOIFN,RADFN) ;
11 Q:'($D(^RADPT("AO",RAOIFN,RADFN))\10) "^^"
12 ; save current RACNI so we'd know which exam to skip
13 ; in the loop below if Exam Deletion is being processed, because
14 ; 1. the exam node hasn't been killed off yet,
15 ; 2. the exam node may have a non-cancelled exam status,
16 ; which would throw off the loop calculation below
17 N RACNISAV S RACNISAV=$G(RACNI)
18 ;
19 N RACNI,RADTI,RAORDER,RAPROC,RASTATUS
20 S RAORDER=$G(^RAO(75.1,RAOIFN,0))
21 I RAORDER="" Q "^^"
22 S RAPROC=+$P(RAORDER,U,2) ; Procedure IEN
23 S RASTATUS("ORD")=$P(RAORDER,U,5) ; Initial status
24 S RASTATUS("MAX")=-1 ; Largest status found
25 S RASTATUS("MIN")=10 ; Smallest non-zero status found
26 S RASTATUS("NUL")=1 ; $S(All_Statuses=0:1,1:0)
27 ;
28 S RADTI=0
29 F S RADTI=$O(^RADPT("AO",RAOIFN,RADFN,RADTI)) Q:RADTI'>0 D
30 . S RACNI=0
31 . F S RACNI=$O(^RADPT("AO",RAOIFN,RADFN,RADTI,RACNI)) Q:RACNI'>0 D
32 .. I $D(RADELFLG),RACNISAV=RACNI Q ;skip if Exam Deletion
33 .. S RASTATUS=+$P($G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)),U,3)
34 .. S RASTATUS(0)=$P($G(^RA(72,RASTATUS,0)),U,3) Q:RASTATUS(0)=""
35 .. I RASTATUS(0)>RASTATUS("MAX") S RASTATUS("MAX")=RASTATUS(0)
36 .. I (RASTATUS(0)),(RASTATUS(0)<RASTATUS("MIN")) D
37 ... S RASTATUS("MIN")=RASTATUS(0)
38 ... Q
39 .. I RASTATUS(0)>0 S RASTATUS("NUL")=0
40 .. Q
41 . Q
42 Q RASTATUS("MIN")_"^"_RASTATUS("MAX")_"^"_RASTATUS("NUL")
43 ;
44PARNT(RAOIFN,RADFN) ; Based on the patient and the order number, determine
45 ; if the exams are part of an exam set.
46 ; Input: 'RAOIFN' -> Order # 'RADFN' -> Patient ien
47 ; Output: $S(Exam Set:1,1:0)
48 ;
49 Q:'($D(^RADPT("AO",RAOIFN,RADFN))\10) 0
50 N RADTI,RARXM
51 S RADTI=+$O(^RADPT("AO",RAOIFN,RADFN,0)) Q:'RADTI 0
52 S RARXM(0)=$G(^RADPT(RADFN,"DT",RADTI,0))
53 Q +$P(RARXM(0),"^",5)
Note: See TracBrowser for help on using the repository browser.