source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOHELP1.m@ 1270

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

initial load of WorldVistAEHR

File size: 6.8 KB
Line 
1PSOHELP1 ;BIR/SAB-OUTPATIENT HELP TEXT/UTILITY ROUTINE 2 ;11/09/92
2 ;;7.0;OUTPATIENT PHARMACY;**23,36,88,146,227,222**;DEC 1997;Build 12
3 ;External reference ^DIC(19.2 supported by DBIA 1472
4 ;External reference ^PSDRUG( supported by DBIA 221
5 ;External reference ^PS(55 supported by DBIA 2228
62001 N PSOHLP S PSOHLP(1,"F")="!!"
7 S PSOHLP(1)="Enter the lowest prescription number for this site."
8 S PSOHLP(2,"F")="!"
9 S PSOHLP(2)="If this is the first time you are entering this field,"
10 S PSOHLP(3,"F")="!"
11 S PSOHLP(3)="you should pick a number LARGER than the last prescription number used."
12 S PSOHLP(4,"F")="!!"
13 D WRITE
14 Q
15 ;
162002 N PSOHLP S PSOHLP(1,"F")="!!"
17 S PSOHLP(1)="Enter the largest acceptable prescription number for this site."
18 S PSOHLP(2,"F")="!"
19 S PSOHLP(2)="The difference between this number and the lowest prescription"
20 S PSOHLP(3,"F")="!"
21 S PSOHLP(3)="number should be substantial. The system will not allow numbers"
22 S PSOHLP(4,"F")="!"
23 S PSOHLP(4)="larger than the one you choose. It will give a warning message"
24 S PSOHLP(5,"F")="!"
25 S PSOHLP(5)="and not allow entry of any more prescriptions."
26 S PSOHLP(6,"F")="!!"
27 D WRITE
28 Q
29 ;
302003 N PSOHLP S PSOHLP(1,"F")="!!"
31 S PSOHLP(1)="Enter the last prescription number used."
32 S PSOHLP(2,"F")="!"
33 S PSOHLP(2)="If you are entering this for the first time, this number"
34 S PSOHLP(3,"F")="!"
35 S PSOHLP(3)="should be the same as the number you entered for LOW RX#."
36 S PSOHLP(4,"F")="!"
37 S PSOHLP(4)="The system will take this number, increment it by one"
38 S PSOHLP(5,"F")="!"
39 S PSOHLP(5)="until it finds a number that has not been used, and then"
40 S PSOHLP(6,"F")="!"
41 S PSOHLP(6)="use that number for the next prescription."
42 S PSOHLP(7,"F")="!!"
43 D WRITE
44 Q
45WRITE ;EN^DDIOL call
46 D EN^DDIOL(.PSOHLP) K PSOHLP
47 Q
48AUTOQ ;entry point to queue all background jobs
49 D:0 RESET1^PSOTPHL1 ;placed out of order by PSO*7*227
50 D AUTO^PSOAUTOC ;ques auto cancel job
51 D SETUP^PSOAUTOC ;ques nightly cost compile
52 D SETUP1^PSOAUTOC ;ques nightly mgmt compile
53 D QUP,CLO ;ques amis compile
54 D SETUP^PSOHLEXP ;ques exipration status update
55 D AUTO^PSOSUDEL ;ques job to deleted rxs printed from 52.5
56CLO K Y,C,D,D0,DI,DQ,DA,DIE,DR,DIC,Y,X,PSOTM,PSOOPTN,%DT,PSOPTN
57 Q
58QUP K %DT,DIC,DTOUT S DIC(0)="XZM",DIC="^DIC(19.2,",X="PSO AMIS COMPILE" D ^DIC
59 I +Y>0 D EDIT^XUTMOPT("PSO AMIS COMPILE") G CLO
60 D RESCH^XUTMOPT("PSO AMIS COMPILE","","","24H","L"),EDIT^XUTMOPT("PSO AMIS COMPILE")
61 Q
62EXP ;reset "P","A" xref in 55 from cancel option
63 Q:$G(REA)="C"
64 S PCD=+$P($G(^PSRX(DA,3)),"^",5) I 'PCD D K EXP,PCD,IFN Q
65 .S (IFN,EXP)=0
66 .F S EXP=$O(^PS(55,PSODFN,"P","A",EXP)) Q:'EXP F S IFN=$O(^PS(55,PSODFN,"P","A",EXP,IFN)) Q:'IFN I IFN=DA K ^PS(55,PSODFN,"P","A",EXP,DA) S ^PS(55,PSODFN,"P","A",$P(^PSRX(DA,2),"^",6),DA)=""
67 K ^PS(55,PSODFN,"P","A",PCD,DA) S ^PS(55,PSODFN,"P","A",$P(^PSRX(DA,2),"^",6),DA)="",$P(^PSRX(DA,3),"^",5)=""
68 K PCD Q
69SREF ;set "P","A" xref in 55 from fileman
70 I $P($G(^PSRX(X,"STA")),"^")=12,'$P($G(^PSRX(X,3)),"^",5) D Q
71 .F PX=0:0 S PA=$O(^PSRX(X,"A",PX)) Q:'PX S:$P(^PSRX(X,"A",PX,0),"^",2)="C" PCD=$P($P(^PSRX(X,"A",PX,0),"^"),".")
72 .I $G(PCD) S ^PS(55,DA(1),"P","A",PCD,X)="",$P(^PSRX(X,3),"^",5)=PCD
73 .E S:$P($G(^PSRX(X,2)),"^",6) ^PS(55,DA(1),"P","A",$P(^PSRX(X,2),"^",6),X)=""
74 .K PCD,PX
75 I $P($G(^PSRX(X,"STA")),"^")=12,$P($G(^PSRX(X,3)),"^",5) S ^PS(55,DA(1),"P","A",$P(^PSRX(X,3),"^",5),X)="" Q
76 S:$P($G(^PSRX(X,2)),"^",6) ^PS(55,DA(1),"P","A",$P(^PSRX(X,2),"^",6),X)=""
77 Q
78KREF ;kill "P","A" xref in 55 from fileman
79 K:+$P($G(^PSRX(X,2)),"^",6) ^PS(55,DA(1),"P","A",+$P(^PSRX(X,2),"^",6),X)
80 I $P($G(^PSRX(X,"STA")),"^")=12,'$P($G(^PSRX(X,3)),"^",5) D K PCD,PX Q
81 .F PX=0:0 S A=$O(^PSRX(X,"A",PX)) Q:'PX S:$P(^PSRX(X,"A",PX,0),"^",2)="C" PCD=$P($P(^PSRX(X,"A",PX,0),"^"),".")
82 .I $G(PCD) K ^PS(55,DA(1),"P","A",PCD,X)
83 I $P($G(^PSRX(X,"STA")),"^")=12,$P($G(^PSRX(X,3)),"^",5) K ^PS(55,DA(1),"P","A",$P(^PSRX(X,3),"^",5),X)
84 Q
85DAYS K PSMAX I $P($G(^PSDRUG(+$P(^PSRX(DA,0),"^",6),0)),"^",4),$P(^PSRX(DA,0),"^",7)/X>$P($G(^PSDRUG(+$P(^PSRX(DA,0),"^",6),0)),"^",4) D EN^DDIOL("Max Daily Dose of "_$P($G(^(0)),"^",4)_" Exceeded","","$C(7),!?5") D EN^DDIOL(" ","","!")
86 S PSDAYS=$P(^PSRX(DA,0),"^",8),PSRF=+$P(^(0),"^",9),PTST=$G(^PS(53,$P(^(0),"^",3),0)),PTDY=$P(PTST,"^",3),PTRF=$P(PTST,"^",4),PSODEA=$P(^PSDRUG($P(^PSRX(DA,0),"^",6),0),"^",3),CS=0
87 D NARC I $G(CLOZPAT)=1,'PSRF,X>14 K X D EN^DDIOL(" 14 Day Supply Max for Clozapine Prescriptions.","","$C(7),!!") Q
88 I $G(CLOZPAT)=0,'PSRF,X>7 K X D EN^DDIOL(" 7 Day Supply Max for Clozapine Prescriptions.","","$C(7),!!") Q
89 I $G(CLOZPAT)=1,X'=7,PSRF K X D EN^DDIOL(" Day Supply Must Equal 7 with 1 refill for Clozapine Prescriptions.","","$C(7),!!") Q
90 I $G(CLOZPAT)=1,'PSRF,X>14 K X D EN^DDIOL(" 14 Day Supply Max for Clozapine Prescriptions.","","$C(7),!!") Q
91 I $G(CLOZPAT)=2,'PSRF,X>28 K X D EN^DDIOL(" 28 Day Supply Max for Clozapine Prescriptions.","","$C(7),!!") Q
92 I $G(CLOZPAT)=2,PSRF=1,X>14 K X D EN^DDIOL(" Day Supply Must Equal 14 with 1 refill for Clozapine Prescriptions.","","$C(7),!!") Q
93 I $G(CLOZPAT)=2,PSRF=3,X>7 K X D EN^DDIOL(" Day Supply Must Equal 7 with 3 refill for Clozapine Prescriptions.","","$C(7),!!") Q
94 I PSRF>MAX S DS=X D
95 .D FULL^VALM1,EN^DDIOL(PSRF_" refills are not correct for a "_DS_" day supply.","","$C(7),!!") D EN^DDIOL("Please enter correct # of refills for a "_DS_" day supply. Max refills allowed is "_MAX_".","","!") D EN^DDIOL(" ","","!")
96 .K DIR S DIR(0)="E",DIR("A")="Press Return to Continue" D ^DIR K DIR,X,Y,DIRUT S VALMBCK="R"
97 K PSTMAX,DS D EDSTAT^PSOUTLA
98 K MAX,DAYS,PSDAYS,PSODEA,PSOX,PSOX1,PSDY,PSDY1,DEA,CS,PTST,PSRF,PTRF,PTDY
99 Q
100DAYS1 K PSRMAX S PSRF=$P(^PSRX(DA(1),0),"^",9),PTST=$G(^PS(53,$P(^(0),"^",3),0)),PTDY=$P(PTST,"^",3),PTRF=$P(PTST,"^",4)
101 S PSDAYS=$P(^PSRX(DA(1),1,DA,0),"^",10),PSODEA=$P(^PSDRUG($P(^PSRX(DA(1),0),"^",6),0),"^",3),CS=0
102 D NARC I PSRF>MAX S DS=X D
103 .D EN^DDIOL(PSRF_" refills are not correct for a "_DS_" day supply.","","$C(7),!!") D EN^DDIOL("Please enter correct # of refills for a "_DS_" day supply. Max refills allowed is "_MAX_".","","!") D EN^DDIOL(" ","","!")
104 .K DIR S DIR(0)="E",DIR("A")="Press Return to Continue" D ^DIR K DIR,X,Y,DIRUT S VALMBCK="R"
105 K PSTMAX,DS ;D EDSTAT^PSOUTLA
106 K MAX,DAYS,PSDAYS,PSODEA,PSOX,PSOX1,PSDY,PSDY1,DEA,CS,PTST,PSRF,PTDY,PTRF
107 Q
108NARC F DEA=1:1 Q:$E(PSODEA,DEA)="" I $E(+PSODEA,DEA)>1,$E(+PSODEA,DEA)<6 S CS=1
109 I $D(CLOZPAT) S MAX=$S(CLOZPAT=2&($P(^PSRX(DA,0),"^",8)=14):1,CLOZPAT=2&($P(^PSRX(DA,0),"^",8)=7):3,CLOZPAT=1&($P(^PSRX(DA,0),"^",8)=7):1,1:0),MIN=0 Q
110 I CS D
111 .S PSOX1=$S(PTRF>5:5,1:PTRF),PSOX=$S(PSOX1=5:5,1:PSOX1)
112 .S PSOX=$S('PSOX:0,X=90:1,1:PSOX),PSDY1=$S(X<60:5,X'<60&(X'>89):2,X=90:1,1:0) S MAX=$S(PSOX'>PSDY1:PSOX,1:PSDY1)
113 E D
114 .S PSOX1=PTRF,PSOX=$S(PSOX1=11:11,1:PSOX1),PSOX=$S('PSOX:0,X=90:3,1:PSOX)
115 .S PSDY1=$S(X<60:11,X'<60&(X'>89):5,X=90:3,1:0) S MAX=$S(PSOX'>PSDY1:PSOX,1:PSDY1)
116 Q
Note: See TracBrowser for help on using the repository browser.