change ids into codes for device-order,material-order,mcu-order
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/device-order"
|
||||
|
||||
ud "simrs-vx/internal/use-case/main-use-case/doctor"
|
||||
ue "simrs-vx/internal/use-case/main-use-case/encounter"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
@@ -60,11 +59,7 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
doctor_id, err := ud.GetIdByUserId(&input.AuthInfo.User_Id, &event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
input.Doctor_Id = doctor_id
|
||||
input.Doctor_Code = input.AuthInfo.Doctor_Code
|
||||
|
||||
if resData, err := CreateData(input, &event, tx); err != nil {
|
||||
return err
|
||||
@@ -236,11 +231,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
doctor_id, err := ud.GetIdByUserId(&input.AuthInfo.User_Id, &event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !data.IsSameDoctor(doctor_id) {
|
||||
if !data.IsSameDoctor(input.AuthInfo.Doctor_Code) {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "auth-forbidden",
|
||||
@@ -250,7 +241,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
input.Doctor_Id = doctor_id
|
||||
input.Doctor_Code = input.AuthInfo.Doctor_Code
|
||||
|
||||
if err := UpdateData(input, data, &event, tx); err != nil {
|
||||
return err
|
||||
|
||||
@@ -21,5 +21,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.DeviceOrder) {
|
||||
}
|
||||
|
||||
data.Encounter_Id = inputSrc.Encounter_Id
|
||||
data.Doctor_Id = inputSrc.Doctor_Id
|
||||
data.Doctor_Code = inputSrc.Doctor_Code
|
||||
}
|
||||
|
||||
@@ -787,7 +787,7 @@ func insertdataClassCode(input e.CreateDto, soapiData []es.CreateDto, event *pl.
|
||||
inpCreate := ei.CreateDto{
|
||||
Encounter_Id: &input.Id,
|
||||
Class_Code: subCode,
|
||||
Infra_Id: input.Infra_Id,
|
||||
Infra_Code: input.Infra_Code,
|
||||
}
|
||||
|
||||
// create data inpatient
|
||||
|
||||
@@ -22,6 +22,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Inpatient) {
|
||||
|
||||
data.Encounter_Id = inputSrc.Encounter_Id
|
||||
data.Class_Code = inputSrc.Class_Code
|
||||
data.Infra_Code = inputSrc.Infra_Code
|
||||
}
|
||||
|
||||
func CheckClassCode(input *string) (ere.InpatientClassCode, error) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/material-order"
|
||||
|
||||
ud "simrs-vx/internal/use-case/main-use-case/doctor"
|
||||
ue "simrs-vx/internal/use-case/main-use-case/encounter"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
@@ -56,11 +55,7 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
doctor_id, err := ud.GetIdByUserId(&input.AuthInfo.User_Id, &event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
input.Doctor_Id = doctor_id
|
||||
input.Doctor_Code = input.AuthInfo.Doctor_Code
|
||||
|
||||
if resData, err := CreateData(input, &event, tx); err != nil {
|
||||
return err
|
||||
@@ -233,12 +228,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
doctor_id, err := ud.GetIdByUserId(&input.AuthInfo.User_Id, &event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !data.IsSameDoctor(doctor_id) {
|
||||
if !data.IsSameDoctor(input.AuthInfo.Doctor_Code) {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "auth-forbidden",
|
||||
@@ -248,7 +238,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
input.Doctor_Id = doctor_id
|
||||
input.Doctor_Code = input.AuthInfo.Doctor_Code
|
||||
|
||||
if err := UpdateData(input, data, &event, tx); err != nil {
|
||||
return err
|
||||
|
||||
@@ -21,5 +21,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.MaterialOrder) {
|
||||
}
|
||||
|
||||
data.Encounter_Id = inputSrc.Encounter_Id
|
||||
data.Doctor_Id = inputSrc.Doctor_Id
|
||||
data.Doctor_Code = inputSrc.Doctor_Code
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/mcu-order"
|
||||
|
||||
ud "simrs-vx/internal/use-case/main-use-case/doctor"
|
||||
ue "simrs-vx/internal/use-case/main-use-case/encounter"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
@@ -56,11 +55,7 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
doctor_id, err := ud.GetIdByUserId(&input.AuthInfo.User_Id, &event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
input.Doctor_Id = doctor_id
|
||||
input.Doctor_Code = input.AuthInfo.Doctor_Code
|
||||
|
||||
if resData, err := CreateData(input, &event, tx); err != nil {
|
||||
return err
|
||||
@@ -233,12 +228,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
doctor_id, err := ud.GetIdByUserId(&input.AuthInfo.User_Id, &event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !data.IsSameDoctor(doctor_id) {
|
||||
if !data.IsSameDoctor(input.AuthInfo.Doctor_Code) {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "auth-forbidden",
|
||||
@@ -248,7 +238,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
input.Doctor_Id = doctor_id
|
||||
input.Doctor_Code = input.AuthInfo.Doctor_Code
|
||||
|
||||
if err := UpdateData(input, data, &event, tx); err != nil {
|
||||
return err
|
||||
|
||||
@@ -21,12 +21,11 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.McuOrder) {
|
||||
}
|
||||
|
||||
data.Encounter_Id = inputSrc.Encounter_Id
|
||||
data.Doctor_Id = inputSrc.Doctor_Id
|
||||
data.Doctor_Code = inputSrc.Doctor_Code
|
||||
data.SpecimenPickTime = inputSrc.SpecimenPickTime
|
||||
data.ExaminationDate = inputSrc.ExaminationDate
|
||||
data.Number = inputSrc.Number
|
||||
data.Temperature = inputSrc.Temperature
|
||||
data.UrgencyLevel_Code = inputSrc.UrgencyLevel_Code
|
||||
data.Doctor_Id = inputSrc.Doctor_Id
|
||||
data.Scope_Code = inputSrc.Scope_Code
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user