Ignore:
Timestamp:
Dec 4, 2009, 8:26:01 PM (14 years ago)
Author:
George Lilly
Message:

WorldVistAEHR overlayed on FOIAVistA

Location:
FOIAVistA/tag/r
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • FOIAVistA/tag/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGSICHK.m

    r628 r636  
    11PSGSICHK ;BIR/CML3-CHECKS SPECIAL INSTRUCTIONS ;17 Aug 98 / 8:33 AM
    2  ;;5.0; INPATIENT MEDICATIONS ;**3,9,26,29,44,49,59,110,139,146,160,175,201,185**;16 DEC 97;Build 6
     2 ;;5.0; INPATIENT MEDICATIONS ;**3,9,26,29,44,49,59,110,139,146,160,175**;16 DEC 97;Build 18
    33 ;
    4  ; Reference to ^PS(50.605 is supported by DBIA 696.
    54 ; Reference to EN^PSOORDRG is supported by DBIA 2190.
    65 ; Reference to ^PSI(58.1 is supported by DBIA 2284.
     
    1211 ; Reference to ^ORRDI1 is supported by DBIA 4659.
    1312 ; Reference to ^XTMP("ORRDI" is supported by DBIA 4660.
    14  ; Reference to GETDATA^GMRAOR supported by DBIA 4847.
    15  ; Reference to ^TMP("GMRAOC" supported by DBIA 4848.
    1613 ;
    1714START ;
     
    2825ENSET(X) ; expands the SPECIAL INSTRUCTIONS field contained in X into Y
    2926 N X1,X2,Y S Y=""
    30  ;BHW;PSJ*5*185;Modified Logic below to NOT strip spaces and allow existing logic to flow.
    31  ;             ;Removed code I X2]"" Before Set of Y and created argumentless DO structure.
    32  F X1=1:1:$L(X," ") S X2=$P(X," ",X1) D
    33  . I X2']"" S Y=Y_" " Q  ;if multiple spaces in text and were $P'ing through text, X2 will="" so just add space and continue
    34  . S Y=Y_$S($L(X2)>30:X2,'$D(^PS(51,+$O(^PS(51,"B",X2,0)),0)):X2,$P(^(0),"^",2)]""&$P(^(0),"^",4):$P(^(0),"^",2),1:X2)_" "
    35  . Q
    36  ;BHW;Modified stripping of spaces at end of string
    37  F X1=$L(Y):-1:0 Q:$E(Y,X1,X1)'=" "  S Y=$E(Y,1,X1-1)
    38  Q Y
     27 F X1=1:1:$L(X," ") S X2=$P(X," ",X1) I X2]"" S Y=Y_$S($L(X2)>30:X2,'$D(^PS(51,+$O(^PS(51,"B",X2,0)),0)):X2,$P(^(0),"^",2)]""&$P(^(0),"^",4):$P(^(0),"^",2),1:X2)_" "
     28 S Y=$E(Y,1,$L(Y)-1) Q Y
    3929 ;
    4030END ; used by DRUG (55.06,101 & 53.1,101) x-refs to warn user if patient is receiving or about to receive the drug just ordered
     
    5848 I $T(HAVEHDR^ORRDI1)]"",$$HAVEHDR^ORRDI1,'$D(^XTMP("ORRDI","OUTAGE INFO","DOWN")) D
    5949 . I $P($G(^XTMP("ORRDI","PSOO",PSGP,0)),"^",3)<0 W !,"Remote data not available - Only local order checks processed." D PAUSE^PSJLMUT1
     50 K ^TMP($J,"DUPDRG")  ;DEM - Duplicate Drug Check Ehancement.
    6051 I $D(^TMP($J,"DD")) D ORDCHK^PSJLMUT1(PSGP,"DD",4)
    6152 I $D(^TMP($J,"DC")) D ORDCHK^PSJLMUT1(PSGP,"DC",6)
     
    6354 I '$D(PSJFST) N PSJFST S PSJFST=0
    6455 I $D(^TMP($J,"DI")) S INTERVEN=1 D ORDCHK^PSJLMUT1(PSGP,"DI",8)
     56 D DUPDRG^PSJLMUT2(PSGP) K ^TMP($J,"DUPDRG")  ;DEM - Duplicate Drug Check Ehancement.
    6557 ;*** Allergy/adverse reaction check.
    6658 N PTR,X
     
    7567 .W !!
    7668 K PSJACK,GMRAING,I,^TMP($J)
    77  D ALGCLASS
     69 D ALGCLASS^PSGSICH1
    7870CONT ; Ask user if they wish to continue in spite of an order check.
    79  Q:'$D(PSJPDRG)  N DIR S DIR(0)="Y",DIR("A")="Do you wish to continue entering this order",DIR("?",1)="Enter ""N"" if you wish to exit without creating a new order,"
    80  S DIR("?")="or ""Y"" to continue with the order entry process.",DIR("B")="NO" D ^DIR I 'Y S PSGORQF=1,X="^",COMQUIT=1 Q
     71 ;Variable PSJDDCON is the order continuation flag for Duplicate Drug Check Enhancement.
     72 I $D(PSJDDCON("DD")),'PSJDDCON("DD") Q
     73 I '$D(PSJDDCON("DD")) Q:'$D(PSJPDRG)  N DIR D  I 'Y S PSGORQF=1,X="^",COMQUIT=1 K PSJDDCON Q
     74 . S DIR(0)="Y",DIR("A")=$S($G(PSJDDCON("DI")):"Do you wish to continue with the current order",1:"Do you wish to continue entering this order")
     75 . S DIR("?",1)="Enter ""N"" if you wish to exit without creating a new order,",DIR("?")="or ""Y"" to continue with the order entry process.",DIR("B")=$S($G(PSJDDCON("DI")):"YES",1:"NO")
     76 . D ^DIR
     77 . Q
     78 ;
     79 K PSJDDCON  ;Order continuation flag for Duplicate Drug Check Enhancement.
    8180 I 'INTERVEN!($P(PSJSYSU,";")'=3) Q
    82  NEW PSJY
     81 N PSJY
    8382 W:PSJIREQ !!,"This is a CRITICAL interaction, you must enter an intervention log to continue"
    8483 S DIR(0)="Y",DIR("A")="Do you wish to log an intervention",DIR("?",1)="Enter ""N"" if you do not wish to log an intervention,",DIR("?")="or ""Y"" to log an intervention." D ^DIR S PSJY=Y D:Y ^PSJRXI
     
    8988 D ENCV^PSGSETU Q:$D(XQUIT)
    9089 F  S DIC="^PSDRUG(",DIC(0)="AEIMOQZ",DIC("A")="Select DRUG: " W ! D ^DIC K DIC Q:+Y'>0  D SF
    91  D ENKV^PSGSETU K N5,ND,Q,Y Q
     90 D ENKV^PSGSETU K N5,ND,Q,Y
     91 Q
    9292 ;
    9393SF ;
     94 N PSGID
    9495 S Y=+Y,ND=$G(^PSDRUG(Y,0)),PSGID=+$G(^("I")) I PSGID W !!,"THIS DRUG IS INACTIVE AS OF ",$E($$ENDTC^PSGMI(PSGID),1,8)
    9596 W !!,$S($P(ND,"^",9):"NON-",1:""),"FORMULARY ITEM" W:$P(ND,"^",10)]"" !,$P(ND,"^",10)
     
    116117 W ?10,$P(ND,U),!,?13,"Give: ",X," ",$$ENMRN^PSGMI(+$P(ND0,U,3))," ",$P(ND2,U),!!
    117118 Q
    118 ALGCLASS ; checks any Drug allergies or reactions to see if
    119  ;         the new drug is the same class
    120  ; this call can be removed by commenting out the call on IVSOL+16
    121  N PSJLIST,CT,CLS,CLCHK,CNT,PSJL,LIST,DCCNT,PSCLASS,LEN
    122  S PSCLASS=$P($G(^PSDRUG(PSJDD,0)),"^",2),LEN=4 I $E(PSCLASS,1,4)="CN10" S LEN=5 ;look at 5 chars if ANALGESICS
    123  I $T(GETDATA^GMRAOR)]"" G ALGC2
    124  S GMRA="0^0^111" D EN1^GMRADPT
    125  F PSJLIST=0:0 S PSJLIST=$O(GMRAL(PSJLIST)) Q:'PSJLIST  D
    126  .K PSJAGL D EN1^GMRAOR2(PSJLIST,"PSJAGL")
    127  .; is the allergy/reaction drug class first four digits the same as the
    128  .; the class for the drug being entered?
    129  .S (CT,CLS)="",DCCNT=0
    130  .I $D(PSJAGL("V")) D
    131  ..F  S DCCNT=$O(PSJAGL("V",DCCNT)) Q:'DCCNT  S:$E($P($G(PSJAGL("V",DCCNT)),"^"),1,LEN)=$E(PSCLASS,1,LEN) (PSJPDRG,CLCHK)=1,CNT=$S('$D(CNT):1,1:CNT+1),LIST(CNT)=$P($G(PSJAGL),"^")_"^"_$P($G(PSJAGL("V",DCCNT)),"^",2)
    132  D:$G(CLCHK)
    133  .W !!,$C(7),"A Drug-Allergy Reaction exists for this medication and/or class!"
    134  .F PSJL=0:0 S PSJL=$O(LIST(PSJL)) Q:'PSJL  D
    135  ..W !?6,"Drug: "_$P(LIST(PSJL),"^"),!,"Drug Class: "_$P(LIST(PSJL),"^",2),!
    136  Q
    137 ALGC2 ;
    138  K GMRADRCL
    139  D GETDATA^GMRAOR(DFN) Q:'$D(^TMP("GMRAOC",$J,"APC"))
    140  N GMRACL,RET
    141  S RET=0,GMRACL="" F  S GMRACL=$O(^TMP("GMRAOC",$J,"APC",GMRACL)) Q:'$L(GMRACL)  D
    142  .N GMRANM,GMRALOC
    143  .S GMRALOC=^TMP("GMRAOC",$J,"APC",GMRACL)
    144  .S GMRANM=$P(^PS(50.605,+$O(^PS(50.605,"B",GMRACL,0)),0),U,2)
    145  .S GMRADRCL(GMRACL)=GMRACL_U_GMRANM_" ("_GMRALOC_")"
    146  .S RET=RET+1
    147  Q:'RET  K ^TMP("GMRAOC",$J)
    148  S CLCHK="",CT="" F  S CT=$O(GMRADRCL(CT)) Q:CT=""  D
    149  .I $E(PSCLASS,1,LEN)=$E(CT,1,LEN) S CLCHK=$G(CLCHK)+1,^TMP($J,"PSJDRCLS",CLCHK)=CT_" "_$P(GMRADRCL(CT),"^",2)
    150 CLASSDSP ;
    151  I '$D(^TMP($J,"PSJDRCLS")) Q
    152  W $C(7),!,"A Drug-Allergy Reaction exists for this medication and/or class!",!
    153  W !,"Drug: "_$P($G(^PSDRUG(PSJDD,0)),"^")
    154  S CT="" F  S CT=$O(^TMP($J,"PSJDRCLS",CT)) Q:CT=""  W !,"Drug Class: "_^TMP($J,"PSJDRCLS",CT)
    155  K ^TMP($J,"PSJDRCLS")
    156  S DIR("?",1)="Answer 'YES' if you DO want to enter a reaction for this medication,"
    157  S DIR("?")="       'NO' if you DON'T want to enter a reaction for this medication,"
    158  S DIR(0)="SA^1:YES;0:NO",DIR("A")="Do you want to Intervene? ",DIR("B")="Y" W ! D ^DIR
    159  I Y D ^PSJRXI
    160  I '$G(Y) K DIR,DTOUT,DIRUT,DIROUT,DUOUT,Y Q
    161  Q
Note: See TracChangeset for help on using the changeset viewer.