source: FOIAVistA/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSJ089B.m@ 1310

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

initial load of FOIAVistA 6/30/08 version

File size: 2.9 KB
Line 
1PSJ089B ;BIR/MLV-Check for Orderable Items ;02 MAY 02 / 4:29 PM
2 ;;5.0; INPATIENT MEDICATIONS ;**89**;16 DEC 97
3 ;
4 ; Reference to ^PS(55 is supported by DBIA# 2191.
5 ;
6ENNV ; Begin check of existing orders
7 I $G(DUZ)="" W !,"Your DUZ is not defined. It must be defined to run this routine." Q
8 K ZTSAVE,ZTSK S ZTRTN="ENQN^PSJ089B",ZTDESC="Inpatient Orders Check (INPATIENT MEDS)",ZTIO="" D ^%ZTLOAD
9 W !!,"The check of existing Pharmacy orders is",$S($D(ZTSK):"",1:" NOT")," queued",!
10 I $D(ZTSK) D
11 . W " (to start NOW).",!!,"YOU WILL RECEIVE A MAILMAN MESSAGES WHEN TASK #"_ZTSK_" HAS COMPLETED."
12 Q
13ENQN ; Check of existing Pharmacy orders.
14 N ND0,ND2,PSJBEG,PSJPDFN,PSJORD,CREAT,OCNT,PSJCNTX,PSJCNTY,PSJX,PSJOI,BDT,WBDT
15 S (PSJCNTX,PSJCNTY)=0
16 D NOW^%DTC S PSJSTART=$E(%,1,12),CREAT=$E(%,1,7)
17 ; S WBDT to the date before PSJ*5*70 was released.
18 S BDT=3020325
19 F PSJPDFN=0:0 S PSJPDFN=$O(^PS(55,PSJPDFN)) Q:'PSJPDFN F WBDT=BDT:0 S WBDT=$O(^PS(55,PSJPDFN,5,"AUS",WBDT)) Q:'WBDT F PSJORD=0:0 S PSJORD=$O(^PS(55,PSJPDFN,5,"AUS",WBDT,PSJORD)) Q:'PSJORD I '+$G(^PS(55,PSJPDFN,5,PSJORD,.2)) D
20 . S ND0=$G(^PS(55,PSJPDFN,5,PSJORD,0)),ND2=$G(^PS(55,PSJPDFN,5,PSJORD,2))
21 . I $P(ND2,U,2)]"",($P(ND2,U,4)]""),($P(ND0,U,21)="") D Q
22 .. NEW XX S XX=$$ACTIVE^PSJORREN(PSJPDFN,PSJORD_"U")
23 .. I +XX=2 S $P(^PS(55,PSJPDFN,5,PSJORD,.2),U)=$P(XX,U,2)
24 .. I +XX=0,($P(ND0,U,24)="R"),($P(ND0,U,25)["U") D
25 ... S $P(^PS(55,PSJPDFN,5,PSJORD,.2),U)=$P($G(^PS(55,PSJPDFN,5,+$P(ND0,U,25),.2)),U)
26 .. S PSJOI=+$G(^PS(55,PSJPDFN,5,PSJORD,.2))
27 .. I +PSJOI D EN1^PSJHL2(PSJPDFN,"SN",PSJORD_"U") S PSJCNTY=PSJCNTY+1
28 .. I '+PSJOI S PSJCNTX=PSJCNTX+1,PSJX(PSJCNTX)=PSJPDFN_U_PSJORD
29 D SENDMSG
30DONE ;
31 K DAYS,MINS,HOURS,PSG,PSJSTART,X,XMDUZ,XMSUB,XMTEXT,XMY,Y,ZTDESC,ZTDTH,ZTIO,ZTREQ,ZTRTN,ZTSAVE,ZTSK S ZTREQ="@"
32 Q
33SENDMSG ;Send mail message when check is complete.
34 K PSG,XMY NEW X
35 S XMDUZ="MEDICATIONS,INPATIENT"
36 S XMSUB="PSJ*5*89 INPATIENT MEDS ORDERABLE ITEMS ORDER CHECK COMPLETED"
37 S XMTEXT="PSG(",XMY(DUZ)=""
38 D NOW^%DTC S Y=% X ^DD("DD")
39 S PSG(1,0)="The check of existing Pharmacy orders for use with Inpatient"
40 S PSG(2,0)="Medications 5.0 completed as of "_Y_"."
41 S X=$$FMDIFF^XLFDT(%,PSJSTART,3)
42 S:$L(X," ")>1 DAYS=+$P(X," "),X=$P(X," ",2)
43 S HOURS=+$P(X,":"),MINS=+$P(X,":",2)
44 S PSG(3,0)=" "
45 S PSG(4,0)="This process checked orders for patients in "_$S($G(DAYS):DAYS_" day"_$E("s",DAYS'=1)_", ",1:"")_HOURS_" hour"_$E("s",HOURS'=1),PSG(5,0)="and "_MINS_" minute"_$E("s",MINS'=1)_"."
46 S PSG(6,0)=" "
47 I PSJCNTY S PSG(7,0)="Updated the orders with the appropriate Orderable Items."
48 I PSJCNTX=0,'PSJCNTY S PSG(7,0)="There are no Orderable Items missing from the orders."
49 I PSJCNTX>0 S PSG(7,0)="The following order(s) are without the Orderable Item. Please contact the",PSG(8,0)="NATIONAL HELP DESK for assistance:" D
50 . S PSG(9,0)="",OCNT=10
51 . F X=0:0 S X=$O(PSJX(X)) Q:'X S PSG(OCNT,0)="DFN: "_+PSJX(X)_" ORDER #: "_$P(PSJX(X),U,2)_"U",OCNT=OCNT+1
52 D ^XMD
53 Q
54 ;
55SET ;
56 Q
Note: See TracBrowser for help on using the repository browser.