source: WorldVistAEHR/trunk/r/EVENT_CAPTURE-EC--ECT--ECX/ECPRSUM1.m@ 1211

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

initial load of WorldVistAEHR

File size: 5.1 KB
RevLine 
[613]1ECPRSUM1 ;BIR/DMA,RHK,JPW-Provider Summary (1 to 7) ;21 SEP 96
2 ;;2.0; EVENT CAPTURE ;**5,18,33,47,62,63,61,72,88**;8 May 96;Build 2
3 S DIC=200,DIC(0)="AQEMZ",DIC("A")="Select Provider: "
4 D ^DIC K DIC G END:Y<0 S ECU=+Y,ECUN=$P(Y,"^",2)
5 D REASON^ECRUTL ;* Prompt to include Procedure Reasons
6 I ($D(DIRUT))!($D(DUOUT)) G END
7BDATE K %DT S %DT="AEX",%DT("A")="Starting with Date: "
8 D ^%DT G:Y<0 END S ECSD=Y
9EDATE K %DT S %DT="AEX",%DT("A")="Ending with Date: " D ^%DT G:Y<0 END
10 I Y<ECSD D G EDATE
11 .W !!,"The ending date cannot be earlier than the starting date. "
12 .W "Please re-enter",!,"the ending date.",!
13 S ECED=Y,ECDATE=ECSD_"^"_ECED
14DEV ;dev call
15 W !!,"This report is formatted for 132 column output.",!!
16 S %ZIS="Q",%ZIS("A")="Select Device: " D ^%ZIS G END:POP
17 I $D(IO("Q")) K ZTSAVE S (ZTSAVE("ECRY"),ZTSAVE("ECSD"),ZTSAVE("ECDATE"),ZTSAVE("ECED"),ZTSAVE("ECU"),ZTSAVE("ECUN"))="",ZTDESC="Event Capture Provider Summary",ZTRTN="EN^ECPRSUM1" D ^%ZTLOAD,HOME^%ZIS K ZTSK G END
18 ;
19EN ;QUEUED ENTRY POINT
20 N ECPG,ECGT,EC,ECCAT,ECPXD,MODI,ECI,ECPRV,RK,A,ECX,EC725
21 U IO
22 S (ECOUT,ECPG)=0 F ECI=1:1:7 S ECGT(ECI)=0,A(ECI)=0
23 K ^TMP($J) S ECOUT=0,ECSD=ECSD-.1,ECED=ECED+.3
24 F ECD=ECSD:0 S ECD=$O(^ECH("AC",ECD)) Q:'ECD Q:ECD>ECED F DA=0:0 S DA=$O(^ECH("AC",ECD,DA)) Q:'DA S EC=$G(^ECH(DA,0)) D
25 .K ECPRV S ECPRV=$$GETPRV^ECPRVMUT(DA,.ECPRV),ECX=0 I ECPRV Q
26 .F ECI=1:1:7 S A(ECI)=0
27 .F ECI=1:1:7 S ECX=$O(ECPRV(ECX)) Q:'ECX D
28 ..S A(ECI)=$P(ECPRV(ECX),U)=ECU
29 .S ECX=A(1)=A(2)=A(3)=A(4)=A(5)=A(6)=A(7) I 'ECX Q
30 .S ECPAT=+$P(EC,"^",2),PA=$G(^DPT(ECPAT,0)),SS=$P(PA,"^",9)
31 .S PA=$S($P(PA,"^")]"":$P(PA,"^"),1:"UNKNOWN"),ECP=$P(EC,"^",9)
32 .Q:ECP']""
33 .S ECLOC=+$P(EC,U,4),ECUNIT=+$P(EC,U,7),ECCAT=+$P(EC,U,8)
34 .S ECPSY=+$O(^ECJ("AP",ECLOC,ECUNIT,ECCAT,ECP,""))
35 .S ECPSYN=$P($G(^ECJ(ECPSY,"PRO")),"^",2)
36 .S ECFILE=$P(ECP,";",2),ECFILE=$S($E(ECFILE)="I":81,$E(ECFILE)="E":725,1:"UNKNOWN")
37 .I ECFILE="UNKNOWN" S ECPN="UNKNOWN"
38 .S ECCPT=$S(ECFILE=81:+ECP,1:$P($G(^EC(725,+ECP,0)),"^",5)),ECPXD=""
39 .I ECCPT'="" D
40 ..S ECPXD=$$CPT^ICPTCOD(ECCPT,$P(ECED,".")),ECCPT=$P(ECPXD,"^",2)_" "
41 .I ECFILE=81 S ECPN=$S($P(ECPXD,"^",3)]"":$P(ECPXD,"^",3),1:"UNKNOWN")
42 .I ECFILE=725 S EC725=$G(^EC(725,+ECP,0)),ECPN=$P(EC725,"^",2)_" "_$P(EC725,"^")
43 .S ECPTDS=ECCPT_ECPN_$S(ECPSYN]"":" ["_ECPSYN_"] ",1:"")
44 .;Get Procedure CPT modifiers
45 . K ECMOD S ECMODF=0 I $O(^ECH(DA,"MOD",0))'="" D
46 ..S ECMODF=$$MOD^ECUTL(DA,"I",.ECMOD)
47 ..;K ECMOD S ECMODF=$$MOD^ECUTL(DA,"I",.ECMOD)
48 .;
49 .;ALB/ESD - Get procedure reason from EC Patient file (#721) record
50 .S ECPRSN="",ECLNK=+$P(EC,"^",23)
51 .I +ECLNK>0 DO
52 ..S ECPRSN=$P($G(^ECL(ECLNK,0)),"^",1)
53 ..S:+ECPRSN'>0 ECPRSN="REASON NOT DEFINED"
54 ..S:+ECPRSN>0 ECPRSN=$P(^ECR(ECPRSN,0),"^",1)
55 .S:+ECLNK'>0 ECPRSN="REASON NOT DEFINED"
56 .I '$D(ECRY) S ECPRSN="REASON NOT DEFINED"
57 .;
58 .;ALB/ESD - Add procedure reason to ^TMP array
59 .S PRO=ECCPT_ECPN I PRO]"" S V=+$P(EC,"^",10) D
60 ..F J=1:1:7 I A(J) S ^(J)=$G(^TMP($J,PRO,ECPRSN,PA_"^"_SS,J))+V D
61 ...I $G(^TMP($J,PRO))="" S ^TMP($J,PRO)=ECPTDS
62 ..;ALB/JAM - Add Procedure CPT modifier to ^TMP array
63 ..S MOD="" F S MOD=$O(ECMOD(MOD)) Q:MOD="" D
64 ...S ^TMP($J,PRO,ECPRSN,PA_"^"_SS,"MOD",MOD)=$G(^TMP($J,PRO,ECPRSN,PA_"^"_SS,"MOD",MOD))+V
65 K ECLNK,MOD,ECPTDS
66 ;
67PRINT ;print report
68 S ECSD=$P(ECDATE,"^"),ECED=$P(ECDATE,"^",2)
69 D HDR I '$D(^TMP($J)) W !!,?12,"No Event Capture Provider Summary for "_ECUN_" to report for the date range selected.",!! D PAGE G END
70 F ECI=1:1:7 S A(ECI)=0
71 S (ECREAS,PA,PR)=""
72 F S PR=$O(^TMP($J,PR)),PA="" Q:PR="" D Q:ECOUT
73 .W !,^TMP($J,PR)
74 .F S ECREAS=$O(^TMP($J,PR,ECREAS)) Q:ECREAS="" D Q:ECOUT
75 ..F S PA=$O(^TMP($J,PR,ECREAS,PA)) D:PA="" TOT Q:PA="" D Q:ECOUT
76 ...S A=$G(^TMP($J,PR,ECREAS,PA,0))
77 ...W ! W:$D(ECRY) $E(ECREAS,1,23)
78 ...W ?25,$E($P(PA,"^"),1,24),?50,$P(PA,"^",2)
79 ...F J=1:1:7 S A=$G(^TMP($J,PR,ECREAS,PA,J)),A(J)=A(J)+A W ?10*J+50,$J(A,5,0) I J=7 I $Y+5>IOSL D PAGE Q:ECOUT D HDR
80 ...;print CPT procedure modifiers
81 ...Q:ECOUT S IEN=""
82 ...F S IEN=$O(^TMP($J,PR,ECREAS,PA,"MOD",IEN)) Q:IEN="" D I ECOUT Q
83 ....S MODI=$$MOD^ICPTMOD(IEN,"I",$P(ECED,"."))
84 ....S MOD=$P(MODI,U,2) I MOD="" Q
85 ....S MODESC=$P(MODI,U,3) I MODESC="" S MODESC="UNKNOWN"
86 ....S MODAMT=^TMP($J,PR,ECREAS,PA,"MOD",IEN)
87 ....W !?5,"- ",MOD," ",MODESC," (",MODAMT,")"
88 ....I ($Y+4)>IOSL D PAGE Q:ECOUT D HDR
89 ...K MODESC,MOD,MODAMT
90 W !!,?60 F RK=61:1:IOM W "*"
91 W !,?35,"GRAND TOTAL - PROCEDURES"
92 F J=1:1:7 W ?10*J+50,$J(ECGT(J),5,0)
93 D:'ECOUT PAGE G END
94 ;
95PAGE ; end of page
96 I $E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR K DIR I 'Y S ECOUT=1
97 Q
98HDR ;
99 W:$Y @IOF S ECPG=ECPG+1
100 W !!?33,"EVENT CAPTURE PROVIDER SUMMARY FOR ",ECUN,?118,"Page: ",ECPG,!,?33,"FOR THE DATE RANGE ",$$FMTE^XLFDT(ECSD)," TO ",$$FMTE^XLFDT(ECED),!!,"PROCEDURE",?85,"TOTALS AS PROVIDER #",!
101 W:$D(ECRY) "PROCEDURE REASON" W ?25,"PATIENT",?52,"SSN",?64,1,?74,2,?84,3,?94,4,?104,5,?114,6,?124,7
102 W !,?5,"CPT MODIFIER (Volume of modifiers use)",!
103 F RK=1:1:IOM W "-"
104 W !
105 Q
106 ;
107TOT W !,?60 F RK=61:1:IOM W "-"
108 W !?35,"TOTAL PROCEDURES"
109 F J=1:1:7 W ?10*J+50,$J(A(J),5,0) S ECGT(J)=ECGT(J)+A(J)
110 W ! F ECI=1:1:7 S A(ECI)=0
111 Q
112 ;
113END D ^ECKILL K ^TMP($J),ZTSK W @IOF
114 K ^TMP($J) Q:$D(ECGUI)
115 I $D(ZTQUEUED) S ZTREQ="@"
116 D ^%ZISC
117 Q
Note: See TracBrowser for help on using the repository browser.