source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSJIPST3.m@ 701

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

initial load of WorldVistAEHR

File size: 6.9 KB
Line 
1PSJIPST3 ;BIR/MLM-CONVERT PSJ 4.5 QUICK ORDERS FOR USE IN OE/RR 3.0 ; 15 May 98 / 10:56 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**3,5**;16 DEC 97
3 ;
4EN(PROTIEN) ;
5 ; THIS CALL NOT USED ANYMORE... IT IS IN ^PSSQOC
6 Q
7 ;
8GTPC ; Set up TMP for provider comments
9 I $O(^PS(57.1,+PSJQOPTR,2,0)) D
10 .S CNT=0 F X=0:0 S X=$O(^PS(57.1,+PSJQOPTR,2,X)) Q:'X D
11 ..S Y=$G(^PS(57.1,PSJQOPTR,2,X,0)) S:Y]"" CNT=CNT+1,^TMP("PSJQO",$J,"PC",CNT,0)=Y
12 .S:$O(^TMP("PSJQO",$J,"PC",0)) ^TMP("PSJQO",$J,"PC",0)=CNT_U_CNT
13 Q
14111 ; Order Set Conversion
15CONVOS ;Convert Order Sets in ^PS(53.2,
16 D MES^XPDUTL(" ") D MES^XPDUTL("Converting Unit Dose Order Sets......")
17 N PSJNUM,PSJNUM2,PSJND,S,PSJCC,FLAG,PSJOCNT,PSJ50P7
18 S S="PSJOS" K ^TMP(S,$J)
19 F PSJNUM=0:0 S PSJNUM=$O(^PS(53.2,PSJNUM)) Q:'PSJNUM D
20 .Q:'$O(^PS(53.2,PSJNUM,1,0))
21 .S ^TMP(S,$J,PSJNUM,0)=$P(^PS(53.2,PSJNUM,0),"^")
22 .F PSJNUM2=0:0 S PSJNUM2=$O(^PS(53.2,PSJNUM,1,PSJNUM2)) Q:'PSJNUM2 D
23 ..S ^TMP(S,$J,PSJNUM,1,PSJNUM2,0)=^PS(53.2,PSJNUM,1,PSJNUM2,0)
24 ..S ^TMP(S,$J,PSJNUM,1,PSJNUM2,1)=$G(^PS(53.2,PSJNUM,1,PSJNUM2,1))
25 ..F PSJND=0:0 S PSJND=$O(^PS(53.2,PSJNUM,1,PSJNUM2,2,PSJND)) Q:'PSJND D
26 ...S ^TMP(S,$J,PSJNUM,1,PSJNUM2,2,PSJND,0)=^PS(53.2,PSJNUM,1,PSJNUM2,2,PSJND,0)
27 ..I '$$CHECK(PSJNUM,PSJNUM2,S) S ^TMP(S,$J,"BAD",PSJNUM)=1
28 ..E S ^TMP(S,$J,PSJNUM,2,PSJNUM2,"50.7PT")=PSJ50P7
29 D CONVERT D:$D(^TMP(S,$J)) MAILMESS(PSJOCNT) K ^TMP(S,$J)
30 D NOW^%DTC S $P(^PS(59.7,1,20.5),U,4)=%
31 D MES^XPDUTL(" .....finished") W !
32 D SDCON ; queue up conversion of Order sets to OERR quick orders
33 Q
34CONVERT ;
35 N PSJNUM,PSJNUM2,PSJND,PSJT,M1,L1,M2,L2
36 F PSJNUM=0:0 S PSJNUM=$O(^TMP(S,$J,PSJNUM)) Q:'PSJNUM D
37 .Q:$D(^TMP(S,$J,"BAD",PSJNUM)) ; doesn't convert the bad ones
38 .S PSJOCNT=$S('$D(PSJOCNT):1,1:PSJOCNT+1)
39 .S M1=^PS(53.2,PSJNUM,1,0),L1=$L(M1),M1=$E(M1,(L1-3),L1)
40 .S ^PS(53.2,PSJNUM,2,0)="^53.22PA"_M1
41 .F PSJNUM2=0:0 S PSJNUM2=$O(^TMP(S,$J,PSJNUM,1,PSJNUM2)) Q:'PSJNUM2 D
42 ..S ^PS(53.2,PSJNUM,2,PSJNUM2,0)=^TMP(S,$J,PSJNUM,1,PSJNUM2,0)
43 ..S $P(^PS(53.2,PSJNUM,2,PSJNUM2,0),"^")=^TMP(S,$J,PSJNUM,2,PSJNUM2,"50.7PT")
44 ..S PSJT=$S($L(^TMP(S,$J,PSJNUM,1,PSJNUM2,1)):1,1:0)
45 ..I PSJT S ^PS(53.2,PSJNUM,2,PSJNUM2,1)=$G(^TMP(S,$J,PSJNUM,1,PSJNUM2,1))
46 ..F PSJND=0:0 S PSJND=$O(^TMP(S,$J,PSJNUM,1,PSJNUM2,2,PSJND)) Q:'PSJND D
47 ...S ^PS(53.2,PSJNUM,2,PSJNUM2,2,PSJND,0)=^TMP(S,$J,PSJNUM,1,PSJNUM2,2,PSJND,0)
48 ..I $D(^PS(53.2,PSJNUM,1,PSJNUM2,2,0)) D ;if no disp. drug don't set
49 ...S M2=^PS(53.2,PSJNUM,1,PSJNUM2,2,0),L2=$L(M2),M2=$E(M2,(L2-3),L2)
50 ...S ^PS(53.2,PSJNUM,2,PSJNUM2,2,0)="^53.23P"_M2
51 S DIK="^PS(53.2," D IXALL^DIK
52 Q
53CHECK(PSJNUM,PSJNUM2,S) ; check to see if different Orderable Items
54 N PSJFIRST,PSJCC,PSDRUG S FLAG=1
55 F PSJCC=0:0 S PSJCC=$O(^TMP(S,$J,PSJNUM,1,PSJNUM2,2,PSJCC)) Q:'PSJCC D
56 .Q:'FLAG
57 .S PSDRUG=$P(^TMP(S,$J,PSJNUM,1,PSJNUM2,2,PSJCC,0),"^")
58 .S PSJ50P7=+$P($G(^PSDRUG(PSDRUG,2)),"^")
59 .I '$D(PSJFIRST) S PSJFIRST=PSJ50P7,FLAG=1
60 .E S FLAG=(PSJFIRST=PSJ50P7)
61 .S:PSJ50P7=0 FLAG=0 ; sets flag to quit if drug has no Ord Item
62 Q FLAG
63MAILMESS(C) ; send mail msg for Order Set conversion
64 K XMY N LOOP,CNT S XMSUB="Inpatient Medications ORDER SETS conversion"
65 S XMDUZ="INPATIENT MEDICATIONS Version 5.0 Install",XMTEXT="PSJTEXT1("
66 F LOOP=0:0 S LOOP=$O(^XUSEC("PSJU MGR",LOOP)) Q:'LOOP D
67 .S XMY(LOOP)=""
68 S XMY(DUZ)=""
69 S PSJTEXT1(1,0)="The conversion of the Unit Dose Order sets has completed."
70 S PSJTEXT1(2,0)="A total of "_C_" order sets were converted."
71 I $D(^TMP(S,$J,"BAD")) D
72 .S (PSJTEXT1(3,0),PSJTEXT1(8,0))=""
73 .S PSJTEXT1(5,0)="The following Order Sets contained drugs that have"
74 .S PSJTEXT1(5,0)=PSJTEXT1(5,0)_" more than one Dispense drug,"
75 .S PSJTEXT1(6,0)="or dispense drugs that are inactive."
76 .S PSJTEXT1(7,0)="These Dispense drugs are not linked to the same Ordera"
77 .S PSJTEXT1(7,0)=PSJTEXT1(7,0)_"ble item."
78 .S PSJTEXT1(8,0)="Please REENTER these Order Sets through the menu option."
79 .F LOOP=0:0 S LOOP=$O(^TMP(S,$J,"BAD",LOOP)) Q:'LOOP D
80 ..S CNT=$S('$D(CNT):1,1:CNT+1)
81 ..S PSJTEXT1(CNT+9,0)=" ** "_$P($G(^PS(53.2,LOOP,0)),"^")_" needs to be reentered"
82 N DIFROM D ^XMD K XMSUB,XMDUZ,XMTEXT,PSJTEXT1
83 Q
84BADNAMES ;
85 D NOW^%DTC S $P(^PS(59.7,1,20.5),U,2)=%
86 I '$O(^XTMP("PSJ NEW PERSON",0)) K ^XTMP("PSJ NEW PERSON") Q
87 ; fill in ^XTMP zero node
88 N PSJDATE1,PSJDATE2
89 D NOW^%DTC S PSJDATE1=X,X1=X,X2=7 D C^%DTC S PSJDATE2=X
90 S ^XTMP("PSJ NEW PERSON",0)=PSJDATE2_"^"_PSJDATE1_"^"_"List of changed User Names in IV orders"
91 S ^XTMP("PSJ NEW1",0)=PSJDATE2_"^"_PSJDATE1_"^"_"List of changed User Names in IV orders"
92 S Y=PSJDATE2 X ^DD("DD") S PSJDATE2=Y
93 K XMY S XMSUB="Changed user names in IV file"
94 S XMDUZ="INPATIENT MEDICATIONS Version 5.0 Install",XMTEXT="PSJTEXT1("
95 F LOOP=0:0 S LOOP=$O(^XUSEC("PSJI MGR",LOOP)) Q:'LOOP D
96 .S XMY(LOOP)=""
97 S PSJTEXT1(1,0)="The following names were found in IV orders and don't have exact matches in"
98 S PSJTEXT1(2,0)="the NEW PERSON FILE."
99 S PSJTEXT1(3,0)=""
100 N CNT S LOOP=0 F S LOOP=$O(^XTMP("PSJ NEW PERSON",LOOP)) Q:LOOP="" D
101 .S CNT=$S('$D(CNT):1,1:CNT+1)
102 .S PSJTEXT1((CNT+4),0)=" "_LOOP
103 S PSJTEXT1((CNT+5),0)=" "
104 S PSJTEXT1((CNT+6),0)="This message is sent to all the Inpatient pharmacists."
105 S PSJTEXT1((CNT+7),0)="This job should most likely be handled by the Pharmacy Service ADP coordinator."
106 S PSJTEXT1((CNT+8),0)="It is VERY IMPORTANT that these names be corrected. Please have IRM assign"
107 S PSJTEXT1((CNT+9),0)="someone the Inpatient Medications option, PSJI 200, ""Correct changed User"
108 S PSJTEXT1((CNT+10),0)="Names in IV orders"". Then run this option to correct the names."
109 S PSJTEXT1((CNT+11),0)="This correction should be done as soon as possible, or at the latest "
110 S PSJTEXT1((CNT+12),0)="by "_PSJDATE2_"."
111 N DIFROM D ^XMD K XMSUB,XMDUZ,XMTEXT,PSJTEXT1
112 ; PSJ*5*5 cleanup jobs
113 D BADN^PSJ005
114 Q
115 ;
116SDCON ; begin convertion of S. Order Sets to OERR quick orders
117 S ZTDTH=$H,ZTIO="",ZTRTN="SDOT^PSJIPST3",ZTDESC="Conversion of Unit Dose Order sets to OERR Quick Orders" D ^%ZTLOAD
118 I $D(ZTSK) D MES^XPDUTL(" Job to convert Unit Dose Order Sets to OERR Quick Orders is queued. TASK #"_$G(ZTSK))
119 Q
120SDOT ;
121 S PS="PSJQOS" F PSJ1=0:0 S PSJ1=$O(^PS(53.2,PSJ1)) Q:'PSJ1 D
122 . Q:'$D(^PS(53.2,PSJ1,2)) K ^TMP(PS) S ^TMP(PS,$J,"NM")=^PS(53.2,PSJ1,0)
123 . F PSJ2=0:0 S PSJ2=$O(^PS(53.2,PSJ1,2,PSJ2)) Q:'PSJ2 D
124 .. S $P(^TMP(PS,$J,PSJ2,1),"^")=$P($G(^PS(53.2,PSJ1,2,PSJ2,0)),"^")
125 .. S $P(^TMP(PS,$J,PSJ2,1),"^",2)=$P($G(^PS(53.2,PSJ1,2,PSJ2,0)),"^",3)
126 .. S $P(^TMP(PS,$J,PSJ2,1),"^",3)=$P($G(^PS(53.2,PSJ1,2,PSJ2,0)),"^",5)
127 .. S $P(^TMP(PS,$J,PSJ2,1),"^",4)=$P($G(^PS(53.2,PSJ1,2,PSJ2,0)),"^",9)
128 .. S ^TMP(PS,$J,PSJ2,2)=$G(^PS(53.2,PSJ1,2,PSJ2,1)) K CNTT
129 .. F PSJDS=0:0 S PSJDS=$O(^PS(53.2,PSJ1,2,PSJ2,2,PSJDS)) Q:'PSJDS D
130 ... Q:$D(CNTT)
131 ... S $P(^TMP(PS,$J,PSJ2,3),"^")=$P($G(^PS(53.2,PSJ1,2,PSJ2,2,PSJDS,0)),"^")
132 ... S $P(^TMP(PS,$J,PSJ2,3),"^",2)=$P($G(^PS(53.2,PSJ1,2,PSJ2,2,PSJDS,0)),"^",2),CNTT=1
133 . D PSJQOS^ORCONV3 ; call to OERR to process each Order Set
134 K CNTT,^TMP(PS),PS,PSJ1,PSJ2,PSJDS Q
Note: See TracBrowser for help on using the repository browser.