feat/encounter: improved the processing

This commit is contained in:
2025-10-19 21:58:07 +07:00
parent 038c9f6a16
commit 57d9f99468
4 changed files with 17 additions and 10 deletions
@@ -70,7 +70,8 @@ type FilterDto struct {
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Id uint16 `json:"id"`
Includes string `json:"includes"`
}
type UpdateDto struct {
@@ -119,8 +120,8 @@ type ResponseDto struct {
Member_Number *string `json:"member_number"`
Ref_Number *string `json:"ref_number"`
Trx_Number *string `json:"trx_number"`
Appointment_Doctor_Id *uint `json:"assignment_doctor_id"`
Appointment_Doctor *ed.Doctor `json:"assignment_doctor,omitempty"`
Appointment_Doctor_Id *uint `json:"appointment_doctor_id"`
Appointment_Doctor *ed.Doctor `json:"appointment_doctor,omitempty"`
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty"`
Adm_Employee_Id *uint `json:"adm_employee_id"`
@@ -33,15 +33,20 @@ const (
ITGCMedicine ItemGroupCode = "medicine"
ITGCDevice ItemGroupCode = "device"
ITGCMaterial ItemGroupCode = "material"
ITGCMCU ItemGroupCode = "mcu"
ITGCMCUSub ItemGroupCode = "mcuSub"
ITGCEmpFee ItemGroupCode = "employee-fee"
ITGCDocFee ItemGroupCode = "doctor-fee"
ITGCMedAct ItemGroupCode = "medical-action"
IFGCBuilding InfraGroupCode = "building"
IFGCFloor InfraGroupCode = "floor"
IFGCRoom InfraGroupCode = "room"
IFGCChamber InfraGroupCode = "chamber"
IFGCBed InfraGroupCode = "bed"
IFGCWarehouse InfraGroupCode = "warehouse"
IFGCBuilding InfraGroupCode = "building" // Bangunan
IFGCFloor InfraGroupCode = "floor" // Lantai
IFGCRoom InfraGroupCode = "room" // Ruang
IFGCChamber InfraGroupCode = "chamber" // Kamar
IFGCBed InfraGroupCode = "bed" // Ranjang
IFGCWarehouse InfraGroupCode = "warehouse" // Gudang/Depo
IFGCCounter InfraGroupCode = "counter" // Counter
IFGCPubScreen InfraGroupCode = "public-screen" // Public Screen
UTCReg UnitTypeCode = "reg" // Registrasi
UTCExa UnitTypeCode = "exa" // Pemeriksaan
@@ -49,6 +49,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
return
}
dto := e.ReadDetailDto{}
sf.UrlQueryParam(&dto, *r.URL)
dto.Id = uint16(id)
res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err)
@@ -81,7 +81,7 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
tx = dg.I
}
if err := tx.First(&data, input.Id).Error; err != nil {
if err := tx.Scopes(gh.Preload(input.Includes)).First(&data, input.Id).Error; err != nil {
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
return nil, processedErr
}