- Timestamp:
- Dec 4, 2009, 8:26:01 PM (14 years ago)
- 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 1 1 PSGSICHK ;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 62 ;;5.0; INPATIENT MEDICATIONS ;**3,9,26,29,44,49,59,110,139,146,160,175**;16 DEC 97;Build 18 3 3 ; 4 ; Reference to ^PS(50.605 is supported by DBIA 696.5 4 ; Reference to EN^PSOORDRG is supported by DBIA 2190. 6 5 ; Reference to ^PSI(58.1 is supported by DBIA 2284. … … 12 11 ; Reference to ^ORRDI1 is supported by DBIA 4659. 13 12 ; 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.16 13 ; 17 14 START ; … … 28 25 ENSET(X) ; expands the SPECIAL INSTRUCTIONS field contained in X into Y 29 26 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 39 29 ; 40 30 END ; 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 … … 58 48 I $T(HAVEHDR^ORRDI1)]"",$$HAVEHDR^ORRDI1,'$D(^XTMP("ORRDI","OUTAGE INFO","DOWN")) D 59 49 . 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. 60 51 I $D(^TMP($J,"DD")) D ORDCHK^PSJLMUT1(PSGP,"DD",4) 61 52 I $D(^TMP($J,"DC")) D ORDCHK^PSJLMUT1(PSGP,"DC",6) … … 63 54 I '$D(PSJFST) N PSJFST S PSJFST=0 64 55 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. 65 57 ;*** Allergy/adverse reaction check. 66 58 N PTR,X … … 75 67 .W !! 76 68 K PSJACK,GMRAING,I,^TMP($J) 77 D ALGCLASS 69 D ALGCLASS^PSGSICH1 78 70 CONT ; 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. 81 80 I 'INTERVEN!($P(PSJSYSU,";")'=3) Q 82 N EWPSJY81 N PSJY 83 82 W:PSJIREQ !!,"This is a CRITICAL interaction, you must enter an intervention log to continue" 84 83 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 … … 89 88 D ENCV^PSGSETU Q:$D(XQUIT) 90 89 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 92 92 ; 93 93 SF ; 94 N PSGID 94 95 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) 95 96 W !!,$S($P(ND,"^",9):"NON-",1:""),"FORMULARY ITEM" W:$P(ND,"^",10)]"" !,$P(ND,"^",10) … … 116 117 W ?10,$P(ND,U),!,?13,"Give: ",X," ",$$ENMRN^PSGMI(+$P(ND0,U,3))," ",$P(ND2,U),!! 117 118 Q 118 ALGCLASS ; checks any Drug allergies or reactions to see if119 ; the new drug is the same class120 ; this call can be removed by commenting out the call on IVSOL+16121 N PSJLIST,CT,CLS,CLCHK,CNT,PSJL,LIST,DCCNT,PSCLASS,LEN122 S PSCLASS=$P($G(^PSDRUG(PSJDD,0)),"^",2),LEN=4 I $E(PSCLASS,1,4)="CN10" S LEN=5 ;look at 5 chars if ANALGESICS123 I $T(GETDATA^GMRAOR)]"" G ALGC2124 S GMRA="0^0^111" D EN1^GMRADPT125 F PSJLIST=0:0 S PSJLIST=$O(GMRAL(PSJLIST)) Q:'PSJLIST D126 .K PSJAGL D EN1^GMRAOR2(PSJLIST,"PSJAGL")127 .; is the allergy/reaction drug class first four digits the same as the128 .; the class for the drug being entered?129 .S (CT,CLS)="",DCCNT=0130 .I $D(PSJAGL("V")) D131 ..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 D135 ..W !?6,"Drug: "_$P(LIST(PSJL),"^"),!,"Drug Class: "_$P(LIST(PSJL),"^",2),!136 Q137 ALGC2 ;138 K GMRADRCL139 D GETDATA^GMRAOR(DFN) Q:'$D(^TMP("GMRAOC",$J,"APC"))140 N GMRACL,RET141 S RET=0,GMRACL="" F S GMRACL=$O(^TMP("GMRAOC",$J,"APC",GMRACL)) Q:'$L(GMRACL) D142 .N GMRANM,GMRALOC143 .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+1147 Q:'RET K ^TMP("GMRAOC",$J)148 S CLCHK="",CT="" F S CT=$O(GMRADRCL(CT)) Q:CT="" D149 .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")) Q152 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 ^DIR159 I Y D ^PSJRXI160 I '$G(Y) K DIR,DTOUT,DIRUT,DIROUT,DUOUT,Y Q161 Q
Note:
See TracChangeset
for help on using the changeset viewer.