From 7642449eda33cfa2b8e9858432f6f4a7363aa714 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Sat, 7 Oct 2023 09:55:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=BF=94=E5=9B=9E=E7=9B=AE?= =?UTF-8?q?=E5=BD=95,=E6=96=B0=E5=A2=9E=E5=A4=84=E6=96=B9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E3=80=82=E5=88=A0=E9=99=A4=E5=8E=9Fresponse=E7=9B=AE?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/controller/orderPrescription.go | 4 +- api/dto/OrderPrescription.go | 150 +++++++++++--- api/dto/OrderPrescriptionIcd.go | 52 +++++ api/dto/OrderPrescriptionProduct.go | 79 ++++++++ api/responses/basicResponse/basic.go | 1 - .../doctorBankCardResponse/doctorBankCard.go | 14 -- .../doctorExpertise.go | 7 - api/responses/menuResponse/menu.go | 91 --------- .../orderEvaluation.go | 21 -- .../orderInquiryCase.go | 45 ----- .../orderInquiryCoupon.go | 16 -- .../orderInquiryRefund.go | 20 -- .../orderInquiryResponse/orderInquiry.go | 189 ------------------ .../orderPrescriptionIcd.go | 15 -- .../orderPrescriptionProduct.go | 24 --- .../orderPrescription.go | 168 ---------------- .../orderProductItem.go | 22 -- .../orderProductLogistics.go | 17 -- .../orderProductRefund.go | 21 -- .../orderProductResponse/orderProduct.go | 183 ----------------- .../patientFamilyResponse/patientFamily.go | 99 --------- .../userDoctorInfoResponse/userDoctorInfo.go | 25 --- .../userDoctorResponse/userDoctor.go | 25 --- .../userPatientResponse/userPatient.go | 36 ---- api/responses/userResponse/user.go | 48 ----- .../userShipAddress.go | 70 ------- api/service/OrderInquiry.go | 75 ------- api/service/orderPrescription.go | 177 ++++------------ api/service/orderProductItem.go | 50 ----- api/service/orderProductLogistics.go | 29 --- api/service/orderProductRefund.go | 32 --- api/service/patientFamily.go | 57 ------ api/service/userShipAddress.go | 53 ----- 33 files changed, 293 insertions(+), 1622 deletions(-) create mode 100644 api/dto/OrderPrescriptionIcd.go create mode 100644 api/dto/OrderPrescriptionProduct.go delete mode 100644 api/responses/basicResponse/basic.go delete mode 100644 api/responses/doctorBankCardResponse/doctorBankCard.go delete mode 100644 api/responses/doctorExpertiseResponse/doctorExpertise.go delete mode 100644 api/responses/menuResponse/menu.go delete mode 100644 api/responses/orderEvaluationResponse/orderEvaluation.go delete mode 100644 api/responses/orderInquiryCaseResponse/orderInquiryCase.go delete mode 100644 api/responses/orderInquiryCouponResponse/orderInquiryCoupon.go delete mode 100644 api/responses/orderInquiryRefundResponse/orderInquiryRefund.go delete mode 100644 api/responses/orderInquiryResponse/orderInquiry.go delete mode 100644 api/responses/orderPrescriptionIcdResponse/orderPrescriptionIcd.go delete mode 100644 api/responses/orderPrescriptionProductResponse/orderPrescriptionProduct.go delete mode 100644 api/responses/orderPrescriptionResponse/orderPrescription.go delete mode 100644 api/responses/orderProductItemResponse/orderProductItem.go delete mode 100644 api/responses/orderProductLogisticsResponse/orderProductLogistics.go delete mode 100644 api/responses/orderProductRefundResponse/orderProductRefund.go delete mode 100644 api/responses/orderProductResponse/orderProduct.go delete mode 100644 api/responses/patientFamilyResponse/patientFamily.go delete mode 100644 api/responses/userDoctorInfoResponse/userDoctorInfo.go delete mode 100644 api/responses/userDoctorResponse/userDoctor.go delete mode 100644 api/responses/userPatientResponse/userPatient.go delete mode 100644 api/responses/userResponse/user.go delete mode 100644 api/responses/userShipAddressResponse/userShipAddress.go diff --git a/api/controller/orderPrescription.go b/api/controller/orderPrescription.go index ade6678..4aba9fa 100644 --- a/api/controller/orderPrescription.go +++ b/api/controller/orderPrescription.go @@ -3,9 +3,9 @@ package controller import ( "github.com/gin-gonic/gin" "hospital-admin-api/api/dao" + "hospital-admin-api/api/dto" "hospital-admin-api/api/requests" "hospital-admin-api/api/responses" - "hospital-admin-api/api/responses/orderPrescriptionResponse" "hospital-admin-api/api/service" "hospital-admin-api/global" "hospital-admin-api/utils" @@ -44,7 +44,7 @@ func (r *OrderPrescription) GetOrderPrescriptionPage(c *gin.Context) { } // 处理返回值 - GetOrderPrescriptionPage := orderPrescriptionResponse.GetOrderPrescriptionPageResponse(orderPrescription) + GetOrderPrescriptionPage := dto.GetOrderPrescriptionListDto(orderPrescription) result := make(map[string]interface{}) result["page"] = req.GetOrderPrescriptionPage.Page diff --git a/api/dto/OrderPrescription.go b/api/dto/OrderPrescription.go index f573165..9a29871 100644 --- a/api/dto/OrderPrescription.go +++ b/api/dto/OrderPrescription.go @@ -3,35 +3,42 @@ package dto import ( "fmt" "hospital-admin-api/api/model" + "hospital-admin-api/utils" + "strings" ) type OrderPrescriptionDto struct { - OrderPrescriptionId string `json:"order_prescription_id"` // 主键id - OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL - DoctorId string `json:"doctor_id"` // 医生id;NOT NULL - PatientId string `json:"patient_id"` // 患者id - FamilyId string `json:"family_id"` // 家庭成员id(就诊用户) - PharmacistId string `json:"pharmacist_id"` // 药师id - PrescriptionStatus int `json:"prescription_status"` // 处方状态(1:待审核 2:待使用 3:已失效 4:已使用) - PharmacistAuditStatus int `json:"pharmacist_audit_status"` // 药师审核状态(0:审核中 1:审核成功 2:审核驳回) - PharmacistVerifyTime model.LocalTime `json:"pharmacist_verify_time"` // 药师审核时间 - PharmacistFailReason string `json:"pharmacist_fail_reason"` // 药师审核驳回原因 - PlatformAuditStatus int `json:"platform_audit_status"` // 处方平台审核状态(0:审核中 1:审核成功 2:审核驳回) - PlatformFailTime model.LocalTime `json:"platform_fail_time"` // 平台审核失败时间 - PlatformFailReason string `json:"platform_fail_reason"` // 处方平台驳回原因 - IsAutoPharVerify int `json:"is_auto_phar_verify"` // 是否药师自动审核(0:否 1:是) - DoctorCreatedTime model.LocalTime `json:"doctor_created_time"` // 医生开具处方时间 - ExpiredTime model.LocalTime `json:"expired_time"` // 处方过期时间 - VoidTime model.LocalTime `json:"void_time"` // 处方作废时间 - IsDelete int `json:"is_delete"` // 是否删除(0:否 1:是) - PrescriptionCode string `json:"prescription_code"` // 处方编号 - DoctorName string `json:"doctor_name"` // 医生名称 - PatientName string `json:"patient_name"` // 患者姓名-就诊人 - PatientSex int `json:"patient_sex"` // 患者性别-就诊人(1:男 2:女) - PatientAge int `json:"patient_age"` // 患者年龄-就诊人 - DoctorAdvice string `json:"doctor_advice"` // 医嘱 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 + OrderPrescriptionId string `json:"order_prescription_id"` // 主键id + OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL + DoctorId string `json:"doctor_id"` // 医生id;NOT NULL + PatientId string `json:"patient_id"` // 患者id + FamilyId string `json:"family_id"` // 家庭成员id(就诊用户) + PharmacistId string `json:"pharmacist_id"` // 药师id + PrescriptionStatus int `json:"prescription_status"` // 处方状态(1:待审核 2:待使用 3:已失效 4:已使用) + PharmacistAuditStatus int `json:"pharmacist_audit_status"` // 药师审核状态(0:审核中 1:审核成功 2:审核驳回) + PharmacistVerifyTime model.LocalTime `json:"pharmacist_verify_time"` // 药师审核时间 + PharmacistFailReason string `json:"pharmacist_fail_reason"` // 药师审核驳回原因 + PlatformAuditStatus int `json:"platform_audit_status"` // 处方平台审核状态(0:审核中 1:审核成功 2:审核驳回) + PlatformFailTime model.LocalTime `json:"platform_fail_time"` // 平台审核失败时间 + PlatformFailReason string `json:"platform_fail_reason"` // 处方平台驳回原因 + IsAutoPharVerify int `json:"is_auto_phar_verify"` // 是否药师自动审核(0:否 1:是) + DoctorCreatedTime model.LocalTime `json:"doctor_created_time"` // 医生开具处方时间 + ExpiredTime model.LocalTime `json:"expired_time"` // 处方过期时间 + VoidTime model.LocalTime `json:"void_time"` // 处方作废时间 + IsDelete int `json:"is_delete"` // 是否删除(0:否 1:是) + PrescriptionCode string `json:"prescription_code"` // 处方编号 + DoctorName string `json:"doctor_name"` // 医生名称 + PatientName string `json:"patient_name"` // 患者姓名-就诊人 + PatientSex int `json:"patient_sex"` // 患者性别-就诊人(1:男 2:女) + PatientAge int `json:"patient_age"` // 患者年龄-就诊人 + DoctorAdvice string `json:"doctor_advice"` // 医嘱 + PharmacistName string `json:"pharmacist_name"` // 药师姓名 + Mobile string `json:"mobile"` // 手机号 + OrderPrescriptionIcd string `json:"order_prescription_icd"` // 处方诊断疾病 + OrderInquiryCase *OrderInquiryCaseDto `json:"order_inquiry_case"` // 问诊病例 + OrderPrescriptionProduct []*OrderPrescriptionProductDto `json:"order_prescription_product"` // 处方商品 + CreatedAt model.LocalTime `json:"created_at"` // 创建时间 + UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 } func GetOrderPrescriptionDto(m *model.OrderPrescription) *OrderPrescriptionDto { @@ -64,13 +71,13 @@ func GetOrderPrescriptionDto(m *model.OrderPrescription) *OrderPrescriptionDto { } } -func GetOrderPrescriptionListDto(m []*model.OrderPrescription) []OrderPrescriptionDto { +func GetOrderPrescriptionListDto(m []*model.OrderPrescription) []*OrderPrescriptionDto { // 处理返回值 - responses := make([]OrderPrescriptionDto, len(m)) + responses := make([]*OrderPrescriptionDto, len(m)) if len(m) > 0 { for i, v := range m { - response := OrderPrescriptionDto{ + response := &OrderPrescriptionDto{ OrderPrescriptionId: fmt.Sprintf("%d", v.OrderPrescriptionId), OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId), DoctorId: fmt.Sprintf("%d", v.DoctorId), @@ -98,6 +105,26 @@ func GetOrderPrescriptionListDto(m []*model.OrderPrescription) []OrderPrescripti UpdatedAt: v.UpdatedAt, } + // 加载药师名称 + if v.UserPharmacist != nil { + response = response.LoadPharmacisName(v.UserPharmacist) + } + + // 加载患者家庭成员手机号 + if v.PatientFamily != nil { + response = response.LoadPatientFamilyMobileMask(v.PatientFamily) + } + + // 加载患者手机号 + if response.Mobile == "" && v.UserPatient.User != nil { + response = response.LoadPatientMobileMask(v.UserPatient.User) + } + + // 加载处方诊断疾病-字符串 + if len(v.OrderPrescriptionIcd) > 0 { + response = response.LoadOrderPrescriptionIcdString(v.OrderPrescriptionIcd) + } + // 将转换后的结构体添加到新切片中 responses[i] = response } @@ -105,3 +132,68 @@ func GetOrderPrescriptionListDto(m []*model.OrderPrescription) []OrderPrescripti return responses } + +// LoadPharmacisName 加载药师名称 +func (r *OrderPrescriptionDto) LoadPharmacisName(m *model.UserPharmacist) *OrderPrescriptionDto { + if m != nil { + r.PharmacistName = m.UserName + } + return r +} + +// LoadDoctorName 加载医生名称 +func (r *OrderPrescriptionDto) LoadDoctorName(m *model.UserDoctor) *OrderPrescriptionDto { + if m != nil { + r.DoctorName = m.UserName + } + return r +} + +// LoadPatientFamilyMobileMask 加载患者家庭成员手机号 +func (r *OrderPrescriptionDto) LoadPatientFamilyMobileMask(m *model.PatientFamily) *OrderPrescriptionDto { + if m != nil { + r.Mobile = m.MobileMask + } + return r +} + +// LoadPatientMobileMask 加载患者手机号 +func (r *OrderPrescriptionDto) LoadPatientMobileMask(m *model.User) *OrderPrescriptionDto { + if m != nil { + r.Mobile = utils.MaskPhoneStr(m.Mobile) + } + return r +} + +// LoadOrderPrescriptionIcdString 加载处方诊断疾病-字符串 +func (r *OrderPrescriptionDto) LoadOrderPrescriptionIcdString(m []*model.OrderPrescriptionIcd) *OrderPrescriptionDto { + if m != nil { + var orderPrescriptionIcd []string + for _, icd := range m { + orderPrescriptionIcd = append(orderPrescriptionIcd, icd.IcdName) + } + + r.OrderPrescriptionIcd = strings.Join(orderPrescriptionIcd, "、") + } + return r +} + +// LoadOrderInquiryCase 加载问诊病例 +func (r *OrderPrescriptionDto) LoadOrderInquiryCase(m *model.OrderInquiryCase) *OrderPrescriptionDto { + if m != nil { + d := GetOrderInquiryCaseDto(m) + + r.OrderInquiryCase = d + } + return r +} + +// LoadOrderPrescriptionProduct 加载处方商品 +func (r *OrderPrescriptionDto) LoadOrderPrescriptionProduct(m []*model.OrderPrescriptionProduct) *OrderPrescriptionDto { + if m != nil { + d := GetOrderPrescriptionProductListDto(m) + + r.OrderPrescriptionProduct = d + } + return r +} diff --git a/api/dto/OrderPrescriptionIcd.go b/api/dto/OrderPrescriptionIcd.go new file mode 100644 index 0000000..8bb3221 --- /dev/null +++ b/api/dto/OrderPrescriptionIcd.go @@ -0,0 +1,52 @@ +package dto + +import ( + "fmt" + "hospital-admin-api/api/model" +) + +type OrderPrescriptionIcdDto struct { + PrescriptionIcdId string `json:"prescription_icd_id"` // 主键id + OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id + IcdId string `json:"icd_id"` // 疾病id(icd) + IcdName string `json:"icd_name"` // 疾病名称(icd) + IcdCode string `json:"icd_code"` // icd编码 + CreatedAt model.LocalTime `json:"created_at"` // 创建时间 + UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 +} + +func GetOrderPrescriptionIcdDto(m *model.OrderPrescriptionIcd) *OrderPrescriptionIcdDto { + return &OrderPrescriptionIcdDto{ + PrescriptionIcdId: fmt.Sprintf("%d", m.PrescriptionIcdId), + OrderPrescriptionId: fmt.Sprintf("%d", m.OrderPrescriptionId), + IcdId: fmt.Sprintf("%d", m.IcdId), + IcdName: m.IcdName, + IcdCode: m.IcdCode, + CreatedAt: m.CreatedAt, + UpdatedAt: m.UpdatedAt, + } +} + +func GetOrderPrescriptionIcdListDto(m []*model.OrderPrescriptionIcd) []OrderPrescriptionIcdDto { + // 处理返回值 + responses := make([]OrderPrescriptionIcdDto, len(m)) + + if len(m) > 0 { + for i, v := range m { + response := OrderPrescriptionIcdDto{ + PrescriptionIcdId: fmt.Sprintf("%d", v.PrescriptionIcdId), + OrderPrescriptionId: fmt.Sprintf("%d", v.OrderPrescriptionId), + IcdId: fmt.Sprintf("%d", v.IcdId), + IcdName: v.IcdName, + IcdCode: v.IcdCode, + CreatedAt: v.CreatedAt, + UpdatedAt: v.UpdatedAt, + } + + // 将转换后的结构体添加到新切片中 + responses[i] = response + } + } + + return responses +} diff --git a/api/dto/OrderPrescriptionProduct.go b/api/dto/OrderPrescriptionProduct.go new file mode 100644 index 0000000..f5bbbce --- /dev/null +++ b/api/dto/OrderPrescriptionProduct.go @@ -0,0 +1,79 @@ +package dto + +import ( + "fmt" + "hospital-admin-api/api/model" +) + +type OrderPrescriptionProductDto struct { + PrescriptionProductId string `json:"prescription_product_id"` // 主键id + OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id;NOT NULL + ProductId string `json:"product_id"` // 商品id;NOT NULL + UseStatus int `json:"use_status"` // 使用状态(1:已使用 0:未使用) + PrescriptionProductNum int `json:"prescription_product_num"` // 商品数量 + ProductName string `json:"product_name"` // 商品名称 + ProductSpec string `json:"product_spec"` // 商品规格 + LicenseNumber string `json:"license_number"` // 批准文号 + Manufacturer string `json:"manufacturer"` // 生产厂家 + SingleUnit string `json:"single_unit"` // 单次剂量(例:1次1包) + SingleUse string `json:"single_use"` // 单次用法(例:口服) + PackagingUnit string `json:"packaging_unit"` // 基本包装单位(例:盒/瓶) + FrequencyUse string `json:"frequency_use"` // 使用频率(例:1天3次) + AvailableDays int `json:"available_days"` // 可用天数(3) + CreatedAt model.LocalTime `json:"created_at"` // 创建时间 + UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 +} + +func GetOrderPrescriptionProductDto(m *model.OrderPrescriptionProduct) *OrderPrescriptionProductDto { + return &OrderPrescriptionProductDto{ + PrescriptionProductId: fmt.Sprintf("%d", m.OrderPrescriptionId), + OrderPrescriptionId: fmt.Sprintf("%d", m.OrderPrescriptionId), + ProductId: fmt.Sprintf("%d", m.ProductId), + UseStatus: m.UseStatus, + PrescriptionProductNum: m.PrescriptionProductNum, + ProductName: m.ProductName, + ProductSpec: m.ProductSpec, + LicenseNumber: m.LicenseNumber, + Manufacturer: m.Manufacturer, + SingleUnit: m.SingleUnit, + SingleUse: m.SingleUse, + PackagingUnit: m.PackagingUnit, + FrequencyUse: m.FrequencyUse, + AvailableDays: m.AvailableDays, + CreatedAt: m.CreatedAt, + UpdatedAt: m.UpdatedAt, + } +} + +func GetOrderPrescriptionProductListDto(m []*model.OrderPrescriptionProduct) []*OrderPrescriptionProductDto { + // 处理返回值 + responses := make([]*OrderPrescriptionProductDto, len(m)) + + if len(m) > 0 { + for i, v := range m { + response := &OrderPrescriptionProductDto{ + PrescriptionProductId: fmt.Sprintf("%d", v.OrderPrescriptionId), + OrderPrescriptionId: fmt.Sprintf("%d", v.OrderPrescriptionId), + ProductId: fmt.Sprintf("%d", v.ProductId), + UseStatus: v.UseStatus, + PrescriptionProductNum: v.PrescriptionProductNum, + ProductName: v.ProductName, + ProductSpec: v.ProductSpec, + LicenseNumber: v.LicenseNumber, + Manufacturer: v.Manufacturer, + SingleUnit: v.SingleUnit, + SingleUse: v.SingleUse, + PackagingUnit: v.PackagingUnit, + FrequencyUse: v.FrequencyUse, + AvailableDays: v.AvailableDays, + CreatedAt: v.CreatedAt, + UpdatedAt: v.UpdatedAt, + } + + // 将转换后的结构体添加到新切片中 + responses[i] = response + } + } + + return responses +} diff --git a/api/responses/basicResponse/basic.go b/api/responses/basicResponse/basic.go deleted file mode 100644 index f525fad..0000000 --- a/api/responses/basicResponse/basic.go +++ /dev/null @@ -1 +0,0 @@ -package basicResponse diff --git a/api/responses/doctorBankCardResponse/doctorBankCard.go b/api/responses/doctorBankCardResponse/doctorBankCard.go deleted file mode 100644 index 5d4a17c..0000000 --- a/api/responses/doctorBankCardResponse/doctorBankCard.go +++ /dev/null @@ -1,14 +0,0 @@ -package doctorBankCardResponse - -type DoctorBankCard struct { - BankCardId string `json:"bank_card_id"` // 主键id - DoctorId string `json:"doctor_id"` // 医生id - BankId string `json:"bank_id"` // 银行id - BankCardCodeMask string `json:"bank_card_code_mask"` // 银行卡号(掩码) - ProvinceId int `json:"province_id"` // 省份id - Province string `json:"province"` // 省份 - CityId int `json:"city_id"` // 城市id - City string `json:"city"` // 城市 - CountyId int `json:"county_id"` // 区县id - County string `json:"county"` // 区县 -} diff --git a/api/responses/doctorExpertiseResponse/doctorExpertise.go b/api/responses/doctorExpertiseResponse/doctorExpertise.go deleted file mode 100644 index 1236b68..0000000 --- a/api/responses/doctorExpertiseResponse/doctorExpertise.go +++ /dev/null @@ -1,7 +0,0 @@ -package doctorExpertiseResponse - -type DoctorExpertise struct { - DoctorId string `json:"doctor_id"` // 医生id - ExpertiseId string `json:"expertise_id"` // 专长id - ExpertiseName string `json:"expertise_name"` // 专长名称 -} diff --git a/api/responses/menuResponse/menu.go b/api/responses/menuResponse/menu.go deleted file mode 100644 index 026652f..0000000 --- a/api/responses/menuResponse/menu.go +++ /dev/null @@ -1,91 +0,0 @@ -package menuResponse - -import ( - "hospital-admin-api/api/model" - "strconv" -) - -// GetMenuList 获取菜单列表 -type GetMenuList struct { - MenuId string `json:"menu_id"` - MenuName string `json:"menu_name"` // 菜单名称 - MenuTitle string `json:"menu_title"` // 菜单名称 - ParentId string `json:"parent_id"` // 父菜单ID(0表示一级) - MenuStatus int `json:"menu_status"` // 菜单状态(0:隐藏 1:正常)此优先级最高 - MenuType int `json:"menu_type"` // 菜单类型(1:模块 2:菜单 3:按钮) - Permission string `json:"permission"` // 标识 - OrderNum int `json:"order_num"` // 显示顺序 - Icon string `json:"icon"` // 图标地址 - Path string `json:"path"` // 页面地址(#表示当前页) - Component string `json:"component"` // 组件名称 - Children []*GetMenuList `json:"children"` // 下级页面 -} - -// GetMenu 菜单详情 -type getMenu struct { - MenuId string `json:"menu_id"` - MenuName string `json:"menu_name"` // 菜单名称 - MenuTitle string `json:"menu_title"` // 菜单名称 - ParentId string `json:"parent_id"` // 父菜单ID(0表示一级) - MenuStatus int `json:"menu_status"` // 菜单状态(0:隐藏 1:正常)此优先级最高 - MenuType int `json:"menu_type"` // 菜单类型(1:模块 2:菜单 3:按钮) - Permission string `json:"permission"` // 标识 - OrderNum int `json:"order_num"` // 显示顺序 - Icon string `json:"icon"` // 图标地址 - Path string `json:"path"` // 页面地址(#表示当前页) - Component string `json:"component"` // 组件名称 - Api []*getAdminMenuApi `json:"api"` // 接口数据 - Apis []string `json:"apis"` // 接口数据 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} - -// 接口id -type getAdminMenuApi struct { - ApiId string `json:"api_id"` // 接口id - ApiName string `json:"api_name"` // 接口名称 -} - -// GetMenuResponse 菜单详情 -func GetMenuResponse(adminMenu *model.AdminMenu, adminMenuApi []*model.AdminMenuApi) (*getMenu, error) { - var getMenuResponse *getMenu - - getAdminMenuApis := make([]*getAdminMenuApi, len(adminMenuApi)) - apis := make([]string, 0, len(adminMenuApi)) - - if adminMenu != nil { - getMenuResponse = &getMenu{ - MenuId: strconv.Itoa(int(adminMenu.MenuId)), - MenuName: adminMenu.MenuName, - MenuTitle: adminMenu.MenuTitle, - ParentId: strconv.Itoa(int(adminMenu.ParentId)), - MenuStatus: adminMenu.MenuStatus, - MenuType: adminMenu.MenuType, - Permission: adminMenu.Permission, - OrderNum: adminMenu.OrderNum, - Icon: adminMenu.Icon, - Path: adminMenu.Path, - Component: adminMenu.Component, - CreatedAt: adminMenu.CreatedAt, - UpdatedAt: adminMenu.UpdatedAt, - } - } - - if getMenuResponse != nil && len(adminMenuApi) != 0 { - for i, v := range adminMenuApi { - result := &getAdminMenuApi{ - ApiId: strconv.FormatInt(v.ApiId, 10), - ApiName: v.API.APIName, - } - - // 将转换后的结构体添加到新切片中 - getAdminMenuApis[i] = result - apis = append(apis, strconv.FormatInt(v.ApiId, 10)) - } - - getMenuResponse.Api = getAdminMenuApis - getMenuResponse.Apis = apis - } - - return getMenuResponse, nil -} diff --git a/api/responses/orderEvaluationResponse/orderEvaluation.go b/api/responses/orderEvaluationResponse/orderEvaluation.go deleted file mode 100644 index 4a35e9b..0000000 --- a/api/responses/orderEvaluationResponse/orderEvaluation.go +++ /dev/null @@ -1,21 +0,0 @@ -package orderEvaluationResponse - -import ( - "hospital-admin-api/api/model" -) - -type OrderEvaluation struct { - EvaluationId string `json:"evaluation_id"` // 主键id - DoctorId string `json:"doctor_id"` // 医生id;NOT NULL - PatientId string `json:"patient_id"` // 患者id;NOT NULL - OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL - NameMask string `json:"name_mask"` // 患者姓名(掩码) - ReplyQuality float64 `json:"reply_quality"` // 回复质量(百分制) - ServiceAttitude float64 `json:"service_attitude"` // 服务态度(百分制) - ReplyProgress float64 `json:"reply_progress"` // 回复速度(百分制) - AvgScore float64 `json:"avg_score"` // 平均得分(百分制,回复质量占4、服务态度占3、回复速度占3,计算公式:每个得分 * 占比 相加) - Type int `json:"type"` // 类型(1:默认评价 2:主动评价) - Content string `json:"content"` // 评价内容 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} diff --git a/api/responses/orderInquiryCaseResponse/orderInquiryCase.go b/api/responses/orderInquiryCaseResponse/orderInquiryCase.go deleted file mode 100644 index 821d7ef..0000000 --- a/api/responses/orderInquiryCaseResponse/orderInquiryCase.go +++ /dev/null @@ -1,45 +0,0 @@ -package orderInquiryCaseResponse - -import ( - "hospital-admin-api/api/model" -) - -// OrderInquiryCase 问诊病例详情 -type OrderInquiryCase struct { - InquiryCaseId string `json:"inquiry_case_id"` // 主键id - UserId string `json:"user_id"` // 用户id - PatientId string `json:"patient_id"` // 患者id - OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL - FamilyId string `json:"family_id"` // 家庭成员id - Relation *int `json:"relation"` // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他) - Status *int `json:"status"` // 状态(1:正常 2:删除) - Name string `json:"name"` // 患者名称 - Sex *int `json:"sex"` // 患者性别(0:未知 1:男 2:女) - Age *int `json:"age"` // 患者年龄 - Height string `json:"height"` // 身高(cm) - Weight string `json:"weight"` // 体重(kg) - DiseaseClassId string `json:"disease_class_id"` // 疾病分类id-系统 - DiseaseClassName string `json:"disease_class_name"` // 疾病名称-系统 - DiagnosisDate model.LocalTime `json:"diagnosis_date"` // 确诊日期 - DiseaseDesc string `json:"disease_desc"` // 病情描述(主诉) - DiagnoseImages []*string `json:"diagnose_images"` // 复诊凭证(多个使用逗号分隔) - IsAllergyHistory *int `json:"is_allergy_history"` // 是否存在过敏史(0:否 1:是) - AllergyHistory string `json:"allergy_history"` // 过敏史描述 - IsFamilyHistory *int `json:"is_family_history"` // 是否存在家族病史(0:否 1:是) - FamilyHistory string `json:"family_history"` // 家族病史描述 - IsPregnant *int `json:"is_pregnant"` // 是否备孕、妊娠、哺乳期(0:否 1:是) - Pregnant string `json:"pregnant"` // 备孕、妊娠、哺乳期描述 - IsTaboo *int `json:"is_taboo"` // 是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在 - DiagnosisHospital string `json:"diagnosis_hospital"` // 确诊医院 - IsTakeMedicine *int `json:"is_take_medicine"` // 正在服药(0:否 1:是) - DrugsName string `json:"drugs_name"` // 正在服药名称 - DrinkWineStatus *int `json:"drink_wine_status"` // 饮酒状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒酒) - SmokeStatus *int `json:"smoke_status"` // 吸烟状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒烟) - ChemicalCompoundStatus *int `json:"chemical_compound_status"` // 化合物状态(1:从不 2:偶尔 3:经常 4:每天) - ChemicalCompoundDescribe string `json:"chemical_compound_describe"` // 化合物描述 - IsOperation *int `json:"is_operation"` // 是否存在手术(0:否 1:是) - Operation string `json:"operation"` // 手术描述 - Product []*string `json:"product"` // 用药意向 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} diff --git a/api/responses/orderInquiryCouponResponse/orderInquiryCoupon.go b/api/responses/orderInquiryCouponResponse/orderInquiryCoupon.go deleted file mode 100644 index ea6c951..0000000 --- a/api/responses/orderInquiryCouponResponse/orderInquiryCoupon.go +++ /dev/null @@ -1,16 +0,0 @@ -package orderInquiryCouponResponse - -import ( - "hospital-admin-api/api/model" -) - -// OrderInquiryCoupon 优惠卷详情 -type OrderInquiryCoupon struct { - OrderCouponId string `json:"order_coupon_id"` // 主键id - OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id - UserCouponId string `json:"user_coupon_id"` // 用户优惠卷表 - CouponName string `json:"coupon_name"` // 优惠卷名称 - CouponUsePrice float64 `json:"coupon_use_price"` // 优惠卷使用金额 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} diff --git a/api/responses/orderInquiryRefundResponse/orderInquiryRefund.go b/api/responses/orderInquiryRefundResponse/orderInquiryRefund.go deleted file mode 100644 index 40835db..0000000 --- a/api/responses/orderInquiryRefundResponse/orderInquiryRefund.go +++ /dev/null @@ -1,20 +0,0 @@ -package orderInquiryRefundResponse - -import ( - "hospital-admin-api/api/model" -) - -type OrderInquiryRefund struct { - InquiryRefundId string `json:"inquiry_refund_id"` // 主键id - PatientId string `json:"patient_id"` // 患者id - OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id - InquiryNo string `json:"inquiry_no"` // 系统订单编号 - InquiryRefundNo string `json:"inquiry_refund_no"` // 系统退款编号 - RefundId string `json:"refund_id"` // 第三方退款单号 - InquiryRefundStatus int `json:"inquiry_refund_status"` // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) - RefundTotal float64 `json:"refund_total"` // 退款金额 - RefundReason string `json:"refund_reason"` // 退款原因 - SuccessTime model.LocalTime `json:"success_time"` // 退款成功时间 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} diff --git a/api/responses/orderInquiryResponse/orderInquiry.go b/api/responses/orderInquiryResponse/orderInquiry.go deleted file mode 100644 index 47dc66d..0000000 --- a/api/responses/orderInquiryResponse/orderInquiry.go +++ /dev/null @@ -1,189 +0,0 @@ -package orderInquiryResponse - -import ( - "fmt" - "hospital-admin-api/api/dto" - "hospital-admin-api/api/model" - "hospital-admin-api/api/responses/orderEvaluationResponse" - "hospital-admin-api/api/responses/orderInquiryCaseResponse" - "hospital-admin-api/api/responses/orderInquiryCouponResponse" - "hospital-admin-api/api/responses/orderInquiryRefundResponse" -) - -// getOrderInquiryPage 获取问诊列表-分页 -type getOrderInquiryPage struct { - OrderInquiryId string `json:"order_inquiry_id"` // 主键id - UserId string `json:"user_id"` // 用户id-患者 - PatientId string `json:"patient_id"` // 患者id - DoctorId string `json:"doctor_id"` // 医生id(未分配时为null) - FamilyId string `json:"family_id"` // 家庭成员id(就诊用户) - InquiryType int `json:"inquiry_type"` // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) - InquiryMode int `json:"inquiry_mode"` // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) - InquiryStatus int `json:"inquiry_status"` // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) - IsDelete int `json:"is_delete"` // 删除状态(0:否 1:是) - InquiryRefundStatus int `json:"inquiry_refund_status"` // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) - InquiryPayChannel int `json:"inquiry_pay_channel"` // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) - InquiryPayStatus int `json:"inquiry_pay_status"` // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) - InquiryNo string `json:"inquiry_no"` // 系统订单编号 - EscrowTradeNo string `json:"escrow_trade_no"` // 第三方支付流水号 - AmountTotal float64 `json:"amount_total"` // 订单金额 - CouponAmountTotal float64 `json:"coupon_amount_total"` // 优惠卷总金额 - PaymentAmountTotal float64 `json:"payment_amount_total"` // 实际付款金额 - PayTime model.LocalTime `json:"pay_time"` // 支付时间 - ReceptionTime model.LocalTime `json:"reception_time"` // 接诊时间(已接诊) - CompleteTime model.LocalTime `json:"complete_time"` // 订单完成时间(问诊完成时间) - FinishTime model.LocalTime `json:"finish_time"` // 订单结束时间 - StatisticsStatus int `json:"statistics_status"` // 订单统计状态(0:未统计 1:已统计 2:统计失败) - StatisticsTime model.LocalTime `json:"statistics_time"` // 订单统计时间 - IsWithdrawal int `json:"is_withdrawal"` // 是否提现(0:否 1:是 2:提现中) - WithdrawalTime model.LocalTime `json:"withdrawal_time"` // 提现时间 - CancelTime model.LocalTime `json:"cancel_time"` // 订单取消时间 - CancelReason int `json:"cancel_reason"` // 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时) - CancelRemarks string `json:"cancel_remarks"` // 取消订单备注(自动添加) - PatientName string `json:"patient_name"` // 患者姓名-就诊人 - PatientNameMask string `json:"patient_name_mask"` // 患者姓名-就诊人(掩码) - PatientSex int `json:"patient_sex"` // 患者性别-就诊人(0:未知 1:男 2:女) - PatientAge int `json:"patient_age"` // 患者年龄-就诊人 - PatientMobile string `json:"patient_mobile"` // 患者电话 - DoctorName string `json:"doctor_name"` // 医生姓名 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 -} - -// GetOrderInquiry 问诊订单详情 -type GetOrderInquiry struct { - OrderInquiryId string `json:"order_inquiry_id"` // 主键id - UserId string `json:"user_id"` // 用户id-患者 - PatientId string `json:"patient_id"` // 患者id - DoctorId string `json:"doctor_id"` // 医生id(未分配时为null) - FamilyId string `json:"family_id"` // 家庭成员id(就诊用户) - InquiryType int `json:"inquiry_type"` // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) - InquiryMode int `json:"inquiry_mode"` // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) - InquiryStatus int `json:"inquiry_status"` // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) - IsDelete int `json:"is_delete"` // 删除状态(0:否 1:是) - InquiryRefundStatus int `json:"inquiry_refund_status"` // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) - InquiryPayChannel int `json:"inquiry_pay_channel"` // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) - InquiryPayStatus int `json:"inquiry_pay_status"` // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) - InquiryNo string `json:"inquiry_no"` // 系统订单编号 - EscrowTradeNo string `json:"escrow_trade_no"` // 第三方支付流水号 - AmountTotal float64 `json:"amount_total"` // 订单金额 - CouponAmountTotal float64 `json:"coupon_amount_total"` // 优惠卷总金额 - PaymentAmountTotal float64 `json:"payment_amount_total"` // 实际付款金额 - PayTime model.LocalTime `json:"pay_time"` // 支付时间 - ReceptionTime model.LocalTime `json:"reception_time"` // 接诊时间(已接诊) - CompleteTime model.LocalTime `json:"complete_time"` // 订单完成时间(问诊完成时间) - FinishTime model.LocalTime `json:"finish_time"` // 订单结束时间 - StatisticsStatus int `json:"statistics_status"` // 订单统计状态(0:未统计 1:已统计 2:统计失败) - StatisticsTime model.LocalTime `json:"statistics_time"` // 订单统计时间 - IsWithdrawal int `json:"is_withdrawal"` // 是否提现(0:否 1:是 2:提现中) - WithdrawalTime model.LocalTime `json:"withdrawal_time"` // 提现时间 - CancelTime model.LocalTime `json:"cancel_time"` // 订单取消时间 - CancelReason int `json:"cancel_reason"` // 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时) - CancelRemarks string `json:"cancel_remarks"` // 取消订单备注(自动添加) - PatientName string `json:"patient_name"` // 患者姓名-就诊人 - PatientNameMask string `json:"patient_name_mask"` // 患者姓名-就诊人(掩码) - PatientSex int `json:"patient_sex"` // 患者性别-就诊人(0:未知 1:男 2:女) - PatientAge int `json:"patient_age"` // 患者年龄-就诊人 - OrderInquiryCoupon *orderInquiryCouponResponse.OrderInquiryCoupon `json:"order_inquiry_coupon"` // 订单优惠卷 - OrderInquiryCase *orderInquiryCaseResponse.OrderInquiryCase `json:"order_inquiry_case"` // 问诊病例 - OrderInquiryRefund *orderInquiryRefundResponse.OrderInquiryRefund `json:"order_inquiry_refund"` // 退款数据 - OrderEvaluation *orderEvaluationResponse.OrderEvaluation `json:"order_evaluation"` // 订单评价 - UserDoctor *dto.UserDoctorDto `json:"user_doctor"` // 医生数据 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 -} - -type OrderInquiry struct { - OrderInquiryId string `json:"order_inquiry_id"` // 主键id - UserId string `json:"user_id"` // 用户id-患者 - PatientId string `json:"patient_id"` // 患者id - DoctorId string `json:"doctor_id"` // 医生id(未分配时为null) - FamilyId string `json:"family_id"` // 家庭成员id(就诊用户) - InquiryType int `json:"inquiry_type"` // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测) - InquiryMode int `json:"inquiry_mode"` // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员) - InquiryStatus int `json:"inquiry_status"` // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消) - IsDelete int `json:"is_delete"` // 删除状态(0:否 1:是) - InquiryRefundStatus int `json:"inquiry_refund_status"` // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) - InquiryPayChannel int `json:"inquiry_pay_channel"` // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付) - InquiryPayStatus int `json:"inquiry_pay_status"` // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) - InquiryNo string `json:"inquiry_no"` // 系统订单编号 - EscrowTradeNo string `json:"escrow_trade_no"` // 第三方支付流水号 - AmountTotal float64 `json:"amount_total"` // 订单金额 - CouponAmountTotal float64 `json:"coupon_amount_total"` // 优惠卷总金额 - PaymentAmountTotal float64 `json:"payment_amount_total"` // 实际付款金额 - PayTime model.LocalTime `json:"pay_time"` // 支付时间 - ReceptionTime model.LocalTime `json:"reception_time"` // 接诊时间(已接诊) - CompleteTime model.LocalTime `json:"complete_time"` // 订单完成时间(问诊完成时间) - FinishTime model.LocalTime `json:"finish_time"` // 订单结束时间 - StatisticsStatus int `json:"statistics_status"` // 订单统计状态(0:未统计 1:已统计 2:统计失败) - StatisticsTime model.LocalTime `json:"statistics_time"` // 订单统计时间 - IsWithdrawal int `json:"is_withdrawal"` // 是否提现(0:否 1:是 2:提现中) - WithdrawalTime model.LocalTime `json:"withdrawal_time"` // 提现时间 - CancelTime model.LocalTime `json:"cancel_time"` // 订单取消时间 - CancelReason int `json:"cancel_reason"` // 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时) - CancelRemarks string `json:"cancel_remarks"` // 取消订单备注(自动添加) - PatientName string `json:"patient_name"` // 患者姓名-就诊人 - PatientNameMask string `json:"patient_name_mask"` // 患者姓名-就诊人(掩码) - PatientSex int `json:"patient_sex"` // 患者性别-就诊人(0:未知 1:男 2:女) - PatientAge int `json:"patient_age"` // 患者年龄-就诊人 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 -} - -// GetOrderInquiryPageResponse 获取问诊列表-分页 -func GetOrderInquiryPageResponse(orderInquiry []*model.OrderInquiry) []getOrderInquiryPage { - // 处理返回值 - getOrderInquiryPages := make([]getOrderInquiryPage, len(orderInquiry)) - - if len(orderInquiry) > 0 { - for i, v := range orderInquiry { - // 将原始结构体转换为新结构体 - res := getOrderInquiryPage{ - OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId), - UserId: fmt.Sprintf("%d", v.UserId), - PatientId: fmt.Sprintf("%d", v.PatientId), - DoctorId: fmt.Sprintf("%d", v.DoctorId), - FamilyId: fmt.Sprintf("%d", v.FamilyId), - InquiryType: v.InquiryType, - InquiryMode: v.InquiryMode, - InquiryStatus: v.InquiryStatus, - IsDelete: v.IsDelete, - InquiryRefundStatus: v.InquiryRefundStatus, - InquiryPayChannel: v.InquiryPayChannel, - InquiryPayStatus: v.InquiryPayStatus, - InquiryNo: v.InquiryNo, - EscrowTradeNo: v.EscrowTradeNo, - AmountTotal: v.AmountTotal, - CouponAmountTotal: v.CouponAmountTotal, - PaymentAmountTotal: v.PaymentAmountTotal, - PayTime: v.PayTime, - ReceptionTime: v.ReceptionTime, - CompleteTime: v.CompleteTime, - FinishTime: v.FinishTime, - StatisticsStatus: v.StatisticsStatus, - StatisticsTime: v.StatisticsTime, - IsWithdrawal: v.IsWithdrawal, - WithdrawalTime: v.WithdrawalTime, - CancelTime: v.CancelTime, - CancelReason: v.CancelReason, - CancelRemarks: v.CancelRemarks, - PatientName: v.PatientName, - PatientNameMask: v.PatientNameMask, - PatientSex: v.PatientSex, - PatientAge: v.PatientAge, - PatientMobile: v.User.Mobile, - CreatedAt: v.CreatedAt, - UpdatedAt: v.UpdatedAt, - } - - if v.UserDoctor != nil { - res.DoctorName = v.UserDoctor.UserName - } - - // 将转换后的结构体添加到新切片中 - getOrderInquiryPages[i] = res - } - } - - return getOrderInquiryPages -} diff --git a/api/responses/orderPrescriptionIcdResponse/orderPrescriptionIcd.go b/api/responses/orderPrescriptionIcdResponse/orderPrescriptionIcd.go deleted file mode 100644 index 20a26cd..0000000 --- a/api/responses/orderPrescriptionIcdResponse/orderPrescriptionIcd.go +++ /dev/null @@ -1,15 +0,0 @@ -package orderPrescriptionIcdResponse - -import ( - "hospital-admin-api/api/model" -) - -type OrderPrescriptionIcd struct { - PrescriptionIcdId string `json:"prescription_icd_id"` // 主键id - OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id - IcdId string `json:"icd_id"` // 疾病id(icd) - IcdName string `json:"icd_name"` // 疾病名称(icd) - IcdCode string `json:"icd_code"` // icd编码 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} diff --git a/api/responses/orderPrescriptionProductResponse/orderPrescriptionProduct.go b/api/responses/orderPrescriptionProductResponse/orderPrescriptionProduct.go deleted file mode 100644 index 9ef6449..0000000 --- a/api/responses/orderPrescriptionProductResponse/orderPrescriptionProduct.go +++ /dev/null @@ -1,24 +0,0 @@ -package orderPrescriptionProductResponse - -import ( - "hospital-admin-api/api/model" -) - -type OrderPrescriptionProduct struct { - PrescriptionProductId string `json:"prescription_product_id"` // 主键id - OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id;NOT NULL - ProductId string `json:"product_id"` // 商品id;NOT NULL - UseStatus int `json:"use_status"` // 使用状态(1:已使用 0:未使用) - PrescriptionProductNum int `json:"prescription_product_num"` // 商品数量 - ProductName string `json:"product_name"` // 商品名称 - ProductSpec string `json:"product_spec"` // 商品规格 - LicenseNumber string `json:"license_number"` // 批准文号 - Manufacturer string `json:"manufacturer"` // 生产厂家 - SingleUnit string `json:"single_unit"` // 单次剂量(例:1次1包) - SingleUse string `json:"single_use"` // 单次用法(例:口服) - PackagingUnit string `json:"packaging_unit"` // 基本包装单位(例:盒/瓶) - FrequencyUse string `json:"frequency_use"` // 使用频率(例:1天3次) - AvailableDays int `json:"available_days"` // 可用天数(3) - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} diff --git a/api/responses/orderPrescriptionResponse/orderPrescription.go b/api/responses/orderPrescriptionResponse/orderPrescription.go deleted file mode 100644 index b8429f1..0000000 --- a/api/responses/orderPrescriptionResponse/orderPrescription.go +++ /dev/null @@ -1,168 +0,0 @@ -package orderPrescriptionResponse - -import ( - "fmt" - "hospital-admin-api/api/model" - "hospital-admin-api/api/responses/orderInquiryCaseResponse" - "hospital-admin-api/utils" - "strings" -) - -type OrderPrescription struct { - OrderPrescriptionId string `json:"order_prescription_id"` // 主键id - OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL - DoctorId string `json:"doctor_id"` // 医生id;NOT NULL - PatientId string `json:"patient_id"` // 患者id - FamilyId string `json:"family_id"` // 家庭成员id(就诊用户) - PharmacistId string `json:"pharmacist_id"` // 药师id - PrescriptionStatus int `json:"prescription_status"` // 处方状态(1:待审核 2:待使用 3:已失效 4:已使用) - PharmacistAuditStatus int `json:"pharmacist_audit_status"` // 药师审核状态(0:审核中 1:审核成功 2:审核驳回) - PharmacistVerifyTime model.LocalTime `json:"pharmacist_verify_time"` // 药师审核时间 - PharmacistFailReason string `json:"pharmacist_fail_reason"` // 药师审核驳回原因 - PlatformAuditStatus int `json:"platform_audit_status"` // 处方平台审核状态(0:审核中 1:审核成功 2:审核驳回) - PlatformFailTime model.LocalTime `json:"platform_fail_time"` // 平台审核失败时间 - PlatformFailReason string `json:"platform_fail_reason"` // 处方平台驳回原因 - IsAutoPharVerify int `json:"is_auto_phar_verify"` // 是否药师自动审核(0:否 1:是) - DoctorCreatedTime model.LocalTime `json:"doctor_created_time"` // 医生开具处方时间 - ExpiredTime model.LocalTime `json:"expired_time"` // 处方过期时间 - VoidTime model.LocalTime `json:"void_time"` // 处方作废时间 - IsDelete int `json:"is_delete"` // 是否删除(0:否 1:是) - PrescriptionCode string `json:"prescription_code"` // 处方编号 - DoctorName string `json:"doctor_name"` // 医生名称 - PatientName string `json:"patient_name"` // 患者姓名-就诊人 - PatientSex int `json:"patient_sex"` // 患者性别-就诊人(1:男 2:女) - PatientAge int `json:"patient_age"` // 患者年龄-就诊人 - DoctorAdvice string `json:"doctor_advice"` // 医嘱 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} - -type getOrderPrescriptionPage struct { - OrderPrescriptionId string `json:"order_prescription_id"` // 主键id - OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL - DoctorId string `json:"doctor_id"` // 医生id;NOT NULL - PatientId string `json:"patient_id"` // 患者id - FamilyId string `json:"family_id"` // 家庭成员id(就诊用户) - PharmacistId string `json:"pharmacist_id"` // 药师id - PrescriptionStatus int `json:"prescription_status"` // 处方状态(1:待审核 2:待使用 3:已失效 4:已使用) - PharmacistAuditStatus int `json:"pharmacist_audit_status"` // 药师审核状态(0:审核中 1:审核成功 2:审核驳回) - PharmacistVerifyTime model.LocalTime `json:"pharmacist_verify_time"` // 药师审核时间 - PharmacistFailReason string `json:"pharmacist_fail_reason"` // 药师审核驳回原因 - PlatformAuditStatus int `json:"platform_audit_status"` // 处方平台审核状态(0:审核中 1:审核成功 2:审核驳回) - PlatformFailTime model.LocalTime `json:"platform_fail_time"` // 平台审核失败时间 - PlatformFailReason string `json:"platform_fail_reason"` // 处方平台驳回原因 - IsAutoPharVerify int `json:"is_auto_phar_verify"` // 是否药师自动审核(0:否 1:是) - DoctorCreatedTime model.LocalTime `json:"doctor_created_time"` // 医生开具处方时间 - ExpiredTime model.LocalTime `json:"expired_time"` // 处方过期时间 - IsDelete int `json:"is_delete"` // 是否删除(0:否 1:是) - PrescriptionCode string `json:"prescription_code"` // 处方编号 - DoctorName string `json:"doctor_name"` // 医生名称 - PatientName string `json:"patient_name"` // 患者姓名-就诊人 - PatientSex int `json:"patient_sex"` // 患者性别-就诊人(1:男 2:女) - PatientAge int `json:"patient_age"` // 患者年龄-就诊人 - DoctorAdvice string `json:"doctor_advice"` // 医嘱 - PharmacistName string `json:"pharmacist_name"` // 药师姓名 - Mobile string `json:"mobile"` // 手机号 - OrderPrescriptionIcd string `json:"order_prescription_icd"` // 处方诊断疾病 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} - -// GetOrderPrescription 处方详情 -type GetOrderPrescription struct { - OrderPrescriptionId string `json:"order_prescription_id"` // 主键id - OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL - DoctorId string `json:"doctor_id"` // 医生id;NOT NULL - PatientId string `json:"patient_id"` // 患者id - FamilyId string `json:"family_id"` // 家庭成员id(就诊用户) - PharmacistId string `json:"pharmacist_id"` // 药师id - PrescriptionStatus int `json:"prescription_status"` // 处方状态(1:待审核 2:待使用 3:已失效 4:已使用) - PharmacistAuditStatus int `json:"pharmacist_audit_status"` // 药师审核状态(0:审核中 1:审核成功 2:审核驳回) - PharmacistVerifyTime model.LocalTime `json:"pharmacist_verify_time"` // 药师审核时间 - PharmacistFailReason string `json:"pharmacist_fail_reason"` // 药师审核驳回原因 - PlatformAuditStatus int `json:"platform_audit_status"` // 处方平台审核状态(0:审核中 1:审核成功 2:审核驳回) - PlatformFailTime model.LocalTime `json:"platform_fail_time"` // 平台审核失败时间 - PlatformFailReason string `json:"platform_fail_reason"` // 处方平台驳回原因 - IsAutoPharVerify int `json:"is_auto_phar_verify"` // 是否药师自动审核(0:否 1:是) - DoctorCreatedTime model.LocalTime `json:"doctor_created_time"` // 医生开具处方时间 - ExpiredTime model.LocalTime `json:"expired_time"` // 处方过期时间 - VoidTime model.LocalTime `json:"void_time"` // 处方作废时间 - IsDelete int `json:"is_delete"` // 是否删除(0:否 1:是) - PrescriptionCode string `json:"prescription_code"` // 处方编号 - DoctorName string `json:"doctor_name"` // 医生名称 - PatientName string `json:"patient_name"` // 患者姓名-就诊人 - PatientSex int `json:"patient_sex"` // 患者性别-就诊人(1:男 2:女) - PatientAge int `json:"patient_age"` // 患者年龄-就诊人 - DoctorAdvice string `json:"doctor_advice"` // 医嘱 - PharmacistName string `json:"pharmacist_name"` // 药师姓名 - OrderInquiryCase *orderInquiryCaseResponse.OrderInquiryCase `json:"order_inquiry_case"` // 问诊病例 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} - -// GetOrderPrescriptionPageResponse 获取处方列表-分页 -func GetOrderPrescriptionPageResponse(orderPrescription []*model.OrderPrescription) []getOrderPrescriptionPage { - // 处理返回值 - orderPrescriptionResponses := make([]getOrderPrescriptionPage, len(orderPrescription)) - - if len(orderPrescription) > 0 { - for i, v := range orderPrescription { - // 将原始结构体转换为新结构体 - u := getOrderPrescriptionPage{ - OrderPrescriptionId: fmt.Sprintf("%d", v.OrderPrescriptionId), - OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId), - DoctorId: fmt.Sprintf("%d", v.DoctorId), - PatientId: fmt.Sprintf("%d", v.PatientId), - FamilyId: fmt.Sprintf("%d", v.FamilyId), - PharmacistId: fmt.Sprintf("%d", v.PharmacistId), - PrescriptionStatus: v.PrescriptionStatus, - PharmacistAuditStatus: v.PharmacistAuditStatus, - PharmacistVerifyTime: v.PharmacistVerifyTime, - PharmacistFailReason: v.PharmacistFailReason, - PlatformAuditStatus: v.PlatformAuditStatus, - PlatformFailTime: v.PlatformFailTime, - PlatformFailReason: v.PlatformFailReason, - IsAutoPharVerify: v.IsAutoPharVerify, - DoctorCreatedTime: v.DoctorCreatedTime, - ExpiredTime: v.ExpiredTime, - IsDelete: v.IsDelete, - PrescriptionCode: v.PrescriptionCode, - DoctorName: v.DoctorName, - PatientName: v.PatientName, - PatientSex: v.PatientSex, - PatientAge: v.PatientAge, - DoctorAdvice: v.DoctorAdvice, - CreatedAt: v.CreatedAt, - UpdatedAt: v.UpdatedAt, - } - - // 药师姓名 - if v.UserPharmacist != nil { - u.PharmacistName = v.UserPharmacist.UserName - } - - // 手机号 - if v.PatientFamily != nil { - u.Mobile = v.PatientFamily.MobileMask - } - - if u.Mobile == "" && v.UserPatient.User != nil { - u.Mobile = utils.MaskPhoneStr(v.UserPatient.User.Mobile) - } - - // 处方诊断疾病 - if len(v.OrderPrescriptionIcd) > 0 { - var orderPrescriptionIcd []string - for _, icd := range v.OrderPrescriptionIcd { - orderPrescriptionIcd = append(orderPrescriptionIcd, icd.IcdName) - } - - u.OrderPrescriptionIcd = strings.Join(orderPrescriptionIcd, "、") - } - - // 将转换后的结构体添加到新切片中 - orderPrescriptionResponses[i] = u - } - } - return orderPrescriptionResponses -} diff --git a/api/responses/orderProductItemResponse/orderProductItem.go b/api/responses/orderProductItemResponse/orderProductItem.go deleted file mode 100644 index 399ebc5..0000000 --- a/api/responses/orderProductItemResponse/orderProductItem.go +++ /dev/null @@ -1,22 +0,0 @@ -package orderProductItemResponse - -import ( - "hospital-admin-api/api/model" -) - -type OrderProductItem struct { - ProductItemId string `json:"product_item_id"` // 主键id - OrderProductId string `json:"order_product_id"` // 订单-商品订单id - OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id - OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id - ProductId string `json:"product_id"` // 商品id - ProductName string `json:"product_name"` // 商品名称 - ProductPrice float64 `json:"product_price"` // 商品价格 - ProductPlatformCode string `json:"product_platform_code"` // 商品处方平台编码 - Amount int `json:"amount"` // 数量 - Manufacturer string `json:"manufacturer"` // 生产厂家 - ProductCoverImg string `json:"product_cover_img"` // 商品封面图 - ProductSpec string `json:"product_spec"` // 商品规格 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} diff --git a/api/responses/orderProductLogisticsResponse/orderProductLogistics.go b/api/responses/orderProductLogisticsResponse/orderProductLogistics.go deleted file mode 100644 index 7b474c9..0000000 --- a/api/responses/orderProductLogisticsResponse/orderProductLogistics.go +++ /dev/null @@ -1,17 +0,0 @@ -package orderProductLogisticsResponse - -import ( - "hospital-admin-api/api/model" -) - -type OrderProductLogistics struct { - LogisticsId string `json:"logistics_id"` // 主键id - OrderProductId string `json:"order_product_id"` // 药品订单id;NOT NULL - LogisticsStatus int `json:"logistics_status"` // 运单签收状态(0在途 1揽收 2疑难 3签收 4退签 5派件 8清关 14拒签);NOT NULL - LogisticsNo string `json:"logistics_no"` // 物流编号 - CompanyName string `json:"company_name"` // 快递公司名称 - CompanyCode string `json:"company_code"` // 快递公司编码 - LogisticsContent string `json:"logistics_content"` // 内容 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} diff --git a/api/responses/orderProductRefundResponse/orderProductRefund.go b/api/responses/orderProductRefundResponse/orderProductRefund.go deleted file mode 100644 index e34bd78..0000000 --- a/api/responses/orderProductRefundResponse/orderProductRefund.go +++ /dev/null @@ -1,21 +0,0 @@ -package orderProductRefundResponse - -import ( - "hospital-admin-api/api/model" -) - -// OrderProductRefund 药品订单退款详情 -type OrderProductRefund struct { - ProductRefundId string `json:"product_refund_id"` // 主键id - PatientId string `json:"patient_id"` // 患者id - OrderProductId string `json:"order_product_id"` // 订单-药品订单id - OrderProductNo string `json:"order_product_no"` // 系统订单编号 - ProductRefundNo string `json:"product_refund_no"` // 系统退款编号 - RefundId string `json:"refund_id"` // 第三方退款单号 - ProductRefundStatus int `json:"product_refund_status"` // 商品订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) - RefundTotal float64 `json:"refund_total"` // 退款金额 - RefundReason string `json:"refund_reason"` // 退款原因 - SuccessTime model.LocalTime `json:"success_time"` // 退款成功时间 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} diff --git a/api/responses/orderProductResponse/orderProduct.go b/api/responses/orderProductResponse/orderProduct.go deleted file mode 100644 index 4917e48..0000000 --- a/api/responses/orderProductResponse/orderProduct.go +++ /dev/null @@ -1,183 +0,0 @@ -package orderProductResponse - -import ( - "fmt" - "hospital-admin-api/api/model" - "hospital-admin-api/api/responses/orderInquiryCaseResponse" - "hospital-admin-api/api/responses/orderPrescriptionResponse" - "hospital-admin-api/api/responses/orderProductItemResponse" - "hospital-admin-api/api/responses/orderProductLogisticsResponse" - "hospital-admin-api/api/responses/orderProductRefundResponse" - "hospital-admin-api/api/responses/userDoctorResponse" -) - -// getOrderProductPage 获取医生列表-分页 -type getOrderProductPage struct { - OrderProductId string `json:"order_product_id"` // 主键id - OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL - OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id;NOT NULL - DoctorId string `json:"doctor_id"` // 医生id - PatientId string `json:"patient_id"` // 患者id - FamilyId string `json:"family_id"` // 家庭成员id(就诊用户) - OrderProductNo string `json:"order_product_no"` // 订单编号 - EscrowTradeNo string `json:"escrow_trade_no"` // 第三方支付流水号 - OrderProductStatus int `json:"order_product_status"` // 订单状态(1:待支付 2:待发货 3:已发货 4:已签收 5:已取消) - PayChannel int `json:"pay_channel"` // 支付渠道(1:小程序支付 2:微信扫码支付);NOT NULL - PayStatus int `json:"pay_status"` // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) - CancelReason int `json:"cancel_reason"` // 订单取消原因(1:主动取消 2:复核失败/库存不足 3:支付超时 4:客服取消) - AmountTotal float64 `json:"amount_total"` // 订单金额 - PaymentAmountTotal float64 `json:"payment_amount_total"` // 实际付款金额 - LogisticsFee float64 `json:"logistics_fee"` // 运费金额 - LogisticsNo string `json:"logistics_no"` // 物流编号 - LogisticsCompanyCode string `json:"logistics_company_code"` // 快递公司编码 - DeliveryTime model.LocalTime `json:"delivery_time"` // 发货时间 - PayTime model.LocalTime `json:"pay_time"` // 支付时间 - Remarks string `json:"remarks"` // 订单备注 - RefundStatus int `json:"refund_status"` // 商品订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) - ReportPreStatus int `json:"report_pre_status"` // 上报处方平台状态(0:未上报 1:已上报 2:上报失败)) - PrescriptionCode string `json:"prescription_code"` // 处方编号 - ConsigneeNameMask string `json:"consignee_name_mask"` // 收货人姓名(掩码) - ConsigneeTelMask string `json:"consignee_tel_mask"` // 收货人电话(掩码) - DoctorName string `json:"doctor_name"` // 医生姓名 - PatientNameMask string `json:"patient_name_mask"` // 患者姓名-就诊人(掩码) - PatientSex int `json:"patient_sex"` // 患者性别-就诊人(0:未知 1:男 2:女) - PatientAge int `json:"patient_age"` // 患者年龄-就诊人 - PatientMobile string `json:"patient_mobile"` // 患者电话 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 -} - -// GetOrderProduct 问诊订单详情 -type GetOrderProduct struct { - OrderProductId string `json:"order_product_id"` // 主键id - OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL - OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id;NOT NULL - DoctorId string `json:"doctor_id"` // 医生id - PatientId string `json:"patient_id"` // 患者id - FamilyId string `json:"family_id"` // 家庭成员id(就诊用户) - OrderProductNo string `json:"order_product_no"` // 订单编号 - EscrowTradeNo string `json:"escrow_trade_no"` // 第三方支付流水号 - OrderProductStatus int `json:"order_product_status"` // 订单状态(1:待支付 2:待发货 3:已发货 4:已签收 5:已取消) - PayChannel int `json:"pay_channel"` // 支付渠道(1:小程序支付 2:微信扫码支付);NOT NULL - PayStatus int `json:"pay_status"` // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款) - CancelReason int `json:"cancel_reason"` // 订单取消原因(1:主动取消 2:复核失败/库存不足 3:支付超时 4:客服取消) - AmountTotal float64 `json:"amount_total"` // 订单金额 - PaymentAmountTotal float64 `json:"payment_amount_total"` // 实际付款金额 - LogisticsFee float64 `json:"logistics_fee"` // 运费金额 - LogisticsNo string `json:"logistics_no"` // 物流编号 - LogisticsCompanyCode string `json:"logistics_company_code"` // 快递公司编码 - DeliveryTime model.LocalTime `json:"delivery_time"` // 发货时间 - PayTime model.LocalTime `json:"pay_time"` // 支付时间 - Remarks string `json:"remarks"` // 订单备注 - RefundStatus int `json:"refund_status"` // 商品订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) - CancelTime model.LocalTime `json:"cancel_time"` // 订单取消时间 - CancelRemarks string `json:"cancel_remarks"` // 订单取消备注(自动添加) - ReportPreStatus int `json:"report_pre_status"` // 上报处方平台状态(0:未上报 1:已上报 2:上报失败)) - ReportPreTime model.LocalTime `json:"report_pre_time"` // 上报处方平台时间 - ReportPreFailReason string `json:"report_pre_fail_reason"` // 上报失败原因 - ProvinceId int `json:"province_id"` // 省份id - Province string `json:"province"` // 省份 - CityId int `json:"city_id"` // 城市id - City string `json:"city"` // 城市 - CountyId int `json:"county_id"` // county_id - County string `json:"county"` // 区县 - AddressMask string `json:"address_mask"` // 详细地址(掩码) - ConsigneeNameMask string `json:"consignee_name_mask"` // 收货人姓名(掩码) - ConsigneeTelMask string `json:"consignee_tel_mask"` // 收货人电话(掩码) - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 - OrderProductRefund *orderProductRefundResponse.OrderProductRefund `json:"order_product_refund"` // 退款数据 - OrderProductItem []*orderProductItemResponse.OrderProductItem `json:"order_product_item"` // 商品数据 - OrderProductLogistics *orderProductLogisticsResponse.OrderProductLogistics `json:"order_product_logistics"` // 物流数据 - UserDoctor *userDoctorResponse.GetUserDoctorById `json:"user_doctor"` // 医生数据 - OrderPrescription *orderPrescriptionResponse.OrderPrescription `json:"order_prescription"` // 处方数据 - OrderInquiryCase *orderInquiryCaseResponse.OrderInquiryCase `json:"order_inquiry_case"` // 问诊病例 -} - -// GetOrderProductConsignee 获取药品订单收货人数据 -type GetOrderProductConsignee struct { - ProvinceId int `json:"province_id"` // 省份id - Province string `json:"province"` // 省份 - CityId int `json:"city_id"` // 城市id - City string `json:"city"` // 城市 - CountyId int `json:"county_id"` // county_id - County string `json:"county"` // 区县 - Address string `json:"address"` // 详细地址 - ConsigneeName string `json:"consignee_name"` // 收货人姓名 - ConsigneeTel string `json:"consignee_tel"` // 收货人电话 -} - -// GetOrderProductPageResponse 获取药品订单列表-分页 -func GetOrderProductPageResponse(orderProduct []*model.OrderProduct) []getOrderProductPage { - // 处理返回值 - getOrderProductPages := make([]getOrderProductPage, len(orderProduct)) - - if len(orderProduct) > 0 { - for i, v := range orderProduct { - // 将原始结构体转换为新结构体 - res := getOrderProductPage{ - OrderProductId: fmt.Sprintf("%d", v.OrderProductId), - OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId), - OrderPrescriptionId: fmt.Sprintf("%d", v.OrderPrescriptionId), - DoctorId: fmt.Sprintf("%d", v.DoctorId), - PatientId: fmt.Sprintf("%d", v.PatientId), - FamilyId: fmt.Sprintf("%d", v.FamilyId), - OrderProductNo: v.OrderProductNo, - EscrowTradeNo: v.OrderProductNo, - OrderProductStatus: v.OrderProductStatus, - PayChannel: v.PayChannel, - PayStatus: v.PayStatus, - CancelReason: v.CancelReason, - AmountTotal: v.AmountTotal, - PaymentAmountTotal: v.PaymentAmountTotal, - LogisticsFee: v.LogisticsFee, - LogisticsNo: v.LogisticsNo, - LogisticsCompanyCode: v.LogisticsCompanyCode, - DeliveryTime: v.DeliveryTime, - PayTime: v.PayTime, - Remarks: v.Remarks, - RefundStatus: v.RefundStatus, - ReportPreStatus: v.ReportPreStatus, - ConsigneeNameMask: v.ConsigneeNameMask, - ConsigneeTelMask: v.ConsigneeTelMask, - PatientMobile: v.UserPatient.User.Mobile, - CreatedAt: v.CreatedAt, - UpdatedAt: v.UpdatedAt, - } - - if v.UserDoctor != nil { - res.DoctorName = v.UserDoctor.UserName - } - - if v.OrderInquiry != nil { - res.PatientNameMask = v.OrderInquiry.PatientNameMask - res.PatientSex = v.OrderInquiry.PatientSex - res.PatientAge = v.OrderInquiry.PatientAge - } - - if v.OrderPrescription != nil { - res.PrescriptionCode = v.OrderPrescription.PrescriptionCode - } - - // 将转换后的结构体添加到新切片中 - getOrderProductPages[i] = res - } - } - - return getOrderProductPages -} - -// GetOrderProductConsigneeResponse 获取药品订单收货人数据 -func GetOrderProductConsigneeResponse(orderProduct *model.OrderProduct) *GetOrderProductConsignee { - return &GetOrderProductConsignee{ - ProvinceId: orderProduct.ProvinceId, - Province: orderProduct.Province, - CityId: orderProduct.CityId, - City: orderProduct.City, - CountyId: orderProduct.CountyId, - County: orderProduct.County, - Address: orderProduct.Address, - ConsigneeName: orderProduct.ConsigneeName, - ConsigneeTel: orderProduct.ConsigneeTel, - } -} diff --git a/api/responses/patientFamilyResponse/patientFamily.go b/api/responses/patientFamilyResponse/patientFamily.go deleted file mode 100644 index df6102d..0000000 --- a/api/responses/patientFamilyResponse/patientFamily.go +++ /dev/null @@ -1,99 +0,0 @@ -package patientFamilyResponse - -import ( - "hospital-admin-api/api/model" - "hospital-admin-api/api/responses/userResponse" -) - -type PatientFamily struct { - FamilyId string `json:"family_id"` // 主键id - PatientId string `json:"patient_id"` // 患者id - Relation *int `json:"relation"` // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他) - Status *int `json:"status"` // 状态(1:正常 2:删除) - IsDefault *int `json:"is_default"` // 是否默认(0:否 1:是) - CardName string `json:"card_name"` // 姓名 - CardNameMask string `json:"card_name_mask"` // 姓名(掩码) - Mobile string `json:"mobile"` // 电话 - MobileMask string `json:"mobile_mask"` // 电话(掩码) - Type *int `json:"type"` // 身份类型(1:身份证 2:护照 3:港澳通行证 4:台胞证) - IdNumber string `json:"id_number"` // 证件号码 - IdNumberMask string `json:"id_number_mask"` // 证件号码(掩码) - Sex *int `json:"sex"` // 性别(0:未知 1:男 2:女) - Age int `json:"age"` // 年龄 - ProvinceId string `json:"province_id"` // 省份id - Province string `json:"province"` // 省份 - CityId string `json:"city_id"` // 城市id - City string `json:"city"` // 城市 - CountyId string `json:"county_id"` // 区县id - County string `json:"county"` // 区县 - Height string `json:"height"` // 身高(cm) - Weight string `json:"weight"` // 体重(kg) - MaritalStatus *int `json:"marital_status"` // 婚姻状况(0:未婚 1:已婚 2:离异) - NationId string `json:"nation_id"` // 民族 - NationName string `json:"nation_name"` // 民族名称 - JobId string `json:"job_id"` // 职业 - JobName string `json:"job_name"` // 职业名称 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 -} - -// GetUserPatient 患者详情 -type GetUserPatient struct { - FamilyId string `json:"family_id"` // 主键id - PatientId string `json:"patient_id"` // 患者id - Relation *int `json:"relation"` // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他) - Status *int `json:"status"` // 状态(1:正常 2:删除) - IsDefault *int `json:"is_default"` // 是否默认(0:否 1:是) - CardNameMask string `json:"card_name_mask"` // 姓名(掩码) - MobileMask string `json:"mobile_mask"` // 电话(掩码) - IdNumberMask string `json:"id_number_mask"` // 证件号码(掩码) - Sex *int `json:"sex"` // 性别(0:未知 1:男 2:女) - Age int `json:"age"` // 年龄 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 -} - -// 获取就诊人列表-分页 -type getPatientFamilyPage struct { - FamilyId string `json:"family_id"` // 主键id - PatientId string `json:"patient_id"` // 患者id - Relation *int `json:"relation"` // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他) - Status *int `json:"status"` // 状态(1:正常 2:删除) - CardName string `json:"card_name"` // 姓名 - MobileMask string `json:"mobile_mask"` // 电话(掩码) - UserName string `json:"user_name"` // 账号名称 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 -} - -// GetPatientFamily 就诊人详情 -type GetPatientFamily struct { - FamilyId string `json:"family_id"` // 主键id - PatientId string `json:"patient_id"` // 患者id - Relation *int `json:"relation"` // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他) - Status *int `json:"status"` // 状态(1:正常 2:删除) - IsDefault *int `json:"is_default"` // 是否默认(0:否 1:是) - CardName string `json:"card_name"` // 姓名 - CardNameMask string `json:"card_name_mask"` // 姓名(掩码) - MobileMask string `json:"mobile_mask"` // 电话(掩码) - Type *int `json:"type"` // 身份类型(1:身份证 2:护照 3:港澳通行证 4:台胞证) - IdNumberMask string `json:"id_number_mask"` // 证件号码(掩码) - Sex *int `json:"sex"` // 性别(0:未知 1:男 2:女) - Age int `json:"age"` // 年龄 - ProvinceId string `json:"province_id"` // 省份id - Province string `json:"province"` // 省份 - CityId string `json:"city_id"` // 城市id - City string `json:"city"` // 城市 - CountyId string `json:"county_id"` // 区县id - County string `json:"county"` // 区县 - Height string `json:"height"` // 身高(cm) - Weight string `json:"weight"` // 体重(kg) - MaritalStatus *int `json:"marital_status"` // 婚姻状况(0:未婚 1:已婚 2:离异) - NationId string `json:"nation_id"` // 民族 - NationName string `json:"nation_name"` // 民族名称 - JobId string `json:"job_id"` // 职业 - JobName string `json:"job_name"` // 职业名称 - User *userResponse.User `json:"user"` // 用户 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 -} diff --git a/api/responses/userDoctorInfoResponse/userDoctorInfo.go b/api/responses/userDoctorInfoResponse/userDoctorInfo.go deleted file mode 100644 index d98a607..0000000 --- a/api/responses/userDoctorInfoResponse/userDoctorInfo.go +++ /dev/null @@ -1,25 +0,0 @@ -package userDoctorInfoResponse - -import ( - "hospital-admin-api/api/model" -) - -type UserDoctorInfo struct { - DoctorInfoId string `json:"doctor_info_id"` // 主键 - UserId string `json:"user_id"` // 用户id - DoctorId string `json:"doctor_id"` // 医生id - CardType int `json:"card_type"` // 类型(1:身份证 2:护照 3:港澳通行证 4:台胞证);NOT NULL - CardName string `json:"card_name"` // 证件姓名 - CardNameMask string `json:"card_name_mask"` // 证件姓名(掩码) - CardNumMask string `json:"card_num_mask"` // 证件号码(掩码) - LicenseCert []string `json:"license_cert"` // 医师执业证(逗号分隔) - QualificationCert []string `json:"qualification_cert"` // 医师资格证(逗号分隔) - QualificationCertNum string `json:"qualification_cert_num"` // 医师资格证号(逗号分隔) - WorkCert []string `json:"work_cert"` // 医师工作证(逗号分隔) - MultiPointImages []string `json:"multi_point_images"` // 多点执业备案信息(逗号分隔) - IdCardFront string `json:"id_card_front"` // 身份证正面图片 - IdCardBack string `json:"id_card_back"` // 身份证背面图片 - SignImage string `json:"sign_image"` // 签名图片 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 -} diff --git a/api/responses/userDoctorResponse/userDoctor.go b/api/responses/userDoctorResponse/userDoctor.go deleted file mode 100644 index 7b21141..0000000 --- a/api/responses/userDoctorResponse/userDoctor.go +++ /dev/null @@ -1,25 +0,0 @@ -package userDoctorResponse - -import ( - "hospital-admin-api/api/dto" - "hospital-admin-api/api/model" - "hospital-admin-api/api/responses/userDoctorInfoResponse" -) - -// GetUserDoctorById 医生详情-医生id -type GetUserDoctorById struct { - DoctorID string `json:"doctor_id"` // 主键id - UserID string `json:"user_id"` // 用户id - UserName string `json:"user_name"` // 用户名称 - Status int `json:"status"` // 状态(0:禁用 1:正常 2:删除) - IDCardStatus int `json:"idcard_status"` // 实名认证状态(0:未认证 1:认证通过 2:认证失败) - MultiPointStatus int `json:"multi_point_status"` // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) - Avatar string `json:"avatar"` // 头像 - DoctorTitle int `json:"doctor_title"` // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师) - DepartmentCustomName string `json:"department_custom_name"` // 科室名称(如未自己输入,填入标准科室名称) - HospitalID string `json:"hospital_id"` // 所属医院id - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 - Hospital *dto.HospitalDto `json:"hospital"` // 医院 - UserDoctorInfo *userDoctorInfoResponse.UserDoctorInfo `json:"user_doctor_info"` // 医生详情 -} diff --git a/api/responses/userPatientResponse/userPatient.go b/api/responses/userPatientResponse/userPatient.go deleted file mode 100644 index 97f660e..0000000 --- a/api/responses/userPatientResponse/userPatient.go +++ /dev/null @@ -1,36 +0,0 @@ -package userPatientResponse - -import ( - "hospital-admin-api/api/model" - "hospital-admin-api/api/responses/patientFamilyResponse" - "hospital-admin-api/api/responses/userShipAddressResponse" -) - -// getUserPatientPage 获取患者列表-分页 -type getUserPatientPage struct { - PatientId string `json:"patient_id"` // 主键id - UserId string `json:"user_id"` // 用户id;NOT NULL - UserName string `json:"user_name"` // 用户名称 - Status int `json:"status"` // 状态(0:禁用 1:正常 2:删除) - Avatar string `json:"avatar"` // 头像 - Mobile string `json:"mobile"` // 手机号 - DisableReason string `json:"disable_reason"` // 禁用理由 - PatientFamilyCount int `json:"patient_family_count"` // 家庭成员数量 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 -} - -// GetUserPatient 患者详情 -type GetUserPatient struct { - PatientId string `json:"patient_id"` // 主键id - UserId string `json:"user_id"` // 用户id;NOT NULL - UserName string `json:"user_name"` // 用户名称 - Status *int `json:"status"` // 状态(0:禁用 1:正常 2:删除) - Avatar string `json:"avatar"` // 头像 - Mobile string `json:"mobile"` // 手机号 - DisableReason string `json:"disable_reason"` // 禁用理由 - PatientFamily []*patientFamilyResponse.GetUserPatient `json:"patient_family"` // 家庭成员 - UserShipAddress []*userShipAddressResponse.UserShipAddress `json:"user_ship_address"` // 收货地址 - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间 -} diff --git a/api/responses/userResponse/user.go b/api/responses/userResponse/user.go deleted file mode 100644 index efe80f8..0000000 --- a/api/responses/userResponse/user.go +++ /dev/null @@ -1,48 +0,0 @@ -package userResponse - -import ( - "hospital-admin-api/api/model" - "hospital-admin-api/utils" - "strconv" -) - -type User struct { - UserID string `json:"user_id"` // 主键 - UserName string `json:"user_name"` // 用户名称 - UserAccount string `json:"user_account"` // 账号 - Mobile string `json:"mobile"` // 手机号 - WxMobile string `json:"wx_mobile"` // 微信手机号 - UserType int `json:"user_type"` // 用户类型(1:患者 2:医师 3:药师) - UserStatus int `json:"user_status"` // 状态(0:禁用 1:正常 2:删除) - RegisterMethod int `json:"register_method"` // 注册方式(1:微信小程序) - Age uint `json:"age"` // 年龄 - Sex int `json:"sex"` // 性别(0:未知 1:男 2:女) - Avatar string `json:"avatar"` // 头像 - LoginIP string `json:"login_ip"` // 登陆ip - LastLoginAt model.LocalTime `json:"last_login_at"` // 最后登陆时间 - CreatedBy string `json:"created_by"` // 创建者id(后台用户表id null:自己注册) - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} - -// UserResponse 用户详情 -func UserResponse(user *model.User) *User { - return &User{ - UserID: strconv.FormatInt(user.UserId, 10), - UserName: user.UserName, - UserAccount: user.UserAccount, - Mobile: user.Mobile, - WxMobile: user.WxMobile, - UserType: user.UserType, - UserStatus: user.UserStatus, - RegisterMethod: user.RegisterMethod, - Age: user.Age, - Sex: user.Sex, - Avatar: utils.AddOssDomain(user.Avatar), - LoginIP: user.LoginIp, - LastLoginAt: user.LastLoginAt, - CreatedBy: user.CreatedBy, - CreatedAt: user.CreatedAt, - UpdatedAt: user.UpdatedAt, - } -} diff --git a/api/responses/userShipAddressResponse/userShipAddress.go b/api/responses/userShipAddressResponse/userShipAddress.go deleted file mode 100644 index c98b2b7..0000000 --- a/api/responses/userShipAddressResponse/userShipAddress.go +++ /dev/null @@ -1,70 +0,0 @@ -package userShipAddressResponse - -import ( - "fmt" - "hospital-admin-api/api/model" -) - -type UserShipAddress struct { - AddressId string `json:"address_id"` // 主键id - UserId string `json:"user_id"` // 用户id;NOT NULL - ProvinceId string `json:"province_id"` // 省份id - Province string `json:"province"` // 省份 - CityId string `json:"city_id"` // 城市id - City string `json:"city"` // 城市 - CountyId string `json:"county_id"` // 区县id - County string `json:"county"` // 区县 - ConsigneeTownId string `json:"consignee_town_id"` // 镇id - ConsigneeTown string `json:"consignee_town"` // 镇 - Address string `json:"address"` // 详细地址 - AddressMask string `json:"address_mask"` // 详细地址(掩码) - ConsigneeName string `json:"consignee_name"` // 收货人姓名;NOT NULL - ConsigneeNameMask string `json:"consignee_name_mask"` // 收货人姓名(掩码) - ConsigneeTel string `json:"consignee_tel"` // 收货人电话;NOT NULL - ConsigneeTelMask string `json:"consignee_tel_mask"` // 收货人电话(掩码) - ConsigneeZipCode string `json:"consignee_zip_code"` // 收货邮编 - IsDefault *int `json:"is_default"` // 默认地址(0:否 1:是) - Tag *int `json:"tag"` // 地址标签(1:家 2:公司 3:学校 4:其他) - CreatedAt model.LocalTime `json:"created_at"` // 创建时间 - UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间 -} - -// GetUserShipAddressListResponse 获取收货地址列表 -func GetUserShipAddressListResponse(userShipAddress []*model.UserShipAddress) []*UserShipAddress { - // 处理返回值 - items := make([]*UserShipAddress, len(userShipAddress)) - - if len(userShipAddress) > 0 { - for i, v := range userShipAddress { - // 将原始结构体转换为新结构体 - item := &UserShipAddress{ - AddressId: fmt.Sprintf("%d", v.AddressId), - UserId: fmt.Sprintf("%d", v.UserId), - ProvinceId: fmt.Sprintf("%d", v.ProvinceId), - Province: v.Province, - CityId: fmt.Sprintf("%d", v.CityId), - City: v.City, - CountyId: fmt.Sprintf("%d", v.CountyId), - County: v.County, - ConsigneeTownId: fmt.Sprintf("%d", v.ConsigneeTownId), - ConsigneeTown: v.ConsigneeTown, - Address: v.Address, - AddressMask: v.AddressMask, - ConsigneeName: v.ConsigneeName, - ConsigneeNameMask: v.ConsigneeNameMask, - ConsigneeTel: v.ConsigneeTel, - ConsigneeTelMask: v.ConsigneeTelMask, - ConsigneeZipCode: v.ConsigneeZipCode, - IsDefault: &v.IsDefault, - Tag: &v.Tag, - CreatedAt: v.CreatedAt, - UpdatedAt: v.UpdatedAt, - } - - // 将转换后的结构体添加到新切片中 - items[i] = item - } - } - - return items -} diff --git a/api/service/OrderInquiry.go b/api/service/OrderInquiry.go index 8ab3b4e..5917e29 100644 --- a/api/service/OrderInquiry.go +++ b/api/service/OrderInquiry.go @@ -8,8 +8,6 @@ import ( "hospital-admin-api/api/dto" "hospital-admin-api/api/model" "hospital-admin-api/api/requests" - "hospital-admin-api/api/responses/orderInquiryCaseResponse" - "hospital-admin-api/api/responses/orderInquiryResponse" "hospital-admin-api/config" "hospital-admin-api/extend/weChat" "hospital-admin-api/global" @@ -324,76 +322,3 @@ func (r *OrderInquiryService) GetOrderInquiry(orderInquiryId int64) (g *dto.Orde g.LoadOrderEvaluation(orderEvaluation) return g, nil } - -// GetOrderInquiryCaseByOrderInquiryId 获取问诊订单病例-问诊订单 -func (r *OrderInquiryService) GetOrderInquiryCaseByOrderInquiryId(orderInquiryId int64) (u *orderInquiryCaseResponse.OrderInquiryCase, err error) { - orderInquiryCaseDao := dao.OrderInquiryCaseDao{} - orderInquiryCase, err := orderInquiryCaseDao.GetOrderInquiryCaseByOrderInquiryId(orderInquiryId) - if orderInquiryCase == nil { - return nil, errors.New("数据错误,无问诊病例") - } - - u = &orderInquiryCaseResponse.OrderInquiryCase{ - InquiryCaseId: strconv.FormatInt(orderInquiryCase.InquiryCaseId, 10), - UserId: strconv.FormatInt(orderInquiryCase.UserId, 10), - PatientId: strconv.FormatInt(orderInquiryCase.PatientId, 10), - OrderInquiryId: strconv.FormatInt(orderInquiryCase.OrderInquiryId, 10), - FamilyId: strconv.FormatInt(orderInquiryCase.FamilyId, 10), - Name: orderInquiryCase.Name, - Sex: orderInquiryCase.Sex, - Age: orderInquiryCase.Age, - DiseaseClassName: orderInquiryCase.DiseaseClassName, - DiseaseDesc: orderInquiryCase.DiseaseDesc, - } - - return u, nil -} - -// GetOrderInquiryById 问诊订单详情-问诊订单id -func (r *OrderInquiryService) GetOrderInquiryById(orderInquiryId int64) (res *orderInquiryResponse.OrderInquiry, err error) { - // 获取问诊订单数据 - orderInquiryDao := dao.OrderInquiryDao{} - orderInquiry, err := orderInquiryDao.GetOrderInquiryPreloadById(orderInquiryId) - if err != nil || orderInquiry == nil { - return nil, errors.New(err.Error()) - } - - // 处理返回值 - res = &orderInquiryResponse.OrderInquiry{ - OrderInquiryId: strconv.FormatInt(orderInquiry.OrderInquiryId, 10), - UserId: strconv.FormatInt(orderInquiry.UserId, 10), - PatientId: strconv.FormatInt(orderInquiry.PatientId, 10), - FamilyId: strconv.FormatInt(orderInquiry.FamilyId, 10), - InquiryType: orderInquiry.InquiryType, - InquiryMode: orderInquiry.InquiryMode, - InquiryStatus: orderInquiry.InquiryStatus, - IsDelete: orderInquiry.IsDelete, - InquiryRefundStatus: orderInquiry.InquiryRefundStatus, - InquiryPayChannel: orderInquiry.InquiryPayChannel, - InquiryPayStatus: orderInquiry.InquiryPayStatus, - InquiryNo: orderInquiry.InquiryNo, - EscrowTradeNo: orderInquiry.EscrowTradeNo, - AmountTotal: orderInquiry.AmountTotal, - CouponAmountTotal: orderInquiry.CouponAmountTotal, - PaymentAmountTotal: orderInquiry.PaymentAmountTotal, - PayTime: orderInquiry.PayTime, - ReceptionTime: orderInquiry.ReceptionTime, - CompleteTime: orderInquiry.CompleteTime, - FinishTime: orderInquiry.FinishTime, - StatisticsStatus: orderInquiry.StatisticsStatus, - StatisticsTime: orderInquiry.StatisticsTime, - IsWithdrawal: orderInquiry.IsWithdrawal, - WithdrawalTime: orderInquiry.WithdrawalTime, - CancelTime: orderInquiry.CancelTime, - CancelReason: orderInquiry.CancelReason, - CancelRemarks: orderInquiry.CancelRemarks, - PatientName: orderInquiry.PatientName, - PatientNameMask: orderInquiry.PatientNameMask, - PatientSex: orderInquiry.PatientSex, - PatientAge: orderInquiry.PatientAge, - CreatedAt: orderInquiry.CreatedAt, - UpdatedAt: orderInquiry.UpdatedAt, - } - - return res, nil -} diff --git a/api/service/orderPrescription.go b/api/service/orderPrescription.go index 545f9f1..37c98a2 100644 --- a/api/service/orderPrescription.go +++ b/api/service/orderPrescription.go @@ -2,58 +2,16 @@ package service import ( "errors" - "fmt" "hospital-admin-api/api/dao" - "hospital-admin-api/api/model" - "hospital-admin-api/api/responses/orderPrescriptionIcdResponse" - "hospital-admin-api/api/responses/orderPrescriptionProductResponse" - "hospital-admin-api/api/responses/orderPrescriptionResponse" + "hospital-admin-api/api/dto" ) // OrderPrescriptionService 处方 type OrderPrescriptionService struct { } -// GetOrderPrescriptionById 获取处方数据 -func (r *OrderPrescriptionService) GetOrderPrescriptionById(OrderPrescriptionId int64) (u *orderPrescriptionResponse.OrderPrescription, err error) { - orderPrescriptionDao := dao.OrderPrescriptionDao{} - orderPrescription, err := orderPrescriptionDao.GetById(OrderPrescriptionId) - if orderPrescription == nil { - return nil, nil - } - - u = &orderPrescriptionResponse.OrderPrescription{ - OrderPrescriptionId: fmt.Sprintf("%d", orderPrescription.OrderPrescriptionId), - OrderInquiryId: fmt.Sprintf("%d", orderPrescription.OrderInquiryId), - DoctorId: fmt.Sprintf("%d", orderPrescription.DoctorId), - PatientId: fmt.Sprintf("%d", orderPrescription.PatientId), - FamilyId: fmt.Sprintf("%d", orderPrescription.FamilyId), - PharmacistId: fmt.Sprintf("%d", orderPrescription.PharmacistId), - PrescriptionStatus: orderPrescription.PrescriptionStatus, - PharmacistAuditStatus: orderPrescription.PharmacistAuditStatus, - PharmacistVerifyTime: orderPrescription.PharmacistVerifyTime, - PharmacistFailReason: orderPrescription.PharmacistFailReason, - PlatformAuditStatus: orderPrescription.PlatformAuditStatus, - PlatformFailTime: orderPrescription.PlatformFailTime, - PlatformFailReason: orderPrescription.PlatformFailReason, - IsAutoPharVerify: orderPrescription.IsAutoPharVerify, - DoctorCreatedTime: orderPrescription.DoctorCreatedTime, - ExpiredTime: orderPrescription.ExpiredTime, - IsDelete: orderPrescription.IsDelete, - PrescriptionCode: orderPrescription.PrescriptionCode, - DoctorName: orderPrescription.DoctorName, - PatientName: orderPrescription.PatientName, - PatientSex: orderPrescription.PatientSex, - PatientAge: orderPrescription.PatientAge, - DoctorAdvice: orderPrescription.DoctorAdvice, - CreatedAt: orderPrescription.CreatedAt, - UpdatedAt: orderPrescription.UpdatedAt, - } - return u, nil -} - // GetOrderPrescription 处方详情 -func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int64) (getOrderPrescriptionResponse *orderPrescriptionResponse.GetOrderPrescription, err error) { +func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int64) (g *dto.OrderPrescriptionDto, err error) { orderPrescriptionDao := dao.OrderPrescriptionDao{} orderPrescription, err := orderPrescriptionDao.GetById(OrderPrescriptionId) if orderPrescription == nil { @@ -61,114 +19,57 @@ func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int6 } // 获取处方关联疾病数据 - orderPrescriptionIcds, err := r.GetOrderPrescriptionIcdByOrderPrescriptionId(OrderPrescriptionId) - if err != nil { - return nil, errors.New(err.Error()) - } - - fmt.Println(orderPrescriptionIcds) - // 获取问诊病例 - orderInquiryService := OrderInquiryService{} - orderInquiryCase, err := orderInquiryService.GetOrderInquiryCaseByOrderInquiryId(orderPrescription.OrderInquiryId) - if err != nil { - return nil, errors.New(err.Error()) - } - fmt.Println(orderInquiryCase) - - // 获取处方关联问诊数据 - orderInquiry, err := orderInquiryService.GetOrderInquiryById(orderPrescription.OrderInquiryId) - if err != nil { - return nil, errors.New(err.Error()) - } - fmt.Println(orderInquiry) - - // 获取处方商品数据 - orderPrescriptionProducts, err := r.GetOrderPrescriptionProductByOrderPrescriptionId(OrderPrescriptionId) - if err != nil { - return nil, errors.New(err.Error()) - } - fmt.Println(orderPrescriptionProducts) - - // 获取医生数据 - userDoctorService := UserDoctorService{} - userDoctor, err := userDoctorService.GetUserDoctorById(orderPrescription.DoctorId) - if err != nil { - return nil, errors.New(err.Error()) - } - fmt.Println(userDoctor) - - // 获取药师数据 - - result := &orderPrescriptionResponse.GetOrderPrescription{ - - CreatedAt: model.LocalTime{}, - UpdatedAt: model.LocalTime{}, - } - - return result, nil -} - -// GetOrderPrescriptionIcdByOrderPrescriptionId 获取处方关联疾病数据-处方id -func (r *OrderPrescriptionService) GetOrderPrescriptionIcdByOrderPrescriptionId(OrderPrescriptionId int64) (res *orderPrescriptionIcdResponse.OrderPrescriptionIcd, err error) { orderPrescriptionIcdDao := dao.OrderPrescriptionIcdDao{} - orderPrescriptionIcd, err := orderPrescriptionIcdDao.GetOrderPrescriptionIcdById(OrderPrescriptionId) - if orderPrescriptionIcd == nil { + orderPrescriptionIcds, err := orderPrescriptionIcdDao.GetOrderPrescriptionIcdListByOrderPrescriptionId(OrderPrescriptionId) + if len(orderPrescriptionIcds) <= 0 { return nil, errors.New("处方病例错误") } - result := &orderPrescriptionIcdResponse.OrderPrescriptionIcd{ - PrescriptionIcdId: fmt.Sprintf("%d", orderPrescriptionIcd.PrescriptionIcdId), - OrderPrescriptionId: fmt.Sprintf("%d", orderPrescriptionIcd.OrderPrescriptionId), - IcdId: fmt.Sprintf("%d", orderPrescriptionIcd.IcdId), - IcdName: orderPrescriptionIcd.IcdName, - IcdCode: orderPrescriptionIcd.IcdCode, - CreatedAt: orderPrescriptionIcd.CreatedAt, - UpdatedAt: orderPrescriptionIcd.UpdatedAt, + // 获取问诊病例 + orderInquiryCaseDao := dao.OrderInquiryCaseDao{} + orderInquiryCase, err := orderInquiryCaseDao.GetOrderInquiryCaseByOrderInquiryId(orderPrescription.OrderInquiryId) + if orderInquiryCase == nil { + return nil, errors.New("数据错误,无问诊病例") } - return result, nil -} - -// GetOrderPrescriptionProductByOrderPrescriptionId 获取处方关联商品数据-处方id -func (r *OrderPrescriptionService) GetOrderPrescriptionProductByOrderPrescriptionId(orderPrescriptionId int64) (res []*orderPrescriptionProductResponse.OrderPrescriptionProduct, err error) { + // 获取处方商品数据 orderPrescriptionProductDao := dao.OrderPrescriptionProductDao{} - orderPrescriptionProducts, err := orderPrescriptionProductDao.GetOrderPrescriptionProductListByOrderPrescriptionId(orderPrescriptionId) + orderPrescriptionProducts, err := orderPrescriptionProductDao.GetOrderPrescriptionProductListByOrderPrescriptionId(OrderPrescriptionId) if err != nil { return nil, errors.New("数据错误,无处方药品数据") } - if len(orderPrescriptionProducts) == 0 { - return nil, errors.New("数据错误,无处方药品数据") + // 获取医生数据 + userDoctorDao := dao.UserDoctorDao{} + userDoctor, err := userDoctorDao.GetUserDoctorById(orderPrescription.DoctorId) + if err != nil || userDoctor == nil { + return nil, errors.New("医生数据错误") + } + + // 获取药师数据 + userPharmacistDao := dao.UserPharmacistDao{} + userPharmacist, err := userPharmacistDao.GetUserPharmacistById(orderPrescription.PharmacistId) + if err != nil || userPharmacist == nil { + return nil, errors.New("药师数据错误") } // 处理返回值 - items := make([]*orderPrescriptionProductResponse.OrderPrescriptionProduct, len(orderPrescriptionProducts)) + g = dto.GetOrderPrescriptionDto(orderPrescription) - if len(orderPrescriptionProducts) > 0 { - for i, v := range orderPrescriptionProducts { - // 将原始结构体转换为新结构体 - item := &orderPrescriptionProductResponse.OrderPrescriptionProduct{ - PrescriptionProductId: fmt.Sprintf("%d", v.OrderPrescriptionId), - OrderPrescriptionId: fmt.Sprintf("%d", v.OrderPrescriptionId), - ProductId: fmt.Sprintf("%d", v.ProductId), - UseStatus: v.UseStatus, - PrescriptionProductNum: v.PrescriptionProductNum, - ProductName: v.ProductName, - ProductSpec: v.ProductSpec, - LicenseNumber: v.LicenseNumber, - Manufacturer: v.Manufacturer, - SingleUnit: v.SingleUnit, - SingleUse: v.SingleUse, - PackagingUnit: v.PackagingUnit, - FrequencyUse: v.FrequencyUse, - AvailableDays: v.AvailableDays, - CreatedAt: v.CreatedAt, - UpdatedAt: v.UpdatedAt, - } + // 加载问诊病例 + g.LoadOrderInquiryCase(orderInquiryCase) - // 将转换后的结构体添加到新切片中 - items[i] = item - } - } - return items, nil + // 加载处方关联疾病-字符串 + g.LoadOrderPrescriptionIcdString(orderPrescriptionIcds) + + // 加载医生名称 + g.LoadDoctorName(userDoctor) + + // 加载药师名称 + g.LoadPharmacisName(userPharmacist) + + // 加载处方商品数据 + g.LoadOrderPrescriptionProduct(orderPrescriptionProducts) + + return g, nil } diff --git a/api/service/orderProductItem.go b/api/service/orderProductItem.go index 13db479..668da18 100644 --- a/api/service/orderProductItem.go +++ b/api/service/orderProductItem.go @@ -1,54 +1,4 @@ package service -import ( - "errors" - "hospital-admin-api/api/dao" - "hospital-admin-api/api/responses/orderProductItemResponse" - "hospital-admin-api/utils" - "strconv" -) - type OrderProductItemService struct { } - -// GetOrderProductItemByOrderProductId 获取商品列表-问诊订单id -func (r *OrderProductItemService) GetOrderProductItemByOrderProductId(orderProductId int64) (u []*orderProductItemResponse.OrderProductItem, err error) { - orderProductItemDao := dao.OrderProductItemDao{} - orderProductItems, err := orderProductItemDao.GetOrderProductItemByOrderProductId(orderProductId) - if err != nil { - return nil, errors.New("数据错误,无药品数据") - } - - if len(orderProductItems) == 0 { - return nil, errors.New("数据错误,无药品数据") - } - - // 处理返回值 - items := make([]*orderProductItemResponse.OrderProductItem, len(orderProductItems)) - - if len(orderProductItems) > 0 { - for i, v := range orderProductItems { - // 将原始结构体转换为新结构体 - item := &orderProductItemResponse.OrderProductItem{ - ProductItemId: strconv.Itoa(int(v.ProductItemId)), - OrderProductId: strconv.Itoa(int(v.OrderProductId)), - OrderInquiryId: strconv.Itoa(int(v.OrderInquiryId)), - OrderPrescriptionId: strconv.Itoa(int(v.OrderPrescriptionId)), - ProductId: strconv.Itoa(int(v.ProductId)), - ProductName: v.ProductName, - ProductPrice: v.ProductPrice, - ProductPlatformCode: v.ProductPlatformCode, - Amount: v.Amount, - Manufacturer: v.Manufacturer, - ProductCoverImg: utils.AddOssDomain(v.ProductCoverImg), - ProductSpec: v.ProductSpec, - CreatedAt: v.CreatedAt, - UpdatedAt: v.UpdatedAt, - } - - // 将转换后的结构体添加到新切片中 - items[i] = item - } - } - return items, nil -} diff --git a/api/service/orderProductLogistics.go b/api/service/orderProductLogistics.go index a4a08fd..a685bf1 100644 --- a/api/service/orderProductLogistics.go +++ b/api/service/orderProductLogistics.go @@ -1,33 +1,4 @@ package service -import ( - "fmt" - "hospital-admin-api/api/dao" - "hospital-admin-api/api/responses/orderProductLogisticsResponse" -) - type OrderProductLogisticsService struct { } - -// GetOrderProductLogisticsByOrderProductId 获取物流数据-药品订单id -func (r *OrderProductLogisticsService) GetOrderProductLogisticsByOrderProductId(orderProductId int64) (u *orderProductLogisticsResponse.OrderProductLogistics, err error) { - orderProductLogisticsDao := dao.OrderProductLogisticsDao{} - orderProductLogistics, err := orderProductLogisticsDao.GetOrderProductLogisticsByOrderProductId(orderProductId) - if orderProductLogistics == nil { - return nil, nil - } - - u = &orderProductLogisticsResponse.OrderProductLogistics{ - LogisticsId: fmt.Sprintf("%d", orderProductLogistics.LogisticsId), - OrderProductId: fmt.Sprintf("%d", orderProductLogistics.OrderProductId), - LogisticsStatus: orderProductLogistics.LogisticsStatus, - LogisticsNo: orderProductLogistics.LogisticsNo, - CompanyName: orderProductLogistics.CompanyName, - CompanyCode: orderProductLogistics.CompanyCode, - LogisticsContent: orderProductLogistics.LogisticsContent, - CreatedAt: orderProductLogistics.CreatedAt, - UpdatedAt: orderProductLogistics.UpdatedAt, - } - - return u, nil -} diff --git a/api/service/orderProductRefund.go b/api/service/orderProductRefund.go index 87b5975..34ce66c 100644 --- a/api/service/orderProductRefund.go +++ b/api/service/orderProductRefund.go @@ -1,36 +1,4 @@ package service -import ( - "fmt" - "hospital-admin-api/api/dao" - "hospital-admin-api/api/responses/orderProductRefundResponse" -) - type OrderProductRefundService struct { } - -// GetOrderProductRefundByOrderProductId 获取退款数据 -func (r *OrderProductRefundService) GetOrderProductRefundByOrderProductId(orderProductId int64) (u *orderProductRefundResponse.OrderProductRefund, err error) { - orderProductRefundDao := dao.OrderProductRefundDao{} - orderProductRefund, err := orderProductRefundDao.GetOrderProductRefundByOrderProductId(orderProductId) - if orderProductRefund == nil { - return nil, nil - } - - u = &orderProductRefundResponse.OrderProductRefund{ - ProductRefundId: fmt.Sprintf("%d", orderProductRefund.ProductRefundId), - PatientId: fmt.Sprintf("%d", orderProductRefund.PatientId), - OrderProductId: fmt.Sprintf("%d", orderProductRefund.OrderProductId), - OrderProductNo: orderProductRefund.OrderProductNo, - ProductRefundNo: orderProductRefund.ProductRefundNo, - RefundId: orderProductRefund.RefundId, - ProductRefundStatus: orderProductRefund.ProductRefundStatus, - RefundTotal: orderProductRefund.RefundTotal, - RefundReason: orderProductRefund.RefundReason, - SuccessTime: orderProductRefund.SuccessTime, - CreatedAt: orderProductRefund.CreatedAt, - UpdatedAt: orderProductRefund.UpdatedAt, - } - - return u, nil -} diff --git a/api/service/patientFamily.go b/api/service/patientFamily.go index d43c495..77bad31 100644 --- a/api/service/patientFamily.go +++ b/api/service/patientFamily.go @@ -2,70 +2,13 @@ package service import ( "errors" - "fmt" "hospital-admin-api/api/dao" "hospital-admin-api/api/dto" - "hospital-admin-api/api/responses/patientFamilyResponse" ) type PatientFamilyService struct { } -// GetPatientFamilyListByPatientId 获取患者家庭成员-患者id -func (r *PatientFamilyService) GetPatientFamilyListByPatientId(patientId int64) (u []*patientFamilyResponse.PatientFamily, err error) { - patientFamilyDao := dao.PatientFamilyDao{} - patientFamilys, err := patientFamilyDao.GetPatientFamilyListByPatientId(patientId) - - if len(patientFamilys) == 0 { - return nil, nil - } - - // 处理返回值 - items := make([]*patientFamilyResponse.PatientFamily, len(patientFamilys)) - - if len(patientFamilys) > 0 { - for i, v := range patientFamilys { - // 将原始结构体转换为新结构体 - item := &patientFamilyResponse.PatientFamily{ - FamilyId: fmt.Sprintf("%d", v.FamilyId), - PatientId: fmt.Sprintf("%d", v.PatientId), - Relation: v.Relation, - Status: &v.Status, - IsDefault: &v.IsDefault, - CardName: v.CardName, - CardNameMask: v.CardNameMask, - Mobile: v.Mobile, - MobileMask: v.MobileMask, - Type: &v.Type, - IdNumber: v.IdNumber, - IdNumberMask: v.IdNumberMask, - Sex: &v.Sex, - Age: v.Age, - ProvinceId: fmt.Sprintf("%d", v.ProvinceId), - Province: v.Province, - CityId: fmt.Sprintf("%d", v.CityId), - City: v.City, - CountyId: fmt.Sprintf("%d", v.CountyId), - County: v.County, - Height: v.Height, - Weight: v.Weight, - MaritalStatus: &v.MaritalStatus, - NationId: fmt.Sprintf("%d", v.NationId), - NationName: v.NationName, - JobId: fmt.Sprintf("%d", v.JobId), - JobName: v.JobName, - CreatedAt: v.CreatedAt, - UpdatedAt: v.UpdatedAt, - } - - // 将转换后的结构体添加到新切片中 - items[i] = item - } - } - - return items, nil -} - // GetPatientFamily 家庭成员详情 func (r *PatientFamilyService) GetPatientFamily(familyId int64) (g *dto.PatientFamilyDto, err error) { patientFamilyDao := dao.PatientFamilyDao{} diff --git a/api/service/userShipAddress.go b/api/service/userShipAddress.go index bb5cd81..5577c25 100644 --- a/api/service/userShipAddress.go +++ b/api/service/userShipAddress.go @@ -1,57 +1,4 @@ package service -import ( - "fmt" - "hospital-admin-api/api/dao" - "hospital-admin-api/api/responses/userShipAddressResponse" -) - type UserShipAddressService struct { } - -// GetUserShipAddressByUserId 获取用户收货地址-用户id -func (r *UserShipAddressService) GetUserShipAddressByUserId(userId int64) (u []*userShipAddressResponse.UserShipAddress, err error) { - userShipAddressDao := dao.UserShipAddressDao{} - orderProductLogistics, err := userShipAddressDao.GetUserShipAddressListByOrderUserId(userId) - - if len(orderProductLogistics) == 0 { - return nil, nil - } - - // 处理返回值 - items := make([]*userShipAddressResponse.UserShipAddress, len(orderProductLogistics)) - - if len(orderProductLogistics) > 0 { - for i, v := range orderProductLogistics { - // 将原始结构体转换为新结构体 - item := &userShipAddressResponse.UserShipAddress{ - AddressId: fmt.Sprintf("%d", v.AddressId), - UserId: fmt.Sprintf("%d", v.AddressId), - ProvinceId: fmt.Sprintf("%d", v.AddressId), - Province: v.Province, - CityId: fmt.Sprintf("%d", v.CityId), - City: v.City, - CountyId: fmt.Sprintf("%d", v.CountyId), - County: v.County, - ConsigneeTownId: fmt.Sprintf("%d", v.ConsigneeTownId), - ConsigneeTown: v.ConsigneeTown, - Address: v.Address, - AddressMask: v.AddressMask, - ConsigneeName: v.ConsigneeName, - ConsigneeNameMask: v.ConsigneeNameMask, - ConsigneeTel: v.ConsigneeTel, - ConsigneeTelMask: v.ConsigneeTelMask, - ConsigneeZipCode: v.ConsigneeZipCode, - IsDefault: &v.IsDefault, - Tag: &v.Tag, - CreatedAt: v.CreatedAt, - UpdatedAt: v.UpdatedAt, - } - - // 将转换后的结构体添加到新切片中 - items[i] = item - } - } - - return items, nil -}