source: WorldVistAEHR/trunk/r/PHARMACY_DATA_MANAGEMENT-PSS/PSSCSPD.m@ 1211

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

initial load of WorldVistAEHR

File size: 6.3 KB
Line 
1PSSCSPD ;BIR/RTR-Corresponding drug functions ;03/28/00
2 ;;1.0;PHARMACY DATA MANAGEMENT;**34,47**;9/30/97
3 ;
4REP ;
5 W !!,"Since this report must check every drug in the DRUG (#50) File, we recommend",!,"that you queue this report to a printer.",!
6 K IOP,%ZIS,POP S %ZIS="QM" D ^%ZIS I $G(POP) W !!,"Nothing queued to print.",! Q
7 I $D(IO("Q")) S ZTRTN="START^PSSCSPD",ZTDESC="Corresponding drug report" D ^%ZTLOAD K %ZIS W !,"Report queued to print.",! Q
8START ;
9 U IO
10 K ^TMP($J,"PSSC")
11 S (PSSOUT,PSSHV,PSSONE)=0,PSSDV=$S($E(IOST)="C":"C",1:"P"),PSSCT=1
12 K PSSLINE S $P(PSSLINE,"-",78)=""
13 D HDC
14 S PSSN="" F S PSSN=$O(^PSDRUG("B",PSSN)) Q:PSSN=""!($G(PSSOUT)) F PSSIEN=0:0 S PSSIEN=$O(^PSDRUG("B",PSSN,PSSIEN)) Q:'PSSIEN!($G(PSSOUT)) D
15 .Q:'$D(^PSDRUG(PSSIEN,0))
16 .S PSSINDTE=0 I $P($G(^PSDRUG(PSSIEN,"I")),"^"),$P($G(^("I")),"^")'>DT S PSSINDTE=1
17 .S PSSNODE=$G(^PSDRUG(PSSIEN,8))
18 .I '$P(PSSNODE,"^",5),'$P(PSSNODE,"^",6) Q
19 .I ($Y+5)>IOSL D HDC Q:$G(PSSOUT)
20 .S PSSONE=1
21 .W !!,$P($G(^PSDRUG(PSSIEN,0)),"^")
22 .I ($Y+5)>IOSL D HDC Q:$G(PSSOUT)
23 .S PSSUSE=$P($G(^PSDRUG(PSSIEN,2)),"^",3)
24 .K PSSI,PSSO,PSSOX,PSSIX
25 .I $P(PSSNODE,"^",5) W !?3,"Corresponding Outpatient drug: ",?36,$P($G(^PSDRUG(+$P(PSSNODE,"^",5),0)),"^") D
26 ..S PSSOX=+$P(PSSNODE,"^",5) I 'PSSOX!($P($G(^PSDRUG(+$G(PSSOX),0)),"^")="") Q
27 ..Q:$P($G(^PSDRUG(PSSOX,8)),"^",6)
28 ..Q:$D(^TMP($J,"PSSC",$P($G(^PSDRUG(+$G(PSSOX),0)),"^"),1))
29 ..Q:$G(PSSINDTE)
30 ..I PSSUSE["I"!(PSSUSE["U") S ^TMP($J,"PSSC",$P($G(^PSDRUG(+$G(PSSOX),0)),"^"),1)=$P($G(^PSDRUG(PSSIEN,0)),"^")
31 .I $P(PSSNODE,"^",6) W !?3," Corresponding Inpatient drug: ",?36,$P($G(^PSDRUG(+$P(PSSNODE,"^",6),0)),"^") D
32 ..S PSSIX=+$P(PSSNODE,"^",6) I 'PSSIX!($P($G(^PSDRUG(+$G(PSSIX),0)),"^")="") Q
33 ..Q:$P($G(^PSDRUG(PSSIX,8)),"^",5)
34 ..Q:$D(^TMP($J,"PSSC",$P($G(^PSDRUG(+$G(PSSIX),0)),"^"),2))
35 ..Q:$G(PSSINDTE)
36 ..I PSSUSE["O" S ^TMP($J,"PSSC",$P($G(^PSDRUG(+$G(PSSIX),0)),"^"),2)=$P($G(^PSDRUG(PSSIEN,0)),"^")
37 I '$G(PSSOUT),'$G(PSSONE) W !?5,"No Corresponding Drugs were found.",!
38 I $G(PSSOUT) G END
39 S PSSHV=1 S:PSSCT=1 PSSCT=2 D HDC I $G(PSSOUT) G END
40 I '$D(^TMP($J,"PSSC")) W !!?5,"There are no potential matches!",! G END
41 S PSSNM="" F S PSSNM=$O(^TMP($J,"PSSC",PSSNM)) Q:PSSNM=""!($G(PSSOUT)) D
42 .I ($Y+5)>IOSL D HDC Q:$G(PSSOUT)
43 .W !!,$G(PSSNM)
44 .I ($Y+5)>IOSL D HDC Q:$G(PSSOUT)
45 .I $D(^TMP($J,"PSSC",PSSNM,2)) W !," ** Potential corr. Outpatient Drug: "_$G(^(2))
46 .I $D(^TMP($J,"PSSC",PSSNM,1)) W !," ** Potential corr. Inpatient Drug: "_$G(^(1))
47END ;
48 I '$G(PSSOUT),$G(PSSDV)="C" W !!,"End of Report." K DIR S DIR(0)="E",DIR("A")="Press Return to continue" D ^DIR K DIR
49 I $G(PSSDV)="C" W !
50 E W @IOF
51 K ^TMP($J,"PSSC")
52 K PSSI,PSSINDTE,PSSNM,PSSONE,PSSHV,PSSO,PSSIX,PSSOX,PSSB,PSSUSE,PSSLINE,PSSOUT,PSSNODE,PSSN,PSSIEN D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
53 Q
54HDC ;
55 I $G(PSSDV)="C",$G(PSSCT)'=1 W ! K DIR S DIR(0)="E",DIR("A")="Press Return to continue, '^' to exit" D ^DIR K DIR I 'Y S PSSOUT=1 Q
56 W @IOF W !,$S('$G(PSSHV):"Current Corresponding Inpatient/Outpatient Drug Matches",1:" *** Potential Corresponding Inpatient/Outpatient Drug Matches"),?68,"PAGE: "_$G(PSSCT),!,PSSLINE S PSSCT=PSSCT+1
57 Q
58EDIT ;
59 W !! K DIC S DIC(0)="QEAMZ",DIC("A")="Select Drug: ",DIC="^PSDRUG(" D ^DIC K DIC I Y<1!($D(DTOUT))!($D(DUOUT)) W ! K PSSA,PSSI,PSSN,DA,DIE,DR Q
60 S PSSI=+Y,PSSN=$P($G(^PSDRUG(PSSI,0)),"^"),PSSA=$P($G(^(2)),"^",3)
61 W !!,"This entry is marked for the following PHARMACY packages:" W:PSSA["O" !," Outpatient" W:PSSA["U" !," Unit Dose" W:PSSA["I" !," IV" W:PSSA["W" !," Ward Stock" W:PSSA["N" !," Controlled Substances"
62 I PSSA["O" I PSSA["I"!(PSSA["U") W ! K DIR S DIR(0)="E",DIR("A")="Press Return to continue" D ^DIR K DIR G EDIT
63 I PSSA'["O",PSSA'["U",PSSA'["I",PSSA'["W",PSSA'["N" W !," (none)"
64 I PSSA'["O" W ! K DIE S DA=PSSI,DIE="^PSDRUG(",DR=62.05 D ^DIE K DIE I $D(Y)!($D(DTOUT)) G EDIT
65 I PSSA'["I",PSSA'["U" W ! K DIE S DA=PSSI,DIE="^PSDRUG(",DR=905 D ^DIE K DIE
66 G EDIT
67 Q
68PAT ;
69 W ! K PSSOTH,DIC S DIC(0)="QEAMZ",DIC("A")="Select Pharmacy Orderable Item: ",DIC="^PS(50.7," D ^DIC K DIC I Y<1!($D(DTOUT))!($D(DUOUT)) G PATQ
70 S PSSOTH=$S($P($G(^PS(59.7,1,40.2)),"^"):1,1:0)
71 K DIE W ! S DA=+Y,DIE="^PS(50.7,",DR="7;S:'$G(PSSOTH) Y=""@1"";7.1;@1"
72 D ^DIE G:$D(Y)!($D(DTOUT)) PATQ
73 G PAT
74PATQ W ! K DA,DIC,DIE,PSSOTH
75 Q
76MARK ;
77 W !!,"This option will automatically mark all corresponding Inpatient and Outpatient",!,"drugs that are listed in the 'Potential Corresponding Inpatient/Outpatient Drug",!,"Matches' section of the 'Report of Corresponding Drugs'.",!
78 W !,"Before using this option, please make sure you print a current 'Report of",!,"Corresponding Drugs' for review.",!
79 K DIR S DIR(0)="Y",DIR("A")="Mark potential corresponding drugs",DIR("B")="Y" D D ^DIR K DIR I Y'=1 G MARKQ
80 .S DIR("?")=" ",DIR("?",1)="Enter 'Yes' to mark corresponding inpatient and outpatient drugs as displayed",DIR("?",2)="in the 'Potential Corresponding Inpatient/Outpatient Drug Matches' section of"
81 .S DIR("?",3)="the 'Report of Corresponding Drugs'."
82 W !!,"This job must be queued. You will receive a mail message upon completion.",!
83 S PSSDUZX=$G(DUZ)
84 K ZTDTH S ZTIO="",ZTRTN="MARKT^PSSCSPD",ZTDESC="AUTO-MARK CORRESPONDING DRUGS",ZTSAVE("PSSDUZX")="" D ^%ZTLOAD I $D(ZTSK)[0 W !!,"Nothing queued.",!
85MARKQ K PSSDUZX
86 Q
87MARKT ;
88 N PSSN,PSSIEN,PSSINDTE,PSSNODE
89 S PSSN="" F S PSSN=$O(^PSDRUG("B",PSSN)) Q:PSSN="" F PSSIEN=0:0 S PSSIEN=$O(^PSDRUG("B",PSSN,PSSIEN)) Q:'PSSIEN D
90 .Q:'$D(^PSDRUG(PSSIEN,0))
91 .I $P($G(^PSDRUG(PSSIEN,"I")),"^"),$P($G(^("I")),"^")'>DT Q
92 .S PSSNODE=$G(^PSDRUG(PSSIEN,8))
93 .I '$P(PSSNODE,"^",5),'$P(PSSNODE,"^",6) Q
94 .S PSSUSE=$P($G(^PSDRUG(PSSIEN,2)),"^",3)
95 .K PSSI,PSSO,PSSOX,PSSIX
96 .I $P(PSSNODE,"^",5) D
97 ..S PSSOX=+$P(PSSNODE,"^",5) I 'PSSOX!($P($G(^PSDRUG(+$G(PSSOX),0)),"^")="") Q
98 ..Q:$P($G(^PSDRUG(PSSOX,8)),"^",6)
99 ..I PSSUSE["I"!(PSSUSE["U") S $P(^PSDRUG(PSSOX,8),"^",6)=PSSIEN
100 .I $P(PSSNODE,"^",6) D
101 ..S PSSIX=+$P(PSSNODE,"^",6) I 'PSSIX!($P($G(^PSDRUG(+$G(PSSIX),0)),"^")="") Q
102 ..Q:$P($G(^PSDRUG(PSSIX,8)),"^",5)
103 ..I PSSUSE["O" S $P(^PSDRUG(PSSIX,8),"^",5)=PSSIEN
104 I '$G(PSSDUZX) G MMM
105 S XMDUZ="PHARMACY DATA MANAGEMENT",XMY(PSSDUZX)="",XMSUB="PDM CORRESPONDING DRUGS"
106 K PSSXTEXT S PSSXTEXT(1)="The PDM job that automatically marks corresponding inpatient and",PSSXTEXT(2)="outpatient drugs is complete."
107 S XMTEXT="PSSXTEXT(" D ^XMD K PSSXTEXT,XMDUZ,XMY,XMSUB,XMTEXT
108MMM K PSSI,PSSO,PSSOX,PSSIX
109 S:$D(ZTQUEUED) ZTREQ="@"
110 Q
Note: See TracBrowser for help on using the repository browser.