Ignore:
Timestamp:
Dec 4, 2009, 12:11:15 AM (14 years ago)
Author:
George Lilly
Message:

revised back to 6/30/08 version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGOE6.m

    r613 r623  
    1 PSGOE6  ;BIR/CML3-ORDER ENTRY THROUGH OE/RR ;10 Mar 98 / 2:35 PM
    2         ;;5.0; INPATIENT MEDICATIONS ;**3,7,39,45,65,58,81,156,134**;16 DEC 97;Build 124
    3         ;
    4         ; Reference to ^PS(50.7 supported by DBIA #2180.
    5         ; Reference to ^PS(51.1 is supported by DBIA #2177.
    6         ; Reference to ^PS(51.2 is supported by DBIA #2178.
    7         ; Reference to ^PS(55 is supported by DBIA #2191.
    8         ; Reference to ^DD(53.1 is supported by DBIA #2256.
    9         ; Reference to ^VA(200 is supported by DBIA #10060.
    10         ; Reference to ^DICN is supported by DBIA #10009.
    11         ;
    12         K PSGFOK S F1=53.1,PSGPR=$S($D(PSGOERR):PSJORPV,1:PSGOEPR),PSGMR=$S($P(PSGNEDFD,"^",2):$P(PSGNEDFD,"^",2),1:PSGOEDMR),PSGSCH=$P(PSGNEDFD,"^",4),(PSGOROE1,PSGSI,SDT,PSGMRN,PSGSM,PSGHSM,PSGUD,PSGSD,PSGFD,PSGSI,PSGNEFD,PSGNESD)=""
    13         S:PSGMR PSGMRN=$S('$P(PSGNEDFD,"^",2):"ORAL",'$D(^PS(51.2,PSGMR,0)):PSGMR,$P(^(0),"^")]"":$P(^(0),"^"),1:PSGMR) I PSGPR S PSGPRN=$P($G(^VA(200,PSGPR,0)),"^") S:PSGPRN="" PSGPRN=PSGPR
    14         S PSGST=$S($P(PSGNEDFD,"^",3)]"":$P(PSGNEDFD,"^",3),1:"C")
    15         ; Naked references in line below refer to ^PS(53.45,PSJSYSP
    16         K ^PS(53.45,PSJSYSP,1),^(2) I PSGDRG S ^(2,0)="^53.4502P^"_PSGDRG_"^1",^(1,0)=PSGDRG,^PS(53.45,PSJSYSP,2,"B",PSGDRG,1)=""
    17         ;
    18 109     ; dosage ordered
    19         W !,"DOSAGE ORDERED: ",$S(PSGDO]"":PSGDO_"// ",1:"") R X:DTIME I X="^"!'$T W:'$T $C(7) S PSGOROE1=1 G DONE
    20         I X="" S X=PSGDO I X="" W $C(7),"  (Required)" G 109
    21         S PSGF2=109 I X="@" W $C(7),"  (Required)" G 109
    22         I X?1."?" S F1=53.1 D ENHLP^PSGOEM(53.1,109) G 109
    23         I $E(X)="^" D FF G:Y>0 @Y G 109
    24         I $E(X,$L(X))=" " F  S X=$E(X,1,$L(X)-1) Q:$E(X,$L(X))'=" "
    25         I $S(X?.E1C.E:1,$L(X)>20:1,X="":1,X["^":1,X?1.P:1,1:X=+X) W $C(7),"  ",$S(X?1.P!(X=""):"(Required)",1:"??") S X="?" D ENHLP^PSGOEM(53.1,109) G 109
    26         S PSGDO=X,PSGFOK(109)=""
    27         ;
    28 3       ; med route
    29         W !,"MED ROUTE: ",$S(PSGMR:PSGMRN_"// ",1:"") R X:DTIME I X="^"!'$T W:'$T $C(7) S PSGOROE1=1 G DONE
    30         I X="",PSGMR S X=PSGMRN I PSGMR'=PSGMRN,$D(^PS(51.2,PSGMR,0)) W "  "_$P(^(0),"^",3) S PSGFOK(3)="" G 26
    31         S PSGF2=3 I $S(X="@":1,X]"":0,1:'PSGMR) W $C(7),"  (Required)" S X="?" D ENHLP^PSGOEM(53.1,3) G 3
    32         I X?1."?" D ENHLP^PSGOEM(53.1,3)
    33         I $E(X)="^" D FF G:Y>0 @Y G 3
    34         K DIC S DIC="^PS(51.2,",DIC(0)="EMQZ",DIC("S")="I $P(^(0),""^"",4)" D ^DIC K DIC I Y'>0 G 3
    35         S PSGMR=+Y,PSGMRN=Y(0,0),PSGFOK(3)=""
    36         ;
    37 26      ; schedule
    38         W !,"SCHEDULE: ",$S(PSGSCH]"":PSGSCH_"// ",1:"") R X:DTIME I X="^"!'$T W:'$T $C(7) S PSGOROE1=1 G DONE
    39         S:X="" X=PSGSCH S PSGF2=26 ; I "@"[X W $C(7),"  (Required)" S X="?" D ENHLP^PSGOEM(53.1,26) G 26
    40         I X?1."?" D ENHLP^PSGOEM(53.1,26) G 26
    41         I $E(X)="^" D FF G:Y>0 @Y G 26
    42         I X="" S (PSGS0XT,PSGS0Y,PSGST)=""
    43         E  D EN^PSGS0 I '$D(X) W $C(7),"  ??" S X="?" D ENHLP^PSGOEM(53.1,26) G 26
    44         S PSGSCH=X,(PSGFOK(26),PSGST)="",PSGOES=1 S:PSGS0XT="O" $P(PSGNEDFD,"^",3)="O",PSGST="O" D ^PSGNE3 K PSGOES
    45         ;
    46 66      ; provider's comments
    47         ;
    48         ;
    49 DONE    ;
    50         I PSGOROE1 K Y W $C(7),"  ...order not entered..."
    51         K F,F0,F1,PSGF2,F3,PSGFOK,SDT Q
    52         ;
    53 FF      ; up-arrow to another field
    54         S Y=-1 I '$D(PSGFOK) W $C(7),"  ??" Q
    55         S X=$E(X,2,99) I X=+X S Y=$S($D(PSGFOK(X)):X,1:-1) W "  " W:Y>0 $$CODES2^PSIVUTL(53.1,X) W:Y'>0 $C(7),"??" Q
    56         K DIC S DIC="^DD(53.1,",DIC(0)="QEM",DIC("S")="I $D(PSGFOK(+Y))" D ^DIC K DIC S Y=+Y
    57         Q
    58         ;
    59 DEL     ;
    60         W !?3,"SURE YOU WANT TO DELETE" S %=0 D YN^DICN I %'=1 W "  <NOTHING DELETED>"
    61         Q
    62         ;
    63 GTST(ON)        ; Find schedule type for pending order.
    64         N PD,PDAP,ST,X,ST1 S ST=""
    65         S ST=$P($G(^PS(53.1,+ON,0)),"^",7)
    66         I $P($G(^PS(53.1,+ON,0)),U,24)="R" D
    67         .; naked ref below is from line above, ^PS(53.1,ON,0)
    68         .S X=$P(^(0),U,25) S ST=$S(X["N"!(X["P"):$P($G(^PS(53.1,+X,0)),U,7),X["V":"C",1:$P($G(^PS(55,PSGP,5,+X,0)),U,7))
    69         .I ST]"" S (PSGOST,PSGST)=ST,PSGSTN=$$ENSTN^PSGMI(ST) Q
    70         I ST'="" D
    71         . S ST1=""
    72         . S PD=+$G(^PS(53.1,+ON,.2)) S X=$G(^PS(50.7,PD,0)),ST1=$P(X,U,7)
    73         . I $G(ST1)="R" S ST="R"
    74         . K ST1
    75         I ST="" D
    76         . ;PSJ*5*156 - Don't allow backdoor to override intended schedule type from CPRS unless the default
    77         . ;            schedule type (if any) is "Fill on Request".
    78         . S PD=+$G(^PS(53.1,+ON,.2)) S X=$G(^PS(50.7,PD,0)),ST=$P(X,U,7)  ;see if there is a default schedule type.
    79         . I ST="R" Q  ;Fill on Request default schedule type will override incoming schedule type from CPRS
    80         . S ST=""  ;Reset to null in case default schedule type other than Fill on Request is defined.
    81         . D OTS I ST="O" Q
    82         . I PSGSCH="ON CALL"!(PSGSCH="ONCALL")!(PSGSCH="ON-CALL") S ST="OC" Q
    83         . I PSGSCH["PRN" S ST="P" Q
    84         . S ST="C"
    85         S (PSGOST,PSGST)=ST,PSGSTN=$$ENSTN^PSGMI(ST)
    86         Q
    87 OTS     I PSGSCH]"" S X=+$O(^PS(51.1,"B",PSGSCH,0)) I $P($G(^PS(51.1,X,0)),"^",5)="O" S ST="O" Q
    88         I PSGSCH="TODAY"!(PSGSCH="NOW")!(PSGSCH="STAT")!(PSGSCH="ONCE")!(PSGSCH="ONE TIME")!(PSGSCH="ONE-TIME")!(PSGSCH="ONETIME")!(PSGSCH="1TIME")!(PSGSCH="1 TIME")!(PSGSCH="1-TIME") S ST="O"
    89         Q
     1PSGOE6 ;BIR/CML3-ORDER ENTRY THROUGH OE/RR ;10 Mar 98 / 2:35 PM
     2 ;;5.0; INPATIENT MEDICATIONS ;**3,7,39,45,65,58,81,156**;16 DEC 97
     3 ;
     4 ; Reference to ^PS(50.7 supported by DBIA #2180.
     5 ; Reference to ^PS(51.1 is supported by DBIA #2177.
     6 ; Reference to ^PS(51.2 is supported by DBIA #2178.
     7 ; Reference to ^PS(55 is supported by DBIA #2191.
     8 ; Reference to ^DD(53.1 is supported by DBIA #2256.
     9 ; Reference to ^VA(200 is supported by DBIA #10060.
     10 ; Reference to ^DICN is supported by DBIA #10009.
     11 ;
     12 K PSGFOK S F1=53.1,PSGPR=$S($D(PSGOERR):PSJORPV,1:PSGOEPR),PSGMR=$S($P(PSGNEDFD,"^",2):$P(PSGNEDFD,"^",2),1:PSGOEDMR),PSGSCH=$P(PSGNEDFD,"^",4),(PSGOROE1,PSGSI,SDT,PSGMRN,PSGSM,PSGHSM,PSGUD,PSGSD,PSGFD,PSGSI,PSGNEFD,PSGNESD)=""
     13 S:PSGMR PSGMRN=$S('$P(PSGNEDFD,"^",2):"ORAL",'$D(^PS(51.2,PSGMR,0)):PSGMR,$P(^(0),"^")]"":$P(^(0),"^"),1:PSGMR) I PSGPR S PSGPRN=$P($G(^VA(200,PSGPR,0)),"^") S:PSGPRN="" PSGPRN=PSGPR
     14 S PSGST=$S($P(PSGNEDFD,"^",3)]"":$P(PSGNEDFD,"^",3),1:"C")
     15 K ^PS(53.45,PSJSYSP,1),^(2) I PSGDRG S ^(2,0)="^53.4502P^"_PSGDRG_"^1",^(1,0)=PSGDRG,^PS(53.45,PSJSYSP,2,"B",PSGDRG,1)=""
     16 ;
     17109 ; dosage ordered
     18 W !,"DOSAGE ORDERED: ",$S(PSGDO]"":PSGDO_"// ",1:"") R X:DTIME I X="^"!'$T W:'$T $C(7) S PSGOROE1=1 G DONE
     19 I X="" S X=PSGDO I X="" W $C(7),"  (Required)" G 109
     20 S PSGF2=109 I X="@" W $C(7),"  (Required)" G 109
     21 I X?1."?" S F1=53.1 D ENHLP^PSGOEM(53.1,109) G 109
     22 I $E(X)="^" D FF G:Y>0 @Y G 109
     23 I $E(X,$L(X))=" " F  S X=$E(X,1,$L(X)-1) Q:$E(X,$L(X))'=" "
     24 I $S(X?.E1C.E:1,$L(X)>20:1,X="":1,X["^":1,X?1.P:1,1:X=+X) W $C(7),"  ",$S(X?1.P!(X=""):"(Required)",1:"??") S X="?" D ENHLP^PSGOEM(53.1,109) G 109
     25 S PSGDO=X,PSGFOK(109)=""
     26 ;
     273 ; med route
     28 W !,"MED ROUTE: ",$S(PSGMR:PSGMRN_"// ",1:"") R X:DTIME I X="^"!'$T W:'$T $C(7) S PSGOROE1=1 G DONE
     29 I X="",PSGMR S X=PSGMRN I PSGMR'=PSGMRN,$D(^PS(51.2,PSGMR,0)) W "  "_$P(^(0),"^",3) S PSGFOK(3)="" G 26
     30 S PSGF2=3 I $S(X="@":1,X]"":0,1:'PSGMR) W $C(7),"  (Required)" S X="?" D ENHLP^PSGOEM(53.1,3) G 3
     31 I X?1."?" D ENHLP^PSGOEM(53.1,3)
     32 I $E(X)="^" D FF G:Y>0 @Y G 3
     33 K DIC S DIC="^PS(51.2,",DIC(0)="EMQZ",DIC("S")="I $P(^(0),""^"",4)" D ^DIC K DIC I Y'>0 G 3
     34 S PSGMR=+Y,PSGMRN=Y(0,0),PSGFOK(3)=""
     35 ;
     3626 ; schedule
     37 W !,"SCHEDULE: ",$S(PSGSCH]"":PSGSCH_"// ",1:"") R X:DTIME I X="^"!'$T W:'$T $C(7) S PSGOROE1=1 G DONE
     38 S:X="" X=PSGSCH S PSGF2=26 ; I "@"[X W $C(7),"  (Required)" S X="?" D ENHLP^PSGOEM(53.1,26) G 26
     39 I X?1."?" D ENHLP^PSGOEM(53.1,26) G 26
     40 I $E(X)="^" D FF G:Y>0 @Y G 26
     41 I X="" S (PSGS0XT,PSGS0Y,PSGST)=""
     42 E  D EN^PSGS0 I '$D(X) W $C(7),"  ??" S X="?" D ENHLP^PSGOEM(53.1,26) G 26
     43 S PSGSCH=X,(PSGFOK(26),PSGST)="",PSGOES=1 S:PSGS0XT="O" $P(PSGNEDFD,"^",3)="O",PSGST="O" D ^PSGNE3 K PSGOES
     44 ;
     4566 ; provider's comments
     46 ;S DA=PSJSYSP,DIE="^PS(53.45,",DR=4 D ^DIE K DA,DIE,DR
     47 ;S PSGFOK(66)="",Y=1
     48 ;
     49 ;
     50DONE ;
     51 I PSGOROE1 K Y W $C(7),"  ...order not entered..."
     52 K F,F0,F1,PSGF2,F3,PSGFOK,SDT Q
     53 ;
     54FF ; up-arrow to another field
     55 S Y=-1 I '$D(PSGFOK) W $C(7),"  ??" Q
     56 S X=$E(X,2,99) I X=+X S Y=$S($D(PSGFOK(X)):X,1:-1) W "  " W:Y>0 $$CODES2^PSIVUTL(53.1,X) W:Y'>0 $C(7),"??" Q
     57 K DIC S DIC="^DD(53.1,",DIC(0)="QEM",DIC("S")="I $D(PSGFOK(+Y))" D ^DIC K DIC S Y=+Y
     58 Q
     59 ;
     60DEL ;
     61 W !?3,"SURE YOU WANT TO DELETE" S %=0 D YN^DICN I %'=1 W "  <NOTHING DELETED>"
     62 Q
     63 ;
     64GTST(ON) ; Find schedule type for pending order.
     65 N PD,PDAP,ST,X S ST="" I $P($G(^PS(53.1,+ON,0)),U,24)="R" D
     66 .; naked ref below is from line above, ^PS(53.1,ON,0)
     67 .S X=$P(^(0),U,25) S ST=$S(X["N"!(X["P"):$P($G(^PS(53.1,+X,0)),U,7),X["V":"C",1:$P($G(^PS(55,PSGP,5,+X,0)),U,7))
     68 .I ST]"" S (PSGOST,PSGST)=ST,PSGSTN=$$ENSTN^PSGMI(ST) Q
     69 I ST="" D
     70 . ;PSJ*5*156 - Don't allow backdoor to override intended schedule type from CPRS unless the default
     71 . ;            schedule type (if any) is "Fill on Request".
     72 . S PD=+$G(^PS(53.1,+ON,.2)) S X=$G(^PS(50.7,PD,0)),ST=$P(X,U,7)  ;see if there is a default schedule type.
     73 . I ST="R" Q  ;Fill on Request default schedule type will override incoming schedule type from CPRS
     74 . S ST=""  ;Reset to null in case default schedule type other than Fill on Request is defined.
     75 . D OTS I ST="O" Q
     76 . I PSGSCH="ON CALL"!(PSGSCH="ONCALL")!(PSGSCH="ON-CALL") S ST="OC" Q
     77 . I PSGSCH["PRN" S ST="P" Q
     78 . S ST="C"
     79 S (PSGOST,PSGST)=ST,PSGSTN=$$ENSTN^PSGMI(ST)
     80 Q
     81OTS I PSGSCH]"" S X=+$O(^PS(51.1,"B",PSGSCH,0)) I $P($G(^PS(51.1,X,0)),"^",5)="O" S ST="O" Q
     82 I PSGSCH="TODAY"!(PSGSCH="NOW")!(PSGSCH="STAT")!(PSGSCH="ONCE")!(PSGSCH="ONE TIME")!(PSGSCH="ONE-TIME")!(PSGSCH="ONETIME")!(PSGSCH="1TIME")!(PSGSCH="1 TIME")!(PSGSCH="1-TIME") S ST="O"
     83 Q
Note: See TracChangeset for help on using the changeset viewer.