source: WorldVistAEHR/trunk/r/PCE_PATIENT_CARE_ENCOUNTER-AUTN-EFDP-PX-VSIT--PXRM/PXRRLCCP.m@ 1166

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

initial load of WorldVistAEHR

File size: 3.0 KB
Line 
1PXRRLCCP ;ISL/PKR - encounter by clinic print. ;5/27/97
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**3,10,12,18**;Aug 12, 1996
3 ;
4 N BMARG,C2S,C3S,C3E,C3HS,CMAX,DONE,HEAD,HLOCMAX,INDENT,MID,PAGE
5 N CLASSNAM,DATE,IC,FACILITY,FACPNAME,FTOTAL
6 N GTOTAL,HLOC
7 N LOCLIST,LOCNAME,NLOCLIST,PNAME,SC,TEMP,VIEN
8 ;
9 ;Allow the task to be cleaned up upon successful completion.
10 S ZTREQ="@"
11 ;
12 U IO
13 ;Setup the formatting parameters.
14 S HLOCMAX=^XTMP(PXRRXTMP,"HLOCMAX")
15 S INDENT=3
16 S C2S=INDENT+HLOCMAX+1
17 S C3HS=INDENT+38
18 ;We assume that the counts will never be longer than six digits.
19 S MID=C3HS+6
20 S BMARG=2
21 ;
22 S DONE=0
23 S GTOTAL=0
24 ;
25 S PAGE=1
26 D HDR^PXRRGPRT(PAGE)
27 W !!,"Criteria for Clinic Encounter Count Report"
28 D OLRCRIT^PXRRGPRT(3)
29 ;
30SET ;Set up print fields
31 S FACILITY=0
32FAC S FACILITY=$O(^XTMP(PXRRXTMP,FACILITY))
33 I +FACILITY=0 G END
34 ;Mark the facility as being found.
35 F IC=1:1:NFAC I $P(PXRRFAC(IC),U,1)=FACILITY D Q
36 . S $P(PXRRFAC(IC),U,4)="M"
37 K LOCLIST
38 K ^TMP(PXRRXTMP,$J,"PXRRLOC")
39 S HEAD=1
40 S FTOTAL=0
41 S FACPNAME=$P(PXRRFACN(FACILITY),U,1)_" "_$P(PXRRFACN(FACILITY),U,2)
42 ;
43 ;Check for a user request to stop the task.
44 I $$S^%ZTLOAD S ZTSTOP=1 D EXIT^PXRRGUT
45 ;
46 S PNAME=""
47PRV S PNAME=$O(^XTMP(PXRRXTMP,FACILITY,PNAME))
48 I PNAME="" G TOTAL
49 ;
50 S CLASSNAM=""
51CLASS ;
52 S CLASSNAM=$O(^XTMP(PXRRXTMP,FACILITY,PNAME,CLASSNAM))
53 I CLASSNAM="" G PRV
54 ;
55 S DATE=""
56DATE S DATE=$O(^XTMP(PXRRXTMP,FACILITY,PNAME,CLASSNAM,DATE))
57 I DATE="" G CLASS
58 ;
59 S HLOC=""
60HLO S HLOC=$O(^XTMP(PXRRXTMP,FACILITY,PNAME,CLASSNAM,DATE,HLOC))
61 I HLOC="" G DATE
62 S VIEN=""
63 F S VIEN=$O(^XTMP(PXRRXTMP,FACILITY,PNAME,CLASSNAM,DATE,HLOC,VIEN)) Q:VIEN="" D
64 . S ^TMP(PXRRXTMP,$J,"PXRRLOC",HLOC,VIEN)=""
65 ;
66 G HLO
67 ;
68TOTAL ;Total up the encounters.
69 S NLOCLIST=0
70 S CMAX=0
71 S HLOC=""
72NLOC S HLOC=$O(^TMP(PXRRXTMP,$J,"PXRRLOC",HLOC))
73 I HLOC="" G OUTPUT
74 S TEMP=$$LOCCNT^PXRRLCHP(HLOC)
75 S CMAX=$$MAX^XLFMTH(CMAX,TEMP)
76 S LOCLIST(HLOC)=TEMP
77 S NLOCLIST=NLOCLIST+1
78 G NLOC
79 ;
80OUTPUT ;Print the data.
81 S HEAD=1
82 S C3E=MID+($L(CMAX)/2)
83 S HLOC=""
84NEXTP S HLOC=$O(LOCLIST(HLOC))
85 I HLOC="" S GTOTAL=GTOTAL+FTOTAL G FINAL
86 S TEMP=LOCLIST(HLOC)
87 S FTOTAL=FTOTAL+TEMP
88 D HEAD
89 I DONE G EXIT
90 S C3S=C3E-$L(TEMP)
91 S LOCNAME=$P(HLOC,U,1)
92 S SC="("_$P(HLOC,U,3)_")"
93 W !,?INDENT,LOCNAME,?C2S,SC,?C3S,TEMP
94 G NEXTP
95 ;
96FINAL ;Print facility total.
97 I $Y>(IOSL-BMARG-3) D PAGE^PXRRGPRT
98 I DONE G EXIT
99 D PTOTAL^PXRRGPRT("Total facility encounters ",FTOTAL,C3E,1)
100 G FAC
101END ;
102 I $Y>(IOSL-BMARG-3) D PAGE^PXRRGPRT
103 I DONE G EXIT
104 I GTOTAL>0 D PTOTAL^PXRRGPRT("Total encounters ",GTOTAL,C3E,0)
105 I $Y>(IOSL-BMARG-3) D PAGE^PXRRGPRT
106 I DONE G EXIT
107 D FACNE^PXRRGPRT(INDENT)
108EXIT ;
109 D EXIT^PXRRGUT
110 D EOR^PXRRGUT
111 Q
112 ;
113 ;=======================================================================
114HEAD ;If necessary, write the header.
115 I HEAD D
116 . I $Y>(IOSL-BMARG-6) D PAGE^PXRRGPRT
117 . I DONE Q
118 . W !!,"Facility: ",FACPNAME
119 . W !!,?INDENT,"Clinic Stop (Stop Code)",?C3HS,"Encounters"
120 . W !,?INDENT,"------------------------------------",?C3HS,"----------"
121 . S HEAD=0
122 Q
123 ;
Note: See TracBrowser for help on using the repository browser.