source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSIVCHK.m@ 1361

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

initial load of WorldVistAEHR

File size: 3.3 KB
RevLine 
[613]1PSIVCHK ;BIR/PR,MLM-CHECK ORDER FOR INTEGRITY ;12 DEC 97 / 10:16 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**54,58,81,111**;16 DEC 97
3 ;
4 ; Reference to ^PS(51.1 supported by DBIA# 2177.
5 ; Reference to ^DIE supported by DBIA# 2053.
6 ;
7 ;Need DFN and ON
8 W ! S ERR=0,P("TYP")=P(4) S:P("TYP")="C" P("TYP")=P(23) I P("TYP")="S" S P("TYP")=$S(+P(5):"P",1:"A")
9 I '+P("MR") W !,"*** You have not specified a med route! ",! S ERR=1
10 I P(11)]"" S X=P(11) D CHK^DIE(51.1,1,"",X,.PSJTIM) I PSJTIM="^" W !,"*** Your administration time(s) are in an invalid format !" S ERR=1
11M I P(15)<0 S ERR=1 W !,"*** Time interval between doses is less than zero !"
12 NEW X S X=0 S:P(9)]"" X=$O(^PS(51.1,"APPSJ",P(9),0))
13 ;I P("TYP")="P",('X!("^NOW^STAT^ONCE^"[(U_$P(P(9)," ")_U))),P(11)["-" S:'ERR ERR=2 W !,"*** WARNING -- You have a non-standard schedule ...",!?15,"with an administration time."
14 ;* I P("TYP")="P",(P(15)!("^NOW^STAT^ONCE^"[(U_$P(P(9)," ")_U))),P(11)["-" S:'ERR ERR=2 W !,"*** WARNING -- You have a non-standard schedule ...",!?15,"with an administration time."
15 N XX F XX=2,3 I $P(P(XX),".",2)=""!($L(P(XX))>12) S ERR=1 W !,"*** ",$S(XX=2:"Start",1:"Stop")," date is in an invalid format or must contain time !"
16 I P(2)>P(3) S ERR=1 W !,"*** Start date/time CANNOT be greater than the stop date/time"
17 I $$SCHREQ^PSJLIVFD(.P),'X D
18 .N PSJXSTMP S PSJXSTMP=P(9) I PSJXSTMP="" S ERR=1 Q
19 .N X,Y,PSGS0XT,PSGS0Y,PSGOES S PSGOES=2,X=PSJXSTMP D ENOS^PSGS0 I $G(X)]""&($G(X)=$G(PSJXSTMP)) Q
20 .W !," *** WARNING -- Missing or Invalid Schedule ...",! S ERR=1
21INF I P(8)="","AH"[P("TYP") S ERR=1 W !,"*** You have no infusion rate defined !"
22 ;I "AH"[P("TYP"),P(8)'?1N.N1" ml/hr",P(8)'?.E1"@"1N.N S ERR=1 W !,"*** Your infusion rate is in an invalid format !"
23 I "AH"[P("TYP"),P(8)'?1N.N.1".".1N1" ml/hr",P(8)'?.E1"@"1N.N S ERR=1 W !,"*** Your infusion rate is in an invalid format !"
24 I P(8)="",P("TYP")="P" S:'ERR ERR=2 W !,"*** WARNING -- You have not specified an infusion rate. "
25 I '$$CODES1^PSIVUTL(P("TYP"),55.01,.04)!(P("TYP")="") S ERR=1 W !,"*** Type of order is invalid !"
26 I '$$CODES1^PSIVUTL(P(17),55.01,100)!(P(17)="") S ERR=1 W !,"*** Status of order is invalid !"
27AH ;
28 I "HA"[P("TYP"),(P(11)]""!(P(9)]"")) W !,$C(7),"Order type is an admixture, hyperal, or continuous syringe, and you have",!,"a schedule and/or administration times defined!"
29 I F Q=0:0 W !,"Ok to delete these fields" S %=1 D YN^DICN D NULSET Q:%
30 K % I P(6)="" S ERR=1 W !,"*** You have not entered a physician!"
31 I P(6)]"",'$D(^VA(200,+P(6),"PS")) S ERR=1 W !,"*** Physician entered does not exist or is not authorized to write",!,"medication orders"
32 I P(6)]"",$D(^VA(200,+P(6),"PS")),(+$P(^("PS"),U,4)),($P(^("PS"),U,4)'>DT) S ERR=1 W !,"*** Physician entered is no longer active."
33 D ^PSIVCHK1
34 Q
35 ;
36NULSET ;Delete admin/schedule fields for hyperals and/or admixtures
37 I '% W !!?2,"Enter 'YES' to delete the schedule and/or administration times fields from",!,"this order. Enter 'NO' (or '^') to leave the fields intact.",! Q
38 S:%=1 P(9)="",P(11)=""
39 Q
40CKO S P16=0,PSIVEXAM=1,PSIVCT=1 D PSIVCHK S PSIVNOL=1 W ! D ^PSIVORLB K PSIVEXAM Q:'ERR
41 I ERR=2 F J=0:0 W !!,"Since there is a warning with this order.",!,"do you wish to re-edit this order" S %=1 D YN^DICN Q:% W !!,"Answer 'YES' to re-edit this order."
42 I ERR=2,%=1 S PSIVOK="57^58^59^26^39^63^64^62^10^25^1" D ^PSIVORV2,GSTRING^PSIVORE1,GTFLDS^PSIVORFE K DA,DIE,DR G CKO
43 Q
Note: See TracBrowser for help on using the repository browser.