Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSSDSBPB

PSSDSBPB.m

Go to the documentation of this file.
PSSDSBPB ;BIR/RTR-Determine numeric dose multiplier for dose call, continued ;02/12/09
 ;;1.0;PHARMACY DATA MANAGEMENT;**117,160**;9/30/97;Build 76
 ;
 ;
NUMX() ;Determine numeric dose multiplier from Local Possible Dosage
 ;Q $S($$6:4,1:0)
 ;
 S PSSQVJ1=$E(PSSQVLCD,1,5) I PSSQVJ1="0.33 " Q:'$$7 0 S PSSQVJ2=$E(PSSQVLCD,6,$L(PSSQVLCD)) Q $S($$6:.33,1:0)
 S PSSQVJ1=$E(PSSQVLCD,1,4) I PSSQVJ1="1/3 " Q:'$$7 0 S PSSQVJ2=$E(PSSQVLCD,5,$L(PSSQVLCD)) Q $S($$6:.33,1:0)
 S PSSQVJ1=$E(PSSQVLCD,1,10) I PSSQVJ1="ONE THIRD " Q:'$$7 0 S PSSQVJ2=$E(PSSQVLCD,11,$L(PSSQVLCD)) Q $S($$6:.33,1:0)
 S PSSQVJ1=$E(PSSQVLCD,1,10) I PSSQVJ1="ONE-THIRD " Q:'$$7 0 S PSSQVJ2=$E(PSSQVLCD,11,$L(PSSQVLCD)) Q $S($$6:.33,1:0)
 ;
 S PSSQVJ1=$E(PSSQVLCD,1,5) I PSSQVJ1="0.25 " Q:'$$7 0 S PSSQVJ2=$E(PSSQVLCD,6,$L(PSSQVLCD)) Q $S($$6:.25,1:0)
 S PSSQVJ1=$E(PSSQVLCD,1,4) I PSSQVJ1="1/4 " Q:'$$7 0 S PSSQVJ2=$E(PSSQVLCD,5,$L(PSSQVLCD)) Q $S($$6:.25,1:0)
 S PSSQVJ1=$E(PSSQVLCD,1,11) I PSSQVJ1="ONE FOURTH " Q:'$$7 0 S PSSQVJ2=$E(PSSQVLCD,12,$L(PSSQVLCD)) Q $S($$6:.25,1:0)
 S PSSQVJ1=$E(PSSQVLC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0
 I PSSQVJ2["-" Q 0
 I PSSQVJ2["&" Q 0
 I PSSQVJ2["\" Q 0
 I PSSQVJ2["/" Q 0
 Q 1
 ;
7() ;
 I $L(PSSQVLCD)'>$L(PSSQVJ1) Q 0
 Q 1
 ;
9() ;
 I PSSQVJ2'["4",PSSQVJ2'["3",PSSQVJ2'["2",PSSQVJ2'["FOURTH",PSSQVJ2'["THIRD",PSSQVJ2'["HALF" Q 1
 Q 0
 ;
 ;
NUMC() ;Continuation of Free Text Dosage conversion from routine PSSDSAPL
 ;
 S PSSDBV1=$E(PSSDBV9,1,4) I PSSDBV1="3-4 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,5,$L(PSSDBV9)) Q $S($$8:4,1:0)
 S PSSDBV1=$E(PSSDBV9,1,6) I PSSDBV1="3 - 4 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,7,$L(PSSDBV9)) Q $S($$8:4,1:0)
 S PSSDBV1=$E(PSSDBV9,1,7) I PSSDBV1="3 TO 4 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,8,$L(PSSDBV9)) Q $S($$8:4,1:0)
 S PSSDBV1=$E(PSSDBV9,1,7) I PSSDBV1="3 OR 4 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,8,$L(PSSDBV9)) Q $S($$8:4,1:0)
 S PSSDBV1=$E(PSSDBV9,1,14) I PSSDBV1="THREE TO FOUR " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,15,$L(PSSDBV9)) Q $S($$8:4,1:0)
 S PSSDBV1=$E(PSSDBV9,1,14) I PSSDBV1="THREE OR FOUR " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,15,$L(PSSDBV9)) Q $S($$8:4,1:0)
 S PSSDBV1=$E(PSSDBV9,1,11) I PSSDBV1="THREE-FOUR " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,12,$L(PSSDBV9)) Q $S($$8:4,1:0)
 S PSSDBV1=$E(PSSDBV9,1,13) I PSSDBV1="THREE - FOUR " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,14,$L(PSSDBV9)) Q $S($$8:4,1:0)
 ;
 S PSSDBV1=$E(PSSDBV9,1,2) I PSSDBV1="4 ",$$4 S PSSDBV2=$E(PSSDBV9,3,$L(PSSDBV9)) I $$8 Q 4
 S PSSDBV1=$E(PSSDBV9,1,5) I PSSDBV1="FOUR ",$$4 S PSSDBV2=$E(PSSDBV9,6,$L(PSSDBV9)) I $$8 Q 4
 ;
 S PSSDBV1=$E(PSSDBV9,1,10) I PSSDBV1="4 AND 1/4 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,11,$L(PSSDBV9)) Q $S($$8:4.25,1:0)
 S PSSDBV1=$E(PSSDBV9,1,20) I PSSDBV1="FOUR AND ONE FOURTH " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,21,$L(PSSDBV9)) Q $S($$8:4.25,1:0)
 S PSSDBV1=$E(PSSDBV9,1,20) I PSSDBV1="FOUR AND ONE-FOURTH " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,21,$L(PSSDBV9)) Q $S($$8:4.25,1:0)
 S PSSDBV1=$E(PSSDBV9,1,17) I PSSDBV1="4 AND ONE FOURTH " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,18,$L(PSSDBV9)) Q $S($$8:4.25,1:0)
 S PSSDBV1=$E(PSSDBV9,1,17) I PSSDBV1="4 AND ONE-FOURTH " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,18,$L(PSSDBV9)) Q $S($$8:4.25,1:0)
 S PSSDBV1=$E(PSSDBV9,1,13) I PSSDBV1="FOUR AND 1/4 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,14,$L(PSSDBV9)) Q $S($$8:4.25,1:0)
 ;
 S PSSDBV1=$E(PSSDBV9,1,10) I PSSDBV1="4 AND 1/3 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,11,$L(PSSDBV9)) Q $S($$8:4.33,1:0)
 S PSSDBV1=$E(PSSDBV9,1,19) I PSSDBV1="FOUR AND ONE THIRD " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,20,$L(PSSDBV9)) Q $S($$8:4.33,1:0)
 S PSSDBV1=$E(PSSDBV9,1,19) I PSSDBV1="FOUR AND ONE-THIRD " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,20,$L(PSSDBV9)) Q $S($$8:4.33,1:0)
 S PSSDBV1=$E(PSSDBV9,1,16) I PSSDBV1="4 AND ONE THIRD " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,17,$L(PSSDBV9)) Q $S($$8:4.33,1:0)
 S PSSDBV1=$E(PSSDBV9,1,16) I PSSDBV1="4 AND ONE-THIRD " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,17,$L(PSSDBV9)) Q $S($$8:4.33,1:0)
 S PSSDBV1=$E(PSSDBV9,1,13) I PSSDBV1="FOUR AND 1/3 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,14,$L(PSSDBV9)) Q $S($$8:4.33,1:0)
 ;
 S PSSDBV1=$E(PSSDBV9,1,10) I PSSDBV1="4 AND 1/2 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,11,$L(PSSDBV9)) Q $S($$8:4.5,1:0)
 S PSSDBV1=$E(PSSDBV9,1,18) I PSSDBV1="FOUR AND ONE HALF " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,19,$L(PSSDBV9)) Q $S($$8:4.5,1:0)
 S PSSDBV1=$E(PSSDBV9,1,18) I PSSDBV1="FOUR AND ONE-HALF " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,19,$L(PSSDBV9)) Q $S($$8:4.5,1:0)
 S PSSDBV1=$E(PSSDBV9,1,15) I PSSDBV1="4 AND ONE HALF " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,16,$L(PSSDBV9)) Q $S($$8:4.5,1:0)
 S PSSDBV1=$E(PSSDBV9,1,15) I PSSDBV1="4 AND ONE-HALF " Q:'$$4 0  S PSSDBV2=$E(PS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BV9,3,$L(PSSDBV9)) I $$8 Q 5
 S PSSDBV1=$E(PSSDBV9,1,5) I PSSDBV1="FIVE ",$$4 S PSSDBV2=$E(PSSDBV9,6,$L(PSSDBV9)) I $$8 Q 5
 ;
 S PSSDBV1=$E(PSSDBV9,1,10) I PSSDBV1="5 AND 1/4 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,11,$L(PSSDBV9)) Q $S($$8:5.25,1:0)
 S PSSDBV1=$E(PSSDBV9,1,20) I PSSDBV1="FIVE AND ONE FOURTH " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,21,$L(PSSDBV9)) Q $S($$8:5.25,1:0)
 S PSSDBV1=$E(PSSDBV9,1,20) I PSSDBV1="FIVE AND ONE-FOURTH " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,21,$L(PSSDBV9)) Q $S($$8:5.25,1:0)
 S PSSDBV1=$E(PSSDBV9,1,17) I PSSDBV1="5 AND ONE FOURTH " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,18,$L(PSSDBV9)) Q $S($$8:5.25,1:0)
 S PSSDBV1=$E(PSSDBV9,1,17) I PSSDBV1="5 AND ONE-FOURTH " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,18,$L(PSSDBV9)) Q $S($$8:5.25,1:0)
 S PSSDBV1=$E(PSSDBV9,1,13) I PSSDBV1="FIVE AND 1/4 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,14,$L(PSSDBV9)) Q $S($$8:5.25,1:0)
 ;
 S PSSDBV1=$E(PSSDBV9,1,10) I PSSDBV1="5 AND 1/3 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,11,$L(PSSDBV9)) Q $S($$8:5.33,1:0)
 S PSSDBV1=$E(PSSDBV9,1,19) I PSSDBV1="FIVE AND ONE THIRD " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,20,$L(PSSDBV9)) Q $S($$8:5.33,1:0)
 S PSSDBV1=$E(PSSDBV9,1,19) I PSSDBV1="FIVE AND ONE-THIRD " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,20,$L(PSSDBV9)) Q $S($$8:5.33,1:0)
 S PSSDBV1=$E(PSSDBV9,1,16) I PSSDBV1="5 AND ONE THIRD " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,17,$L(PSSDBV9)) Q $S($$8:5.33,1:0)
 S PSSDBV1=$E(PSSDBV9,1,16) I PSSDBV1="5 AND ONE-THIRD " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,17,$L(PSSDBV9)) Q $S($$8:5.33,1:0)
 S PSSDBV1=$E(PSSDBV9,1,13) I PSSDBV1="FIVE AND 1/3 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,14,$L(PSSDBV9)) Q $S($$8:5.33,1:0)
 ;
 S PSSDBV1=$E(PSSDBV9,1,10) I PSSDBV1="5 AND 1/2 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,11,$L(PSSDBV9)) Q $S($$8:5.5,1:0)
 S PSSDBV1=$E(PSSDBV9,1,18) I PSSDBV1="FIVE AND ONE HALF " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,19,$L(PSSDBV9)) Q $S($$8:5.5,1:0)
 S PSSDBV1=$E(PSSDBV9,1,18) I PSSDBV1="FIVE AND ONE-HALF " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,19,$L(PSSDBV9)) Q $S($$8:5.5,1:0)
 S PSSDBV1=$E(PSSDBV9,1,15) I PSSDBV1="5 AND ONE HALF " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,16,$L(PSSDBV9)) Q $S($$8:5.5,1:0)
 S PSSDBV1=$E(PSSDBV9,1,15) I PSSDBV1="5 AND ONE-HALF " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,16,$L(PSSDBV9)) Q $S($$8:5.5,1:0)
 S PSSDBV1=$E(PSSDBV9,1,13) I PSSDBV1="FIVE AND 1/2 " Q:'$$4 0  S PSSDBV2=$E(PSSDBV9,14,$L(PSSDBV9)) Q $S($$8:5.5,1:0)
 ;
 ;
 Q ""
 ;
8() ;Look for Unit - PSSDBIFL set in PSSSAPD, indicates if Order has a Dispense Drug, or just an Orderable Item
 S PSSDBV3="" D
 .I PSSDBIFL S PSSDBV3=$$UNITD^PSSDSAPI(PSSDBV2) Q
 .S PSSDBV3=$$UNIT^PSSDSAPI(PSSDBV2)
 Q $S(PSSDBV3="":0,1:1)
 ;
 ;
4() ;Validate text follow the numeric part of the text
 I $L(PSSDBV9)'>$L(PSSDBV1) Q 0
 Q 1
 ;
TEST ;used for testing numeric dose multiplier from Local Possible Dosage
 N X,Y,PSSQVLCD,DIR,DIRUT,DTOUT
TEST1 ;
 K DIR S DIR("A")="Possible Dosage",DIR(0)="FO^1:40"     ;,DIR("?")="Enter a possible dosage for testing numeric dose multiplier."
 D ^DIR G TESTE:$G(DIRUT)!($G(DTOUT))!(X="")
 K DIR S PSSQVLCD=Y W !!,$$NUM^PSSDSBPA,!!
 G TEST1
TESTE ;
 Q