PSS55MIS ;BIR/TSS - API FOR VARIOUS DATA FROM PHARMACY PATIENT FILE; 5 Sep 03
;;1.0;PHARMACY DATA MANAGEMENT;**112**;9/30/97;Build 30
STATUS(PSSFILE,PSSFIELD,LIST) ;
;PSSFILE - FILE NUMBER (VALIDATED AGAINST "FILES" LINE-TAG BELOW)
;PSSFIELD - FIELD NUMBER FROM FILE
;LIST - NAME OF LOCAL ARRAY RETURNED
;Returns the set of codes valid for the status field
S PSSDIY=""
Q:'$G(PSSFILE) Q:'$G(PSSFIELD) Q:$G(LIST)=""
N PSSTEST S PSSTEST=$$VALID(PSSFILE,PSSFIELD)
I PSSTEST'>0 S PSSDIY=-1 Q
D FIELD^DID(PSSFILE,PSSFIELD,"","POINTER",LIST) Q
VALID(PSTFILE,PSTFIELD) ;TEST FOR VALID DATA INPUT FOR PSOFILE AND DIC
N PSVLOOP,PSVTEST,PSVALID S PSVALID=-1
F PSVLOOP=1:1 S PSVTEST=$P($T(FILES+PSVLOOP),";;",2)_";;"_$P($T(FILES+PSVLOOP),";;",3) Q:$G(PSVTEST)'>0!(PSVALID=1) D
.I PSTFILE=$P(PSVTEST,";;",1) D Q
..I PSTFIELD=$P(PSVTEST,";;",2) S PSVALID=1
Q PSVALID
;
FILES ;ACCESS FILE LIST
;;55.06;;28
;;55.01;;100
;;55.05;;5
Q
CLINIC(PSSORD,PSSDFN,PSSMED) ;
;PSSORD - ORDER NUMBER
;PSSDFN - DFN NUMBER
;PSSMED - MED TYPE: "U" FOR UNIT DOSE, "I" FOR IV
N PSSOUT S PSSOUT=""
Q:'PSSORD
Q:'PSSDFN
Q:$G(PSSMED)=""
S PSSIEN=PSSORD_","_PSSDFN
K ^TMP($J,"TEMP")
;DMS TEST CASES FOR UNIT DOSE: 73,739
;TEST CASES FOR IV: 6,1
I PSSMED="U" D
.D GETS^DIQ(55.06,PSSIEN,"130","IE","^TMP($J,""TEMP"")")
.I $G(^TMP($J,"TEMP",55.06,PSSIEN_",",130,"I"))'="" S PSSOUT=$G(^TMP($J,"TEMP",55.06,PSSIEN_",",130,"I"))_"^"_$G(^TMP($J,"TEMP",55.06,PSSIEN_",",130,"E"))
I PSSMED="I" D
.D GETS^DIQ(55.01,PSSIEN,"136","IE","^TMP($J,""TEMP"")")
.I $G(^TMP($J,"TEMP",55.01,PSSIEN_",",136,"I"))'="" S PSSOUT=$G(^TMP($J,"TEMP",55.01,PSSIEN_",",136,"I"))_"^"_$G(^TMP($J,"TEMP",55.01,PSSIEN_",",136,"E"))
K ^TMP($J,"TEMP")
Q PSSOUT
;
PSS55MIS ;BIR/TSS - API FOR VARIOUS DATA FROM PHARMACY PATIENT FILE; 5 Sep 03
+1 ;;1.0;PHARMACY DATA MANAGEMENT;**112**;9/30/97;Build 30
STATUS(PSSFILE,PSSFIELD,LIST) ;
+1 ;PSSFILE - FILE NUMBER (VALIDATED AGAINST "FILES" LINE-TAG BELOW)
+2 ;PSSFIELD - FIELD NUMBER FROM FILE
+3 ;LIST - NAME OF LOCAL ARRAY RETURNED
+4 ;Returns the set of codes valid for the status field
+5 SET PSSDIY=""
+6 IF '$GET(PSSFILE)
QUIT
IF '$GET(PSSFIELD)
QUIT
IF $GET(LIST)=""
QUIT
+7 NEW PSSTEST
SET PSSTEST=$$VALID(PSSFILE,PSSFIELD)
+8 IF PSSTEST'>0
SET PSSDIY=-1
QUIT
+9 DO FIELD^DID(PSSFILE,PSSFIELD,"","POINTER",LIST)
QUIT
VALID(PSTFILE,PSTFIELD) ;TEST FOR VALID DATA INPUT FOR PSOFILE AND DIC
+1 NEW PSVLOOP,PSVTEST,PSVALID
SET PSVALID=-1
+2 FOR PSVLOOP=1:1
SET PSVTEST=$PIECE($TEXT(FILES+PSVLOOP),";;",2)_";;"_$PIECE($TEXT(FILES+PSVLOOP),";;",3)
IF $GET(PSVTEST)'>0!(PSVALID=1)
QUIT
Begin DoDot:1
+3 IF PSTFILE=$PIECE(PSVTEST,";;",1)
Begin DoDot:2
+4 IF PSTFIELD=$PIECE(PSVTEST,";;",2)
SET PSVALID=1
End DoDot:2
QUIT
End DoDot:1
+5 QUIT PSVALID
+6 ;
FILES ;ACCESS FILE LIST
+1 ;;55.06;;28
+2 ;;55.01;;100
+3 ;;55.05;;5
+4 QUIT
CLINIC(PSSORD,PSSDFN,PSSMED) ;
+1 ;PSSORD - ORDER NUMBER
+2 ;PSSDFN - DFN NUMBER
+3 ;PSSMED - MED TYPE: "U" FOR UNIT DOSE, "I" FOR IV
+4 NEW PSSOUT
SET PSSOUT=""
+5 IF 'PSSORD
QUIT
+6 IF 'PSSDFN
QUIT
+7 IF $GET(PSSMED)=""
QUIT
+8 SET PSSIEN=PSSORD_","_PSSDFN
+9 KILL ^TMP($JOB,"TEMP")
+10 ;DMS TEST CASES FOR UNIT DOSE: 73,739
+11 ;TEST CASES FOR IV: 6,1
+12 IF PSSMED="U"
Begin DoDot:1
+13 DO GETS^DIQ(55.06,PSSIEN,"130","IE","^TMP($J,""TEMP"")")
+14 IF $GET(^TMP($JOB,"TEMP",55.06,PSSIEN_",",130,"I"))'=""
SET PSSOUT=$GET(^TMP($JOB,"TEMP",55.06,PSSIEN_",",130,"I"))_"^"_$GET(^TMP($JOB,"TEMP",55.06,PSSIEN_",",130,"E"))
End DoDot:1
+15 IF PSSMED="I"
Begin DoDot:1
+16 DO GETS^DIQ(55.01,PSSIEN,"136","IE","^TMP($J,""TEMP"")")
+17 IF $GET(^TMP($JOB,"TEMP",55.01,PSSIEN_",",136,"I"))'=""
SET PSSOUT=$GET(^TMP($JOB,"TEMP",55.01,PSSIEN_",",136,"I"))_"^"_$GET(^TMP($JOB,"TEMP",55.01,PSSIEN_",",136,"E"))
End DoDot:1
+18 KILL ^TMP($JOB,"TEMP")
+19 QUIT PSSOUT
+20 ;