source: FOIAVistA/trunk/r/PHARMACY_DATA_MANAGEMENT-PSS/PSSDOSED.m@ 1336

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

initial load of FOIAVistA 6/30/08 version

File size: 4.2 KB
Line 
1PSSDOSED ;BIR/RTR-Dosage edit ;03/09/00
2 ;;1.0;PHARMACY DATA MANAGEMENT;**34,38,49,50**;9/30/97
3 ;Reference to ^PS(50.607 supported by DBIA #2221
4 ;
5 W ! K DIC S DIC="^PSDRUG(",DIC(0)="QEAMZ",DIC("A")="Select Drug: " D ^DIC K DIC I +Y<1!($D(DTOUT)) Q
6 Q
7SET ;x-ref on Dispense Unit per Dose to set Dose field
8 N PSSUNIT,PSSUNITV,PSSDOSEV,PSS2,PSS1,PSS3,PSSU1,PSSUNITA,PSSUNITB,PSSUSL,PSSUST,PSSU50,PSSUSL2,PSSUSL3,PSSUSL4,PSSUSL5
9 N PSSUZ,PSSUZ1,PSSUZD
10 S PSSDOSEV=+$G(X)*+$P($G(^PSDRUG(DA(1),"DOS")),"^")
11 S $P(^PSDRUG(DA(1),"DOS1",DA,0),"^",2)=PSSDOSEV
12 S PSSUNIT=$P($G(^PS(50.607,+$P($G(^PSDRUG(DA(1),"DOS")),"^",2),0)),"^")
13 S PSSUSL=0 I PSSUNIT["/" S PSSHLDDA=$G(DA),PSSHLDX=$G(X) S PSSUST=$$PSJST^PSNAPIS(+$P($G(^PSDRUG(DA(1),"ND")),"^"),+$P($G(^PSDRUG(DA(1),"ND")),"^",3)) D S PSSUST=+$P($G(PSSUST),"^",2) I $G(PSSUST),$G(PSSU50),+$G(PSSUST)'=+$G(PSSU50) S PSSUSL=1
14 .S DA=$G(PSSHLDDA),X=$G(PSSHLDX) K PSSHLDDA,PSSHLDX
15 .S PSSU50=$P($G(^PSDRUG(DA(1),"DOS")),"^")
16 I PSSUNIT["/" S PSSUNITA=$P(PSSUNIT,"/"),PSSUNITB=$P(PSSUNIT,"/",2),PSS1=+$G(PSSUNITA),PSSU1=+$G(PSSUNITB)
17 I PSSUNIT["/",$G(PSSUSL) S PSSUSL2=PSSU50/PSSUST,PSSUSL3=PSSUSL2*X S PSSUSL4=PSSUSL3*$S($G(PSSU1):PSSU1,1:1) S PSSUSL5=$S('$G(PSSU1):PSSUSL4_$G(PSSUNITB),1:PSSUSL4_$P(PSSUNITB,PSSU1,2))
18 I PSSUNIT["/" S PSSUNITV=$S('$G(PSS1):PSSDOSEV,1:($G(PSS1)*PSSDOSEV))_$S($G(PSS1):$P(PSSUNITA,PSS1,2),1:PSSUNITA)_"/"_$S($G(PSSUSL):$G(PSSUSL5),'$G(PSSU1):X_PSSUNITB,1:(X*+PSSU1)_$P(PSSUNITB,PSSU1,2))
19 I PSSUNIT'["/" S PSSUNITV=PSSDOSEV_PSSUNIT
20 I $G(PSSUNITV)["/." S PSSUZD=$G(PSSUNITV) D
21 .S PSSUZ=$P(PSSUZD,"/."),PSSUZ1=$P(PSSUZD,"/.",2)
22 .S PSSUNITV=$G(PSSUZ)_"/0."_$G(PSSUZ1)
23 D EN^DDIOL(" Dosage = "_$S($E($G(PSSUNITV),1)=".":"0",1:"")_$G(PSSUNITV))
24 Q
25KILL ;
26 S $P(^PSDRUG(DA(1),"DOS1",DA,0),"^",2)=""
27 Q
28SETS ;Set cross reference on Strength
29 N PSS4,PSS5,PSS6,PSS7,PSS8,PSS9,PSSUNA1,PSSUNB1,PSSUA1,PSSUB1,PSSNDS,PSSLASH,PSSLASH1,PSSLASH2,PSSLASH3,PSSLASH4,PSSLASH5
30 N PSSSZ,PSSSZ1,PSSSZD
31 D EN^DDIOL(" ")
32 D EN^DDIOL("Resetting possible dosages:")
33 F PSS4=0:0 S PSS4=$O(^PSDRUG(DA,"DOS1",PSS4)) Q:'PSS4 S PSS5=+$P($G(^PSDRUG(DA,"DOS1",PSS4,0)),"^") D:PSS5
34 .S PSS6=+$G(X)*+$G(PSS5)
35 .S $P(^PSDRUG(DA,"DOS1",PSS4,0),"^",2)=PSS6
36 .S PSS7=$P($G(^PS(50.607,+$P($G(^PSDRUG(DA,"DOS")),"^",2),0)),"^")
37 .S PSSLASH=0 I PSS7["/" S PSSHLDDA=$G(DA),PSSHLDX=$G(X) S PSSNDS=$$PSJST^PSNAPIS(+$P($G(^PSDRUG(DA,"ND")),"^"),+$P($G(^PSDRUG(DA,"ND")),"^",3)) D S PSSNDS=+$P($G(PSSNDS),"^",2) I $G(PSSNDS),$G(X),+$G(PSSNDS)'=+$G(X) S PSSLASH=1
38 ..S DA=$G(PSSHLDDA),X=$G(PSSHLDX) K PSSHLDDA,PSSHLDX
39 .I PSS7["/" S PSSUNA1=$P(PSS7,"/"),PSSUNB1=$P(PSS7,"/",2),PSSUA1=+$G(PSSUNA1),PSSUB1=+$G(PSSUNB1)
40 .I PSS7["/",$G(PSSLASH) S PSSLASH2=X/PSSNDS,PSSLASH3=PSSLASH2*PSS5 S PSSLASH4=PSSLASH3*$S($G(PSSUB1):PSSUB1,1:1) S PSSLASH5=$S('$G(PSSUB1):PSSLASH4_$G(PSSUNB1),1:PSSLASH4_$P(PSSUNB1,PSSUB1,2))
41 .I PSS7["/" S PSS9=$S('$G(PSSUA1):PSS6,1:($G(PSSUA1)*PSS6))_$S($G(PSSUA1):$P(PSSUNA1,PSSUA1,2),1:PSSUNA1)_"/"_$S($G(PSSLASH):$G(PSSLASH5),'$G(PSSUB1):PSS5_$G(PSSUNB1),1:(PSS5*+PSSUB1)_$P(PSSUNB1,PSSUB1,2))
42 .I PSS7'["/" S PSS9=PSS6_PSS7
43 .I $G(PSS9)["/." S PSSSZD=$G(PSS9) D
44 ..S PSSSZ=$P(PSSSZD,"/."),PSSSZ1=$P(PSSSZD,"/.",2)
45 ..S PSS9=$G(PSSSZ)_"/0."_$G(PSSSZ1)
46 .D EN^DDIOL(" Possible Dosage = "_$S($E($G(PSS9),1)=".":"0",1:"")_$G(PSS9))
47 Q
48KILLS ;Kill cross reference on Strength
49 N PSS10
50 F PSS10=0:0 S PSS10=$O(^PSDRUG(DA,"DOS1",PSS10)) Q:'PSS10 S $P(^PSDRUG(DA,"DOS1",PSS10,0),"^",2)=""
51 Q
52IO ;Input Transform for Package field in Possible Dose multiple
53 S X=$$UP^XLFSTR(X) I (X'?1"I")&(X'?1"O")&(X'?1"IO")&(X'?1"OI") K X Q
54 S PSS12=$P($G(^PSDRUG(DA(1),"ND")),"^",3),PSS121=$P($G(^("ND")),"^") S PSSSAVEX=$G(X)
55 S PSSSAVDA=$G(DA),PSSSAVD1=$G(DA(1))
56 S PSSIOVAR="" I PSS12,PSS121 S PSSIOVAR=$$DFSU^PSNAPIS(PSS121,PSS12)
57 S X=PSSSAVEX,DA=PSSSAVDA,DA(1)=PSSSAVD1
58 S PSS13=$S($P($G(^PSDRUG(DA(1),"DOS")),"^",2):$P($G(^("DOS")),"^",2),1:+$P(PSSIOVAR,"^",5)),PSS14=+$P(PSSIOVAR,"^")
59 I X["I",'$D(^PS(50.606,"ACONI",+$G(PSS14),+$G(PSS13))) D K X D IOK Q
60 .D EN^DDIOL("Unit/Dosage Form combination cannot be converted for Inpatient Medications")
61 I X["O",'$D(^PS(50.606,"ACONO",+$G(PSS14),+$G(PSS13))) D K X D IOK Q
62 .D EN^DDIOL("Unit/Dosage Form combination cannot be converted for Outpatient Pharmacy")
63 D IOK
64 Q
65IOK ;
66 K PSS12,PSS13,PSSSAVEX,PSSIOVAR,PSSSAVDA,PSSSAVD1
67 Q
Note: See TracBrowser for help on using the repository browser.