药品、处方列表关联药房信息
This commit is contained in:
@@ -40,11 +40,28 @@ type OrderPrescriptionDto struct {
|
||||
UserDoctor *UserDoctorDto `json:"user_doctor"` // 原始医生
|
||||
InquiryDoctor *UserDoctorDto `json:"inquiry_doctor"` // 问诊医生信息
|
||||
TransferUserDoctor *UserDoctorDto `json:"transfer_prescription_doctor"` // 接受抄方的医生(抄方处方医生信息)
|
||||
PharmacyId string `json:"pharmacy_id"` // 药房id
|
||||
PharmacyCode string `json:"pharmacy_code"` // 药房代码
|
||||
PharmacyName string `json:"pharmacy_name"` // 药房名称
|
||||
Pharmacy *PharmacyDto `json:"pharmacy"` // 药房详情
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
|
||||
func GetOrderPrescriptionDto(m *model.OrderPrescription) *OrderPrescriptionDto {
|
||||
pharmacyName := m.PharmacyName
|
||||
pharmacyCode := m.PharmacyCode
|
||||
var pharmacyDto *PharmacyDto
|
||||
if m.Pharmacy != nil {
|
||||
pharmacyDto = GetPharmacyDto(m.Pharmacy)
|
||||
if pharmacyName == "" {
|
||||
pharmacyName = m.Pharmacy.PharmacyName
|
||||
}
|
||||
if pharmacyCode == "" {
|
||||
pharmacyCode = m.Pharmacy.PharmacyCode
|
||||
}
|
||||
}
|
||||
|
||||
return &OrderPrescriptionDto{
|
||||
OrderPrescriptionId: fmt.Sprintf("%d", m.OrderPrescriptionId),
|
||||
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
||||
@@ -69,6 +86,10 @@ func GetOrderPrescriptionDto(m *model.OrderPrescription) *OrderPrescriptionDto {
|
||||
PatientSex: m.PatientSex,
|
||||
PatientAge: m.PatientAge,
|
||||
DoctorAdvice: m.DoctorAdvice,
|
||||
PharmacyId: fmt.Sprintf("%d", m.PharmacyId),
|
||||
PharmacyCode: pharmacyCode,
|
||||
PharmacyName: pharmacyName,
|
||||
Pharmacy: pharmacyDto,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
@@ -80,6 +101,19 @@ func GetOrderPrescriptionListDto(m []*model.OrderPrescription) []*OrderPrescript
|
||||
|
||||
if len(m) > 0 {
|
||||
for i, v := range m {
|
||||
pharmacyName := v.PharmacyName
|
||||
pharmacyCode := v.PharmacyCode
|
||||
var pharmacyDto *PharmacyDto
|
||||
if v.Pharmacy != nil {
|
||||
pharmacyDto = GetPharmacyDto(v.Pharmacy)
|
||||
if pharmacyName == "" {
|
||||
pharmacyName = v.Pharmacy.PharmacyName
|
||||
}
|
||||
if pharmacyCode == "" {
|
||||
pharmacyCode = v.Pharmacy.PharmacyCode
|
||||
}
|
||||
}
|
||||
|
||||
response := &OrderPrescriptionDto{
|
||||
OrderPrescriptionId: fmt.Sprintf("%d", v.OrderPrescriptionId),
|
||||
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
||||
@@ -104,6 +138,10 @@ func GetOrderPrescriptionListDto(m []*model.OrderPrescription) []*OrderPrescript
|
||||
PatientSex: v.PatientSex,
|
||||
PatientAge: v.PatientAge,
|
||||
DoctorAdvice: v.DoctorAdvice,
|
||||
PharmacyId: fmt.Sprintf("%d", v.PharmacyId),
|
||||
PharmacyCode: pharmacyCode,
|
||||
PharmacyName: pharmacyName,
|
||||
Pharmacy: pharmacyDto,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user