revise refactor
This commit is contained in:
@@ -51,7 +51,7 @@ type MetaDto struct {
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Unit_Code *string `json:"unit_id"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Doctor_Code *string `json:"doctor_id"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty"`
|
||||
|
||||
@@ -53,7 +53,7 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Subspecialist_Code *string `json:"subspecialist_id"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
|
||||
@@ -573,7 +573,7 @@ func CheckIn(input e.CheckinDto) (*d.Data, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Upsert responsible_doctor_hist if responsible_doctor_id has changed
|
||||
// Upsert responsible_doctor_hist if responsible_doctor_code has changed
|
||||
if data.Responsible_Doctor_Code == nil || *input.Responsible_Doctor_Code != *data.Responsible_Doctor_Code {
|
||||
// upsert responsibleDoctorHist
|
||||
if err = upsertResponsibleDoctorHist(erdh.CreateDto{
|
||||
@@ -801,7 +801,7 @@ func ApproveSwitchUnit(input e.ApproveUnitDto) (*d.Data, error) {
|
||||
|
||||
// update data response
|
||||
data.Responsible_Doctor_Code = irData.Doctor_Code
|
||||
data.Unit = irData.Unit // TODO: check if this is correct
|
||||
data.Unit_Code = irData.Unit_Code //
|
||||
data.Specialist_Code = irData.Doctor.Specialist_Code
|
||||
data.Subspecialist_Code = irData.Doctor.Subspecialist_Code
|
||||
|
||||
|
||||
@@ -903,7 +903,7 @@ func validateForeignKey(input e.CheckinDto) error {
|
||||
}
|
||||
}
|
||||
|
||||
// validate doctor_id
|
||||
// validate doctor_Code
|
||||
if input.Responsible_Doctor_Code != nil {
|
||||
if _, err := ud.ReadDetail(ed.ReadDetailDto{Code: input.Responsible_Doctor_Code}); err != nil {
|
||||
return err
|
||||
@@ -951,7 +951,7 @@ func getUnits(unitIds []string, event *pl.Event) ([]eu.Unit, error) {
|
||||
func getDoctors(doctorIds []string, event *pl.Event) ([]ed.Doctor, error) {
|
||||
pl.SetLogInfo(event, nil, "started", "getDoctors")
|
||||
var doctors []ed.Doctor
|
||||
err := dg.I.Where("\"Id\" Code ?", doctorIds).Find(&doctors).Error
|
||||
err := dg.I.Where("\"Code\" IN ?", doctorIds).Find(&doctors).Error
|
||||
if err != nil {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
@@ -979,7 +979,7 @@ func validateUnitCodes(unitCodes map[string]struct{}, event *pl.Event) error {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "data-validation-fail",
|
||||
Detail: "unit_id not found",
|
||||
Detail: "unit_code not found",
|
||||
}
|
||||
return pl.SetLogError(event, nil)
|
||||
}
|
||||
@@ -1003,7 +1003,7 @@ func validateDoctorCodes(doctorCodes map[string]struct{}, event *pl.Event) error
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "data-validation-fail",
|
||||
Detail: "doctor_id not found",
|
||||
Detail: "doctor_code not found",
|
||||
}
|
||||
return pl.SetLogError(event, nil)
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.En
|
||||
tx = tx.Model(&e.Encounter{})
|
||||
|
||||
if input.AuthInfo.Doctor_Code != nil {
|
||||
tx.Where("\"Responsible_Doctor_Id\" = ?", *input.AuthInfo.Doctor_Code) // TODO: fix this
|
||||
tx.Where("\"Responsible_Doctor_Code\" = ?", *input.AuthInfo.Doctor_Code) //
|
||||
}
|
||||
|
||||
tx.Scopes(gh.Preload(input.Includes)).
|
||||
|
||||
Reference in New Issue
Block a user