source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SCRPU3.m@ 1383

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

initial load of FOIAVistA 6/30/08 version

File size: 5.1 KB
Line 
1SCRPU3 ;ALB/CMM - GENERIC UTILITIES ; 9/26/05 8:50am
2 ;;5.3;Scheduling;**41,45,52,140,181,177,432,433,346**;AUG 13, 1993
3 ;
4ELIG(DFN) ;
5 ;Gets Primary Eligibility
6 N PRIM
7 I '$D(^DPT(DFN,.36)) Q 0
8 I '$D(^DIC(8,+$P(^DPT(DFN,.36),"^"),0)) Q 0
9 S PRIM=$P($G(^DIC(8,$P($G(^DPT(DFN,.36)),"^"),0)),"^",9)
10 ;MAS Primary Eligibility Code
11 S PRIM=$P($G(^DIC(8.1,PRIM,0)),"^")
12 ;
13 S PRIM=$TR(PRIM,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
14 I PRIM="NON-SERVICE CONNECTED" S PRIM="NSC"
15 I PRIM["SERVICE CONNECTED" S PRIM=$P(PRIM,"SERVICE CONNECTED")_"SC"_$P(PRIM,"SERVICE CONNECTED",2,999)
16 I PRIM["LESS THAN" S PRIM=$P(PRIM,"LESS THAN")_"<"_$P(PRIM,"LESS THAN",2,999)
17 I PRIM[" TO " S PRIM=$P(PRIM," TO ")_"-"_$P(PRIM," TO ",2,999)
18 I PRIM["%" S PRIM=$TR(PRIM,"%","")
19 S PRIM=$E(PRIM,1,9)
20 Q PRIM
21 ;
22GETNEXT(DFN,CLN) ;
23 ;Get next appointment for patient (DFN) at Clinic (CLN)
24 ;Returning the date in 00/00/0000 format
25 N NEXT,APPT,FOUND
26 ;
27 N SDARRAY,SDCOUNT,SDDATE,SDAPPT,SDSTATUS,%
28 ; Tell SDAPI that we want only the next appointment based on:
29 ; Date SDARRAY(1)=Today's Date;
30 ; Clinic SDARRAY(2)=CLN
31 ; Patient SDARRAY(4)=DFN
32 ; Status SDARRAY(3)="R;I;NS;NSR;NT"
33 ; KEPT/INPATIENT/NOSHOW/NOSHOWRESCHED/NOACTIONTAKEN
34 ; and that we want to have field 3 (appt status) returned
35 ; SDARRAY("FLDS")="3"
36 ; DATA will be returned in ^TMP($J,"SDAMA301",DFN,CLN,SDDATE)
37 ;
38 S FOUND=0,NEXT=""
39 I $G(CLN)=""!($G(DFN)="") Q NEXT
40 D NOW^%DTC S SDARRAY(1)=$P(%,".",1)_";"
41 S SDARRAY(2)=CLN,SDARRAY(3)="R;I;NS;NSR;NT",SDARRAY(4)=DFN,SDARRAY("FLDS")="3",SDARRAY("MAX")=1
42 S SDCOUNT=$$SDAPI^SDAMA301(.SDARRAY)
43 I SDCOUNT>0 S SDDATE="" S SDDATE=$O(^TMP($J,"SDAMA301",DFN,CLN,SDDATE)) D
44 .S NEXT=$TR($$FMTE^XLFDT(SDDATE,"5DF")," ","0")
45 I SDCOUNT<0 D ;do processing for errors
46 .; None to do in this case -- return null
47 .Q
48 ; when finished with all processing, kill SDAPI output array
49 K ^TMP($J,"SDAMA301")
50 Q NEXT
51 ;
52GETLAST(DFN,CLN) ;
53 ;Get last appointment for patient (DFN) at Clinic (CLN)
54 ;Returning the date in 00/00/0000 format
55 N LAST,APPT,FOUND,STATUS
56 N SDARRAY,SDCOUNT,SDDATE,SDAPPT,SDSTATUS,%
57 ; Tell SDAPI that we want only the next appointment based on:
58 ; Date SDARRAY(1)=;Today's Date
59 ; Clinic SDARRAY(2)=CLN
60 ; Patient SDARRAY(4)=DFN
61 ; Status SDARRAY(3)="R;I;NT"
62 ; MAX SDARRAY("MAX")=-1
63 ; and that we want to have field 3 (appt status) returned
64 ; SDARRAY("FLDS")="3"
65 ; DATA will be returned in ^TMP($J,"SDAMA301",DFN,CLN,SDDATE)
66 ;
67 S FOUND=0,LAST=""
68 I $G(CLN)=""!($G(DFN)="") Q LAST
69 D NOW^%DTC S SDARRAY(1)=";"_$P(%,".",1)
70 S SDARRAY(2)=CLN,SDARRAY(3)="R;I;NT",SDARRAY(4)=DFN,SDARRAY("MAX")=-1
71 S SDARRAY("FLDS")="3"
72 S SDCOUNT=$$SDAPI^SDAMA301(.SDARRAY)
73 I SDCOUNT>0 S SDDATE="" D
74 .S SDDATE=$O(^TMP($J,"SDAMA301",DFN,CLN,SDDATE))
75 .S LAST=$TR($$FMTE^XLFDT(SDDATE,"5DF")," ","0")
76 I SDCOUNT<0 D ;do processing for errors
77 .Q ; None to do in this case
78 ; when finished with all processing, kill SDAPI output array
79 K ^TMP($J,"SDAMA301")
80 Q LAST
81 ;
82PDEVICE() ;
83 ;Generic Printer Call
84 N TION,POP
85 S %ZIS="QN" D ^%ZIS K %ZIS Q:POP!(ION="^") -1
86 S TION=ION
87 I $D(IO("Q")) S TION="Q;"_TION
88 Q TION_"^"_IOST
89 ;
90GETTIME() ;
91 ;Prompt for Queue Time
92 N X,Y
93 S DIR(0)="D^::RFE",DIR("A")="Start Time",DIR("B")="NOW"
94 D ^DIR
95 I $D(DTOUT)!(X="") S Y=$H
96 I $D(DUOUT)!($D(DIROUT)) S Y=-1
97 K DIR,DTOUT,DUOUT,DIROUT
98 Q Y
99 ;
100HOLD(PAGE,TIT,MARG) ;
101 ;device is home, reached end of page
102 N X
103 S MARG=$G(MARG) S:MARG'>80 MARG=80
104 W !!,"Press Any Key to Continue or '^' to Quit" R X:DTIME
105 I '$T!(X="^") S STOP=1 Q
106 D NEWP1(.PAGE,TIT,MARG)
107 Q
108 ;
109NEWP1(PAGE,TITL,MARG) ;
110 ;new page
111 ;
112 S MARG=$G(MARG) S:MARG'>80 MARG=80
113 D STOPCHK^DGUTL
114 I $G(STOP) D STOPPED^DGUTL Q
115 W:PAGE>0 @IOF
116 S PAGE=PAGE+1
117 D TITLE(PAGE,TITL,MARG)
118 Q
119 ;
120TITLE(PG,TITL,MARG) ;
121 N PDATE,SCX,SCI
122 S MARG=$G(MARG) S:MARG'>80 MARG=80
123 S PDATE=$$FMTE^XLFDT(DT,"5D")
124 S SCI=(IOM-$L(TITL)\2) S:SCI<24 SCI=24
125 S SCX="Printed on: "_PDATE
126 S $E(SCX,SCI)=TITL
127 S $E(SCX,(IOM-6-$L(PG)))="Page: "_PG
128 W SCX,!
129 Q
130 ;
131CLOSE ;close device
132 D:$E(IOST)'="C" ^%ZISC
133 Q
134 ;
135OPEN ;opens device
136 IF IOST?1"C-".E D Q ;%zis has already been called via $$pdevice
137 .W @IOF
138 D ^%ZIS
139 Q:POP
140 U IO
141 Q
142 ;
143NODATA(TITL) ;
144 ;no data to print
145 ;returns 1
146 D OPEN
147 D TITLE(1,TITL)
148 W !,"No data to report"
149 D CLOSE
150 Q 1
151 ;
152HELP W:'$D(VAUTNA) !,"ENTER:",!?5,"- A or ALL for all ",VAUTSTR,"s, or"
153 W:($D(VAUTTN))&(VAUTSTR="TEAM") !?5,"- N or NOT for not assigned to a team or"
154 W:($D(VAUTPO))&(VAUTSTR="PRACTITIONER") !?5,"- N or NONE or NOT for not assigned to a Practitioner"
155 W !?5,"- Select individual "_VAUTSTR W:'$D(VAUTPO) " -- limit 20"
156 W !?5,"Imprecise selections will yield an additional prompt."
157 I $O(@VAUTVB@(0))]"" W !?5,"- An entry preceeded by a minus [-] sign to remove entry from list."
158 I $O(@VAUTVB@(0))]"" W !,"NOTE, you have already selected:" S VAJ=0 F VAJ1=0:0 S VAJ=$O(@VAUTVB@(VAJ)) Q:VAJ="" W !?8,$S(VAUTNI=1:VAJ,1:@VAUTVB@(VAJ))
159 Q
160 ;
161CONV(ORIGA,NEWA) ;
162 ;ORIGA - original array - name(ien)=data
163 ;NEWA - new array - name(n)=ien^data
164 ;
165 N ENT,CNT
166 S ENT=0,CNT=0
167 S NEWA=ORIGA
168 F S ENT=$O(ORIGA(ENT)) Q:ENT=""!(ENT'?.N) D
169 .S CNT=CNT+1
170 .S NEWA(CNT)=ENT_"^"_ORIGA(ENT)
171 Q
Note: See TracBrowser for help on using the repository browser.