Merge branch 'dev'
This commit is contained in:
commit
f6e50fb04e
@ -499,6 +499,54 @@ func (r *Export) OrderProduct(c *gin.Context) {
|
||||
responses.OkWithData(ossAddress, c)
|
||||
}
|
||||
|
||||
// OrderPrescription 抄方的处方
|
||||
func (r *Export) OrderTransferPrescription(c *gin.Context) {
|
||||
orderPrescriptionRequest := requests.OrderPrescriptionRequest{}
|
||||
req := orderPrescriptionRequest.OrderPrescriptionExportList
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(req); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
orderPrescriptionDao := dao.OrderPrescriptionDao{}
|
||||
orderPrescriptions, err := orderPrescriptionDao.GetOrderTransferPrescriptionExportListSearch(req)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 业务处理
|
||||
exportService := service.ExportService{}
|
||||
ossAddress, err := exportService.OrderPrescription(orderPrescriptions)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取当前登陆用户id
|
||||
userId := c.GetInt64("UserId")
|
||||
if userId != 0 {
|
||||
// 记录日志
|
||||
logExport := &model.LogExport{
|
||||
AdminUserId: userId,
|
||||
ExportModule: "处方",
|
||||
ExportFile: utils.RemoveOssDomain(ossAddress),
|
||||
}
|
||||
|
||||
logExportDao := dao.LogExportDao{}
|
||||
_, _ = logExportDao.AddLogExportUnTransaction(logExport)
|
||||
}
|
||||
|
||||
responses.OkWithData(ossAddress, c)
|
||||
}
|
||||
|
||||
// OrderPrescription 处方
|
||||
func (r *Export) OrderPrescription(c *gin.Context) {
|
||||
orderPrescriptionRequest := requests.OrderPrescriptionRequest{}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/requests"
|
||||
@ -10,6 +9,8 @@ import (
|
||||
"hospital-admin-api/global"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type OrderPrescription struct{}
|
||||
@ -55,6 +56,47 @@ func (r *OrderPrescription) GetOrderPrescriptionPage(c *gin.Context) {
|
||||
responses.OkWithData(result, c)
|
||||
}
|
||||
|
||||
// GetOrderPrescriptionTransferPage 获取抄方的处方列表-分页
|
||||
func (r *OrderPrescription) GetOrderPrescriptionTransferPage(c *gin.Context) {
|
||||
orderPrescriptionRequest := requests.OrderPrescriptionRequest{}
|
||||
req := orderPrescriptionRequest.GetOrderPrescriptionPage
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(req); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
if req.Page == 0 {
|
||||
req.Page = 1
|
||||
}
|
||||
|
||||
if req.PageSize == 0 {
|
||||
req.PageSize = 20
|
||||
}
|
||||
|
||||
orderPrescriptionDao := dao.OrderPrescriptionDao{}
|
||||
orderPrescription, total, err := orderPrescriptionDao.GetOrderPrescriptionTransferPageSearch(req, req.Page, req.PageSize)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
GetOrderPrescriptionPage := dto.GetOrderPrescriptionListDto(orderPrescription)
|
||||
|
||||
result := make(map[string]interface{})
|
||||
result["page"] = req.Page
|
||||
result["page_size"] = req.PageSize
|
||||
result["total"] = total
|
||||
result["data"] = GetOrderPrescriptionPage
|
||||
responses.OkWithData(result, c)
|
||||
}
|
||||
|
||||
// GetOrderPrescription 处方详情
|
||||
func (r *OrderPrescription) GetOrderPrescription(c *gin.Context) {
|
||||
id := c.Param("order_prescription_id")
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/requests"
|
||||
@ -10,6 +9,8 @@ import (
|
||||
"hospital-admin-api/global"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type OrderProduct struct{}
|
||||
|
||||
@ -49,7 +49,8 @@ func (r *UserDoctor) GetUserDoctorPage(c *gin.Context) {
|
||||
if systemConfig.IsAnnualReview == 1 {
|
||||
// 后台用户id
|
||||
adminUserId := c.GetInt64("UserId")
|
||||
if adminUserId == 1845704393354121216 {
|
||||
// 正式lixiumei user_id 测试 lixiumei user_id
|
||||
if adminUserId == 1845704393354121216 || adminUserId == 1732273543535661056 {
|
||||
status := 1
|
||||
req.GetUserDoctorPage.MultiPointStatus = &status
|
||||
}
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/global"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type DoctorInquiryConfigDao struct {
|
||||
@ -39,6 +40,7 @@ func (r *DoctorInquiryConfigDao) DeleteDoctorInquiryConfig(tx *gorm.DB, maps int
|
||||
|
||||
// EditDoctorInquiryConfigById 修改医生问诊配置-问诊配置id
|
||||
func (r *DoctorInquiryConfigDao) EditDoctorInquiryConfigById(tx *gorm.DB, inquiryConfigId int64, data interface{}) error {
|
||||
// 使用Debug()打印执行的SQL
|
||||
err := tx.Model(&model.DoctorInquiryConfig{}).Where("inquiry_config_id = ?", inquiryConfigId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@ -2,12 +2,13 @@ package dao
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/global"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type OrderPrescriptionDao struct {
|
||||
@ -15,7 +16,18 @@ type OrderPrescriptionDao struct {
|
||||
|
||||
// GetById 获取处方-处方id
|
||||
func (r *OrderPrescriptionDao) GetById(orderPrescriptionId int64) (m *model.OrderPrescription, err error) {
|
||||
err = global.Db.First(&m, orderPrescriptionId).Error
|
||||
query := global.Db.Model(&model.OrderPrescription{})
|
||||
|
||||
// 处方关联问诊表(抄方用)
|
||||
query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "doctor_id")
|
||||
}).Preload("TransferUserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "doctor_id")
|
||||
})
|
||||
})
|
||||
|
||||
err = query.First(&m, orderPrescriptionId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -100,6 +112,15 @@ func (r *OrderPrescriptionDao) GetOrderPrescriptionPageSearch(req requests.GetOr
|
||||
// 处方关联疾病表
|
||||
query = query.Preload("OrderPrescriptionIcd")
|
||||
|
||||
// 处方关联问诊表(抄方用)
|
||||
query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "doctor_id")
|
||||
}).Preload("TransferUserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "doctor_id")
|
||||
})
|
||||
})
|
||||
|
||||
// 患者家庭成员表
|
||||
query = query.Preload("PatientFamily")
|
||||
|
||||
@ -166,7 +187,7 @@ func (r *OrderPrescriptionDao) GetOrderPrescriptionPageSearch(req requests.GetOr
|
||||
|
||||
// 药品订单编号
|
||||
if req.OrderProductNo != "" {
|
||||
subQuery := global.Db.Model(&model.OrderInquiry{}).
|
||||
subQuery := global.Db.Model(&model.OrderProduct{}).
|
||||
Select("order_prescription_id").
|
||||
Where("order_product_no = ?", req.OrderProductNo)
|
||||
query = query.Where("order_prescription_id IN (?)", subQuery)
|
||||
@ -233,6 +254,391 @@ func (r *OrderPrescriptionDao) GetOrderPrescriptionPageSearch(req requests.GetOr
|
||||
return m, totalRecords, nil
|
||||
}
|
||||
|
||||
// GetOrderPrescriptionTransferPageSearch 获取抄方的处方列表-分页
|
||||
func (r *OrderPrescriptionDao) GetOrderPrescriptionTransferPageSearch(req requests.GetOrderPrescriptionPage, page, pageSize int) (m []*model.OrderPrescription, total int64, err error) {
|
||||
var totalRecords int64
|
||||
prescriptionTable := (&model.OrderPrescription{}).TableName()
|
||||
inquiryTable := (&model.OrderInquiry{}).TableName()
|
||||
doctorTable := (&model.UserDoctor{}).TableName()
|
||||
userTable := (&model.User{}).TableName()
|
||||
|
||||
// 构建查询条件
|
||||
query := global.Db.Model(&model.OrderPrescription{})
|
||||
|
||||
// 关联问诊表,只查询TransferDoctorId不等于null的记录
|
||||
query = query.Joins("INNER JOIN " + inquiryTable + " ON " + prescriptionTable + ".order_inquiry_id = " + inquiryTable + ".order_inquiry_id").
|
||||
Where(inquiryTable + ".transfer_doctor_id IS NOT NULL")
|
||||
|
||||
// 关联抄方医生表
|
||||
query = query.Joins("LEFT JOIN " + doctorTable + " ON " + inquiryTable + ".doctor_id = " + doctorTable + ".doctor_id")
|
||||
|
||||
// 关联抄方医生对应的用户表(用于按用户姓名查询)
|
||||
query = query.Joins("LEFT JOIN " + userTable + " ON " + doctorTable + ".user_id = " + userTable + ".user_id")
|
||||
|
||||
// 患者表
|
||||
query = query.Preload("UserPatient", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||
})
|
||||
|
||||
// 用户表
|
||||
query = query.Preload("UserPatient.User", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Omit("user_password", "salt")
|
||||
})
|
||||
|
||||
// 药师表
|
||||
query = query.Preload("UserPharmacist", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||
})
|
||||
|
||||
// 处方关联疾病表
|
||||
query = query.Preload("OrderPrescriptionIcd")
|
||||
|
||||
// 处方关联问诊表(抄方用)
|
||||
query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "doctor_id")
|
||||
}).Preload("TransferUserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "doctor_id")
|
||||
})
|
||||
})
|
||||
|
||||
// 患者家庭成员表
|
||||
query = query.Preload("PatientFamily")
|
||||
|
||||
// 处方编号
|
||||
if req.PrescriptionCode != "" {
|
||||
query = query.Where(prescriptionTable+".prescription_code = ?", req.PrescriptionCode)
|
||||
}
|
||||
|
||||
// 医生名称 - 查询抄方医生名称
|
||||
if req.DoctorName != "" {
|
||||
query = query.Where(userTable+".user_name LIKE ?", "%"+req.DoctorName+"%")
|
||||
}
|
||||
|
||||
// 患者姓名-就诊人
|
||||
if req.PatientName != "" {
|
||||
query = query.Where(prescriptionTable+".patient_name LIKE ?", "%"+req.PatientName+"%")
|
||||
}
|
||||
|
||||
// 手机号-医生/患者/就诊人(医生部分改为抄方医生)
|
||||
if req.Mobile != "" {
|
||||
// 就诊人
|
||||
patientFamilySubQuery := global.Db.Model(&model.PatientFamily{}).
|
||||
Select("family_id").
|
||||
Where("mobile = ?", req.Mobile)
|
||||
|
||||
// 患者
|
||||
patientUserSubQuery := global.Db.Model(&model.User{}).
|
||||
Select("user_id").
|
||||
Where("mobile = ?", req.Mobile)
|
||||
|
||||
patientSubQuery := global.Db.Model(&model.UserPatient{}).
|
||||
Select("patient_id").
|
||||
Where(gorm.Expr("user_id IN (?)", patientUserSubQuery))
|
||||
|
||||
// 抄方医生:通过手机号找到 user_id -> doctor_id(抄方医生)
|
||||
transferDoctorUserSubQuery := global.Db.Model(&model.User{}).
|
||||
Select("user_id").
|
||||
Where("mobile = ?", req.Mobile)
|
||||
|
||||
transferDoctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
Select("doctor_id").
|
||||
Where(gorm.Expr("user_id IN (?)", transferDoctorUserSubQuery))
|
||||
|
||||
// 使用 OR 条件:患者匹配 OR 抄方医生匹配 OR 就诊人匹配(整体加括号)
|
||||
query = query.Where(
|
||||
gorm.Expr("("+prescriptionTable+".patient_id IN (?) OR "+inquiryTable+".doctor_id IN (?) OR "+prescriptionTable+".family_id IN (?))",
|
||||
patientSubQuery, transferDoctorSubQuery, patientFamilySubQuery),
|
||||
)
|
||||
}
|
||||
|
||||
// 处方状态
|
||||
if req.PrescriptionStatus != nil {
|
||||
query = query.Where(prescriptionTable+".prescription_status = ?", req.PrescriptionStatus)
|
||||
}
|
||||
|
||||
// 药师审核状态
|
||||
if req.PharmacistAuditStatus != nil {
|
||||
query = query.Where(prescriptionTable+".pharmacist_audit_status = ?", req.PharmacistAuditStatus)
|
||||
}
|
||||
|
||||
// 问诊订单编号
|
||||
if req.InquiryNo != "" {
|
||||
subQuery := global.Db.Model(&model.OrderInquiry{}).
|
||||
Select("order_inquiry_id").
|
||||
Where("inquiry_no = ?", req.InquiryNo)
|
||||
query = query.Where(prescriptionTable+".order_inquiry_id IN (?)", subQuery)
|
||||
}
|
||||
|
||||
// 药品订单编号
|
||||
if req.OrderProductNo != "" {
|
||||
subQuery := global.Db.Model(&model.OrderProduct{}).
|
||||
Select("order_prescription_id").
|
||||
Where("order_product_no = ?", req.OrderProductNo)
|
||||
query = query.Where(prescriptionTable+".order_prescription_id IN (?)", subQuery)
|
||||
}
|
||||
|
||||
// 药师审核时间
|
||||
if req.PharmacistVerifyTime != "" {
|
||||
pharmacistVerifyTime := strings.Split(req.PharmacistVerifyTime, "&")
|
||||
if len(pharmacistVerifyTime) == 2 {
|
||||
startTime, _ := time.Parse("2006-01-02", pharmacistVerifyTime[0])
|
||||
endTime, _ := time.Parse("2006-01-02", pharmacistVerifyTime[1])
|
||||
|
||||
if startTime == endTime {
|
||||
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||
}
|
||||
|
||||
query = query.Where(prescriptionTable+".pharmacist_verify_time BETWEEN ? AND ?", startTime, endTime)
|
||||
}
|
||||
}
|
||||
|
||||
// 医生开具处方时间
|
||||
if req.DoctorCreatedTime != "" {
|
||||
doctorCreatedTime := strings.Split(req.DoctorCreatedTime, "&")
|
||||
if len(doctorCreatedTime) == 2 {
|
||||
startTime, _ := time.Parse("2006-01-02", doctorCreatedTime[0])
|
||||
endTime, _ := time.Parse("2006-01-02", doctorCreatedTime[1])
|
||||
|
||||
if startTime == endTime {
|
||||
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||
}
|
||||
|
||||
query = query.Where(prescriptionTable+".doctor_created_time BETWEEN ? AND ?", startTime, endTime)
|
||||
}
|
||||
}
|
||||
|
||||
// 处方过期时间
|
||||
if req.ExpiredTime != "" {
|
||||
expiredTime := strings.Split(req.ExpiredTime, "&")
|
||||
if len(expiredTime) == 2 {
|
||||
startTime, _ := time.Parse("2006-01-02", expiredTime[0])
|
||||
endTime, _ := time.Parse("2006-01-02", expiredTime[1])
|
||||
|
||||
if startTime == endTime {
|
||||
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||
}
|
||||
|
||||
query = query.Where(prescriptionTable+".expired_time BETWEEN ? AND ?", startTime, endTime)
|
||||
}
|
||||
}
|
||||
|
||||
// 排序
|
||||
query = query.Order(prescriptionTable + ".created_at desc")
|
||||
|
||||
// 查询总数量
|
||||
if err := query.Count(&totalRecords).Error; err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
err = query.Scopes(model.Paginate(page, pageSize)).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
return m, totalRecords, nil
|
||||
}
|
||||
|
||||
// GetOrderPrescriptionExportListSearch 获取抄方的处方列表-导出
|
||||
func (r *OrderPrescriptionDao) GetOrderTransferPrescriptionExportListSearch(req requests.OrderPrescriptionExportList) (m []*model.OrderPrescription, err error) {
|
||||
|
||||
prescriptionTable := (&model.OrderPrescription{}).TableName()
|
||||
inquiryTable := (&model.OrderInquiry{}).TableName()
|
||||
userTable := (&model.User{}).TableName()
|
||||
doctorTable := (&model.UserDoctor{}).TableName()
|
||||
|
||||
// 构建查询条件
|
||||
query := global.Db.Model(&model.OrderPrescription{})
|
||||
|
||||
// 关联问诊表,只查询TransferDoctorId不等于null的记录
|
||||
query = query.Joins("INNER JOIN " + inquiryTable + " ON " + prescriptionTable + ".order_inquiry_id = " + inquiryTable + ".order_inquiry_id").
|
||||
Where(inquiryTable + ".transfer_doctor_id IS NOT NULL")
|
||||
|
||||
// 关联抄方医生表
|
||||
query = query.Joins("LEFT JOIN " + doctorTable + " ON " + inquiryTable + ".doctor_id = " + doctorTable + ".doctor_id")
|
||||
|
||||
// 关联抄方医生对应的用户表(用于按用户姓名查询)
|
||||
query = query.Joins("LEFT JOIN " + userTable + " ON " + doctorTable + ".user_id = " + userTable + ".user_id")
|
||||
|
||||
// 患者表
|
||||
query = query.Preload("UserPatient", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||
})
|
||||
|
||||
// 用户表
|
||||
query = query.Preload("UserPatient.User", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Omit("user_password", "salt")
|
||||
})
|
||||
|
||||
// 医生表
|
||||
query = query.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||
})
|
||||
|
||||
// 药师表
|
||||
query = query.Preload("UserPharmacist", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||
})
|
||||
|
||||
// 处方关联疾病表
|
||||
query = query.Preload("OrderPrescriptionIcd")
|
||||
|
||||
// 处方关联问诊表(抄方用)
|
||||
query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "doctor_id")
|
||||
})
|
||||
})
|
||||
|
||||
// 患者家庭成员表
|
||||
query = query.Preload("PatientFamily")
|
||||
|
||||
// 当前搜索数据
|
||||
if req.Type == 1 {
|
||||
// 处方编号
|
||||
if req.PrescriptionCode != "" {
|
||||
query = query.Where("prescription_code = ?", req.PrescriptionCode)
|
||||
}
|
||||
|
||||
// // 医生名称
|
||||
// if req.DoctorName != "" {
|
||||
// query = query.Where("doctor_name LIKE ?", "%"+req.DoctorName+"%")
|
||||
// }
|
||||
// 医生名称 - 查询抄方医生名称
|
||||
if req.DoctorName != "" {
|
||||
query = query.Where(userTable+".user_name LIKE ?", "%"+req.DoctorName+"%")
|
||||
}
|
||||
|
||||
// 患者姓名-就诊人
|
||||
if req.PatientName != "" {
|
||||
query = query.Where("patient_name LIKE ?", "%"+req.PatientName+"%")
|
||||
}
|
||||
|
||||
// 手机号-医生/患者/就诊人(医生部分改为抄方医生)
|
||||
if req.Mobile != "" {
|
||||
// 就诊人
|
||||
patientFamilySubQuery := global.Db.Model(&model.PatientFamily{}).
|
||||
Select("family_id").
|
||||
Where("mobile = ?", req.Mobile)
|
||||
|
||||
// 患者
|
||||
patientUserSubQuery := global.Db.Model(&model.User{}).
|
||||
Select("user_id").
|
||||
Where("mobile = ?", req.Mobile)
|
||||
|
||||
patientSubQuery := global.Db.Model(&model.UserPatient{}).
|
||||
Select("patient_id").
|
||||
Where(gorm.Expr("user_id IN (?)", patientUserSubQuery))
|
||||
|
||||
// 抄方医生:通过手机号找到 user_id -> doctor_id(抄方医生)
|
||||
transferDoctorUserSubQuery := global.Db.Model(&model.User{}).
|
||||
Select("user_id").
|
||||
Where("mobile = ?", req.Mobile)
|
||||
|
||||
transferDoctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
Select("doctor_id").
|
||||
Where(gorm.Expr("user_id IN (?)", transferDoctorUserSubQuery))
|
||||
|
||||
// 使用 OR 条件:患者匹配 OR 抄方医生匹配 OR 就诊人匹配(整体加括号)
|
||||
query = query.Where(
|
||||
gorm.Expr("("+prescriptionTable+".patient_id IN (?) OR "+inquiryTable+".doctor_id IN (?) OR "+prescriptionTable+".family_id IN (?))",
|
||||
patientSubQuery, transferDoctorSubQuery, patientFamilySubQuery),
|
||||
)
|
||||
}
|
||||
|
||||
// 处方状态
|
||||
if req.PrescriptionStatus != nil {
|
||||
query = query.Where("prescription_status = ?", req.PrescriptionStatus)
|
||||
}
|
||||
|
||||
// 药师审核状态
|
||||
if req.PharmacistAuditStatus != nil {
|
||||
query = query.Where("pharmacist_audit_status = ?", req.PharmacistAuditStatus)
|
||||
}
|
||||
|
||||
// 问诊订单编号
|
||||
if req.InquiryNo != "" {
|
||||
subQuery := global.Db.Model(&model.OrderInquiry{}).
|
||||
Select("order_inquiry_id").
|
||||
Where("inquiry_no = ?", req.InquiryNo)
|
||||
query = query.Where("order_inquiry_id IN (?)", subQuery)
|
||||
}
|
||||
|
||||
// 药品订单编号
|
||||
if req.OrderProductNo != "" {
|
||||
subQuery := global.Db.Model(&model.OrderProduct{}).
|
||||
Select("order_prescription_id").
|
||||
Where("order_product_no = ?", req.OrderProductNo)
|
||||
query = query.Where("order_prescription_id IN (?)", subQuery)
|
||||
}
|
||||
|
||||
// 药师审核时间
|
||||
if req.PharmacistVerifyTime != "" {
|
||||
pharmacistVerifyTime := strings.Split(req.PharmacistVerifyTime, "&")
|
||||
if len(pharmacistVerifyTime) == 2 {
|
||||
startTime, _ := time.Parse("2006-01-02", pharmacistVerifyTime[0])
|
||||
endTime, _ := time.Parse("2006-01-02", pharmacistVerifyTime[1])
|
||||
|
||||
if startTime == endTime {
|
||||
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||
}
|
||||
|
||||
query = query.Where("pharmacist_verify_time BETWEEN ? AND ?", startTime, endTime)
|
||||
}
|
||||
}
|
||||
|
||||
// 医生开具处方时间
|
||||
if req.DoctorCreatedTime != "" {
|
||||
doctorCreatedTime := strings.Split(req.DoctorCreatedTime, "&")
|
||||
if len(doctorCreatedTime) == 2 {
|
||||
startTime, _ := time.Parse("2006-01-02", doctorCreatedTime[0])
|
||||
endTime, _ := time.Parse("2006-01-02", doctorCreatedTime[1])
|
||||
|
||||
if startTime == endTime {
|
||||
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||
}
|
||||
|
||||
query = query.Where("doctor_created_time BETWEEN ? AND ?", startTime, endTime)
|
||||
}
|
||||
}
|
||||
|
||||
// 处方过期时间
|
||||
if req.ExpiredTime != "" {
|
||||
expiredTime := strings.Split(req.ExpiredTime, "&")
|
||||
if len(expiredTime) == 2 {
|
||||
startTime, _ := time.Parse("2006-01-02", expiredTime[0])
|
||||
endTime, _ := time.Parse("2006-01-02", expiredTime[1])
|
||||
|
||||
if startTime == endTime {
|
||||
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||
}
|
||||
|
||||
query = query.Where("expired_time BETWEEN ? AND ?", startTime, endTime)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 当前选中数据
|
||||
if req.Type == 2 {
|
||||
if req.Id == "" {
|
||||
return nil, errors.New("未提供需导出数据编号")
|
||||
}
|
||||
|
||||
id := strings.Split(req.Id, ",")
|
||||
query = query.Where("order_prescription_id IN (?)", id)
|
||||
}
|
||||
|
||||
// 排序
|
||||
query = query.Order("created_at desc")
|
||||
|
||||
err = query.Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetOrderPrescriptionExportListSearch 获取处方列表-导出
|
||||
func (r *OrderPrescriptionDao) GetOrderPrescriptionExportListSearch(req requests.OrderPrescriptionExportList) (m []*model.OrderPrescription, err error) {
|
||||
// 构建查询条件
|
||||
@ -329,7 +735,7 @@ func (r *OrderPrescriptionDao) GetOrderPrescriptionExportListSearch(req requests
|
||||
|
||||
// 药品订单编号
|
||||
if req.OrderProductNo != "" {
|
||||
subQuery := global.Db.Model(&model.OrderInquiry{}).
|
||||
subQuery := global.Db.Model(&model.OrderProduct{}).
|
||||
Select("order_prescription_id").
|
||||
Where("order_product_no = ?", req.OrderProductNo)
|
||||
query = query.Where("order_prescription_id IN (?)", subQuery)
|
||||
|
||||
@ -2,13 +2,14 @@ package dao
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/global"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
type OrderProductDao struct {
|
||||
@ -25,7 +26,21 @@ func (r *OrderProductDao) GetOrderProductById(orderProductId int64) (m *model.Or
|
||||
|
||||
// GetOrderProductPreloadById 获取药品订单数据-加载全部关联-药品订单id
|
||||
func (r *OrderProductDao) GetOrderProductPreloadById(orderProductId int64) (m *model.OrderProduct, err error) {
|
||||
err = global.Db.Preload(clause.Associations).First(&m, orderProductId).Error
|
||||
query := global.Db.Model(&model.OrderProduct{})
|
||||
|
||||
// 预加载所有关联
|
||||
query = query.Preload(clause.Associations)
|
||||
|
||||
// 处方关联问诊表(抄方用)
|
||||
query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "doctor_id")
|
||||
}).Preload("TransferUserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "doctor_id")
|
||||
})
|
||||
})
|
||||
|
||||
err = query.First(&m, orderProductId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -116,13 +131,30 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
||||
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||
})
|
||||
|
||||
// 医生姓名
|
||||
// 医生姓名 - 同时查询原医生和抄方医生
|
||||
if req.DoctorName != "" {
|
||||
subQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
// 原医生查询条件
|
||||
originalDoctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
Select("doctor_id").
|
||||
Where("user_name LIKE ?", "%"+req.DoctorName+"%")
|
||||
|
||||
query = query.Where(gorm.Expr("doctor_id IN (?)", subQuery))
|
||||
// 抄方医生查询条件
|
||||
transferDoctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
Select("doctor_id").
|
||||
Where("user_name LIKE ?", "%"+req.DoctorName+"%")
|
||||
|
||||
// 查询抄方医生对应的问诊订单ID
|
||||
inquirySubQuery := global.Db.Model(&model.OrderInquiry{}).
|
||||
Select("order_inquiry_id").
|
||||
Where(gorm.Expr("doctor_id IN (?)", transferDoctorSubQuery))
|
||||
|
||||
// 使用 OR 条件:原医生匹配 OR 抄方医生匹配
|
||||
// 通过嵌套 Where 子查询把 OR 条件包在一组括号里,避免影响其它条件
|
||||
orCond := global.Db.
|
||||
Where(gorm.Expr("doctor_id IN (?)", originalDoctorSubQuery)).
|
||||
Or(gorm.Expr("order_inquiry_id IN (?)", inquirySubQuery))
|
||||
|
||||
query = query.Where(orCond)
|
||||
}
|
||||
|
||||
// 处方
|
||||
@ -132,7 +164,11 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
||||
|
||||
// 问诊订单
|
||||
query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("order_inquiry_id", "patient_name_mask", "patient_sex", "patient_age")
|
||||
return db.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "doctor_id")
|
||||
}).Preload("TransferUserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "doctor_id")
|
||||
})
|
||||
})
|
||||
|
||||
// 患者名称
|
||||
@ -172,6 +208,16 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
||||
query = query.Where("order_product_id IN (?)", subQuery)
|
||||
}
|
||||
|
||||
// 处方编号
|
||||
if req.PrescriptionCode != "" {
|
||||
// 处方编号存在于处方表中,这里通过处方表查询出对应的处方ID,再反查商品订单
|
||||
subQuery := global.Db.Model(&model.OrderPrescription{}).
|
||||
Select("order_prescription_id").
|
||||
Where("prescription_code = ?", req.PrescriptionCode)
|
||||
|
||||
query = query.Where("order_prescription_id IN (?)", subQuery)
|
||||
}
|
||||
|
||||
// 订单编号
|
||||
if req.OrderProductNo != "" {
|
||||
query = query.Where("order_product_no = ?", req.OrderProductNo)
|
||||
@ -302,7 +348,7 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
||||
query = query.Where("consignee_tel LIKE ?", "%"+req.ConsigneeTel+"%")
|
||||
}
|
||||
|
||||
// 手机号-医生/患者
|
||||
// 手机号-医生/患者 - 同时查询原医生和抄方医生
|
||||
if req.Mobile != "" {
|
||||
// 患者
|
||||
patientUserSubQuery := global.Db.Model(&model.User{}).
|
||||
@ -313,16 +359,37 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
||||
Select("patient_id").
|
||||
Where(gorm.Expr("user_id IN (?)", patientUserSubQuery))
|
||||
|
||||
// 医生
|
||||
// 原医生
|
||||
doctorUserSubQuery := global.Db.Model(&model.User{}).
|
||||
Select("user_id").
|
||||
Where("mobile = ?", req.Mobile)
|
||||
|
||||
doctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
originalDoctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
Select("doctor_id").
|
||||
Where(gorm.Expr("user_id IN (?)", doctorUserSubQuery))
|
||||
|
||||
query = query.Where("patient_id IN (?)", patientSubQuery).Or("doctor_id IN (?)", doctorSubQuery)
|
||||
// 抄方医生
|
||||
transferDoctorUserSubQuery := global.Db.Model(&model.User{}).
|
||||
Select("user_id").
|
||||
Where("mobile = ?", req.Mobile)
|
||||
|
||||
transferDoctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
Select("doctor_id").
|
||||
Where(gorm.Expr("user_id IN (?)", transferDoctorUserSubQuery))
|
||||
|
||||
// 查询抄方医生对应的问诊订单ID
|
||||
inquirySubQuery := global.Db.Model(&model.OrderInquiry{}).
|
||||
Select("order_inquiry_id").
|
||||
Where(gorm.Expr("doctor_id IN (?)", transferDoctorSubQuery))
|
||||
|
||||
// 使用 OR 条件:患者匹配 OR 原医生匹配 OR 抄方医生匹配
|
||||
// 通过嵌套 Where 子查询把 OR 条件包在一组括号里,避免影响其它条件
|
||||
orCond := global.Db.
|
||||
Where("patient_id IN (?)", patientSubQuery).
|
||||
Or("doctor_id IN (?)", originalDoctorSubQuery).
|
||||
Or(gorm.Expr("order_inquiry_id IN (?)", inquirySubQuery))
|
||||
|
||||
query = query.Where(orCond)
|
||||
}
|
||||
|
||||
// 排序
|
||||
@ -359,11 +426,20 @@ func (r *OrderProductDao) GetOrderProductExportListSearch(req requests.OrderProd
|
||||
return db.Select("order_prescription_id", "prescription_code")
|
||||
})
|
||||
|
||||
// 问诊订单
|
||||
// query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
|
||||
// return db.Select("order_inquiry_id", "patient_name", "patient_name_mask", "patient_sex", "patient_age")
|
||||
// })
|
||||
// 问诊订单
|
||||
query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("order_inquiry_id", "patient_name", "patient_name_mask", "patient_sex", "patient_age")
|
||||
return db.Preload("UserDoctor.User", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "mobile")
|
||||
}).Preload("TransferUserDoctor.User", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "mobile")
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// 患者
|
||||
query = query.Preload("UserPatient.User", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("user_id", "user_name", "mobile")
|
||||
@ -377,13 +453,30 @@ func (r *OrderProductDao) GetOrderProductExportListSearch(req requests.OrderProd
|
||||
|
||||
// 当前搜索数据
|
||||
if req.Type == 1 {
|
||||
// 医生姓名
|
||||
// 医生姓名 - 同时查询原医生和抄方医生
|
||||
if req.DoctorName != "" {
|
||||
subQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
// 原医生查询条件
|
||||
originalDoctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
Select("doctor_id").
|
||||
Where("user_name LIKE ?", "%"+req.DoctorName+"%")
|
||||
|
||||
query = query.Where(gorm.Expr("doctor_id IN (?)", subQuery))
|
||||
// 抄方医生查询条件
|
||||
transferDoctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
Select("doctor_id").
|
||||
Where("user_name LIKE ?", "%"+req.DoctorName+"%")
|
||||
|
||||
// 查询抄方医生对应的问诊订单ID
|
||||
inquirySubQuery := global.Db.Model(&model.OrderInquiry{}).
|
||||
Select("order_inquiry_id").
|
||||
Where(gorm.Expr("doctor_id IN (?)", transferDoctorSubQuery))
|
||||
|
||||
// 使用 OR 条件:原医生匹配 OR 抄方医生匹配
|
||||
// 通过嵌套 Where 子查询把 OR 条件包在一组括号里,避免影响其它条件
|
||||
orCond := global.Db.
|
||||
Where(gorm.Expr("doctor_id IN (?)", originalDoctorSubQuery)).
|
||||
Or(gorm.Expr("order_inquiry_id IN (?)", inquirySubQuery))
|
||||
|
||||
query = query.Where(orCond)
|
||||
}
|
||||
|
||||
// 患者姓名-就诊人
|
||||
|
||||
@ -8,6 +8,7 @@ type Login struct {
|
||||
NickName string `json:"nick_name"` // 昵称
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
Token string `json:"token"` // 用户名
|
||||
RoleName string `json:"role_name"` // 角色名
|
||||
}
|
||||
|
||||
// GetLoginFullAvatar 返回带有指定字符串的头像路径
|
||||
|
||||
@ -11,6 +11,7 @@ type OrderInquiryDto struct {
|
||||
UserId string `json:"user_id"` // 用户id-患者
|
||||
PatientId string `json:"patient_id"` // 患者id
|
||||
DoctorId string `json:"doctor_id"` // 医生id(未分配时为null)
|
||||
TransferDoctorId string `json:"transfer_doctor_id"` // 接受抄方的医生id
|
||||
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:会员)
|
||||
@ -61,11 +62,17 @@ func GetOrderInquiryDto(m *model.OrderInquiry) *OrderInquiryDto {
|
||||
doctorId = fmt.Sprintf("%v", m.DoctorId)
|
||||
}
|
||||
|
||||
var transferDoctorId string
|
||||
if m.TransferDoctorId != 0 {
|
||||
transferDoctorId = fmt.Sprintf("%v", m.TransferDoctorId)
|
||||
}
|
||||
|
||||
return &OrderInquiryDto{
|
||||
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
||||
OrderId: fmt.Sprintf("%d", m.OrderId),
|
||||
UserId: fmt.Sprintf("%d", m.UserId),
|
||||
DoctorId: doctorId,
|
||||
TransferDoctorId: transferDoctorId,
|
||||
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||||
FamilyId: fmt.Sprintf("%d", m.FamilyId),
|
||||
InquiryType: m.InquiryType,
|
||||
@ -113,6 +120,7 @@ func GetOrderInquiryListDto(m []*model.OrderInquiry) []*OrderInquiryDto {
|
||||
UserId: fmt.Sprintf("%d", v.UserId),
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||
TransferDoctorId: fmt.Sprintf("%d", v.TransferDoctorId),
|
||||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||
InquiryType: v.InquiryType,
|
||||
InquiryMode: v.InquiryMode,
|
||||
@ -172,6 +180,7 @@ func GetOrderInquiryRecordListDto(m []*model.OrderInquiry) []*OrderInquiryDto {
|
||||
UserId: fmt.Sprintf("%d", v.UserId),
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||
TransferDoctorId: fmt.Sprintf("%d", v.TransferDoctorId),
|
||||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||
InquiryType: v.InquiryType,
|
||||
InquiryMode: v.InquiryMode,
|
||||
@ -228,6 +237,7 @@ func GetOrderInquiryForAccountListDto(m []*model.OrderInquiry) []*OrderInquiryDt
|
||||
UserId: fmt.Sprintf("%d", v.UserId),
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||
TransferDoctorId: fmt.Sprintf("%d", v.TransferDoctorId),
|
||||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||
InquiryType: v.InquiryType,
|
||||
InquiryMode: v.InquiryMode,
|
||||
@ -279,11 +289,17 @@ func GetOrderInquiryRecordDto(m *model.OrderInquiry) *OrderInquiryDto {
|
||||
doctorId = fmt.Sprintf("%v", m.DoctorId)
|
||||
}
|
||||
|
||||
var transferDoctorId string
|
||||
if m.TransferDoctorId != 0 {
|
||||
transferDoctorId = fmt.Sprintf("%v", m.TransferDoctorId)
|
||||
}
|
||||
|
||||
return &OrderInquiryDto{
|
||||
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
||||
OrderId: fmt.Sprintf("%d", m.OrderId),
|
||||
UserId: fmt.Sprintf("%d", m.UserId),
|
||||
DoctorId: doctorId,
|
||||
TransferDoctorId: transferDoctorId,
|
||||
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||||
FamilyId: fmt.Sprintf("%d", m.FamilyId),
|
||||
InquiryType: m.InquiryType,
|
||||
|
||||
@ -37,6 +37,9 @@ type OrderPrescriptionDto struct {
|
||||
OrderPrescriptionIcd string `json:"order_prescription_icd"` // 处方诊断疾病
|
||||
OrderInquiryCase *OrderInquiryCaseDto `json:"order_inquiry_case"` // 问诊病例
|
||||
OrderPrescriptionProduct []*OrderPrescriptionProductDto `json:"order_prescription_product"` // 处方商品
|
||||
UserDoctor *UserDoctorDto `json:"user_doctor"` // 原始医生
|
||||
InquiryDoctor *UserDoctorDto `json:"inquiry_doctor"` // 问诊医生信息
|
||||
TransferUserDoctor *UserDoctorDto `json:"transfer_prescription_doctor"` // 接受抄方的医生(抄方处方医生信息)
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
@ -125,6 +128,16 @@ func GetOrderPrescriptionListDto(m []*model.OrderPrescription) []*OrderPrescript
|
||||
response = response.LoadOrderPrescriptionIcdString(v.OrderPrescriptionIcd)
|
||||
}
|
||||
|
||||
// 加载问诊医生信息
|
||||
if v.OrderInquiry != nil && v.OrderInquiry.UserDoctor != nil {
|
||||
response = response.LoadInquiryDoctor(v.OrderInquiry.UserDoctor)
|
||||
}
|
||||
|
||||
// 加载接受抄方的医生信息
|
||||
if v.OrderInquiry != nil && v.OrderInquiry.TransferUserDoctor != nil {
|
||||
response = response.LoadTransferUserDoctor(v.OrderInquiry.TransferUserDoctor)
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
@ -205,3 +218,19 @@ func (r *OrderPrescriptionDto) LoadOrderProductId(m *model.OrderProduct) *OrderP
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadUserDoctor 加载问诊医生信息
|
||||
func (r *OrderPrescriptionDto) LoadInquiryDoctor(m *model.UserDoctor) *OrderPrescriptionDto {
|
||||
if m != nil {
|
||||
r.InquiryDoctor = GetUserDoctorDto(m)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadTransferUserDoctor 加载接受抄方的医生信息
|
||||
func (r *OrderPrescriptionDto) LoadTransferUserDoctor(m *model.UserDoctor) *OrderPrescriptionDto {
|
||||
if m != nil {
|
||||
r.TransferUserDoctor = GetUserDoctorDto(m)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ type OrderProductDto struct {
|
||||
OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id;NOT NULL
|
||||
OrderId string `json:"order_id"` // 订单id
|
||||
DoctorId string `json:"doctor_id"` // 医生id
|
||||
TransferDoctorId string `json:"transfer_doctor_id"` // 接受抄方的医生id
|
||||
PatientId string `json:"patient_id"` // 患者id
|
||||
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
||||
OrderProductNo string `json:"order_product_no"` // 订单编号
|
||||
@ -55,7 +56,10 @@ type OrderProductDto struct {
|
||||
OrderProductRefund *OrderProductRefundDto `json:"order_product_refund"` // 退款数据
|
||||
OrderProductItem []*OrderProductItemDto `json:"order_product_item"` // 商品数据
|
||||
OrderProductLogistics *OrderProductLogisticsDto `json:"order_product_logistics"` // 物流数据
|
||||
UserDoctor *UserDoctorDto `json:"user_doctor"` // 医生数据
|
||||
UserDoctor *UserDoctorDto `json:"user_doctor"` // 原始医生
|
||||
InquiryDoctor *UserDoctorDto `json:"inquiry_doctor"` // 问诊医生信息
|
||||
TransferUserDoctor *UserDoctorDto `json:"transfer_prescription_doctor"` // 接受抄方的医生(抄方处方医生信息)
|
||||
IsTransferOrder int `json:"is_transfer_order"` // 是否为抄方订单
|
||||
OrderPrescription *OrderPrescriptionDto `json:"order_prescription"` // 处方数据
|
||||
OrderInquiryCase *OrderInquiryCaseDto `json:"order_inquiry_case"` // 问诊病例
|
||||
OrderProductCoupon *OrderProductCouponDto `json:"order_product_coupon"` // 优惠卷
|
||||
@ -179,6 +183,21 @@ func GetOrderProductListDto(m []*model.OrderProduct) []*OrderProductDto {
|
||||
response = response.LoadOrderInquiryAttr(v.OrderInquiry)
|
||||
}
|
||||
|
||||
// 加载原问诊医生信息
|
||||
if v.OrderInquiry != nil && v.OrderInquiry.UserDoctor != nil {
|
||||
response = response.LoadInquiryDoctor(v.OrderInquiry.UserDoctor)
|
||||
}
|
||||
|
||||
//加载问诊类型
|
||||
if v.OrderInquiry != nil && v.OrderInquiry.UserDoctor != nil && v.OrderInquiry.TransferUserDoctor != nil {
|
||||
response = response.LoadIsTransferOrder(v.OrderInquiry.UserDoctor, v.OrderInquiry.TransferUserDoctor)
|
||||
}
|
||||
|
||||
// 加载接受抄方的医生信息
|
||||
if v.OrderInquiry != nil && v.OrderInquiry.TransferUserDoctor != nil {
|
||||
response = response.LoadTransferUserDoctor(v.OrderInquiry.TransferUserDoctor)
|
||||
}
|
||||
|
||||
// 加载处方编号
|
||||
if v.OrderPrescription != nil {
|
||||
response = response.LoadOrderPrescriptionCode(v.OrderPrescription)
|
||||
@ -205,12 +224,44 @@ func (r *OrderProductDto) LoadDoctorName(m *model.UserDoctor) *OrderProductDto {
|
||||
return r
|
||||
}
|
||||
|
||||
|
||||
// LoadUserDoctor 加载问诊医生信息
|
||||
func (r *OrderProductDto) LoadInquiryDoctor(m *model.UserDoctor) *OrderProductDto {
|
||||
if m != nil {
|
||||
r.InquiryDoctor = GetUserDoctorDto(m)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadUserDoctor 加载问诊类型
|
||||
func (r *OrderProductDto) LoadIsTransferOrder(m *model.UserDoctor, n *model.UserDoctor) *OrderProductDto {
|
||||
if m != nil && n != nil {
|
||||
if(int(m.DoctorId) != int(n.DoctorId)){
|
||||
r.IsTransferOrder = 1
|
||||
}else{
|
||||
r.IsTransferOrder = 0
|
||||
}
|
||||
}else{
|
||||
r.IsTransferOrder = 0
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadTransferUserDoctor 加载接受抄方的医生信息
|
||||
func (r *OrderProductDto) LoadTransferUserDoctor(m *model.UserDoctor) *OrderProductDto {
|
||||
if m != nil {
|
||||
r.TransferUserDoctor = GetUserDoctorDto(m)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadOrderInquiryAttr 加载问诊属性
|
||||
func (r *OrderProductDto) LoadOrderInquiryAttr(m *model.OrderInquiry) *OrderProductDto {
|
||||
if m != nil {
|
||||
r.PatientNameMask = m.PatientNameMask
|
||||
r.PatientSex = m.PatientSex
|
||||
r.PatientAge = m.PatientAge
|
||||
r.TransferDoctorId = string(m.TransferDoctorId)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
@ -37,6 +37,7 @@ type UserDoctorDto struct {
|
||||
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation"` // 是否平台深度合作医生(0:否 1:是)
|
||||
IsEnterpriseDeepCooperation int `json:"is_enterprise_deep_cooperation"` // 是否企业深度合作医生(0:否 1:是)
|
||||
IsSysDiagnoCooperation int `json:"is_sys_diagno_cooperation"` // 是否先思达合作医生(0:否 1:是)
|
||||
IsTransferPrescription int `json:"is_transfer_prescription"` // 是否接受抄方(0:否 1:是)
|
||||
QrCode string `json:"qr_code"` // 分享二维码
|
||||
BeGoodAt string `json:"be_good_at"` // 擅长
|
||||
BriefIntroduction string `json:"brief_introduction"` // 医生简介
|
||||
@ -77,6 +78,7 @@ type UserDoctorPendingDto struct {
|
||||
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation"` // 是否平台深度合作医生(0:否 1:是)
|
||||
IsEnterpriseDeepCooperation int `json:"is_enterprise_deep_cooperation"` // 是否企业深度合作医生(0:否 1:是)
|
||||
IsSysDiagnoCooperation int `json:"is_sys_diagno_cooperation"` // 是否先思达合作医生(0:否 1:是)
|
||||
IsTransferPrescription int `json:"is_transfer_prescription"` // 是否接受抄方(0:否 1:是)
|
||||
IsRecommend int `json:"is_recommend"` // 是否首页推荐(0:否 1:是)
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
@ -143,8 +145,10 @@ func GetUserDoctorDto(m *model.UserDoctor) *UserDoctorDto {
|
||||
PraiseRate: m.PraiseRate,
|
||||
AvgResponseTime: m.AvgResponseTime,
|
||||
NumberOfFans: m.NumberOfFans,
|
||||
IsPlatformDeepCooperation: m.IsPlatformDeepCooperation,
|
||||
IsSysDiagnoCooperation: m.IsSysDiagnoCooperation,
|
||||
IsPlatformDeepCooperation: m.IsPlatformDeepCooperation,
|
||||
IsEnterpriseDeepCooperation: m.IsEnterpriseDeepCooperation,
|
||||
IsSysDiagnoCooperation: m.IsSysDiagnoCooperation,
|
||||
IsTransferPrescription: m.IsTransferPrescription,
|
||||
QrCode: utils.AddOssDomain(m.QrCode),
|
||||
BeGoodAt: m.BeGoodAt,
|
||||
BriefIntroduction: m.BriefIntroduction,
|
||||
@ -182,7 +186,9 @@ func GetUserDoctorListDto(m []*model.UserDoctor) []*UserDoctorDto {
|
||||
PraiseRate: v.PraiseRate,
|
||||
AvgResponseTime: v.AvgResponseTime,
|
||||
NumberOfFans: v.NumberOfFans,
|
||||
IsPlatformDeepCooperation: v.IsPlatformDeepCooperation,
|
||||
IsPlatformDeepCooperation: v.IsPlatformDeepCooperation,
|
||||
IsEnterpriseDeepCooperation: v.IsEnterpriseDeepCooperation,
|
||||
IsTransferPrescription: v.IsTransferPrescription,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
@ -241,6 +247,7 @@ func GetUserDoctorPendingDto(m *model.UserDoctor) *UserDoctorPendingDto {
|
||||
IsPlatformDeepCooperation: m.IsPlatformDeepCooperation,
|
||||
IsEnterpriseDeepCooperation: m.IsEnterpriseDeepCooperation,
|
||||
IsSysDiagnoCooperation: m.IsSysDiagnoCooperation,
|
||||
IsTransferPrescription: m.IsTransferPrescription,
|
||||
IsRecommend: m.IsRecommend,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/global"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// OrderInquiry 订单-问诊表
|
||||
@ -13,6 +14,7 @@ type OrderInquiry struct {
|
||||
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id-患者;NOT NULL" json:"user_id"`
|
||||
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id;NOT NULL" json:"patient_id"`
|
||||
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id(未分配时为null)" json:"doctor_id"`
|
||||
TransferDoctorId int64 `gorm:"column:transfer_doctor_id;type:bigint(19);comment:接受抄方的医生id" json:"transfer_doctor_id"`
|
||||
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id(就诊用户);NOT NULL" json:"family_id"`
|
||||
InquiryType int `gorm:"column:inquiry_type;type:tinyint(1);comment:订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测);NOT NULL" json:"inquiry_type"`
|
||||
InquiryMode int `gorm:"column:inquiry_mode;type:tinyint(1);comment:订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员);NOT NULL" json:"inquiry_mode"`
|
||||
@ -41,8 +43,9 @@ type OrderInquiry struct {
|
||||
PatientNameMask string `gorm:"column:patient_name_mask;type:varchar(255);comment:患者姓名-就诊人(掩码)" json:"patient_name_mask"`
|
||||
PatientSex int `gorm:"column:patient_sex;type:tinyint(1);default:0;comment:患者性别-就诊人(0:未知 1:男 2:女)" json:"patient_sex"`
|
||||
PatientAge int `gorm:"column:patient_age;type:int(1);comment:患者年龄-就诊人" json:"patient_age"`
|
||||
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
||||
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 患者
|
||||
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
||||
TransferUserDoctor *UserDoctor `gorm:"foreignKey:TransferDoctorId;references:doctor_id" json:"transfer_user_doctor"` // 接受抄方的医生
|
||||
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 患者
|
||||
Model
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/global"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// UserDoctor 用户-医生表
|
||||
@ -42,6 +43,7 @@ type UserDoctor struct {
|
||||
IsPlatformDeepCooperation int `gorm:"column:is_platform_deep_cooperation;type:tinyint(1);default:0;comment:是否平台深度合作医生(0:否 1:是)" json:"is_platform_deep_cooperation"`
|
||||
IsEnterpriseDeepCooperation int `gorm:"column:is_enterprise_deep_cooperation;type:tinyint(1);default:0;comment:是否企业深度合作医生(0:否 1:是)" json:"is_enterprise_deep_cooperation"`
|
||||
IsSysDiagnoCooperation int `gorm:"column:is_sys_diagno_cooperation;type:tinyint(1);default:0;comment:是否先思达合作医生(0:否 1:是)" json:"is_sys_diagno_cooperation"`
|
||||
IsTransferPrescription int `gorm:"column:is_transfer_prescription;type:tinyint(1);default:0;comment:是否接受抄方(0:否 1:是)" json:"is_transfer_prescription"`
|
||||
QrCode string `gorm:"column:qr_code;type:varchar(255);comment:分享二维码" json:"qr_code"`
|
||||
BeGoodAt string `gorm:"column:be_good_at;type:text;comment:擅长" json:"be_good_at"`
|
||||
BriefIntroduction string `gorm:"column:brief_introduction;type:text;comment:医生简介" json:"brief_introduction"`
|
||||
|
||||
@ -33,6 +33,8 @@ type GetOrderProductPage struct {
|
||||
Mobile string `json:"mobile" form:"mobile" label:"手机号-医生/患者"`
|
||||
ProductName string `json:"product_name" form:"product_name" label:"药品名称"`
|
||||
CommonName string `json:"common_name" form:"common_name" label:"药品通用名"`
|
||||
PrescriptionCode string `json:"prescription_code" form:"prescription_code" label:"处方编号"`
|
||||
|
||||
}
|
||||
|
||||
// CancelOrderProduct 取消药品订单
|
||||
|
||||
@ -48,6 +48,7 @@ type PutUserDoctor struct {
|
||||
HospitalId string `json:"hospital_id" form:"hospital_id" validate:"required" label:"所属医院id"`
|
||||
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation" form:"is_platform_deep_cooperation" label:"平台深度合作医生"` // 是否平台深度合作医生(0:否 1:是)
|
||||
IsSysDiagnoCooperation int `json:"is_sys_diagno_cooperation" form:"is_sys_diagno_cooperation" label:"是否先思达合作医生)"` // 是否先思达合作医生(0:否 1:是)
|
||||
IsTransferPrescription int `json:"is_transfer_prescription" form:"is_transfer_prescription" label:"是否接受抄方"` // 是否接受抄方(0:否 1:是)
|
||||
BeGoodAt string `json:"be_good_at" form:"be_good_at" validate:"required" label:"擅长"`
|
||||
BriefIntroduction string `json:"brief_introduction" form:"brief_introduction" validate:"required" label:"医生简介"`
|
||||
LicenseCert []string `json:"license_cert" form:"license_cert" label:"医师执业证"`
|
||||
@ -78,6 +79,7 @@ type AddUserDoctor struct {
|
||||
HospitalId string `json:"hospital_id" form:"hospital_id" validate:"required" label:"所属医院id"`
|
||||
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation" form:"is_platform_deep_cooperation" label:"平台深度合作医生"` // 是否平台深度合作医生(0:否 1:是)
|
||||
IsSysDiagnoCooperation int `json:"is_sys_diagno_cooperation" form:"is_sys_diagno_cooperation" label:"是否先思达合作医生)"` // 是否先思达合作医生(0:否 1:是)
|
||||
IsTransferPrescription int `json:"is_transfer_prescription" form:"is_transfer_prescription" label:"是否接受抄方"` // 是否接受抄方(0:否 1:是)
|
||||
BeGoodAt string `json:"be_good_at" form:"be_good_at" validate:"required" label:"擅长"`
|
||||
BriefIntroduction string `json:"brief_introduction" form:"brief_introduction" validate:"required" label:"医生简介"`
|
||||
LicenseCert []string `json:"license_cert" form:"license_cert" validate:"required" label:"医师执业证"`
|
||||
|
||||
@ -2,13 +2,14 @@ package router
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"hospital-admin-api/api/controller"
|
||||
"hospital-admin-api/api/exception"
|
||||
"hospital-admin-api/api/middlewares"
|
||||
"hospital-admin-api/config"
|
||||
"hospital-admin-api/consts"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Init 初始化路由
|
||||
@ -531,6 +532,15 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
||||
|
||||
// 处方详情
|
||||
prescriptionGroup.GET("/:order_prescription_id", api.OrderPrescription.GetOrderPrescription)
|
||||
|
||||
prescriptionTransferGroup := prescriptionGroup.Group("/transfer")
|
||||
{
|
||||
// 获取抄方的处方列表-分页
|
||||
prescriptionTransferGroup.GET("", api.OrderPrescription.GetOrderPrescriptionTransferPage)
|
||||
|
||||
// 抄方的处方详情
|
||||
prescriptionTransferGroup.GET("/:order_prescription_id", api.OrderPrescription.GetOrderPrescription)
|
||||
}
|
||||
}
|
||||
|
||||
// 问诊管理
|
||||
@ -747,6 +757,9 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
||||
{
|
||||
// 处方
|
||||
prescriptionGroup.POST("", api.Export.OrderPrescription)
|
||||
|
||||
// 抄方的处方
|
||||
prescriptionGroup.POST("/transfer", api.Export.OrderTransferPrescription)
|
||||
}
|
||||
|
||||
// 药品
|
||||
|
||||
@ -3,7 +3,6 @@ package service
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/model"
|
||||
@ -12,6 +11,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// InquiryConfigService 问诊配置
|
||||
@ -372,7 +373,6 @@ func (r *DoctorInquiryConfigService) PutDoctorInquiryConfig(inquiryConfigId int6
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 修改医生服务设置-疑难会诊
|
||||
if doctorInquiryConfig.InquiryType == 1 && doctorInquiryConfig.InquiryMode == 6 {
|
||||
// 获取医生服务设置-疑难会诊
|
||||
@ -408,9 +408,7 @@ func (r *DoctorInquiryConfigService) PutDoctorInquiryConfig(inquiryConfigId int6
|
||||
return false, errors.New("修改失败")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
return true, nil
|
||||
}
|
||||
|
||||
@ -42,6 +42,9 @@ func (b *AdminService) Login(LoginRequest requests.Login) (*dto.Login, error) {
|
||||
return nil, errors.New("您的账号已被禁用,请联系管理员处理")
|
||||
}
|
||||
|
||||
roleDao := dao.AdminRoleDao{}
|
||||
adminRole, err := roleDao.GetAdminRoleFirstById(adminUser.RoleID)
|
||||
|
||||
token := &utils.Token{
|
||||
UserId: strconv.FormatInt(adminUser.UserID, 10),
|
||||
RoleId: strconv.FormatInt(adminUser.RoleID, 10),
|
||||
@ -60,6 +63,7 @@ func (b *AdminService) Login(LoginRequest requests.Login) (*dto.Login, error) {
|
||||
NickName: adminUser.NickName,
|
||||
Avatar: adminUser.Avatar,
|
||||
Token: jwt,
|
||||
RoleName: adminRole.RoleName,
|
||||
}
|
||||
|
||||
result.GetLoginFullAvatar()
|
||||
|
||||
@ -1571,13 +1571,13 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) {
|
||||
ConsigneeTel: v.ConsigneeTel,
|
||||
}
|
||||
|
||||
if v.UserDoctor != nil {
|
||||
if v.OrderInquiry != nil && v.OrderInquiry.UserDoctor != nil {
|
||||
// 医生姓名
|
||||
data.DoctorName = v.UserDoctor.UserName
|
||||
data.DoctorName = v.OrderInquiry.UserDoctor.UserName
|
||||
|
||||
if v.UserDoctor.User != nil {
|
||||
// 医生电话
|
||||
data.DoctorMobile = v.UserDoctor.User.Mobile
|
||||
// 医生电话
|
||||
if v.OrderInquiry.UserDoctor.User != nil {
|
||||
data.DoctorMobile = v.OrderInquiry.UserDoctor.User.Mobile
|
||||
}
|
||||
}
|
||||
|
||||
@ -1830,9 +1830,9 @@ func (r *ExportService) OrderPrescription(d []*model.OrderPrescription) (string,
|
||||
DoctorAdvice: v.DoctorAdvice,
|
||||
}
|
||||
|
||||
if v.UserDoctor != nil {
|
||||
if v.OrderInquiry !=nil && v.OrderInquiry.UserDoctor != nil {
|
||||
// 医生姓名
|
||||
data.DoctorName = v.UserDoctor.UserName
|
||||
data.DoctorName = v.OrderInquiry.UserDoctor.UserName
|
||||
}
|
||||
|
||||
if v.UserPharmacist != nil {
|
||||
|
||||
@ -82,5 +82,15 @@ func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int6
|
||||
// 加载药品订单id
|
||||
g.LoadOrderProductId(orderProduct)
|
||||
|
||||
// 加载原始医生信息
|
||||
if orderPrescription.OrderInquiry != nil && orderPrescription.OrderInquiry.UserDoctor != nil {
|
||||
g.LoadInquiryDoctor(orderPrescription.OrderInquiry.UserDoctor)
|
||||
}
|
||||
|
||||
// 加载接受抄方的医生信息
|
||||
if orderPrescription.OrderInquiry != nil && orderPrescription.OrderInquiry.TransferUserDoctor != nil {
|
||||
g.LoadTransferUserDoctor(orderPrescription.OrderInquiry.TransferUserDoctor)
|
||||
}
|
||||
|
||||
return g, nil
|
||||
}
|
||||
|
||||
@ -68,9 +68,24 @@ func (r *OrderProductService) GetOrderProduct(orderProductId int64) (g *dto.Orde
|
||||
// 加载医生数据
|
||||
g.UserDoctor = userDoctor
|
||||
|
||||
// 加载原始医生信息
|
||||
if orderProduct.OrderInquiry != nil && orderProduct.OrderInquiry.UserDoctor != nil {
|
||||
g.LoadInquiryDoctor(orderProduct.OrderInquiry.UserDoctor)
|
||||
}
|
||||
|
||||
// 加载接受抄方的医生信息
|
||||
if orderProduct.OrderInquiry != nil && orderProduct.OrderInquiry.TransferUserDoctor != nil {
|
||||
g.LoadTransferUserDoctor(orderProduct.OrderInquiry.TransferUserDoctor)
|
||||
}
|
||||
|
||||
// 加载问诊病例
|
||||
g.LoadOrderInquiryCase(orderInquiryCase)
|
||||
|
||||
// 加载问诊类型
|
||||
if orderProduct.OrderInquiry != nil && orderProduct.OrderInquiry.UserDoctor != nil && orderProduct.OrderInquiry.TransferUserDoctor != nil{
|
||||
g.LoadIsTransferOrder(orderProduct.OrderInquiry.UserDoctor, orderProduct.OrderInquiry.TransferUserDoctor)
|
||||
}
|
||||
|
||||
// 加载处方数据
|
||||
g.LoadOrderPrescription(orderPrescription)
|
||||
|
||||
|
||||
@ -175,6 +175,11 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDo
|
||||
userDoctorData["is_sys_diagno_cooperation"] = req.IsSysDiagnoCooperation
|
||||
}
|
||||
|
||||
// 处理是否接受抄方
|
||||
if userDoctor.IsTransferPrescription != req.IsTransferPrescription {
|
||||
userDoctorData["is_transfer_prescription"] = req.IsTransferPrescription
|
||||
}
|
||||
|
||||
// 是否推荐
|
||||
if userDoctor.IsRecommend != req.IsRecommend {
|
||||
userDoctorData["is_recommend"] = req.IsRecommend
|
||||
@ -970,6 +975,7 @@ func (r *UserDoctorService) AddUserDoctor(userId string, req requests.AddUserDoc
|
||||
HospitalID: hospitalId,
|
||||
IsPlatformDeepCooperation: req.IsPlatformDeepCooperation,
|
||||
IsSysDiagnoCooperation: req.IsSysDiagnoCooperation,
|
||||
IsTransferPrescription: req.IsTransferPrescription,
|
||||
BeGoodAt: req.BeGoodAt,
|
||||
BriefIntroduction: req.BriefIntroduction,
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user