add validation for class_code ambulatory
This commit is contained in:
@@ -63,3 +63,26 @@ func validateRequestCheckIn(w http.ResponseWriter, i e.CheckinDto) (valid bool)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func validateRequestCreate(w http.ResponseWriter, i e.CreateDto) (valid bool) {
|
||||
switch {
|
||||
case i.Class_Code == ere.ECAmbulatory:
|
||||
if i.Ambulatory == nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: "ambulatory required",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if i.Class_Code == ere.ECAmbulatory && i.Ambulatory.Class_Code == ere.ACCRme && i.Ambulatory.VisitMode_Code == ere.VMCAdm {
|
||||
if *i.Rehab.AllocatedVisitCount == 0 {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: "rehab.AllocatedVisitCode required",
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user