VistA-WorldVistAEHR/r/OUTPATIENT_PHARMACY-PSO-APS.../PSOOREDX.m

79 lines
3.5 KiB
Mathematica

PSOOREDX ;BIR/MHA-Rxs dosing common calls ;03/06/03
;;7.0;OUTPATIENT PHARMACY;**133**;DEC 1997
;External reference to PS(51.2 supported by DBIA 2226
;called from psoored4 & psoored5
VER D KV S DIR(0)="52.0113,8"
S:$G(PSORXED("VERB",ENT))]"" DIR("B")=PSORXED("VERB",ENT)
D ^DIR Q
DUPD ;
D KV S DIR(0)="52.0113,1",DIR("A")="DISPENSE UNITS PER DOSE"_$S($G(PSORXED("NOUN",ENT))]"":"("_PSORXED("NOUN",ENT)_")",1:"")
I '$G(PSORXED("DOSE",ENT)),$G(PSORXED("DOSE",ENT-1)) S PSORXED("DOSE",ENT)=PSORXED("DOSE",ENT-1)
Q
;
STR S:+STRE>0&(X>0) PSORXED("DOSE",ENT)=(X*STRE) W !,"Dosage Ordered: "_$S($E(PSORXED("DOSE",ENT),1)=".":"0",1:"")_PSORXED("DOSE",ENT)_UNITN,!
S:X'="" (PSORXED("DOSE ORDERED",ENT),DUPD)=X
Q
;
NOU D KV S DIR(0)="52.0113,3"
S DIR("B")=$S($G(NOUN)]"":NOUN,1:$G(PSORXED("NOUN",ENT))) K:DIR("B")="" DIR("B")
S PSONDEF=$G(DIR("B"))
D ^DIR Q
;
DUR1 K:X="@" DUR,PSORXED("DURATION",ENT)
I Y'="" S PSORXED("DURATION",ENT)=Y W " ("_$S(Y["L":"MONTHS",Y["W":"WEEKS",Y["H":"HOURS",Y["M":"MINUTES",1:"DAYS")_")"
Q
;
CON D KV S DIR(0)="52.0113,5"
S:$G(PSORXED("CONJUNCTION",ENT))'="" DIR("B")=PSORXED("CONJUNCTION",ENT)
D ^DIR Q
;
CON1 D KV S DIR(0)="Y",DIR("A",1)="Deleting this conjunction will delete the dosing sequence that follows!"
S DIR("A")="Are you sure you want to delete",DIR("B")="NO" D ^DIR
Q
;
KV K DIR,DIRUT,DTOUT,DUOUT Q
;
;
FNM S NM=$E(X,2,4),NM=$TR(NM,"qwertyuioplkjhgfdsazxcvbnm","QWERTYUIOPLKJHGFDSAZXCVBNM")
S FLDNM=$S(NM="DOS":"DOSE^*Dosage",NM="DIS":"DOSE ORDERED^Dispense Units",NM="ROU":"ROUTE^*Route",NM="SCH":"SCHEDULE^*Schedule",NM="DUR"!(NM="LIM"):"DURATION^*Duration",1:"")
S:FLDNM="" FLDNM=$S(NM="CON":"CONJUNCTION^*Conjunction",NM="NOU":"NOUN^Noun",NM="VER":"VERB^Verb",1:"")
Q
JFN K FLDNM,AR S ENT=+Y,FLDNM=$S(NM="NOU":"NOU",NM="VER":"VER",NM="DOS":"ASK",NM="DIS":"DUPD",NM="ROU":"RTE",NM="SCH":"SCH",NM="DUR"!(NM="LIM"):"DUR",NM="CON":"CON",1:"")
Q
JP2 F AR=1:1:PSORXED("ENT") D:$G(PSORXED("SCHEDULE",AR))]""
.W !,AR_". "_$P(FLDNM,"^",2)_": "_$S(NM="ROU"&($G(PSORXED($P(FLDNM,"^"),AR))):$P(^PS(51.2,PSORXED($P(FLDNM,"^"),AR),0),"^"),1:$G(PSORXED($P(FLDNM,"^"),AR))) S AR1=AR
Q
UPD ;updates dosing array
K PSORXED("CONJUNCTION",ENT) S I=ENT+1 D RV
S HENT=ENT
UPD1 ;
S I=HENT+1,J=I+1
I $G(PSORXED("CONJUNCTION",I))]"",'$D(PSORXED("DOSE",J)) K PSORXED("CONJUNCTION",I) Q
I $G(PSORXED("CONJUNCTION",I))]"" S PSORXED("CONJUNCTION",HENT)=PSORXED("CONJUNCTION",I) D G UPD1
.K PSORXED("CONJUNCTION",I) I $D(PSORXED("DOSE",J)) D
..S PSORXED("DOSE",I)=PSORXED("DOSE",J)
..S PSORXED("DOSE ORDERED",I)=$G(PSORXED("DOSE ORDERED",J))
..S PSORXED("UNITS",I)=$G(PSORXED("UNITS",J))
..S PSORXED("NOUN",I)=$G(PSORXED("NOUN",J))
..S PSORXED("VERB",I)=$G(PSORXED("VERB",J))
..S PSORXED("DURATION",I)=$G(PSORXED("DURATION",J))
..S PSORXED("CONJUNCTION",I)=$G(PSORXED("CONJUNCTION",J))
..S PSORXED("ROUTE",I)=$G(PSORXED("ROUTE",J))
..S PSORXED("SCHEDULE",I)=$G(PSORXED("SCHEDULE",J))
..S PSORXED("ODOSE",I)=$G(PSORXED("ODOSE",J))
..S HENT=HENT+1,I=HENT+1
..I $G(PSORXED("CONJUNCTION",I))]"" Q
..K PSORXED("CONJUNCTION",I) D RV
S PSORXED("ENT")=HENT K HENT D EN^PSOFSIG(.PSORXED)
Q
RV K PSORXED("UNITS",I),PSORXED("NOUN",I),PSORXED("DURATION",I),PSORXED("ROUTE",I),PSORXED("SCHEDULE",I),PSORXED("DOSE",I),PSORXED("DOSE ORDERED",I),PSORXED("VERB",I),PSORXED("ODOSE",I)
Q
M1 S VALMSG="Prescription Not Updated!"
Q
M2 S VALMSG="This edit will create a new prescription!"
Q
M3 S VALMSG=$S($G(COPY):"Copy Request Cancelled!",1:"Prescription Not Updated!")
Q
MP1 S VALMSG="Pending Order Not Updated!"
Q