VistA-FOIAVistA/r/PHARMACY_DATA_MANAGEMENT-PSS/PSS781.m

29 lines
1.5 KiB
Mathematica

PSS781 ;BHM/DB - API FOR PHARMACY PATIENT FILE ; 15 JUN 05
;;1.0;PHARMACY DATA MANAGEMENT;**106**;9/30/97
PSS(PSSDFN,PSSNUM,LIST) ;
;PSSDFN: IEN of Patient [REQUIRED]
;PSSNUM: CLOZAPINE REGISTRATION NUMBER
;LIST: Subscript name used in ^TMP global [REQUIRED]
I $G(LIST)="" Q
K ^TMP($J,LIST) N PSSIEN,DA,DR,DIC
I $G(PSSDFN)'>0,$G(PSSNUM)="" S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
I $G(PSSNUM)'="",$G(PSSDFN)'>0 S PSSDFN=$O(^PS(55,"ASAND1",PSSNUM,0)) I $G(PSSDFN)'>0 G NODATA
S PSSIEN=$G(PSSDFN) K ^UTILITY("DIQ1",$J),DIQ
S (DA,IEN)=PSSDFN,DIC=55,DR="53:58",DIQ(0)="IE" D EN^DIQ1 I '$D(^UTILITY("DIQ1",$J)) G NODATA
F PSSIEN=53:1:58 S ^TMP($J,LIST,PSSDFN,PSSIEN)=$G(^UTILITY("DIQ1",$J,55,IEN,PSSIEN,"I"))
F PSSIEN=54,55,56,57,58 S ^TMP($J,LIST,PSSDFN,PSSIEN)=$S($G(^UTILITY("DIQ1",$J,55,IEN,PSSIEN,"I"))=$G(^UTILITY("DIQ1",$J,55,IEN,PSSIEN,"E")):"",1:^TMP($J,LIST,PSSDFN,PSSIEN))_"^"_$G(^UTILITY("DIQ1",$J,55,IEN,PSSIEN,"E"))
F X=53:1:58 I $G(^TMP($J,LIST,PSSDFN,X))="^" S ^TMP($J,LIST,PSSDFN,X)=""
K ^UTILITY("DIQ1",$J),DIQ,DIC,DA Q
NODATA S ^TMP($J,LIST,0)="-1^NO DATA FOUND"
Q Q
WRT(PSSDFN,PSSSTAT,LIST) ;Sets Clozapine Status field for Mental Health
;PSSDFN = DFN of Patient (REQUIRED)
;PSSSTAT = Clozapine Status (REQUIRED)
;LIST: Subscript name used in ^TMP global [REQUIRED]
I $G(PSSDFN)'>0 Q
I $G(PSSSTAT)="" Q
I $G(LIST)="" Q
I '$D(^PS(55,PSSDFN)) S ^TMP($J,LIST,0)=0 Q
I $G(PSSSTAT)'="D",$G(PSSSTAT)'="H",$G(PSSSTAT)'="A" S ^TMP($J,LIST,0)=0 Q
S $P(^PS(55,PSSDFN,"SAND"),"^",2)=PSSSTAT,^TMP($J,LIST,0)=1 Q