source: FOIAVistA/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORX009.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 5.0 KB
Line 
1RORX009 ;HCIOFO/SG - PHARMACY PRESCRIPTION UTILIZATION ; 11/16/05 10:49am
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 ;;DOSES(NP,IPNRX)^I $$PARAM^RORTSK01("PATIENTS","INPATIENT")
16 ;;DRUGS_DOSES(#,NAME,NP,IPNRX,MAXNRPP,MAXNP)
17 ;;DRUGS_FILLS(#,NAME,NP,OPNRX,MAXNRPP,MAXNP)
18 ;;FILLS(NP,OPNRX)^I $$PARAM^RORTSK01("PATIENTS","OUTPATIENT")
19 ;;HU_DOSES(#,NAME,LAST4,DOD,IPNRX,ND)^I $$PARAM^RORTSK01("PATIENTS","INPATIENT")
20 ;;HU_FILLS(#,NAME,LAST4,DOD,OPNRX,ND)^I $$PARAM^RORTSK01("PATIENTS","OUTPATIENT")
21 ;;HU_NRX(#,NAME,LAST4,DOD,OPNRX,IPNRX,ND)^I $$PARAM^RORTSK01("PATIENTS","OUTPATIENT"),$$PARAM^RORTSK01("PATIENTS","INPATIENT")
22 ;
23 N HEADER,RC
24 S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
25 Q:HEADER<0 HEADER
26 S RC=$$TBLDEF^RORXU002("HEADER^RORX009",HEADER)
27 Q $S(RC<0:RC,1:HEADER)
28 ;
29 ;***** OUTPUTS THE PARAMETERS TO THE REPORT
30 ;
31 ; PARTAG Reference (IEN) to the parent tag
32 ;
33 ; [.STDT] Start and end dates of the report
34 ; [.ENDT] are returned via these parameters
35 ;
36 ; [.FLAGS] Flags for the $$SKIP^RORXU005 are
37 ; returned via this parameter
38 ;
39 ; Return Values:
40 ; <0 Error code
41 ; >0 IEN of the PARAMETERS element
42 ;
43PARAMS(PARTAG,STDT,ENDT,FLAGS) ;
44 N PARAMS,TMP
45 S PARAMS=$$PARAMS^RORXU002(.RORTSK,PARTAG,.STDT,.ENDT,.FLAGS)
46 Q:PARAMS<0 PARAMS
47 ;--- Process the drug list and options
48 S TMP=$$DRUGLST^RORXU007(.RORTSK,PARAMS,.RORXL,.RORXGRP)
49 Q:TMP<0 TMP
50 ;--- Additional parameters
51 F NAME="MAXUTNUM" D
52 . S TMP=$$PARAM^RORTSK01(NAME)
53 . D:TMP'="" ADDVAL^RORTSK11(RORTSK,NAME,TMP,PARAMS)
54 ;---
55 Q PARAMS
56 ;
57 ;***** COMPILES THE "PHARMACY PRESCRIPTION UTILIZATION" REPORT
58 ; REPORT CODE: 009
59 ;
60 ; .RORTSK Task number and task parameters
61 ;
62 ; The ^TMP("RORX009",$J) global node is used by this function.
63 ;
64 ; ^TMP("RORX009",$J,
65 ;
66 ; "IP", Number of inpatients
67 ; DFN, Patient's data
68 ; ^01: Last 4 digits of SSN
69 ; ^02: Name
70 ; ^03: Date of Death
71 ; ^04: Total number of doses
72 ; ^05: Number of different drugs
73 ; "D",
74 ; DrugIEN) Quantity
75 ;
76 ; "IPD", Number of different drugs
77 ; DrugIEN, Drug Name
78 ; "D") Number of doses
79 ; "M") Maximum
80 ; ^01: Maximum number of doses
81 ; ^02: Number of patients
82 ; "P") Number of patients
83 ; "B",
84 ; NumOfDoses,
85 ; DrugName,
86 ; DrugIEN) ""
87 ;
88 ; "IPRX", Total number of doses
89 ; NumOfDoses, Number of patients
90 ; PatientName,
91 ; DFN) ""
92 ;
93 ; "OP", Number of outpatients
94 ; DFN, Patient's data
95 ; ^01: Last 4 digits of SSN
96 ; ^02: Name
97 ; ^03: Date of Death
98 ; ^04: Total number of fills
99 ; ^05: Number of different drugs
100 ; "D",
101 ; DrugIEN) Quantity
102 ;
103 ; "OPD", Number of different drugs
104 ; DrugIEN, Drug Name
105 ; "D") Number of fills
106 ; "M") Maximum
107 ; ^01: Maximum number of fills
108 ; ^02: Number of patients
109 ; "P") Number of patients
110 ; "B",
111 ; NumOfFills,
112 ; DrugName,
113 ; DrugIEN) ""
114 ;
115 ; "OPRX", Total number of fills
116 ; NumOfFills, Number of patients
117 ; PatientName,
118 ; DFN) ""
119 ;
120 ; "SUMRX",
121 ; NumberOfRX, Number of patients
122 ; PatientName,
123 ; DFN, Number of different drugs
124 ; "IP")
125 ; "OP")
126 ;
127 ; Return Values:
128 ; <0 Error code
129 ; 0 Ok
130 ;
131RXUTIL(RORTSK) ;
132 N ROREDT ; End date
133 N RORREG ; Registry IEN
134 N RORSDT ; Start date
135 N RORXGRP ; List of drug groups
136 N RORXL ; List of drugs for the pharmacy search API
137 ;
138 N ECNT,RC,REPORT,SFLAGS,TMP
139 S RORXL="",(ECNT,RC)=0
140 K ^TMP("RORX009",$J)
141 ;--- Root node of the report
142 S REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
143 Q:REPORT<0 REPORT
144 ;
145 D
146 . ;--- Get and prepare the report parameters
147 . S RORREG=$$PARAM^RORTSK01("REGIEN")
148 . S RC=$$PARAMS(REPORT,.RORSDT,.ROREDT,.SFLAGS) Q:RC<0
149 . ;--- Report header
150 . S RC=$$HEADER(REPORT) Q:RC<0
151 . ;--- Query the registry
152 . D TPPSETUP^RORTSK01(80)
153 . S RC=$$QUERY^RORX009A(SFLAGS)
154 . I RC Q:RC<0 S ECNT=ECNT+RC
155 . ;--- Sort the data
156 . D TPPSETUP^RORTSK01(10)
157 . S RC=$$SORT^RORX009A()
158 . I RC Q:RC<0 S ECNT=ECNT+RC
159 . ;--- Store the results
160 . D TPPSETUP^RORTSK01(10)
161 . S RC=$$STORE^RORX009C(REPORT)
162 . I RC Q:RC<0 S ECNT=ECNT+RC
163 ;
164 ;--- Cleanup
165 K ^TMP("RORX009",$J)
166 D FREE^RORTMP(RORXL)
167 Q $S(RC<0:RC,ECNT>0:-43,1:0)
Note: See TracBrowser for help on using the repository browser.