source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SCRPEC.m@ 1767

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

WorldVistAEHR overlayed on FOIAVistA

File size: 3.5 KB
Line 
1SCRPEC ;ALB/CMM - Detail List of Pts & Enroll Clinics ; 29 Jun 99 04:11PM
2 ;;5.3;Scheduling;**41,140,174,177,431**;AUG 13, 1993
3 ;
4 ;Detailed Listing of Patients and Their Enrolled Clinics Report
5 ;
6PROMPTS ;
7 ;Prompt for Institution, Team, Clinic, Assigned or Unassigned to Primary
8 ;Care, and Print device
9 ;
10 N VAUTD,VAUTT,VAUTC,VAUTA,QTIME,PRNT
11 K VAUTD,VAUTT,VAUTC,VAUTA,VAUTCA,SCUP
12 S QTIME=""
13 W ! D INST^SCRPU1 I Y=-1 G ERR
14 W ! K Y D PRMTT^SCRPU1 I '$D(VAUTT) G ERR
15 ;S VAUTCA="" ;allows for selection of any clinic in one of the selected divisions
16 W ! K Y D CLINIC^SCRPU1 I '$D(VAUTC) G ERR
17 W ! K Y D ASSUN^SCRPU2 I '$D(VAUTA) G ERR
18 W !!,"This report requires 132 column output!"
19 D QUE(.VAUTD,.VAUTT,.VAUTC,.VAUTA) Q
20 ;
21QUE(INST,TEAM,CLINIC,ASSUN) ;queue report
22 ;Input Parameters:
23 ;INST - institutions selected (variable and array)
24 ;TEAM - teams selected (variable and array)
25 ;CLINIC - clinics selected (variable and array)
26 ;ASSUN - Assigned or Unassigned to PC
27 N ZTSAVE,II
28 F II="INST","TEAM","CLINIC","ASSUN","INST(","TEAM(","CLINIC(" S ZTSAVE(II)=""
29 W ! D EN^XUTMDEVQ("QENTRY^SCRPEC","Detailed Patient Enrollments",.ZTSAVE)
30 Q
31 ;
32ENTRY2(INST,TEAM,CLINIC,ASSUN,IOP,ZTDTH) ;
33 ;Second entry point for GUI to use
34 ;Input Parameters:
35 ;INST - institutions selected (variable and array)
36 ;TEAM - teams selected (variable and array)
37 ;CLINIC - clinics selected (variable and array)
38 ;ASSUN - Assigned or Unassigned to PC
39 ;IOP - print device
40 ;ZTDTH - queue time (optional)
41 ;
42 ;validate parameters
43 I '$D(INST)!'$D(TEAM)!'$D(CLINIC)!'$D(ASSUN)!'$D(IOP)!(IOP="") Q
44 ;
45 N NUMBER
46 S IOST=$P(IOP,"^",2),IOP=$P(IOP,"^")
47 I IOP?1"Q;".E S IOP=$P(IOP,"Q;",2)
48 I IOST?1"C-".E D QENTRY G RET
49 I ZTDTH="" S ZTDTH=$H
50 S ZTRTN="QENTRY^SCRPEC"
51 S ZTDESC="Detailed Patient List & Enrolled Clinics",ZTIO=IOP
52 N II
53 F II="INST","TEAM","CLINIC","ASSUN","INST(","TEAM(","CLINIC(","IOP" S ZTSAVE(II)=""
54 D ^%ZTLOAD
55RET S NUMBER=0
56 I $D(ZTSK) S NUMBER=ZTSK
57 D EXIT1
58 Q NUMBER
59 ;
60QENTRY ;
61 ;driver entry point
62 S VAUTTN=""
63 S TITL="Detailed Patient Assignments - "_$S(ASSUN=1:"Assigned PC",1:"Not Assigned PC")
64 S STORE="^TMP("_$J_",""SCRPEC"")"
65 K @STORE
66 S @STORE=0
67 D FIND^SCRPEC3
68 I $O(@STORE@(0))="" S NODATA=$$NODATA^SCRPU3(TITL)
69 I '$D(NODATA) D HEADER^SCRPEC2,PRINTIT^SCRPEC3(STORE,TITL)
70 D EXIT2
71 Q
72 ;
73ERR ;
74EXIT1 ;
75 K ZTSAVE,ZTSK,ZTIO,ZTDTH,ZTRTN,ZTDESC,VAUTCA,SCUP
76 Q
77EXIT2 ;
78 K @STORE
79 K STORE,VAUTTN,PAGE,TITL,IOP,TITL,NODATA,CLINIC,ASSUN,INST,TEAM,STOP
80 Q
81 ;
82PDATA(DFN,CLNEN,FLAG) ;
83 ;Collect and format data for report
84 ;
85 N NODE,NAME,PID,PELIG,MT,PSTAT,STATD,DATA,LAST,NEXT,CEN,CNAME
86 S DATA=""
87 S NODE=$G(^DPT(DFN,0))
88 S NAME=$P(NODE,"^") ;patient name
89 S PID=$P($G(^DPT(DFN,.36)),"^",3),PID=$TR(PID,"-","") ;PID without '-'s
90 S MT=$$LST^DGMTU(DFN),MT=$P(MT,"^",4) ;means test status SD*5.3*431
91 S PELIG=$$ELIG^SCRPU3(DFN) ;primary eligibility
92 ;
93 S CNAME=$P($G(^SC(CLNEN,0)),"^")
94 S CEN=+$O(^DPT(DFN,"DE","B",CLNEN,""))
95 S NODE=$G(^DPT(DFN,"DE",CEN,1,1,0))
96 S PSTAT=$P(NODE,"^",2) S PSTAT=PSTAT_$S(PSTAT="A":"C",PSTAT="O":"PT",1:"") ;opt or ac status
97 I $P(NODE,"^")="" S STATD=""
98 I $P(NODE,"^")'="" S STATD=$TR($$FMTE^XLFDT($P(NODE,"^"),"5DF")," ","0") ;enrollment date
99 S LAST=$$GETLAST^SCRPU3(DFN,CLNEN) ;last clinic appointment
100 S NEXT=$$GETNEXT^SCRPU3(DFN,CLNEN) ;next clinic appointment
101 I '$D(FLAG) S DATA=$$FORMAT^SCRPEC2(NAME,PID,MT,PELIG,PSTAT,STATD,LAST,NEXT,CNAME),DATA=$E(NAME,1,20)_"^"_DATA
102 I $D(FLAG) S DATA=$E(NAME,1,20)_"^"_PID_"^"_MT_"^"_PELIG_"^"_PSTAT_"^"_STATD_"^"_LAST_"^"_NEXT
103 Q DATA
104 ;
Note: See TracBrowser for help on using the repository browser.