source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORQQRA.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 2.9 KB
Line 
1ORQQRA ; slc/CLA - Functions which return patient radiology/nuclear med data ;12/15/97
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**9**;Dec 17, 1997
3LIST(ORY,ORPT,ORSDT,OREDT,ORMAX) ; return patient's radiological procedures (max. number) between start date/time and end date/time:
4 ;ORY: return variable, results are returned in the format: radiology id^
5 ; procedure name^diagnostic code^report status^abnormal flag
6 ;ORPT: patient identifier from Patient File [#2]
7 ;ORSDT: start date/time in Fileman format
8 ;OREDT: end date/time in Fileman format
9 ;ORMAX: maximum number of procedures to return
10 N DIFF,ORSRV,ORLOC
11 ;
12 ;get patient's location flag (INPATIENT ONLY - outpt locations cannot be
13 ;reliably determined, and many simultaneous outpt locations can occur):
14 I +$G(ORPT)>0 D
15 .N DFN S DFN=ORPT,VA200="" D OERR^VADPT
16 .I +$G(VAIN(4))>0 S ORLOC=+$G(^DIC(42,+$G(VAIN(4)),44))
17 .K VA200,VAIN
18 ;
19 S ORSRV=$G(^VA(200,DUZ,5)) I +ORSRV>0 S ORSRV=$P(ORSRV,U)
20 I '$L($G(ORSDT)) D
21 .S DIFF=$$GET^XPAR("USR^LOC.`"_$G(ORLOC)_"^SRV.`"_$G(ORSRV)_"^DIV^SYS^PKG","ORQQRA SEARCH RANGE",1,"E")
22 .D DT^DILF("T","T-"_DIFF,.ORSDT,"","")
23 .I ORSDT=-1 S ORY(1)="^Error in date range." Q
24 I '$L($G(OREDT)) D NOW^%DTC S OREDT=+% K %
25 K ^TMP($J,"RAE1")
26 D EN1^RAO7PC1(ORPT,ORSDT,OREDT,ORMAX)
27 N I,RAID S I=1,RAID=0
28 F S RAID=$O(^TMP($J,"RAE1",+ORPT,RAID)) Q:RAID<1 D
29 .S ORY(I)=RAID_"^"_^TMP($J,"RAE1",+ORPT,RAID),I=I+1
30 K ^TMP($J,"RAE1")
31 Q
32DETAIL(Y,PATIENT,INVDT,CASE) ; RETURN DETAILED NARRATIVE FOR A RAD PROC
33 N RADID S RADID=PATIENT_"^"_INVDT_"^"_CASE
34 K ^TMP($J,"RAE2")
35 D EN3^RAO7PC1(RADID)
36 N PROC,CASE,I,J,CR S PROC="",CASE="",I=1,J=0,CR=$CHAR(13)
37 S CASE=$O(^TMP($J,"RAE2",PATIENT,CASE)) Q:CASE="" D
38 .S PROC=$O(^TMP($J,"RAE2",PATIENT,CASE,PROC)) Q:PROC="" D
39 ..S Y(I)="Procedure: "_PROC_" Report Status: "_$P(^(PROC),U)
40 ..S Y(I)=Y(I)_" Case No. "_CASE,I=I+1
41 ..S Y(I)=CR,I=I+1,Y(I)="Diagnostic Code: "_^(PROC,"D",1),I=I+1
42 ..I $G(^TMP($J,"RAE2",PATIENT,CASE,PROC,"I",1))'="" D
43 ...S Y(I)=CR,I=I+1,Y(I)="Impression: ",I=I+1
44 ...F S J=$O(^TMP($J,"RAE2",PATIENT,CASE,PROC,"I",J)) Q:J<1 S Y(I)=^(J),I=I+1
45 ..I $G(^TMP($J,"RAE2",PATIENT,CASE,PROC,"R",1))'="" D
46 ...S Y(I)=CR,I=I+1,Y(I)="Report: ",I=I+1,J=0
47 ...F S J=$O(^TMP($J,"RAE2",PATIENT,CASE,PROC,"R",J)) Q:J<1 S Y(I)=^(J),I=I+1
48 ..S Y(I)=CR,I=I+1,Y(I)="Verified by: "_$P($G(^TMP($J,"RAE2",PATIENT,CASE,PROC,"V")),U,2)
49 K ^TMP($J,"RAE2")
50 Q
51SEVEN(Y,PATIENT) ; RETURN PATIENT'S RADIOLOGY PROCEDURES FOR THE PAST SEVEN DAYS
52 K ^TMP($J,"RAE7")
53 D EN2^RAO7PC1(PATIENT)
54 N I,RAID S I=1,RAID=0
55 F S RAID=$O(^TMP($J,"RAE7",+PATIENT,RAID)) Q:RAID<1 D
56 .S Y(I)=RAID_"^"_^TMP($J,"RAE7",+PATIENT,RAID),I=I+1
57 K ^TMP($J,"RAE7")
58 Q
59CM(ORQOI) ; extrinic funct. returns contrast media used by the procedure
60 ; and/or if the procedure is a cholecystogram
61 ; B = barium, M = unspecified contrast media, C = cholecystogram
62 N CMT
63 S CMT=$G(^ORD(101.43,ORQOI,"RA"))
64 I $L($G(CMT)) S CMT=$P(CMT,U)
65 Q CMT
Note: See TracBrowser for help on using the repository browser.