source: WorldVistAEHR/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORX006.m@ 1714

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

initial load of WorldVistAEHR

File size: 3.7 KB
RevLine 
[613]1RORX006 ;HCIOFO/BH,SG - LAB UTILIZATION ; 11/8/05 8:53am
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 Q
5 ;
6 ;***** OUTPUTS THE REPORT HEADER
7 ;
8 ; PARTAG Reference (IEN) to the parent tag
9 ;
10 ; Return Values:
11 ; <0 Error code
12 ; >0 IEN of the HEADER element
13 ;
14HEADER(PARTAG) ;
15 ;;LABTESTS(#,NAME,NP,NR,MAXNRPP,MAXNP)
16 ;;PATIENTS(#,NAME,LAST4,DOD,NO,NR,NDT)
17 ;;RESULTS(NP,NR)
18 ;
19 N HEADER,RC
20 S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
21 Q:HEADER<0 HEADER
22 S RC=$$TBLDEF^RORXU002("HEADER^RORX006",HEADER)
23 Q $S(RC<0:RC,1:HEADER)
24 ;
25 ;
26 ;***** COMPILES THE "LAB UTILIZATION" REPORT
27 ; REPORT CODE: 006
28 ;
29 ; .RORTSK Task number and task parameters
30 ;
31 ; The ^TMP("RORX006",$J) global node is used by this function.
32 ;
33 ; ^TMP("RORX006",$J,
34 ;
35 ; "ORD", Total number of orders
36 ; NumOfOrd, Number of patients
37 ; PatientName,
38 ; DFN)
39 ;
40 ; "PAT", Total number of patients
41 ; DFN, Patient descriptor
42 ; 01: Last 4 digits of SSN
43 ; 02: Date of death
44 ; "O") Number of orders
45 ; "R", Results
46 ; ^01: Number of results
47 ; ^02: Number of different tests
48 ; TestIEN) Number of results
49 ;
50 ; "RES", Totals
51 ; ^01: Total number of results
52 ; ^02: Number of different tests
53 ; TestIEN,
54 ; "M") Maximum
55 ; ^01: Maximum number of results
56 ; ^02: Number of patients
57 ; "P") Number of patients
58 ; "R") Number of results
59 ; "B",
60 ; NumOfRes,
61 ; TestName,
62 ; TestIEN)
63 ;
64 ; "RES1",
65 ; NumOfResults, Number of patients
66 ; PatientName,
67 ; DFN)
68 ;
69 ; Return Values:
70 ; <0 Error code
71 ; 0 Ok
72 ;
73LABUTL(RORTSK) ;
74 N ROREDT ; End date
75 N ROREDT1 ; End date + 1 day
76 N RORLTST ; Closed root of the list of lab tests
77 N RORREG ; Registry IEN
78 N RORSDT ; Start date
79 ;
80 N ECNT,RC,REPORT,SFLAGS,TMP
81 K ^TMP("RORX006",$J)
82 S RORLTST="",(ECNT,RC)=0
83 ;--- Root node of the report
84 S REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
85 Q:REPORT<0 REPORT
86 ;
87 D
88 . ;--- Get and prepare the report parameters
89 . S RORREG=$$PARAM^RORTSK01("REGIEN")
90 . S RC=$$PARAMS(REPORT,.RORSDT,.ROREDT,.SFLAGS) Q:RC<0
91 . S ROREDT1=$$FMADD^XLFDT(ROREDT\1,1)
92 . ;--- Report header
93 . S RC=$$HEADER(REPORT) Q:RC<0
94 . ;--- Query the registry
95 . D TPPSETUP^RORTSK01(70)
96 . S RC=$$QUERY^RORX006A(SFLAGS)
97 . I RC Q:RC<0 S ECNT=ECNT+RC
98 . ;--- Sort the data
99 . D TPPSETUP^RORTSK01(15)
100 . S RC=$$SORT^RORX006A()
101 . I RC Q:RC<0 S ECNT=ECNT+RC
102 . ;--- Store the results
103 . D TPPSETUP^RORTSK01(15)
104 . S RC=$$STORE^RORX006C(REPORT)
105 . I RC Q:RC<0 S ECNT=ECNT+RC
106 ;
107 ;--- Cleanup
108 D FREE^RORTMP(RORLTST)
109 K ^TMP("RORX006",$J)
110 Q $S(RC<0:RC,ECNT>0:-43,1:0)
111 ;
112 ;***** OUTPUTS PARAMETERS TO THE REPORT
113 ;
114 ; PARTAG Reference (IEN) to the parent tag
115 ;
116 ; [.STDT] Start and end dates of the report
117 ; [.ENDT] are returned via these parameters
118 ;
119 ; [.FLAGS] Flags for the $$SKIP^RORXU005 are
120 ; returned via this parameter
121 ;
122 ; Return Values:
123 ; <0 Error code
124 ; >0 IEN of the PARAMETERS element
125 ;
126PARAMS(PARTAG,STDT,ENDT,FLAGS) ;
127 N PARAMS,TMP
128 S PARAMS=$$PARAMS^RORXU002(.RORTSK,PARTAG,.STDT,.ENDT,.FLAGS)
129 Q:PARAMS<0 PARAMS
130 ;--- Additional parameters
131 F NAME="MAXUTNUM","MINRPNUM" D
132 . S TMP=$$PARAM^RORTSK01(NAME)
133 . D:TMP'="" ADDVAL^RORTSK11(RORTSK,NAME,TMP,PARAMS)
134 ;--- Process the list of Lab tests
135 S TMP=$$LTLST^RORXU006(.RORTSK,PARAMS,.RORLTST) Q:TMP<0 TMP
136 ;---
137 Q PARAMS
Note: See TracBrowser for help on using the repository browser.