VistA-FOIAVistA/r/REMOTE_ORDER_ENTRY_SYSTEM-R.../RMPFET4.m

52 lines
2.8 KiB
Mathematica
Raw Normal View History

RMPFET4 ;DDC/KAW-EVALUATE ORDER STATUS BY TYPE [ 05/27/95 2:10 PM ]
;;2.0;REMOTE ORDER/ENTRY SYSTEM;**20**;MAY 30, 1995
CUST ;; input: RMPFX
;;output: RMPFERR,RMPFMSG
S SS=$S($D(^RMPF(791810,RMPFX,11)):^(11),1:"")
S RMPFTF=$P(SS,U,1),RMPFUS=$P(SS,U,2)
S RMPFDC=$P($G(^RMPF(791810,RMPFX,2)),U,1) I RMPFDC,$D(^RMPR(662,RMPFDC,0)) S X=$P(^(0),U,1) D
.I X["DEAF/U",RMPFTF="B" S RMPFERR("FITTING CANNOT BE BINAURAL IF PATIENT IS DEAF/U")=""
.I X["DEAF/U",RMPFUS="B" S RMPFERR("PATIENT CANNOT BE AUTHORIZED FOR BINAURAL USE IF DISABILITY IS DEAF/U")=""
D ARRAY^RMPFDT2 S (X,CX)=0 K RMPFEAR
F I=1:1 S X=$O(RMPFO(X)) Q:'X S CX=CX+1,A=$P(^RMPF(791810,RMPFX,101,X,0),U,4) I A'="" D
.S IT=$P(^RMPF(791810,RMPFX,101,X,0),U,1) Q:'IT
.Q:'$D(^RMPF(791811,IT,0))
.Q:$P(^RMPF(791811,IT,0),"^",1)["REMOTE"
.I $D(RMPFEAR(A)) S RMPFMSG("TWO OR MORE AIDS ARE ORDERED FOR THE SAME EAR")=""
.S RMPFEAR(A)="" Q
I RMPFTF="B",CX<2 S RMPFERR("TWO AIDS MUST BE ORDERED WITH A BINAURAL FITTING")=""
I RMPFUS="M",RMPFTF="B" S RMPFERR("FITTING CANNOT BE BINAURAL IF AUTHORIZED USAGE IS MONAURAL")=""
I RMPFUS="M",CX>2 S RMPFMSG("MORE THAN TWO AIDS HAVE BEEN ORDERED FOR A MONAURAL USER")=""
S SS=$G(^RMPF(791810,RMPFX,10)),RC=$P(SS,U,4),AD=$P(SS,U,8)
I RC>DT S RMPFERR("REQUEST FOR CARE DATE CANNOT BE A FUTURE DATE")=""
I AD>DT S RMPFERR("AUDIOLOGICAL ASSESSMENT DATE CANNOT BE A FUTURE DATE")=""
I AD,RC>AD S RMPFERR("AUDIOLOGICAL ASSESSMENT DATE CANNOT BE PRIOR TO REQUEST FOR CARE DATE")=""
K SS,RMPFDC,RMPFO,RMPFTF,RMPFUS,RMPFEAR,I,X,CX,A,RC,AD,IT Q
REG ;; input: RMPFX
;;output: RMPFERR
S X=0
F I=1:1 S X=$O(^RMPF(791810,RMPFX,101,X)) G REGE:'X D
.Q:'$D(^RMPF(791810,RMPFX,101,X,0)) Q:$P(^(0),U,1)'=1
.I '$D(^RMPF(791810,RMPFX,101,X,2)) S RMPFERR("FREE TEXT MAKE AND MODEL NOT ENTERED")=""
.S MM=$G(^RMPF(791810,RMPFX,101,X,2)) S MK=$P(MM,U,1) I MK="" S RMPFERR("FREE TEXT MAKE MISSING")=""
.S MD=$P(MM,U,2) I MD="" S RMPFERR("FREE TEXT MODEL MISSING")=""
.Q
REGE K X,I,MM,MK,MD Q
ISS ;;Special error checks for Custom Hearing Aid Issue Orders
;; input: RMPFX
;;output: RMPFERR
S OD=$P(^RMPF(791810,RMPFX,0),U,9) D ARRAY^RMPFDT2 S RMPFY=0
I1 F S RMPFY=$O(RMPFO(RMPFY)) Q:'RMPFY D
.Q:'$D(^RMPF(791810,RMPFX,101,RMPFY)) S S0=^(RMPFY,0) Q:$P(S0,U,15)="C"
.I $P(S0,U,20),$P(S0,U,19)["R" D
..I $P(S0,U,5)="" S RMPFERR("SERIAL NUMBER MISSING")=""
..S X=$G(^RMPF(791810,RMPFX,101,RMPFY,90))
..I $P(X,U,8)=""!($P(X,U,9)="") S RMPFERR("CERTIFICATION INFORMATION MISSING")=""
.S ID=$P(S0,U,8),X=$P(S0,U,19),BT=$P(S0,U,2)
.I BT="",$P($G(^RMPF(791810,RMPFX,101,RMPFY,90)),U,8),'$P(^(0),U,20),$P(^(0),U,19)["I" S RMPFERR("BATTERY TYPE MISSING")=""
.I X["I",$P($G(^RMPF(791810,RMPFX,101,RMPFY,90)),U,12)="" S RMPFERR("ISSUING USER MISSING")=""
.I ID="",X["I" S RMPFERR("ISSUE DATE MISSING")="" Q
.Q:ID=""
.I ID<OD S RMPFERR("ISSUE DATE IS PRIOR TO ORDER DATE")=""
ISSE K OD,ID,BT,S0,RMPFY,X,RMPFO Q