1 | RORX016C ;HCIOFO/BH,SG - OUTPATIENT UTILIZATION (STORE) ; 9/14/05 9:43am
|
---|
2 | ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
|
---|
3 | ;
|
---|
4 | Q
|
---|
5 | ;
|
---|
6 | ;***** HIGHEST UTILIZATION
|
---|
7 | ;
|
---|
8 | ; PRNTELMT IEN of the parent element
|
---|
9 | ;
|
---|
10 | ; RORNODE Closed root of the section in the temporary global
|
---|
11 | ;
|
---|
12 | ; Return Values:
|
---|
13 | ; <0 Error code
|
---|
14 | ; 0 Ok
|
---|
15 | ;
|
---|
16 | HIGHUTIL(PRNTELMT,RORNODE) ;
|
---|
17 | N BUF,COUNT,DFN,I,ITEM,NAME,NUM,RC,RORMAXUT,RORTCNT,SECTION,TABLE,TMP
|
---|
18 | S RORMAXUT=$$PARAM^RORTSK01("MAXUTNUM")
|
---|
19 | Q:RORMAXUT'>0 0
|
---|
20 | S SECTION=$$ADDVAL^RORTSK11(RORTSK,"HIGHUTIL",,PRNTELMT)
|
---|
21 | Q:SECTION<0 SECTION
|
---|
22 | S (RC,RORTCNT)=0
|
---|
23 | ;--- Stops
|
---|
24 | I $D(@RORNODE@("OPS1"))>1 D Q:RC<0 RC
|
---|
25 | . S TABLE=$$ADDVAL^RORTSK11(RORTSK,"HU_STOPS",,SECTION)
|
---|
26 | . I TABLE<0 S RC=TABLE Q
|
---|
27 | . D ADDATTR^RORTSK11(RORTSK,TABLE,"TABLE","HU_STOPS")
|
---|
28 | . S RORTCNT=RORTCNT+1
|
---|
29 | . ;---
|
---|
30 | . S NUM="",(COUNT,RC)=0
|
---|
31 | . F S NUM=$O(@RORNODE@("OPS1",NUM),-1) Q:NUM="" D Q:RC
|
---|
32 | . . S NAME=""
|
---|
33 | . . F S NAME=$O(@RORNODE@("OPS1",NUM,NAME)) Q:NAME="" D Q:RC
|
---|
34 | . . . S DFN=""
|
---|
35 | . . . F S DFN=$O(@RORNODE@("OPS1",NUM,NAME,DFN)) Q:DFN="" D Q:RC
|
---|
36 | . . . . S COUNT=COUNT+1 I COUNT>RORMAXUT S RC=1 Q
|
---|
37 | . . . . S BUF=$G(@RORNODE@("OP",DFN))
|
---|
38 | . . . . S ITEM=$$ADDVAL^RORTSK11(RORTSK,"PATIENT",,TABLE)
|
---|
39 | . . . . D ADDVAL^RORTSK11(RORTSK,"NAME",NAME,ITEM,1)
|
---|
40 | . . . . D ADDVAL^RORTSK11(RORTSK,"LAST4",$P(BUF,U,3),ITEM,2)
|
---|
41 | . . . . D ADDVAL^RORTSK11(RORTSK,"NV",+$P(BUF,U,4),ITEM,3)
|
---|
42 | . . . . D ADDVAL^RORTSK11(RORTSK,"NSC",NUM,ITEM,3)
|
---|
43 | . . . . D ADDVAL^RORTSK11(RORTSK,"NDS",+$P(BUF,U,2),ITEM,3)
|
---|
44 | ;--- Disable the empty section
|
---|
45 | D:RORTCNT'>0 UPDVAL^RORTSK11(RORTSK,SECTION,"",,1)
|
---|
46 | Q 0
|
---|
47 | ;
|
---|
48 | ;***** STORES THE REPORT DATA
|
---|
49 | ;
|
---|
50 | ; REPORT IEN of the REPORT element
|
---|
51 | ;
|
---|
52 | ; Return Values:
|
---|
53 | ; <0 Error code
|
---|
54 | ; 0 Ok
|
---|
55 | ; >0 Number of non-fatal errors
|
---|
56 | ;
|
---|
57 | STORE(REPORT) ;
|
---|
58 | N RORSONLY ; Output summary only
|
---|
59 | ;
|
---|
60 | N ECNT,NODE,RC,TMP
|
---|
61 | S NODE=$NA(^TMP("RORX016",$J))
|
---|
62 | Q:$D(@NODE)<10 0
|
---|
63 | S RORSONLY=$$SMRYONLY^RORXU006(),(ECNT,RC)=0
|
---|
64 | ;--- Outpatients
|
---|
65 | S RC=$$LOOP^RORTSK01(0) Q:RC<0 RC
|
---|
66 | S RC=$$STOREOP(REPORT,NODE)
|
---|
67 | I RC Q:RC<0 RC S ECNT=ECNT+1
|
---|
68 | ;--- Highest utilization
|
---|
69 | S RC=$$LOOP^RORTSK01(0.5) Q:RC<0 RC
|
---|
70 | S RC=$$HIGHUTIL(REPORT,NODE)
|
---|
71 | I RC Q:RC<0 RC S ECNT=ECNT+1
|
---|
72 | ;---
|
---|
73 | Q ECNT
|
---|
74 | ;
|
---|
75 | ;***** OUTPATIENT DATA
|
---|
76 | ;
|
---|
77 | ; PRNTELMT IEN of the parent element
|
---|
78 | ;
|
---|
79 | ; NODE Closed root of the category section
|
---|
80 | ; in the temporary global
|
---|
81 | ;
|
---|
82 | ; Return Values:
|
---|
83 | ; <0 Error code
|
---|
84 | ; 0 Ok
|
---|
85 | ;
|
---|
86 | STOREOP(PRNTELMT,NODE) ;
|
---|
87 | Q:$D(@NODE@("OP"))<10 0
|
---|
88 | N ITEM,NSC,NV,RC,SECTION,STOP,TABLE,TMP
|
---|
89 | S SECTION=$$ADDVAL^RORTSK11(RORTSK,"OUTPATIENTS",,PRNTELMT)
|
---|
90 | Q:SECTION<0 SECTION
|
---|
91 | S RC=0
|
---|
92 | ;--- Stop codes
|
---|
93 | I $D(@NODE@("OPS1"))>1 D Q:RC<0 RC
|
---|
94 | . S TABLE=$$ADDVAL^RORTSK11(RORTSK,"STOPS",,SECTION)
|
---|
95 | . I TABLE<0 S RC=TABLE Q
|
---|
96 | . D ADDATTR^RORTSK11(RORTSK,TABLE,"TABLE","STOPS")
|
---|
97 | . S NSC=""
|
---|
98 | . F S NSC=$O(@NODE@("OPS1",NSC),-1) Q:NSC="" D
|
---|
99 | . . S ITEM=$$ADDVAL^RORTSK11(RORTSK,"ITEM",,TABLE)
|
---|
100 | . . D ADDVAL^RORTSK11(RORTSK,"NP",$P(@NODE@("OPS1",NSC),U),ITEM,3)
|
---|
101 | . . D ADDVAL^RORTSK11(RORTSK,"NSC",NSC,ITEM,3)
|
---|
102 | ;--- Clinics
|
---|
103 | I $D(@NODE@("OPS"))>1 D Q:RC<0 RC
|
---|
104 | . S TABLE=$$ADDVAL^RORTSK11(RORTSK,"CLINICS",,SECTION)
|
---|
105 | . I TABLE<0 S RC=TABLE Q
|
---|
106 | . D ADDATTR^RORTSK11(RORTSK,TABLE,"TABLE","CLINICS")
|
---|
107 | . S STOP=""
|
---|
108 | . F S STOP=$O(@NODE@("OPS",STOP)) Q:STOP="" D
|
---|
109 | . . S ITEM=$$ADDVAL^RORTSK11(RORTSK,"CLINIC",,TABLE)
|
---|
110 | . . D ADDVAL^RORTSK11(RORTSK,"STOP",STOP,ITEM,3)
|
---|
111 | . . D ADDVAL^RORTSK11(RORTSK,"NAME",$P(@NODE@("OPS",STOP),U),ITEM,1)
|
---|
112 | . . D ADDVAL^RORTSK11(RORTSK,"NP",+$G(@NODE@("OPS",STOP,"P")),ITEM,3)
|
---|
113 | . . S TMP=+$G(@NODE@("OPS",STOP,"V"))
|
---|
114 | . . D ADDVAL^RORTSK11(RORTSK,"NV",$J(TMP,0,2),ITEM,3)
|
---|
115 | . . D ADDVAL^RORTSK11(RORTSK,"NSC",+$G(@NODE@("OPS",STOP,"S")),ITEM,3)
|
---|
116 | ;--- Summary
|
---|
117 | D ADDVAL^RORTSK11(RORTSK,"NP",+$G(@NODE@("OP")),SECTION)
|
---|
118 | D ADDVAL^RORTSK11(RORTSK,"NV",+$G(@NODE@("OPV")),SECTION)
|
---|
119 | D ADDVAL^RORTSK11(RORTSK,"NSC",+$G(@NODE@("OPS")),SECTION)
|
---|
120 | Q 0
|
---|