source: WorldVistAEHR/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORX016.m@ 702

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

initial load of WorldVistAEHR

File size: 3.4 KB
RevLine 
[613]1RORX016 ;HCIOFO/BH,SG - OUTPATIENT UTILIZATION ; 10/14/05 2:06pm
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 ;;CLINICS(#,STOP,NAME,NP,NV,NSC)
16 ;;HU_STOPS(#,NAME,LAST4,NV,NSC,NDS)
17 ;;STOPS(NP,NSC)
18 ;
19 N HEADER,RC
20 S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
21 Q:HEADER<0 HEADER
22 S RC=$$TBLDEF^RORXU002("HEADER^RORX016",HEADER)
23 Q $S(RC<0:RC,1:HEADER)
24 ;
25 ;
26 ;***** COMPILES THE "OUTPATIENT UTILIZATION" REPORT
27 ; REPORT CODE: 016
28 ;
29 ; .RORTSK Task number and task parameters
30 ;
31 ; The ^TMP("RORX016",$J) global node is used by this function.
32 ;
33 ; ^TMP("RORX016",$J,
34 ;
35 ; "OP", Number of outpatients
36 ; DFN, Patient's data
37 ; ^01: Number of stops
38 ; ^02: Number of different stops
39 ; ^03: Last 4 digits of SSN
40 ; ^04: Number of visits
41 ; Children of this node are KILL'ed by
42 ; the $$TOTALS^RORX016B function.
43 ; Date, Number of stops associated with the visit
44 ; StopCode) Quantity
45 ;
46 ; "OPS", Totals
47 ; ^01: Total number of stops
48 ; ^02: Number of different stops
49 ; StopCode, Name of the Clinic Stop Code
50 ; "P") Number of patients
51 ; "S") Quantity
52 ; "V") Number of visits
53 ;
54 ; "OPS1",
55 ; NumOfStops, Number of patients
56 ; PatientName,
57 ; DFN)
58 ;
59 ; "OPV") Total number of visits
60 ;
61 ; Return Values:
62 ; <0 Error code
63 ; 0 Ok
64 ;
65OPUTL(RORTSK) ;
66 N RORDIV ; List of division IEN's
67 N ROREDT ; End date
68 N RORREG ; Registry IEN
69 N RORSDT ; Start date
70 ;
71 N ECNT,RC,REPORT,SFLAGS,TMP
72 S (ECNT,RC)=0 K ^TMP("RORX016",$J)
73 ;--- Root node of the report
74 S REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
75 Q:REPORT<0 REPORT
76 ;
77 ;--- Get and prepare the report parameters
78 S RORREG=$$PARAM^RORTSK01("REGIEN")
79 S RC=$$PARAMS(REPORT,.RORSDT,.ROREDT,.SFLAGS) Q:RC<0 RC
80 ;
81 ;--- Report header
82 S RC=$$HEADER(REPORT) Q:RC<0 RC
83 ;
84 D
85 . ;--- Query the registry
86 . D TPPSETUP^RORTSK01(70)
87 . S RC=$$QUERY^RORX016A(SFLAGS)
88 . I RC Q:RC<0 S ECNT=ECNT+RC
89 . ;--- Sort the data
90 . D TPPSETUP^RORTSK01(15)
91 . S RC=$$SORT^RORX016B()
92 . I RC Q:RC<0 S ECNT=ECNT+RC
93 . ;--- Store the results
94 . D TPPSETUP^RORTSK01(15)
95 . S RC=$$STORE^RORX016C(REPORT)
96 . I RC Q:RC<0 S ECNT=ECNT+RC
97 ;
98 ;--- Cleanup
99 K ^TMP("RORX016",$J)
100 Q $S(RC<0:RC,ECNT>0:-43,1:0)
101 ;
102 ;***** OUTPUTS THE PARAMETERS TO THE REPORT
103 ;
104 ; PARTAG Reference (IEN) to the parent tag
105 ;
106 ; [.STDT] Start and end dates of the report
107 ; [.ENDT] are returned via these parameters
108 ;
109 ; [.FLAGS] Flags for the $$SKIP^RORXU005 are
110 ; returned via this parameter
111 ;
112 ; Return Values:
113 ; <0 Error code
114 ; >0 IEN of the PARAMETERS element
115 ;
116PARAMS(PARTAG,STDT,ENDT,FLAGS) ;
117 N PARAMS,TMP
118 S PARAMS=$$PARAMS^RORXU002(.RORTSK,PARTAG,.STDT,.ENDT,.FLAGS)
119 Q:PARAMS<0 PARAMS
120 ;--- Process the list of divisions
121 S TMP=$$DIVLST^RORXU006(.RORTSK,PARAMS)
122 Q:TMP<0 TMP
123 ;--- Additional parameters
124 F NAME="MAXUTNUM" D
125 . S TMP=$$PARAM^RORTSK01(NAME)
126 . D:TMP'="" ADDVAL^RORTSK11(RORTSK,NAME,TMP,PARAMS)
127 ;---
128 Q PARAMS
Note: See TracBrowser for help on using the repository browser.