source: WorldVistAEHR/trunk/r/PHARMACY_DATA_MANAGEMENT-PSS/PSS51P1.m@ 1365

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

revised back to 6/30/08 version

File size: 7.7 KB
Line 
1PSS51P1 ;BIR/LDT - API FOR INFORMATION FROM FILE 51.1 ;5 Sep 03
2 ;;1.0;PHARMACY DATA MANAGEMENT;**85,91,108,118**;9/30/97;Build 8
3 ;
4ZERO(PSSIEN,PSSFT,PSSPP,PSSTSCH,LIST) ;
5 ;PSSIEN - IEN of entry in ADMINISTRATION SCHEDULE file (#51.1).
6 ;PSSFT - Free Text name in ADMINISTRATION SCHEDULE file (#51.1).
7 ;PSSPP - PACKAGE PREFIX field (#4) in ADMINISTRATION SCHEDULE file (#51.1). Screens for Administration
8 ;Schedules for the Package Prefix passed.
9 ;PSSTSCH - TYPE OF SCHEDULE field (#5) of ADMINISTRATION SCHEDULE file (#51.1). Screens for
10 ; One-time "O" if PSSTSCH passed in.
11 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
12 ; Field Number of the data piece being returned.
13 ;Returns NAME field (#.01), STANDARD ADMINISTRATION TIMES field (#1), FREQUENCY (IN MINUTES) field (#2),
14 ;MAXIMUM DAYS FOR ORDERS field (#2.5), PACKAGE PREFIX field (#4), TYPE OF SCHEDULE field (#5),
15 ;STANDARD SHIFTS field (#6), OUTPATIENT EXPANSION field (#8), and OTHER LANGUAGE EXPANSIONS field (#8.1)
16 ;of ADMINISTRATION SCHEDULE file (#51.1).
17 N DIERR,ZZERR,PSS51P1,SCR,PSS
18 I $G(LIST)']"" Q
19 K ^TMP($J,LIST)
20 I +$G(PSSIEN)'>0,($G(PSSFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
21 I $G(PSSIEN)]"",+$G(PSSIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
22 I $G(PSSTSCH)]"",PSSTSCH'="O" S PSSTSCH=""
23 S SCR("S")="" I $G(PSSTSCH)]""!$G(PSSPP)]"" D SETSCR
24 I +$G(PSSIEN)>0 N PSSIEN2 S PSSIEN2=$$FIND1^DIC(51.1,"","A","`"_PSSIEN,"B",SCR("S"),"") D
25 .I +PSSIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
26 .S ^TMP($J,LIST,0)=1
27 .D GETS^DIQ(51.1,+PSSIEN2,".01;1;2;4;5;6;2.5;8;8.1","IE","PSS51P1") S PSS(1)=0
28 .F S PSS(1)=$O(PSS51P1(51.1,PSS(1))) Q:'PSS(1) D SETZRO^PSS51P1B
29 I +$G(PSSIEN)'>0,$G(PSSFT)]"" D
30 .I PSSFT["??" D LOOP^PSS51P1B(1) Q
31 .D FIND^DIC(51.1,,"@;.01;1","QP",PSSFT,,"B",SCR("S"),,"")
32 .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
33 .I +^TMP("DILIST",$J,0)>0 S ^TMP($J,LIST,0)=+^TMP("DILIST",$J,0) N PSSXX S PSSXX=0 F S PSSXX=$O(^TMP("DILIST",$J,PSSXX)) Q:'PSSXX D
34 ..S PSSIEN=+^TMP("DILIST",$J,PSSXX,0) K PSS51P1 D GETS^DIQ(51.1,+PSSIEN,".01;1;2;4;5;6;2.5;8;8.1","IE","PSS51P1") S PSS(1)=0
35 ..F S PSS(1)=$O(PSS51P1(51.1,PSS(1))) Q:'PSS(1) D SETZRO^PSS51P1B
36 K ^TMP("DILIST",$J)
37 Q
38 ;
39WARD(PSSIEN,PSSFT,PSSIEN2,LIST) ;
40 ;PSSIEN - IEN of entry in ADMINISTRATION SCHEDULE file (#51.1).
41 ;PSSFT - Free Text name in ADMINISTRATION SCHEDULE file (#51.1).
42 ;PSSIEN2 - IEN of entry in WARD sub-file (#51.11)
43 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
44 ; Field Number of the data piece being returned.
45 ;Returns NAME field (#.01), WARD multiple (#51.11) WARD field (#.01), and WARD ADMINISTRATION TIMES field (#1)
46 ;of ADMINISTRATION SCHEDULE file (#51.1).
47 N DIERR,ZZERR,PSS51P1,PSS,CNT
48 S CNT=0
49 I $G(LIST)']"" Q
50 K ^TMP($J,LIST)
51 I +$G(PSSIEN)'>0,($G(PSSFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
52 I $G(PSSIEN)]"",+$G(PSSIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
53 I $G(PSSIEN2)]"",+$G(PSSIEN2)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
54 D WARD^PSS51P1C
55 Q
56 ;
57HOSP(PSSIEN,PSSFT,LIST) ;
58 ;PSSIEN - IEN of entry in ADMINISTRATION SCHEDULE file (#51.1).
59 ;PSSFT - Free Text name in ADMINISTRATION SCHEDULE file (#51.1).
60 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
61 ; Field Number of the data piece being returned.
62 ;Returns NAME field (#.01), HOSPITAL LOCATION multiple (#51.17) HOSPITAL LOCATION field (#.01), ADMINISTRATION TIMES field (#1),
63 ;and SHIFTS field (#2) of ADMINISTRATION SCHEDULE file (#51.1).
64 N DIERR,ZZERR,PSS51P1,SCR,PSS,CNT
65 I $G(LIST)']"" Q
66 D HOSP^PSS51P1A
67 Q
68 ;
69IEN(PSSFT,LIST) ;
70 ;PSSFT - Free Text name in ADMINISTRATION SCHEDULE file (#51.1).
71 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
72 ; Field Number of the data piece being returned.
73 ;Returns NAME field (#.01) and STANDARD ADMINISTRATION TIMES field (#1) of ADMINISTRATION SCHEDULE file (#51.1).
74 N DIERR,ZZERR,PSS51P1,SCR,PSS
75 I $G(LIST)']"" Q
76 K ^TMP($J,LIST)
77 I $G(PSSFT)']"" S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
78 D IEN^PSS51P1A
79 Q
80 ;
81AP(PSSPP,PSSFT,PSSWDIEN,PSSTYP,LIST,PSSFREQ) ;
82 ;PSSPP - PACKAGE PREFIX in ADMINISTRATION SCHEDULE file (#51.1).
83 ;PSSFT - Free Text name in ADMINISTRATION SCHEDULE file (#51.1).
84 ;PSSWDIEN - IEN of entry of WARD multiple in ADMINISTRATION SCHEDULE file (#51.1).
85 ;PSSSTYP - TYPE OF SCHEDULE field (#5) in ADMINISTRATION SCHEDULE file (#51.1).
86 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
87 ; Field Number of the data piece being returned.
88 ;Returns NAME field (#.01), STANDARD ADMINISTRATION TIMES field (#1), and PACKAGE PREFIX field (#4)
89 ;of ADMINISTRATION SCHEDULE file (#51.1).
90 ;If PSSWDIEN is passed in then the WARD multiple (#51.11) WARD field (#.01), and WARD ADMINISTRATION TIMES field (#1)
91 ;of ADMINISTRATION SCHEDULE file (#51.1) is returned.
92 N DIERR,ZZERR,PSS51P1,SCR,PSS,PSSIEN,PSSVAL,PSSTMP
93 I $G(PSSFREQ)']"" S PSSFREQ=""
94 I $G(LIST)']"" Q
95 D AP^PSS51P1A
96 Q
97 ;
98IX(PSSFT,PSSPP,LIST) ;
99 ;PSSFT - Free Text name in ADMINISTRATION SCHEDULE file (#51.1).
100 ;PSSPP - PACKAGE PREFIX in ADMINISTRATION SCHEDULE file (#51.1).
101 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
102 ; Field Number of the data piece being returned.
103 ;Returns NAME field (#.01), STANDARD ADMINISTRATION TIMES field (#1), FREQUENCY (IN MINUTES) field (#2),
104 ;MAXIMUM DAYS FOR ORDERS field (#2.5),PACKAGE PREFIX field (#4), TYPE OF SCHEDULE field (#5), STANDARD
105 ;SHIFTS field (#6), OUTPATIENT EXPANSION field (#8), and OTHER LANGUAGE EXPANSION field (#8.1) of
106 ;ADMINISTRATION SCHEDULE file (#51.1).
107 N DIERR,ZZERR,PSS51P1,PSS
108 I $G(LIST)']"" Q
109 D IX^PSS51P1A
110 Q
111 ;
112ADM(PSSADM) ; admin times
113 N X S X=PSSADM
114 I $S($L($P(X,"-"))>4:1,$L(X)>119:1,$L(X)<2:1,X'>0:1,1:X'?.ANP) K X Q "^"
115 S X(1)=$P(X,"-") I X(1)'?2N,X(1)'?4N K X Q "^"
116 S X(1)=$L(X(1)) F X(2)=2:1:$L(X,"-") S X(3)=$P(X,"-",X(2)) I $S($L(X(3))'=X(1):1,X(3)>$S(X(1)=2:24,1:2400):1,1:X(3)'>$P(X,"-",X(2)-1)) K X Q
117 I '$D(X) Q "^"
118 K:$D(X) X(1),X(2),X(3) Q PSSADM
119 ;
120ALL(PSSIEN,PSSFT,LIST) ;
121 ;PSSIEN - IEN of entry in ADMINISTRATION SCHEDULE file (#51.1).
122 ;PSSFT - Free Text name in ADMINISTRATION SCHEDULE file (#51.1).
123 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
124 ; Field Number of the data piece being returned.
125 ;Returns NAME field (#.01), STANDARD ADMINISTRATION TIMES field (#1), FREQUENCY (IN MINUTES) field (#2),
126 ;MAXIMUM DAYS FOR ORDERS field (#2.5), PACKAGE PREFIX field (#4), TYPE OF SCHEDULE field (#5),
127 ;STANDARD SHIFTS field (#6), OUTPATIENT EXPANSION field (#8), OTHER LANGUAGE EXPANSIONS field (#8.1),
128 ; HOSPITAL LOCATION multiple (#51.17) HOSPITAL LOCATION field (#.01), ADMINISTRATION TIMES field (#1),
129 ;SHIFTS field (#2), WARD multiple (#51.11) WARD field (#.01), and WARD ADMINISTRATION TIMES field (#1)
130 ;of ADMINISTRATION SCHEDULE file (#51.1).
131 N DIERR,ZZERR,PSS
132 I $G(LIST)']"" Q
133 K ^TMP($J,LIST)
134 I +$G(PSSIEN)'>0,($G(PSSFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
135 I $G(PSSIEN)]"",+$G(PSSIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
136 D ALL^PSS51P1C
137 Q
138 ;
139SETSCR ;Set Screen for One-time schedule type
140 ;Naked reference below refers to ^PS(51.1,+Y,0)
141 I $G(PSSTSCH)]"" S SCR("S")="I $P(^(0),""^"",5)=""O"""
142 ;Naked reference below refers to ^PS(51.1,+Y,0)
143 I $G(PSSPP)]"" S SCR("S")=$S(SCR("S")]"":SCR("S")_" I $P(^(0),""^"",4)=PSSPP",1:"I $P(^(0),""^"",4)=PSSPP")
144 Q
145FREQ(PSSVAL,PSSFREQ) ; VALIDATES FREQUNCY FIELD
146 S PSSTMP=0
147 I PSSVAL>PSSFREQ S PSSTMP=1
148 I PSSVAL<1 S PSSTMP=1
149 I PSSFREQ="" S PSSTMP=0
150 Q PSSTMP
151PSSDQ ;DQ^DICQ call on 51.1
152 N DIC,D,DZ S DIC="^PS(51.1,",D="B",DIC(0)="EQS",DZ="??" D DQ^DICQ Q
Note: See TracBrowser for help on using the repository browser.