source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSO59.m@ 1144

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

initial load of WorldVistAEHR

File size: 2.6 KB
Line 
1PSO59 ;BHM/DB - Outpatient Site File API ;1 JUL 05
2 ;;7.0;OUTPATIENT PHARMACY;**213,229,254,267,273**;DEC 1997;Build 8
3PSS(PSOIEN,PSOTXT,LIST) ;
4 N DA,DIC,DR,X,I,DIQ
5 I $G(LIST)="" Q
6 I $G(LIST)'="" K ^TMP($J,LIST)
7 I '$G(PSOIEN),$G(PSOTXT)="" S ^TMP($J,LIST,0)="-1^NO DATA FOUND" Q
8 I $G(PSOIEN),$G(PSOTXT)="" D SINGLE Q
9 I '$G(PSOIEN),$G(PSOTXT)'="" D
10 .I $G(PSOTXT)="??" D ALLDIV Q
11 .I $G(PSOTXT)'="??" D SINGLE Q
12 I $G(PSOIEN),$G(PSOTXT)'="" S PSOTXT="" D SINGLE Q
13 Q
14 ;
15SINGLE ;RETURNS SINGLE DIVISION
16 K ^TMP($J,LIST) S:$G(PSOIEN)>0 ^TMP($J,LIST,PSOIEN,0)=0
17 I $G(PSOIEN)>0,'$D(^PS(59,PSOIEN,0)) S ^TMP($J,LIST,PSOIEN,0)="-1^NO DATA FOUND" Q
18 I $G(PSOTXT)'="",'$D(^PS(59,"B",PSOTXT)),$G(PSOIEN)>0 S ^TMP($J,LIST,PSOIEN,0)="-1^NO DATA FOUND" Q
19 S DA=$S($G(PSOIEN)]"":PSOIEN,1:$O(^PS(59,"B",PSOTXT,0)))
20 I $G(DA)'>0 S ^TMP($J,LIST,0)="-1^NO DATA FOUND" Q
21 K ^UTILITY("DIQ1",$J),DIC S DIC=59,DR=".01;.02;.05;.06;.07;.08;1;100;101;1003;1008",DIQ(0)="IE" D EN^DIQ1
22 I '$D(^UTILITY("DIQ1",$J)) S ^TMP($J,LIST,PSOIEN,0)="-1^NO DATA FOUND" Q
23 F X=.01,.02,.05,.06,.07,.08,1,100,101,1003,1008 D
24 .I $G(^UTILITY("DIQ1",$J,59,DA,X,"I"))'=$G(^UTILITY("DIQ1",$J,59,DA,X,"E")) S ^TMP($J,LIST,DA,X)=$G(^UTILITY("DIQ1",$J,59,DA,X,"I"))_"^"_$G(^UTILITY("DIQ1",$J,59,DA,X,"E")) Q
25 .S ^TMP($J,LIST,DA,X)=$G(^UTILITY("DIQ1",$J,59,DA,X,"I"))
26 S PSOTXT=$G(^UTILITY("DIQ1",$J,59,DA,.01,"E")) S ^TMP($J,LIST,"B",PSOTXT,DA)=""
27 S ^TMP($J,LIST,DA,0)=$G(^TMP($J,LIST,DA,0))+1
28 K DA,DIC,DIQ,DR,PSOIEN,PSOTXT
29 Q
30 ;
31ALLDIV ; RETURNS ALL DIVISIONS
32 N IEN,SITE S IEN=0,SITE=""
33 F S SITE=$O(^PS(59,"B",SITE)) Q:SITE="" D
34 .S ^TMP($J,LIST,0)=$G(^TMP($J,LIST,0))+1
35 .F S IEN=$O(^PS(59,"B",SITE,IEN)) Q:'IEN D
36 ..N PSODIV S PSODIV=$G(^PS(59,IEN,0))
37 ..S ^TMP($J,LIST,"B",SITE,IEN)=""
38 ..S ^TMP($J,LIST,IEN,.01)=$P($G(PSODIV),U,1)
39 ..S ^TMP($J,LIST,IEN,.02)=$P($G(PSODIV),U,2)
40 ..S ^TMP($J,LIST,IEN,.05)=$P($G(PSODIV),U,5)
41 ..S ^TMP($J,LIST,IEN,.06)=$P($G(PSODIV),U,6)
42 ..S ^TMP($J,LIST,IEN,.07)=$P($G(PSODIV),U,7)
43 ..S ^TMP($J,LIST,IEN,.08)=$S($P($G(PSODIV),U,8)>0:$P($G(PSODIV),U,8)_"^"_$P($G(^DIC(5,$P($G(PSODIV),U,8),0)),U,1),1:"")
44 ..S ^TMP($J,LIST,IEN,1)=$P($G(^PS(59,IEN,"SAND")),U,1)
45 ..S ^TMP($J,LIST,IEN,100)=$S($P($G(^PS(59,IEN,"INI")),U,1)>0:$P($G(^PS(59,IEN,"INI")),U,1)_"^"_$P($G(^DIC(4,$P($G(^PS(59,IEN,"INI")),U,1),0)),U,1),1:"")
46 ..S ^TMP($J,LIST,IEN,101)=$S($P($G(^PS(59,IEN,"INI")),U,2)>0:$P($G(^PS(59,IEN,"INI")),U,2)_"^"_$P($G(^DIC(4,$P($G(^PS(59,IEN,"INI")),U,2),0)),U,1),1:"")
47 ..S ^TMP($J,LIST,IEN,1003)=$S($G(^PS(59,IEN,"IB"))>0:$G(^PS(59,IEN,"IB"))_"^"_$P($G(^DIC(49,$G(^PS(59,IEN,"IB")),0)),U,1),1:"")
48 ..S ^TMP($J,LIST,IEN,1008)=$P($G(^PS(59,IEN,"SAND")),U,3)
49 Q
Note: See TracBrowser for help on using the repository browser.