source: FOIAVistA/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORX015.m@ 1203

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

initial load of FOIAVistA 6/30/08 version

File size: 4.2 KB
Line 
1RORX015 ;HOIFO/SG - PROCEDURES REPORT ; 6/23/06 1:36pm
2 ;;1.5;CLINICAL CASE REGISTRIES;**1**;Feb 17, 2006;Build 24
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 ;;PROCLST(#,PROCODE,PROCNAME,NP,NC,SOURCE)
16 ;;PROCEDURES(#,NAME,LAST4,DOD,PROCODE,PROCNAME,DATE,SOURCE)
17 ;;PATIENTS(#,NAME,LAST4,DOD)
18 ;
19 N HEADER,RC
20 S HEADER=$$HEADER^RORXU002(.RORTSK,PARTAG)
21 Q:HEADER<0 HEADER
22 S RC=$$TBLDEF^RORXU002("HEADER^RORX015",HEADER)
23 Q $S(RC<0:RC,1:HEADER)
24 ;
25 ;***** OUTPUTS THE PARAMETERS TO THE REPORT
26 ;
27 ; PARTAG Reference (IEN) to the parent tag
28 ;
29 ; [.STDT] Start and end dates of the report
30 ; [.ENDT] are returned via these parameters
31 ;
32 ; [.FLAGS] Flags for the $$SKIP^RORXU005 are
33 ; returned via this parameter
34 ;
35 ; Return Values:
36 ; <0 Error code
37 ; >0 IEN of the PARAMETERS element
38 ;
39PARAMS(PARTAG,STDT,ENDT,FLAGS) ;
40 N PARAMS,TMP
41 S PARAMS=$$PARAMS^RORXU002(.RORTSK,PARTAG,.STDT,.ENDT,.FLAGS)
42 Q:PARAMS<0 PARAMS
43 ;--- Process the list of ICD-9 codes
44 I $$PARAM^RORTSK01("PATIENTS","INPATIENT") D Q:TMP<0 TMP
45 . S TMP=$$ICD9LST^RORXU008(.RORTSK,PARAMS,.RORICDL,.RORIGRP)
46 ;--- Process the list of CPT codes
47 I $$PARAM^RORTSK01("PATIENTS","OUTPATIENT") D Q:TMP<0 TMP
48 . S TMP=$$CPTLST^RORXU006(.RORTSK,PARAMS)
49 ;---
50 Q PARAMS
51 ;
52 ;***** COMPILES THE "PROCEDURES" REPORT
53 ; REPORT CODE: 015
54 ;
55 ; .RORTSK Task number and task parameters
56 ;
57 ; @RORTMP@(
58 ;
59 ; "PAT", Number of patients
60 ; DFN, Descriptor
61 ; ^01: Las 4 digits of SSN
62 ; ^02: Name
63 ; ^03: Date of Death
64 ; "I",
65 ; ICDIEN, Earliest Code Descriptor
66 ; ^01: Date
67 ; "C") Quantity
68 ; "O",
69 ; CPTIEN, Earliest Code Descriptor
70 ; ^01: Date
71 ; "C") Quantity
72 ;
73 ; "PROC", Totals
74 ; ^01: Number of procedure codes
75 ; ^02: Number of different codes
76 ; "B",
77 ; ProcName,
78 ; Source,
79 ; IEN) ""
80 ; "I",
81 ; ICDIEN, Procedure Descriptor
82 ; ^01: Code
83 ; ^02: Short description (current version)
84 ; "C") Quantity
85 ; "P") Number of unique patients
86 ; "O",
87 ; CPTIEN, Procedure Descriptor
88 ; ^01: Code
89 ; ^02: Short description (current version)
90 ; "C") Quantity
91 ; "P") Number of unique patients
92 ;
93 ; Return Values:
94 ; <0 Error code
95 ; 0 Ok
96 ;
97PROCLST(RORTSK) ;
98 N RORPROC ; Procedures mode (-1|1)
99 N ROREDT ; End date
100 N RORICDL ; Prepared list of ICD-9 codes
101 N RORIGRP ; List of ICD-9 groups
102 N RORREG ; Registry IEN
103 N RORSDT ; Start date
104 N RORTMP ; Closed root of the temporary buffer
105 ;
106 N ECNT,RC,REPORT,SFLAGS,TMP
107 S (ECNT,RC)=0,(RORICDL,RORTMP)=""
108 ;
109 ;--- Root node of the report
110 S REPORT=$$ADDVAL^RORTSK11(RORTSK,"REPORT")
111 Q:REPORT<0 REPORT
112 ;
113 ;--- Get and prepare the report parameters
114 S RORREG=$$PARAM^RORTSK01("REGIEN")
115 S RC=$$PARAMS(REPORT,.RORSDT,.ROREDT,.SFLAGS) Q:RC<0 RC
116 S RORPROC=$$RPTMODE("PROC")
117 ;
118 ;--- Report header
119 S RC=$$HEADER(REPORT) Q:RC<0 RC
120 S RORTMP=$$ALLOC^RORTMP()
121 D
122 . ;--- Query the registry
123 . D TPPSETUP^RORTSK01(70)
124 . S RC=$$QUERY^RORX015A(SFLAGS)
125 . I RC Q:RC<0 S ECNT=ECNT+RC
126 . ;--- Sort the data
127 . D TPPSETUP^RORTSK01(10)
128 . S RC=$$SORT^RORX015A()
129 . I RC Q:RC<0 S ECNT=ECNT+RC
130 . ;--- Store the results
131 . D TPPSETUP^RORTSK01(20)
132 . S RC=$$STORE^RORX015C(REPORT)
133 . I RC Q:RC<0 S ECNT=ECNT+RC
134 ;
135 ;--- Cleanup
136 D FREE^RORTMP(RORTMP),FREE^RORTMP(RORICDL)
137 Q $S(RC<0:RC,ECNT>0:-43,1:0)
138 ;
139 ;***** DETERMINES THE REPORT MODE FOR PROCEDURES
140 ;
141 ; NAME Base name of the attribute ("PROC")
142 ;
143 ; Return Values:
144 ; <0 "Did Not"
145 ; 0 Not selected
146 ; >0 "Did"
147RPTMODE(NAME) ;
148 Q:$$PARAM^RORTSK01("PATIENTS",NAME) 1 ; "Did"
149 Q:$$PARAM^RORTSK01("PATIENTS","NO"_NAME) -1 ; "Did Not"
150 Q 0
Note: See TracBrowser for help on using the repository browser.