source: FOIAVistA/trunk/r/SURGERY-SR/SROMED.m@ 1328

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

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1SROMED ;BIR/MAM - ENTER/EDIT MEDICATIONS ;01/30/08
2 ;;3.0; Surgery ;**21,44,79,100,151,166**;24 Jun 93;Build 6
3 ;
4 I '$D(^XUSEC("SROEDIT",DUZ))&'$D(^XUSEC("SROANES",DUZ)) W !!!,$C(7),"You must hold the SROEDIT key or the SROANES key to use this option !",! Q
5 D ^SROLOCK G:SROLOCK END Q:'$D(SRTN)
6 N SRLCK S SRLCK=$$LOCK^SROUTL(SRTN) I 'SRLCK G END
7START S SRQ=0,SRSMED=1 G:SRTN<1 END W @IOF S SRF=0 R !!,"ENTER MEDICATION/DOSE(MG)/ROUTE/TIME: ",M:DTIME S:'$T M="^" G:M=""!(M="^") END S SRM=$P(M,"/",1),SRD=$P(M,"/",2),SRR=$P(M,"/",3),SRT=$P(M,"/",4) W !!
8 I M="?" W !!,"Enter the medication, dose, route and time, separated by slashes (/).",!,"The Medication and time MUST be included, however the route and dose",!,"can be omitted. i.e. 'MEDICATION/DOSE//TIME' will omit the route."
9 I M="?" W !!,"Enter '??' to get a list of available drugs.",! D RET G:SRQ END G START
10 I M?.E1C.E W !!,"Your answer has a control character in it, please re-type it.",! D RET G:SRQ END G START
11 S (X,SRMM)=SRM D
12 .N SRDIC,SRD S SRDIC=50,SRDIC(0)="EMQSZ",SRD="B^C" D MIX^PSSDI(50,"SR",.SRDIC,SRD,X,,DT)
13 S SRM=$S(Y<0:"",1:$P(Y,"^",2))
14 I SRM="",SRMM'["?" W !!,"The Drug '",SRMM,"' does not exist in your Drug file. Please re-enter. " D RET G:SRQ END G START
15 I SRMM="??" D RET G:SRQ END G START
16 D TIME G:'$D(SRT) FLAG S X=SRT D FIELD^DID(130,.204,"","INPUT TRANSFORM","SRX") S SRX=SRX("INPUT TRANSFORM") X:SRT'="" SRX S SRT=$S(X="":SRT,1:X) D ROUTE G:'$D(SRR) FLAG D DOSE G:'$D(SRD) FLAG
17FLAG S SRF=$S('$D(SRT)!('$D(SRD))!('$D(SRR)):0,1:1) I 'SRF W !!!,"NO ACTION TAKEN",! H 2 G END
18DIE S DA=SRTN,DIE=130,DR=".375///"_SRM,DR(2,130.33)="1///"_SRT,DR(3,130.34)="1///"_SRD_";4///"_SRR D ^DIE W !!!,"MEDICATION ENTERED ...." K DR H 2
19 G START
20END W @IOF D ^SRSKILL D:$G(SRLCK) UNLOCK^SROUTL(SRTN)
21 Q
22RET R !!,"Press RETURN to Continue. ",Z:DTIME S:'$T Z="^" S:Z="^" SRQ=1 Q
23 Q
24ROUTE ; check for route of administration
25 Q:SRR="" N SRHELP,SRVALUE D CHK^DIE(130.34,4,"E",SRR,.SRVALUE) I SRVALUE'="^" S SRR=SRVALUE Q
26 D HELP^DIE(130.34,"",4,"S","SRHELP(1)")
27 W !!,"Route entered is not one of the available choices.",!,"Please enter medication route again.",!!
28 I $G(SRHELP(1,"DIHELP")) F I=1:1:SRHELP(1,"DIHELP") W SRHELP(1,"DIHELP",I),!
29 S DIR("A")="Enter ROUTE",DIR(0)="130.34,4O" D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) S SRR="" Q
30 S SRR=$P(Y,"^")
31 Q
32TIME ; check for time
33 K %DT S X=SRT,%DT="R" D ^%DT I Y>0 Q
34 W:SRT="" !!,"A time MUST be entered !"
35 I '(SRT?1N!(SRT?2N&(SRT<13))!(SRT?4N)!(SRT?3N)!(SRT?2N1":"2N)!(SRT?1N1":"2N))!(+SRT>2400)!(SRT="") S SRF=1
36 I SRF W !!,?5,"Enter the time in one of the following formats:",!,?9,"7:45, 0745, 745, 07:45, Date@Time, or NOW",!!,?5,"Time is required."
37T1 S:SRT="" SRF=1 Q:SRF=0 R !!,"Enter Time: ",SRT:DTIME S:'$T!(SRT="") SRT="^" G:SRT["^" END W:SRT["?" !!,"Enter a time in the format above, or RETURN to bypass. An '^' will exit this option." G:SRT["?" T1 S SRF=0 G TIME
38 Q
39DOSE ; check dosage
40 Q:SRD="" I $L(SRD)>15!($L(SRD)<1) W !!,"Dosage entered incorrectly." S SRF=1
41 I SRD="?" W !!,"Dosage must be 1 to 15 characters in length, i.e. 15 mg." S SRF=1
42D1 I SRF=1 R !!,"ENTER DOSE: ",SRD1:DTIME S:'$T SRD1="^" K:SRD1["^" SRD Q:SRD1["^" W:SRD1["?" !!,"Dosage must be 1 to 15 characters in length" G:SRD1["?" D1 S SRD=SRD1,SRF=0 G DOSE
43 Q
44SCR(SRFL,SRPK) ; screening for fields point to the DRUG file (#50)
45 N SRDT,SRN0,SRNODE,SROK,SRY S SROK=0,SRY=+Y K ^TMP($J,"SR")
46 I $G(SRFL)=1 S SRTN=$S($G(SRTN):SRTN,1:DA),SRN0=$G(^SRF(SRTN,0)),SRDT=$S($P(SRN0,"^",9):$P($P(SRN0,"^",9),"."),1:DT)
47 D DATA^PSS50(SRY,,$S($G(SRFL):SRDT,1:""),,,"SR")
48 I SRPK="S" D Q SROK
49 .S SRNODE=$P($G(^TMP($J,"SR",SRY,63)),"^") K ^TMP($J,"SR") I SRNODE["S" S SROK=1
50 S SROK=$S($P($G(^TMP($J,"SR",0)),"^")=-1:0,1:1) K ^TMP($J,"SR") Q SROK
Note: See TracBrowser for help on using the repository browser.