修正返回目录,新增处方详情。删除原response目录
This commit is contained in:
+121
-29
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user