source: WorldVistAEHR/trunk/r/PHARMACY_DATA_MANAGEMENT-PSS/PSSCOMMN.m@ 1375

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

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1PSSCOMMN ;BIR/RTR-Most Common Dosages Report ;06/07/00
2 ;;1.0;PHARMACY DATA MANAGEMENT;**34**;9/30/97
3 ;Reference to ^DGPM supported by DBIA 1865
4EN ;
5 W !!,"This report displays common dosages of Dispense Drugs for Unit Dose orders",!,"based on the time frame entered. Unit Dose orders without a Dosage Ordered",!,"are not included on this report."
6 W !,"If there are multiple Dispense Drugs associated with an order, only the first",!,"Dispense Drug of the order will print with the Dosage Ordered.",!
7 K DIR S DIR(0)="E",DIR("A")="Press Return to continue, '^' to exit" D ^DIR K DIR I 'Y!(Y["^") W !!,"Nothing queued to print.",! G ENDX
8 W ! K %DT S %DT="AEPX",%DT(0)=-DT,%DT("A")="Enter start date for gathering Dosages: " D ^%DT K %DT I Y<0!($G(DTOUT)) W !!,"Nothing queued to print.",! G ENDX
9 S PSSBEG=+Y
10 W ! K DIR S DIR(0)="N^1:100^",DIR("A")="Do not print Dosage if frequency is less than"
11 S DIR("?")=" ",DIR("?",1)="This number represents the minimum number of times a Dosage was entered",DIR("?",2)="for a Dispense Drug in a Unit Dose order."
12 S DIR("B")=1 D ^DIR K DIR I 'Y!($D(DIRUT)) W !!,"Nothing queued to print.",! G ENDX
13 S PSSMIN=Y
14 W !!,"Because of the length of this report, and the time needed to gather the",!,"information, this report must be queued to a printer.",!
15QUEUE ;
16 K IOP,%ZIS,POP S %ZIS="QM" D ^%ZIS I $G(POP) W !!,"Nothing queued to print.",! G ENDX
17 I '$D(IO("Q")) W !!,"This report must be queued to a printer.",! G QUEUE
18 S ZTRTN="START^PSSCOMMN",ZTDESC="Most Common Dosages Report",ZTSAVE("PSSBEG")="",ZTSAVE("PSSMIN")="" D ^%ZTLOAD W !!,"Report queued to print.",! G ENDX
19 Q
20START ;
21 U IO
22 I '$G(DT) S DT=$$DT^XLFDT
23 S PSSOUT=0,PSSDV="P",PSSCT=1
24 K ^TMP("PSSPAT",$J),^TMP("PSSDOS",$J),PSSD,PSSDV,PSSLINE,PSSP,PSSIEN,PSSPAT,PSSOR,PSSORDA,PSSDO,PSSONE,PSSDIEN,PSSDNAME,PSSPFLAG,PSSDNM,PSSDCT,PSSDOSEG,PSSPRINT,PSSXXX
25 S $P(PSSLINE,"-",79)=""
26 I $G(PSSBEG) S PSSPRINT=$E(PSSBEG,4,5)_"/"_$E(PSSBEG,6,7)_"/"_$E(PSSBEG,2,3)
27 D COMMH
28 I '$G(PSSBEG) G END
29 S PSSD=PSSBEG-.001
30 F PSSP=PSSD:0 S PSSP=$O(^DGPM("ATT1",PSSP)) Q:'PSSP!(PSSP>DT) F PSSIEN=0:0 S PSSIEN=$O(^DGPM("ATT1",PSSP,PSSIEN)) Q:'PSSIEN D
31 .S PSSPAT=$P($G(^DGPM(PSSIEN,0)),"^",3) Q:'PSSPAT
32 .Q:$D(^TMP("PSSPAT",$J,PSSPAT))
33 .S ^TMP("PSSPAT",$J,PSSPAT)=""
34 .F PSSOR=PSSD:0 S PSSOR=$O(^PS(55,PSSPAT,5,"AUS",PSSOR)) Q:'PSSOR F PSSORDA=0:0 S PSSORDA=$O(^PS(55,PSSPAT,5,"AUS",PSSOR,PSSORDA)) Q:'PSSORDA D
35 ..S PSSDO=$P($G(^PS(55,PSSPAT,5,PSSORDA,.2)),"^",2) Q:PSSDO=""
36 ..S PSSONE=$O(^PS(55,PSSPAT,5,PSSORDA,1,0)) Q:'PSSONE
37 ..S PSSDIEN=$P($G(^PS(55,PSSPAT,5,PSSORDA,1,PSSONE,0)),"^") Q:'PSSDIEN!($P($G(^PSDRUG(PSSDIEN,0)),"^")="")
38 ..S PSSDNAME=$P($G(^PSDRUG(PSSDIEN,0)),"^")
39 ..I '$D(^TMP("PSSDOS",$J,PSSDNAME,PSSDO)) S ^TMP("PSSDOS",$J,PSSDNAME,PSSDO)=1 Q
40 ..S ^TMP("PSSDOS",$J,PSSDNAME,PSSDO)=^TMP("PSSDOS",$J,PSSDNAME,PSSDO)+1
41 S PSSPFLAG=0
42 S PSSDNM="" F S PSSDNM=$O(^TMP("PSSDOS",$J,PSSDNM)) Q:PSSDNM="" S PSSDCT=1 S PSSDOSEG="" F S PSSDOSEG=$O(^TMP("PSSDOS",$J,PSSDNM,PSSDOSEG)) Q:PSSDOSEG="" D
43 .Q:^TMP("PSSDOS",$J,PSSDNM,PSSDOSEG)<$G(PSSMIN)
44 .S PSSXXX=0
45 .I ($Y+5)>IOSL S PSSXXX=1 D COMMH
46 .S PSSPFLAG=1
47 .I PSSDCT=1 W:'$G(PSSXXX) ! W !,PSSDNM
48 .W:PSSDCT'=1 ! W ?43,PSSDOSEG,?65,^TMP("PSSDOS",$J,PSSDNM,PSSDOSEG)
49 .S PSSDCT=PSSDCT+1
50 I '$G(PSSPFLAG) W !!,"NO DATA TO PRINT",!!
51END ;
52 W @IOF
53ENDX ;
54 K ^TMP("PSSPAT",$J),^TMP("PSSDOS",$J),PSSD,PSSDV,PSSLINE,PSSMIN,PSSBEG,PSSP,PSSIEN,PSSPAT,PSSOR,PSSORDA,PSSDO,PSSONE,PSSDIEN,PSSDNAME,PSSPFLAG,PSSDNM,PSSDCT,PSSDOSEG,PSSPRINT,PSSXXX
55 K %ZIS D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
56 Q
57COMMH ;
58 W @IOF W !?3,"COMMON DOSAGES REPORT STARTING FROM "_$G(PSSPRINT)_$S($G(PSSCT)=1:"",1:" (cont.)"),?67,"PAGE: "_$G(PSSCT) S PSSCT=PSSCT+1
59 W !!,"DRUG",?43,"DOSAGE",?62,"FREQUENCY",!,PSSLINE,!
60 Q
Note: See TracBrowser for help on using the repository browser.