Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSO59

PSO59.m

Go to the documentation of this file.
PSO59 ;BHM/DB - Outpatient Site File API ;1 JUL 05
 ;;7.0;OUTPATIENT PHARMACY;**213,229,254,267,273**;DEC 1997;Build 8
PSS(PSOIEN,PSOTXT,LIST) ;
 N DA,DIC,DR,X,I,DIQ
 I $G(LIST)="" Q
 I $G(LIST)'="" K ^TMP($J,LIST)
 I '$G(PSOIEN),$G(PSOTXT)="" S ^TMP($J,LIST,0)="-1^NO DATA FOUND" Q
 I $G(PSOIEN),$G(PSOTXT)="" D SINGLE Q 
 I '$G(PSOIEN),$G(PSOTXT)'="" D
 .I $G(PSOTXT)="??" D ALLDIV Q
 .I $G(PSOTXT)'="??" D SINGLE Q
 I $G(PSOIEN),$G(PSOTXT)'="" S PSOTXT="" D SINGLE Q
 Q
 ;
SINGLE ;RETURNS SINGLE DIVISION
 K ^TMP($J,LIST) S:$G(PSOIEN)>0 ^TMP($J,LIST,PSOIEN,0)=0
 I $G(PSOIEN)>0,'$D(^PS(59,PSOIEN,0)) S ^TMP($J,LIST,PSOIEN,0)="-1^NO DATA FOUND" Q
 I $G(PSOTXT)'="",'$D(^PS(59,"B",PSOTXT)),$G(PSOIEN)>0 S ^TMP($J,LIST,PSOIEN,0)="-1^NO DATA FOUND" Q
 S DA=$S($G(PSOIEN)]"":PSOIEN,1:$O(^PS(59,"B",PSOTXT,0)))
 I $G(DA)'>0 S ^TMP($J,LIST,0)="-1^NO DATA FOUND" Q
 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
 I '$D(^UTILITY("DIQ1",$J)) S ^TMP($J,LIST,PSOIEN,0)="-1^NO DATA FOUND" Q
 F X=.01,.02,.05,.06,.07,.08,1,100,101,1003,1008 D
 .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
 .S ^TMP($J,LIST,DA,X)=$G(^UTILITY("DIQ1",$J,59,DA,X,"I"))
 S PSOTXT=$G(^UTILITY("DIQ1",$J,59,DA,.01,"E")) S ^TMP($J,LIST,"B",PSOTXT,DA)=""
 S ^TMP($J,LIST,DA,0)=$G(^TMP($J,LIST,DA,0))+1
 K DA,DIC,DIQ,DR,PSOIEN,PSOTXT
 Q
 ;
ALLDIV ; RETURNS ALL DIVISIONS
 N IEN,SITE S IEN=0,SITE=""
 F  S SITE=$O(^PS(59,"B",SITE)) Q:SITE=""  D
 .S ^TMP($J,LIST,0)=$G(^TMP($J,LIST,0))+1
 .F  S IEN=$O(^PS(59,"B",SITE,IEN)) Q:'IEN  D
 ..N PSODIV S PSODIV=$G(^PS(59,IEN,0))
 ..S ^TMP($J,LIST,"B",SITE,IEN)=""
 ..S ^TMP($J,LIST,IEN,.01)=$P($G(PSODIV),U,1)
 ..S ^TMP($J,LIST,IEN,.02)=$P($G(PSODIV),U,2)
 ..S ^TMP($J,LIST,IEN,.05)=$P($G(PSODIV),U,5)
 ..S ^TMP($J,LIST,IEN,.06)=$P($G(PSODIV),U,6)
 ..S ^TMP($J,LIST,IEN,.07)=$P($G(PSODIV),U,7)
 ..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:"")
 ..S ^TMP($J,LIST,IEN,1)=$P($G(^PS(59,IEN,"SAND")),U,1)
 ..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:"")
 ..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:"")
 ..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:"")
 ..S ^TMP($J,LIST,IEN,1008)=$P($G(^PS(59,IEN,"SAND")),U,3)
 Q