PSS50P4 ;BIR/LDT - API FOR INFORMATION FROM FILE 50.4; 5 Sep 03
;;1.0;PHARMACY DATA MANAGEMENT;**85**;9/30/97
;
ALL(PSSIEN,PSSFT,LIST) ;
;PSSIEN - IEN of entry in 50.4.
;PSSFT - Free Text name in 50.4.
;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
; Field Number of the data piece being returned.
;Returns NAME field (#.01) and CONCENTRATION UNITS field (#1) of DRUG ELECTROLYTES file (#50.4).
N DIERR,ZZERR,PSS50P4,SCR,PSS
I $G(LIST)']"" Q
K ^TMP($J,LIST)
I +$G(PSSIEN)'>0,($G(PSSFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
I $G(PSSIEN)]"",+$G(PSSIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
I +$G(PSSIEN)>0 N PSSIEN2 S PSSIEN2=$$FIND1^DIC(50.4,"","A","`"_PSSIEN,,,"") D
.I +PSSIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
.S ^TMP($J,LIST,0)=1
.D GETS^DIQ(50.4,+PSSIEN2,".01;1","IE","PSS50P4") S PSS(1)=0
.F S PSS(1)=$O(PSS50P4(50.4,PSS(1))) Q:'PSS(1) D SETALL
I +$G(PSSIEN)'>0,$G(PSSFT)]"" D
.I PSSFT["??" D LOOP Q
.D FIND^DIC(50.4,,"@;.01;","QP",PSSFT,,"B",,,"")
.I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
.I +^TMP("DILIST",$J,0)>0 S ^TMP($J,LIST,0)=+^TMP("DILIST",$J,0) N PSSXLP S PSSXLP=0 F S PSSXLP=$O(^TMP("DILIST",$J,PSSXLP)) Q:'PSSXLP D
..S PSSIEN=+^TMP("DILIST",$J,PSSXLP,0) K PSS50P4 D GETS^DIQ(50.4,+PSSIEN,".01;1","IE","PSS50P4") S PSS(1)=0
..F S PSS(1)=$O(PSS50P4(50.4,PSS(1))) Q:'PSS(1) D SETALL
K ^TMP("DILIST",$J)
Q
;
SETALL ;
S ^TMP($J,LIST,+PSS(1),.01)=$G(PSS50P4(50.4,PSS(1),.01,"I"))
S ^TMP($J,LIST,"B",$G(PSS50P4(50.4,PSS(1),.01,"I")),+PSS(1))=""
S ^TMP($J,LIST,+PSS(1),1)=$S($G(PSS50P4(50.4,PSS(1),1,"I"))="":"",1:PSS50P4(50.4,PSS(1),1,"I")_"^"_PSS50P4(50.4,PSS(1),1,"E"))
Q
;
LOOP ;
N CNT,PSSIEN S CNT=0
S PSSIEN=0 F S PSSIEN=$O(^PS(50.4,PSSIEN)) Q:'PSSIEN K PSS50P4 D GETS^DIQ(50.4,+PSSIEN,".01;1","IE","PSS50P4") S PSS(1)=0 D
.F S PSS(1)=$O(PSS50P4(50.4,PSS(1))) Q:'PSS(1) D SETALL S CNT=CNT+1
S ^TMP($J,LIST,0)=$S(CNT>0:CNT,1:"-1^NO DATA FOUND")
Q
PSS50P4 ;BIR/LDT - API FOR INFORMATION FROM FILE 50.4; 5 Sep 03
+1 ;;1.0;PHARMACY DATA MANAGEMENT;**85**;9/30/97
+2 ;
ALL(PSSIEN,PSSFT,LIST) ;
+1 ;PSSIEN - IEN of entry in 50.4.
+2 ;PSSFT - Free Text name in 50.4.
+3 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
+4 ; Field Number of the data piece being returned.
+5 ;Returns NAME field (#.01) and CONCENTRATION UNITS field (#1) of DRUG ELECTROLYTES file (#50.4).
+6 NEW DIERR,ZZERR,PSS50P4,SCR,PSS
+7 IF $GET(LIST)']""
QUIT
+8 KILL ^TMP($JOB,LIST)
+9 IF +$GET(PSSIEN)'>0
IF ($GET(PSSFT)']"")
SET ^TMP($JOB,LIST,0)=-1_"^"_"NO DATA FOUND"
QUIT
+10 IF $GET(PSSIEN)]""
IF +$GET(PSSIEN)'>0
SET ^TMP($JOB,LIST,0)=-1_"^"_"NO DATA FOUND"
QUIT
+11 IF +$GET(PSSIEN)>0
NEW PSSIEN2
SET PSSIEN2=$$FIND1^DIC(50.4,"","A","`"_PSSIEN,,,"")
Begin DoDot:1
+12 IF +PSSIEN2'>0
SET ^TMP($JOB,LIST,0)=-1_"^"_"NO DATA FOUND"
QUIT
+13 SET ^TMP($JOB,LIST,0)=1
+14 DO GETS^DIQ(50.4,+PSSIEN2,".01;1","IE","PSS50P4")
SET PSS(1)=0
+15 FOR
SET PSS(1)=$ORDER(PSS50P4(50.4,PSS(1)))
IF 'PSS(1)
QUIT
DO SETALL
End DoDot:1
+16 IF +$GET(PSSIEN)'>0
IF $GET(PSSFT)]""
Begin DoDot:1
+17 IF PSSFT["??"
DO LOOP
QUIT
+18 DO FIND^DIC(50.4,,"@;.01;","QP",PSSFT,,"B",,,"")
+19 IF +$GET(^TMP("DILIST",$JOB,0))=0
SET ^TMP($JOB,LIST,0)=-1_"^"_"NO DATA FOUND"
QUIT
+20 IF +^TMP("DILIST",$JOB,0)>0
SET ^TMP($JOB,LIST,0)=+^TMP("DILIST",$JOB,0)
NEW PSSXLP
SET PSSXLP=0
FOR
SET PSSXLP=$ORDER(^TMP("DILIST",$JOB,PSSXLP))
IF 'PSSXLP
QUIT
Begin DoDot:2
+21 SET PSSIEN=+^TMP("DILIST",$JOB,PSSXLP,0)
KILL PSS50P4
DO GETS^DIQ(50.4,+PSSIEN,".01;1","IE","PSS50P4")
SET PSS(1)=0
+22 FOR
SET PSS(1)=$ORDER(PSS50P4(50.4,PSS(1)))
IF 'PSS(1)
QUIT
DO SETALL
End DoDot:2
End DoDot:1
+23 KILL ^TMP("DILIST",$JOB)
+24 QUIT
+25 ;
SETALL ;
+1 SET ^TMP($JOB,LIST,+PSS(1),.01)=$GET(PSS50P4(50.4,PSS(1),.01,"I"))
+2 SET ^TMP($JOB,LIST,"B",$GET(PSS50P4(50.4,PSS(1),.01,"I")),+PSS(1))=""
+3 SET ^TMP($JOB,LIST,+PSS(1),1)=$SELECT($GET(PSS50P4(50.4,PSS(1),1,"I"))="":"",1:PSS50P4(50.4,PSS(1),1,"I")_"^"_PSS50P4(50.4,PSS(1),1,"E"))
+4 QUIT
+5 ;
LOOP ;
+1 NEW CNT,PSSIEN
SET CNT=0
+2 SET PSSIEN=0
FOR
SET PSSIEN=$ORDER(^PS(50.4,PSSIEN))
IF 'PSSIEN
QUIT
KILL PSS50P4
DO GETS^DIQ(50.4,+PSSIEN,".01;1","IE","PSS50P4")
SET PSS(1)=0
Begin DoDot:1
+3 FOR
SET PSS(1)=$ORDER(PSS50P4(50.4,PSS(1)))
IF 'PSS(1)
QUIT
DO SETALL
SET CNT=CNT+1
End DoDot:1
+4 SET ^TMP($JOB,LIST,0)=$SELECT(CNT>0:CNT,1:"-1^NO DATA FOUND")
+5 QUIT