EDPLOG1 ;SLC/KCM - Update ED Log Validate ;2/28/12 08:33am
;;2.0;EMERGENCY DEPARTMENT;;May 2, 2012;Build 103
;
VALID(REC) ; validate the entries passed in REC
D XLATE("arrival")
D XLATE("clinic")
D XLATE("bed")
D XLATE("acuity")
D XLATE("status")
D XLATE("provider")
D XLATE("nurse")
D XLATE("resident")
D XLATE("disposition")
D XLATE("delay")
;
N ERR S ERR=""
D ADDTXT(.ERR,$$CHECK("name",230,.04,"Patient Name"))
D ADDTXT(.ERR,$$CHECK("complaint",230,1.1,"Complaint"))
D ADDTXT(.ERR,$$CHECK("compLong",230,2,"Long Complaint"))
D ADDTXT(.ERR,$$CHECK("comment",230,3.8,"Comment"))
;
N DIAG S DIAG="diagnosis-0"
F S DIAG=$O(REC(DIAG)) Q:$E(DIAG,1,10)'="diagnosis-" D
. S REC("edpDiagnosis")=$P(REC(DIAG),U,2)
. D ADDTXT(ERR,$$CHECK("edpDiagnosis",230.04,.01,"Diagnosis"))
Q ERR
;
CHECK(NAME,FILE,FIELD,MSG) ; return error msg if field is not valid
; called from VALID, assumes REC is defined
N VAL,EDPRSLT
S VAL=$G(REC(NAME))
I VAL="" Q ""
D CHK^DIE(FILE,FIELD,"",VAL,.EDPRSLT)
I EDPRSLT="^" Q MSG_" is not valid."
Q ""
ADDTXT(X,NEW) ; add new text comma delimited
I $L(NEW),$L(X) S X=X_", "_NEW
I $L(NEW),'$L(X) S X=NEW
Q
XLATE(NAME) ; set up pointer fields for FDA array
Q:'$D(REC(NAME))
;I REC(NAME)=0 S REC(NAME)="" ; store 0 when removing staff
I REC(NAME)=-1 S REC(NAME)="@"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEDPLOG1 1367 printed Nov 22, 2024@17:02:10 Page 2
EDPLOG1 ;SLC/KCM - Update ED Log Validate ;2/28/12 08:33am
+1 ;;2.0;EMERGENCY DEPARTMENT;;May 2, 2012;Build 103
+2 ;
VALID(REC) ; validate the entries passed in REC
+1 DO XLATE("arrival")
+2 DO XLATE("clinic")
+3 DO XLATE("bed")
+4 DO XLATE("acuity")
+5 DO XLATE("status")
+6 DO XLATE("provider")
+7 DO XLATE("nurse")
+8 DO XLATE("resident")
+9 DO XLATE("disposition")
+10 DO XLATE("delay")
+11 ;
+12 NEW ERR
SET ERR=""
+13 DO ADDTXT(.ERR,$$CHECK("name",230,.04,"Patient Name"))
+14 DO ADDTXT(.ERR,$$CHECK("complaint",230,1.1,"Complaint"))
+15 DO ADDTXT(.ERR,$$CHECK("compLong",230,2,"Long Complaint"))
+16 DO ADDTXT(.ERR,$$CHECK("comment",230,3.8,"Comment"))
+17 ;
+18 NEW DIAG
SET DIAG="diagnosis-0"
+19 FOR
SET DIAG=$ORDER(REC(DIAG))
if $EXTRACT(DIAG,1,10)'="diagnosis-"
QUIT
Begin DoDot:1
+20 SET REC("edpDiagnosis")=$PIECE(REC(DIAG),U,2)
+21 DO ADDTXT(ERR,$$CHECK("edpDiagnosis",230.04,.01,"Diagnosis"))
End DoDot:1
+22 QUIT ERR
+23 ;
CHECK(NAME,FILE,FIELD,MSG) ; return error msg if field is not valid
+1 ; called from VALID, assumes REC is defined
+2 NEW VAL,EDPRSLT
+3 SET VAL=$GET(REC(NAME))
+4 IF VAL=""
QUIT ""
+5 DO CHK^DIE(FILE,FIELD,"",VAL,.EDPRSLT)
+6 IF EDPRSLT="^"
QUIT MSG_" is not valid."
+7 QUIT ""
ADDTXT(X,NEW) ; add new text comma delimited
+1 IF $LENGTH(NEW)
IF $LENGTH(X)
SET X=X_", "_NEW
+2 IF $LENGTH(NEW)
IF '$LENGTH(X)
SET X=NEW
+3 QUIT
XLATE(NAME) ; set up pointer fields for FDA array
+1 if '$DATA(REC(NAME))
QUIT
+2 ;I REC(NAME)=0 S REC(NAME)="" ; store 0 when removing staff
+3 IF REC(NAME)=-1
SET REC(NAME)="@"
+4 QUIT