新增获取处方列表-分页
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
package orderPrescriptionResponse
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/utils"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type OrderPrescription struct {
|
||||
@@ -32,3 +35,101 @@ type OrderPrescription struct {
|
||||
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"` // 修改时间
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ func GetUserPatientResponse(patientFamilys []*model.PatientFamily) []*GetUserPat
|
||||
item := &GetUserPatient{
|
||||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
Relation: &v.Relation,
|
||||
Relation: v.Relation,
|
||||
Status: &v.Status,
|
||||
IsDefault: &v.IsDefault,
|
||||
CardNameMask: v.CardNameMask,
|
||||
@@ -137,12 +137,11 @@ func GetPatientFamilyPageResponse(patientFamily []*model.PatientFamily) []getPat
|
||||
|
||||
if len(patientFamily) > 0 {
|
||||
for i, v := range patientFamily {
|
||||
// 将原始结构体转换为新结构体
|
||||
// 将原始结构体转换为新结构体
|
||||
patientFamilyResponse := getPatientFamilyPage{
|
||||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
Relation: &v.Relation,
|
||||
Relation: v.Relation,
|
||||
Status: &v.Status,
|
||||
CardName: v.CardName,
|
||||
MobileMask: utils.MaskPhoneStr(v.UserPatient.User.Mobile),
|
||||
|
||||
Reference in New Issue
Block a user