feat (vclaim/bpjs/jkn): add several endpoint

This commit is contained in:
dpurbosakti
2025-12-01 12:43:23 +07:00
parent 2a39301563
commit 2a979f60a6
24 changed files with 561 additions and 27 deletions
@@ -21,7 +21,7 @@ func GetListCities(w http.ResponseWriter, r *http.Request) {
dto := e.ReadListDto{}
pValue := rw.ValidateString(w, "provinceCode", r.PathValue("provinceCode"))
if pValue == "" {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "provinceCode is required"}, nil)
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "provinceCode is required"}, nil)
}
dto.ReferenceType = e.RTCities
dto.PathValue1 = pValue
@@ -33,7 +33,7 @@ func GetListDistrict(w http.ResponseWriter, r *http.Request) {
dto := e.ReadListDto{}
pValue := rw.ValidateString(w, "regencyCode", r.PathValue("regencyCode"))
if pValue == "" {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "regencyCode is required"}, nil)
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "regencyCode is required"}, nil)
}
dto.ReferenceType = e.RTDistrict
dto.PathValue1 = pValue
@@ -45,7 +45,7 @@ func GetListDiagnose(w http.ResponseWriter, r *http.Request) {
dto := e.ReadListDto{}
pValue := rw.ValidateString(w, "keyword", r.PathValue("keyword"))
if pValue == "" {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "keyword is required"}, nil)
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "keyword is required"}, nil)
}
dto.ReferenceType = e.RTDiagnose
dto.PathValue1 = pValue
@@ -64,7 +64,7 @@ func GetListMedicinePrb(w http.ResponseWriter, r *http.Request) {
dto := e.ReadListDto{}
pValue := rw.ValidateString(w, "keyword", r.PathValue("keyword"))
if pValue == "" {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "keyword is required"}, nil)
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "keyword is required"}, nil)
}
dto.ReferenceType = e.RTMedicinePrb
dto.PathValue1 = pValue
@@ -76,7 +76,7 @@ func GetListUnit(w http.ResponseWriter, r *http.Request) {
dto := e.ReadListDto{}
pValue := rw.ValidateString(w, "unitCode", r.PathValue("unitCode"))
if pValue == "" {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "unitCode is required"}, nil)
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "unitCode is required"}, nil)
}
dto.ReferenceType = e.RTUnit
dto.PathValue1 = pValue
@@ -88,11 +88,11 @@ func GetListHealthcare(w http.ResponseWriter, r *http.Request) {
dto := e.ReadListDto{}
pValue1 := rw.ValidateString(w, "healthcare", r.PathValue("healthcare"))
if pValue1 == "" {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "healthcare is required"}, nil)
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "healthcare is required"}, nil)
}
pValue2 := rw.ValidateString(w, "healthcareType", r.PathValue("healthcareType"))
if pValue2 == "" {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "healthcareType is required"}, nil)
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "healthcareType is required"}, nil)
}
dto.ReferenceType = e.RTHealthcare
dto.PathValue1 = pValue1
@@ -105,15 +105,15 @@ func GetListDoctor(w http.ResponseWriter, r *http.Request) {
dto := e.ReadListDto{}
pValue1 := rw.ValidateString(w, "serviceType", r.PathValue("serviceType"))
if pValue1 == "" {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "serviceType is required"}, nil)
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "serviceType is required"}, nil)
}
pValue2 := rw.ValidateString(w, "serviceDate", r.PathValue("serviceDate"))
if pValue2 == "" {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "serviceDate is required"}, nil)
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "serviceDate is required"}, nil)
}
pValue3 := rw.ValidateString(w, "specialistCode", r.PathValue("specialistCode"))
if pValue3 == "" {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "specialistCode is required"}, nil)
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "specialistCode is required"}, nil)
}
dto.PathValue1 = pValue1
dto.PathValue2 = pValue2