refactor: use static HIS database per instance
This commit is contained in:
@@ -32,6 +32,7 @@ func (h Handler) StoreMedrec(w http.ResponseWriter, r *http.Request) {
|
||||
writeMedrecResponse(w, http.StatusUnprocessableEntity, false, "validation_error", message, nil)
|
||||
return
|
||||
}
|
||||
params.HospitalCode = h.hospitalCode
|
||||
|
||||
outcome, err := h.patientRepository(r.Context()).StoreMedrec(r.Context(), params)
|
||||
if err != nil {
|
||||
@@ -48,10 +49,6 @@ func (h Handler) StoreMedrec(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func validateMedrec(payload map[string]any) (repository.MedrecParams, string) {
|
||||
rs, message := requiredString(payload, "rs", 20, "Kode RS wajib diisi")
|
||||
if message != "" {
|
||||
return repository.MedrecParams{}, message
|
||||
}
|
||||
name, message := requiredString(payload, "nama", 255, "Nama pasien wajib diisi")
|
||||
if message != "" {
|
||||
return repository.MedrecParams{}, message
|
||||
@@ -191,7 +188,6 @@ func validateMedrec(payload map[string]any) (repository.MedrecParams, string) {
|
||||
}
|
||||
|
||||
return repository.MedrecParams{
|
||||
HospitalCode: normalizeText(rs),
|
||||
Name: normalizeName(name),
|
||||
Gender: normalizeText(gender),
|
||||
DateOfBirth: birthDate,
|
||||
|
||||
Reference in New Issue
Block a user