Compare commits
59 Commits
1b33c1f241
...
f6e50fb04e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6e50fb04e | ||
|
|
6a9688b34f | ||
|
|
fce126bbbd | ||
|
|
9937ef8e0c | ||
|
|
ffff3ee5f3 | ||
|
|
7a7b51382b | ||
|
|
e840e99388 | ||
|
|
c786568d99 | ||
|
|
8cd2095983 | ||
|
|
32734e14f1 | ||
|
|
92781a3624 | ||
|
|
ffbc1c83c2 | ||
|
|
226b106997 | ||
|
|
5b5997f2e2 | ||
|
|
198f37fa42 | ||
|
|
916b788b1b | ||
|
|
b450125512 | ||
|
|
7fc14a3642 | ||
|
|
89dad42646 | ||
|
|
efc60d1244 | ||
|
|
542a8f71ad | ||
|
|
ed72e480f1 | ||
|
|
18a2ce1dde | ||
|
|
e3111beda8 | ||
|
|
75c1575830 | ||
|
|
0fb3681628 | ||
|
|
49fc422218 | ||
|
|
773e3bdc43 | ||
|
|
0ee06842c6 | ||
|
|
f5d9cf462e | ||
|
|
33372af1fc | ||
|
|
7b2ef6e239 | ||
|
|
86ef379053 | ||
|
|
1c29997b9a | ||
|
|
9070e69a66 | ||
|
|
d94aa44654 | ||
|
|
a10fb58886 | ||
|
|
8ebd97e153 | ||
|
|
da819de61b | ||
|
|
beb791a4ce | ||
|
|
7a51cec28b | ||
|
|
bdd3990fa6 | ||
|
|
deef662a31 | ||
|
|
daa4ff7bff | ||
|
|
88d138f2c0 | ||
|
|
9ee32f80ed | ||
|
|
0a0f85321a | ||
|
|
a4df927d7d | ||
|
|
ba7fb4ae8c | ||
|
|
4edbca5f67 | ||
|
|
406d91a81a | ||
|
|
f787ac0061 | ||
|
|
1ad8ffab1e | ||
|
|
c1cb96c01e | ||
|
|
0f8693f1c8 | ||
|
|
83a54826b6 | ||
|
|
f8e208077a | ||
|
|
a04a499a43 | ||
|
|
4133c7e26b |
@ -499,6 +499,54 @@ func (r *Export) OrderProduct(c *gin.Context) {
|
|||||||
responses.OkWithData(ossAddress, c)
|
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 处方
|
// OrderPrescription 处方
|
||||||
func (r *Export) OrderPrescription(c *gin.Context) {
|
func (r *Export) OrderPrescription(c *gin.Context) {
|
||||||
orderPrescriptionRequest := requests.OrderPrescriptionRequest{}
|
orderPrescriptionRequest := requests.OrderPrescriptionRequest{}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"hospital-admin-api/api/dao"
|
"hospital-admin-api/api/dao"
|
||||||
"hospital-admin-api/api/dto"
|
"hospital-admin-api/api/dto"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
@ -10,6 +9,8 @@ import (
|
|||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"hospital-admin-api/utils"
|
"hospital-admin-api/utils"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
type OrderPrescription struct{}
|
type OrderPrescription struct{}
|
||||||
@ -55,6 +56,47 @@ func (r *OrderPrescription) GetOrderPrescriptionPage(c *gin.Context) {
|
|||||||
responses.OkWithData(result, c)
|
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 处方详情
|
// GetOrderPrescription 处方详情
|
||||||
func (r *OrderPrescription) GetOrderPrescription(c *gin.Context) {
|
func (r *OrderPrescription) GetOrderPrescription(c *gin.Context) {
|
||||||
id := c.Param("order_prescription_id")
|
id := c.Param("order_prescription_id")
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"hospital-admin-api/api/dao"
|
"hospital-admin-api/api/dao"
|
||||||
"hospital-admin-api/api/dto"
|
"hospital-admin-api/api/dto"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
@ -10,6 +9,8 @@ import (
|
|||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"hospital-admin-api/utils"
|
"hospital-admin-api/utils"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
type OrderProduct struct{}
|
type OrderProduct struct{}
|
||||||
|
|||||||
@ -49,7 +49,8 @@ func (r *UserDoctor) GetUserDoctorPage(c *gin.Context) {
|
|||||||
if systemConfig.IsAnnualReview == 1 {
|
if systemConfig.IsAnnualReview == 1 {
|
||||||
// 后台用户id
|
// 后台用户id
|
||||||
adminUserId := c.GetInt64("UserId")
|
adminUserId := c.GetInt64("UserId")
|
||||||
if adminUserId == 1845704393354121216 {
|
// 正式lixiumei user_id 测试 lixiumei user_id
|
||||||
|
if adminUserId == 1845704393354121216 || adminUserId == 1732273543535661056 {
|
||||||
status := 1
|
status := 1
|
||||||
req.GetUserDoctorPage.MultiPointStatus = &status
|
req.GetUserDoctorPage.MultiPointStatus = &status
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package dao
|
package dao
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gorm.io/gorm"
|
|
||||||
"hospital-admin-api/api/model"
|
"hospital-admin-api/api/model"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DoctorInquiryConfigDao struct {
|
type DoctorInquiryConfigDao struct {
|
||||||
@ -39,6 +40,7 @@ func (r *DoctorInquiryConfigDao) DeleteDoctorInquiryConfig(tx *gorm.DB, maps int
|
|||||||
|
|
||||||
// EditDoctorInquiryConfigById 修改医生问诊配置-问诊配置id
|
// EditDoctorInquiryConfigById 修改医生问诊配置-问诊配置id
|
||||||
func (r *DoctorInquiryConfigDao) EditDoctorInquiryConfigById(tx *gorm.DB, inquiryConfigId int64, data interface{}) error {
|
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
|
err := tx.Model(&model.DoctorInquiryConfig{}).Where("inquiry_config_id = ?", inquiryConfigId).Updates(data).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@ -2,12 +2,13 @@ package dao
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"gorm.io/gorm"
|
|
||||||
"hospital-admin-api/api/model"
|
"hospital-admin-api/api/model"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type OrderPrescriptionDao struct {
|
type OrderPrescriptionDao struct {
|
||||||
@ -15,7 +16,18 @@ type OrderPrescriptionDao struct {
|
|||||||
|
|
||||||
// GetById 获取处方-处方id
|
// GetById 获取处方-处方id
|
||||||
func (r *OrderPrescriptionDao) GetById(orderPrescriptionId int64) (m *model.OrderPrescription, err error) {
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -100,6 +112,15 @@ func (r *OrderPrescriptionDao) GetOrderPrescriptionPageSearch(req requests.GetOr
|
|||||||
// 处方关联疾病表
|
// 处方关联疾病表
|
||||||
query = query.Preload("OrderPrescriptionIcd")
|
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")
|
query = query.Preload("PatientFamily")
|
||||||
|
|
||||||
@ -166,7 +187,7 @@ func (r *OrderPrescriptionDao) GetOrderPrescriptionPageSearch(req requests.GetOr
|
|||||||
|
|
||||||
// 药品订单编号
|
// 药品订单编号
|
||||||
if req.OrderProductNo != "" {
|
if req.OrderProductNo != "" {
|
||||||
subQuery := global.Db.Model(&model.OrderInquiry{}).
|
subQuery := global.Db.Model(&model.OrderProduct{}).
|
||||||
Select("order_prescription_id").
|
Select("order_prescription_id").
|
||||||
Where("order_product_no = ?", req.OrderProductNo)
|
Where("order_product_no = ?", req.OrderProductNo)
|
||||||
query = query.Where("order_prescription_id IN (?)", subQuery)
|
query = query.Where("order_prescription_id IN (?)", subQuery)
|
||||||
@ -233,6 +254,391 @@ func (r *OrderPrescriptionDao) GetOrderPrescriptionPageSearch(req requests.GetOr
|
|||||||
return m, totalRecords, nil
|
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 获取处方列表-导出
|
// GetOrderPrescriptionExportListSearch 获取处方列表-导出
|
||||||
func (r *OrderPrescriptionDao) GetOrderPrescriptionExportListSearch(req requests.OrderPrescriptionExportList) (m []*model.OrderPrescription, err error) {
|
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 != "" {
|
if req.OrderProductNo != "" {
|
||||||
subQuery := global.Db.Model(&model.OrderInquiry{}).
|
subQuery := global.Db.Model(&model.OrderProduct{}).
|
||||||
Select("order_prescription_id").
|
Select("order_prescription_id").
|
||||||
Where("order_product_no = ?", req.OrderProductNo)
|
Where("order_product_no = ?", req.OrderProductNo)
|
||||||
query = query.Where("order_prescription_id IN (?)", subQuery)
|
query = query.Where("order_prescription_id IN (?)", subQuery)
|
||||||
|
|||||||
@ -2,13 +2,14 @@ package dao
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"gorm.io/gorm"
|
|
||||||
"gorm.io/gorm/clause"
|
|
||||||
"hospital-admin-api/api/model"
|
"hospital-admin-api/api/model"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
)
|
)
|
||||||
|
|
||||||
type OrderProductDao struct {
|
type OrderProductDao struct {
|
||||||
@ -25,7 +26,21 @@ func (r *OrderProductDao) GetOrderProductById(orderProductId int64) (m *model.Or
|
|||||||
|
|
||||||
// GetOrderProductPreloadById 获取药品订单数据-加载全部关联-药品订单id
|
// GetOrderProductPreloadById 获取药品订单数据-加载全部关联-药品订单id
|
||||||
func (r *OrderProductDao) GetOrderProductPreloadById(orderProductId int64) (m *model.OrderProduct, err error) {
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -116,13 +131,30 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
|||||||
return db.Omit("open_id", "union_id", "wx_session_key")
|
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||||
})
|
})
|
||||||
|
|
||||||
// 医生姓名
|
// 医生姓名 - 同时查询原医生和抄方医生
|
||||||
if req.DoctorName != "" {
|
if req.DoctorName != "" {
|
||||||
subQuery := global.Db.Model(&model.UserDoctor{}).
|
// 原医生查询条件
|
||||||
|
originalDoctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
Select("doctor_id").
|
Select("doctor_id").
|
||||||
Where("user_name LIKE ?", "%"+req.DoctorName+"%")
|
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 {
|
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)
|
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 != "" {
|
if req.OrderProductNo != "" {
|
||||||
query = query.Where("order_product_no = ?", 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+"%")
|
query = query.Where("consignee_tel LIKE ?", "%"+req.ConsigneeTel+"%")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 手机号-医生/患者
|
// 手机号-医生/患者 - 同时查询原医生和抄方医生
|
||||||
if req.Mobile != "" {
|
if req.Mobile != "" {
|
||||||
// 患者
|
// 患者
|
||||||
patientUserSubQuery := global.Db.Model(&model.User{}).
|
patientUserSubQuery := global.Db.Model(&model.User{}).
|
||||||
@ -313,16 +359,37 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
|||||||
Select("patient_id").
|
Select("patient_id").
|
||||||
Where(gorm.Expr("user_id IN (?)", patientUserSubQuery))
|
Where(gorm.Expr("user_id IN (?)", patientUserSubQuery))
|
||||||
|
|
||||||
// 医生
|
// 原医生
|
||||||
doctorUserSubQuery := global.Db.Model(&model.User{}).
|
doctorUserSubQuery := global.Db.Model(&model.User{}).
|
||||||
Select("user_id").
|
Select("user_id").
|
||||||
Where("mobile = ?", req.Mobile)
|
Where("mobile = ?", req.Mobile)
|
||||||
|
|
||||||
doctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
originalDoctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
Select("doctor_id").
|
Select("doctor_id").
|
||||||
Where(gorm.Expr("user_id IN (?)", doctorUserSubQuery))
|
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")
|
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 {
|
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 {
|
query = query.Preload("UserPatient.User", func(db *gorm.DB) *gorm.DB {
|
||||||
return db.Select("user_id", "user_name", "mobile")
|
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.Type == 1 {
|
||||||
// 医生姓名
|
// 医生姓名 - 同时查询原医生和抄方医生
|
||||||
if req.DoctorName != "" {
|
if req.DoctorName != "" {
|
||||||
subQuery := global.Db.Model(&model.UserDoctor{}).
|
// 原医生查询条件
|
||||||
|
originalDoctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
Select("doctor_id").
|
Select("doctor_id").
|
||||||
Where("user_name LIKE ?", "%"+req.DoctorName+"%")
|
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"` // 昵称
|
NickName string `json:"nick_name"` // 昵称
|
||||||
Avatar string `json:"avatar"` // 头像
|
Avatar string `json:"avatar"` // 头像
|
||||||
Token string `json:"token"` // 用户名
|
Token string `json:"token"` // 用户名
|
||||||
|
RoleName string `json:"role_name"` // 角色名
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLoginFullAvatar 返回带有指定字符串的头像路径
|
// GetLoginFullAvatar 返回带有指定字符串的头像路径
|
||||||
|
|||||||
@ -11,6 +11,7 @@ type OrderInquiryDto struct {
|
|||||||
UserId string `json:"user_id"` // 用户id-患者
|
UserId string `json:"user_id"` // 用户id-患者
|
||||||
PatientId string `json:"patient_id"` // 患者id
|
PatientId string `json:"patient_id"` // 患者id
|
||||||
DoctorId string `json:"doctor_id"` // 医生id(未分配时为null)
|
DoctorId string `json:"doctor_id"` // 医生id(未分配时为null)
|
||||||
|
TransferDoctorId string `json:"transfer_doctor_id"` // 接受抄方的医生id
|
||||||
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
||||||
InquiryType int `json:"inquiry_type"` // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测)
|
InquiryType int `json:"inquiry_type"` // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测)
|
||||||
InquiryMode int `json:"inquiry_mode"` // 订单问诊方式(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)
|
doctorId = fmt.Sprintf("%v", m.DoctorId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var transferDoctorId string
|
||||||
|
if m.TransferDoctorId != 0 {
|
||||||
|
transferDoctorId = fmt.Sprintf("%v", m.TransferDoctorId)
|
||||||
|
}
|
||||||
|
|
||||||
return &OrderInquiryDto{
|
return &OrderInquiryDto{
|
||||||
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
||||||
OrderId: fmt.Sprintf("%d", m.OrderId),
|
OrderId: fmt.Sprintf("%d", m.OrderId),
|
||||||
UserId: fmt.Sprintf("%d", m.UserId),
|
UserId: fmt.Sprintf("%d", m.UserId),
|
||||||
DoctorId: doctorId,
|
DoctorId: doctorId,
|
||||||
|
TransferDoctorId: transferDoctorId,
|
||||||
PatientId: fmt.Sprintf("%d", m.PatientId),
|
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||||||
FamilyId: fmt.Sprintf("%d", m.FamilyId),
|
FamilyId: fmt.Sprintf("%d", m.FamilyId),
|
||||||
InquiryType: m.InquiryType,
|
InquiryType: m.InquiryType,
|
||||||
@ -113,6 +120,7 @@ func GetOrderInquiryListDto(m []*model.OrderInquiry) []*OrderInquiryDto {
|
|||||||
UserId: fmt.Sprintf("%d", v.UserId),
|
UserId: fmt.Sprintf("%d", v.UserId),
|
||||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||||
|
TransferDoctorId: fmt.Sprintf("%d", v.TransferDoctorId),
|
||||||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||||
InquiryType: v.InquiryType,
|
InquiryType: v.InquiryType,
|
||||||
InquiryMode: v.InquiryMode,
|
InquiryMode: v.InquiryMode,
|
||||||
@ -172,6 +180,7 @@ func GetOrderInquiryRecordListDto(m []*model.OrderInquiry) []*OrderInquiryDto {
|
|||||||
UserId: fmt.Sprintf("%d", v.UserId),
|
UserId: fmt.Sprintf("%d", v.UserId),
|
||||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||||
|
TransferDoctorId: fmt.Sprintf("%d", v.TransferDoctorId),
|
||||||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||||
InquiryType: v.InquiryType,
|
InquiryType: v.InquiryType,
|
||||||
InquiryMode: v.InquiryMode,
|
InquiryMode: v.InquiryMode,
|
||||||
@ -228,6 +237,7 @@ func GetOrderInquiryForAccountListDto(m []*model.OrderInquiry) []*OrderInquiryDt
|
|||||||
UserId: fmt.Sprintf("%d", v.UserId),
|
UserId: fmt.Sprintf("%d", v.UserId),
|
||||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||||
|
TransferDoctorId: fmt.Sprintf("%d", v.TransferDoctorId),
|
||||||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||||
InquiryType: v.InquiryType,
|
InquiryType: v.InquiryType,
|
||||||
InquiryMode: v.InquiryMode,
|
InquiryMode: v.InquiryMode,
|
||||||
@ -279,11 +289,17 @@ func GetOrderInquiryRecordDto(m *model.OrderInquiry) *OrderInquiryDto {
|
|||||||
doctorId = fmt.Sprintf("%v", m.DoctorId)
|
doctorId = fmt.Sprintf("%v", m.DoctorId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var transferDoctorId string
|
||||||
|
if m.TransferDoctorId != 0 {
|
||||||
|
transferDoctorId = fmt.Sprintf("%v", m.TransferDoctorId)
|
||||||
|
}
|
||||||
|
|
||||||
return &OrderInquiryDto{
|
return &OrderInquiryDto{
|
||||||
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
||||||
OrderId: fmt.Sprintf("%d", m.OrderId),
|
OrderId: fmt.Sprintf("%d", m.OrderId),
|
||||||
UserId: fmt.Sprintf("%d", m.UserId),
|
UserId: fmt.Sprintf("%d", m.UserId),
|
||||||
DoctorId: doctorId,
|
DoctorId: doctorId,
|
||||||
|
TransferDoctorId: transferDoctorId,
|
||||||
PatientId: fmt.Sprintf("%d", m.PatientId),
|
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||||||
FamilyId: fmt.Sprintf("%d", m.FamilyId),
|
FamilyId: fmt.Sprintf("%d", m.FamilyId),
|
||||||
InquiryType: m.InquiryType,
|
InquiryType: m.InquiryType,
|
||||||
|
|||||||
@ -37,6 +37,9 @@ type OrderPrescriptionDto struct {
|
|||||||
OrderPrescriptionIcd string `json:"order_prescription_icd"` // 处方诊断疾病
|
OrderPrescriptionIcd string `json:"order_prescription_icd"` // 处方诊断疾病
|
||||||
OrderInquiryCase *OrderInquiryCaseDto `json:"order_inquiry_case"` // 问诊病例
|
OrderInquiryCase *OrderInquiryCaseDto `json:"order_inquiry_case"` // 问诊病例
|
||||||
OrderPrescriptionProduct []*OrderPrescriptionProductDto `json:"order_prescription_product"` // 处方商品
|
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"` // 创建时间
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
}
|
}
|
||||||
@ -125,6 +128,16 @@ func GetOrderPrescriptionListDto(m []*model.OrderPrescription) []*OrderPrescript
|
|||||||
response = response.LoadOrderPrescriptionIcdString(v.OrderPrescriptionIcd)
|
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
|
responses[i] = response
|
||||||
}
|
}
|
||||||
@ -205,3 +218,19 @@ func (r *OrderPrescriptionDto) LoadOrderProductId(m *model.OrderProduct) *OrderP
|
|||||||
}
|
}
|
||||||
return r
|
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
|
OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id;NOT NULL
|
||||||
OrderId string `json:"order_id"` // 订单id
|
OrderId string `json:"order_id"` // 订单id
|
||||||
DoctorId string `json:"doctor_id"` // 医生id
|
DoctorId string `json:"doctor_id"` // 医生id
|
||||||
|
TransferDoctorId string `json:"transfer_doctor_id"` // 接受抄方的医生id
|
||||||
PatientId string `json:"patient_id"` // 患者id
|
PatientId string `json:"patient_id"` // 患者id
|
||||||
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
||||||
OrderProductNo string `json:"order_product_no"` // 订单编号
|
OrderProductNo string `json:"order_product_no"` // 订单编号
|
||||||
@ -55,7 +56,10 @@ type OrderProductDto struct {
|
|||||||
OrderProductRefund *OrderProductRefundDto `json:"order_product_refund"` // 退款数据
|
OrderProductRefund *OrderProductRefundDto `json:"order_product_refund"` // 退款数据
|
||||||
OrderProductItem []*OrderProductItemDto `json:"order_product_item"` // 商品数据
|
OrderProductItem []*OrderProductItemDto `json:"order_product_item"` // 商品数据
|
||||||
OrderProductLogistics *OrderProductLogisticsDto `json:"order_product_logistics"` // 物流数据
|
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"` // 处方数据
|
OrderPrescription *OrderPrescriptionDto `json:"order_prescription"` // 处方数据
|
||||||
OrderInquiryCase *OrderInquiryCaseDto `json:"order_inquiry_case"` // 问诊病例
|
OrderInquiryCase *OrderInquiryCaseDto `json:"order_inquiry_case"` // 问诊病例
|
||||||
OrderProductCoupon *OrderProductCouponDto `json:"order_product_coupon"` // 优惠卷
|
OrderProductCoupon *OrderProductCouponDto `json:"order_product_coupon"` // 优惠卷
|
||||||
@ -179,6 +183,21 @@ func GetOrderProductListDto(m []*model.OrderProduct) []*OrderProductDto {
|
|||||||
response = response.LoadOrderInquiryAttr(v.OrderInquiry)
|
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 {
|
if v.OrderPrescription != nil {
|
||||||
response = response.LoadOrderPrescriptionCode(v.OrderPrescription)
|
response = response.LoadOrderPrescriptionCode(v.OrderPrescription)
|
||||||
@ -205,12 +224,44 @@ func (r *OrderProductDto) LoadDoctorName(m *model.UserDoctor) *OrderProductDto {
|
|||||||
return r
|
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 加载问诊属性
|
// LoadOrderInquiryAttr 加载问诊属性
|
||||||
func (r *OrderProductDto) LoadOrderInquiryAttr(m *model.OrderInquiry) *OrderProductDto {
|
func (r *OrderProductDto) LoadOrderInquiryAttr(m *model.OrderInquiry) *OrderProductDto {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
r.PatientNameMask = m.PatientNameMask
|
r.PatientNameMask = m.PatientNameMask
|
||||||
r.PatientSex = m.PatientSex
|
r.PatientSex = m.PatientSex
|
||||||
r.PatientAge = m.PatientAge
|
r.PatientAge = m.PatientAge
|
||||||
|
r.TransferDoctorId = string(m.TransferDoctorId)
|
||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ type UserDoctorDto struct {
|
|||||||
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation"` // 是否平台深度合作医生(0:否 1:是)
|
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation"` // 是否平台深度合作医生(0:否 1:是)
|
||||||
IsEnterpriseDeepCooperation int `json:"is_enterprise_deep_cooperation"` // 是否企业深度合作医生(0:否 1:是)
|
IsEnterpriseDeepCooperation int `json:"is_enterprise_deep_cooperation"` // 是否企业深度合作医生(0:否 1:是)
|
||||||
IsSysDiagnoCooperation int `json:"is_sys_diagno_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"` // 分享二维码
|
QrCode string `json:"qr_code"` // 分享二维码
|
||||||
BeGoodAt string `json:"be_good_at"` // 擅长
|
BeGoodAt string `json:"be_good_at"` // 擅长
|
||||||
BriefIntroduction string `json:"brief_introduction"` // 医生简介
|
BriefIntroduction string `json:"brief_introduction"` // 医生简介
|
||||||
@ -77,6 +78,7 @@ type UserDoctorPendingDto struct {
|
|||||||
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation"` // 是否平台深度合作医生(0:否 1:是)
|
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation"` // 是否平台深度合作医生(0:否 1:是)
|
||||||
IsEnterpriseDeepCooperation int `json:"is_enterprise_deep_cooperation"` // 是否企业深度合作医生(0:否 1:是)
|
IsEnterpriseDeepCooperation int `json:"is_enterprise_deep_cooperation"` // 是否企业深度合作医生(0:否 1:是)
|
||||||
IsSysDiagnoCooperation int `json:"is_sys_diagno_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:是)
|
IsRecommend int `json:"is_recommend"` // 是否首页推荐(0:否 1:是)
|
||||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||||
@ -143,8 +145,10 @@ func GetUserDoctorDto(m *model.UserDoctor) *UserDoctorDto {
|
|||||||
PraiseRate: m.PraiseRate,
|
PraiseRate: m.PraiseRate,
|
||||||
AvgResponseTime: m.AvgResponseTime,
|
AvgResponseTime: m.AvgResponseTime,
|
||||||
NumberOfFans: m.NumberOfFans,
|
NumberOfFans: m.NumberOfFans,
|
||||||
IsPlatformDeepCooperation: m.IsPlatformDeepCooperation,
|
IsPlatformDeepCooperation: m.IsPlatformDeepCooperation,
|
||||||
IsSysDiagnoCooperation: m.IsSysDiagnoCooperation,
|
IsEnterpriseDeepCooperation: m.IsEnterpriseDeepCooperation,
|
||||||
|
IsSysDiagnoCooperation: m.IsSysDiagnoCooperation,
|
||||||
|
IsTransferPrescription: m.IsTransferPrescription,
|
||||||
QrCode: utils.AddOssDomain(m.QrCode),
|
QrCode: utils.AddOssDomain(m.QrCode),
|
||||||
BeGoodAt: m.BeGoodAt,
|
BeGoodAt: m.BeGoodAt,
|
||||||
BriefIntroduction: m.BriefIntroduction,
|
BriefIntroduction: m.BriefIntroduction,
|
||||||
@ -182,7 +186,9 @@ func GetUserDoctorListDto(m []*model.UserDoctor) []*UserDoctorDto {
|
|||||||
PraiseRate: v.PraiseRate,
|
PraiseRate: v.PraiseRate,
|
||||||
AvgResponseTime: v.AvgResponseTime,
|
AvgResponseTime: v.AvgResponseTime,
|
||||||
NumberOfFans: v.NumberOfFans,
|
NumberOfFans: v.NumberOfFans,
|
||||||
IsPlatformDeepCooperation: v.IsPlatformDeepCooperation,
|
IsPlatformDeepCooperation: v.IsPlatformDeepCooperation,
|
||||||
|
IsEnterpriseDeepCooperation: v.IsEnterpriseDeepCooperation,
|
||||||
|
IsTransferPrescription: v.IsTransferPrescription,
|
||||||
CreatedAt: v.CreatedAt,
|
CreatedAt: v.CreatedAt,
|
||||||
UpdatedAt: v.UpdatedAt,
|
UpdatedAt: v.UpdatedAt,
|
||||||
}
|
}
|
||||||
@ -241,6 +247,7 @@ func GetUserDoctorPendingDto(m *model.UserDoctor) *UserDoctorPendingDto {
|
|||||||
IsPlatformDeepCooperation: m.IsPlatformDeepCooperation,
|
IsPlatformDeepCooperation: m.IsPlatformDeepCooperation,
|
||||||
IsEnterpriseDeepCooperation: m.IsEnterpriseDeepCooperation,
|
IsEnterpriseDeepCooperation: m.IsEnterpriseDeepCooperation,
|
||||||
IsSysDiagnoCooperation: m.IsSysDiagnoCooperation,
|
IsSysDiagnoCooperation: m.IsSysDiagnoCooperation,
|
||||||
|
IsTransferPrescription: m.IsTransferPrescription,
|
||||||
IsRecommend: m.IsRecommend,
|
IsRecommend: m.IsRecommend,
|
||||||
CreatedAt: m.CreatedAt,
|
CreatedAt: m.CreatedAt,
|
||||||
UpdatedAt: m.UpdatedAt,
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gorm.io/gorm"
|
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OrderInquiry 订单-问诊表
|
// OrderInquiry 订单-问诊表
|
||||||
@ -13,6 +14,7 @@ type OrderInquiry struct {
|
|||||||
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id-患者;NOT NULL" json:"user_id"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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"`
|
PatientAge int `gorm:"column:patient_age;type:int(1);comment:患者年龄-就诊人" json:"patient_age"`
|
||||||
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
||||||
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 患者
|
TransferUserDoctor *UserDoctor `gorm:"foreignKey:TransferDoctorId;references:doctor_id" json:"transfer_user_doctor"` // 接受抄方的医生
|
||||||
|
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 患者
|
||||||
Model
|
Model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gorm.io/gorm"
|
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserDoctor 用户-医生表
|
// 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"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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:"手机号-医生/患者"`
|
Mobile string `json:"mobile" form:"mobile" label:"手机号-医生/患者"`
|
||||||
ProductName string `json:"product_name" form:"product_name" label:"药品名称"`
|
ProductName string `json:"product_name" form:"product_name" label:"药品名称"`
|
||||||
CommonName string `json:"common_name" form:"common_name" label:"药品通用名"`
|
CommonName string `json:"common_name" form:"common_name" label:"药品通用名"`
|
||||||
|
PrescriptionCode string `json:"prescription_code" form:"prescription_code" label:"处方编号"`
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CancelOrderProduct 取消药品订单
|
// CancelOrderProduct 取消药品订单
|
||||||
|
|||||||
@ -48,6 +48,7 @@ type PutUserDoctor struct {
|
|||||||
HospitalId string `json:"hospital_id" form:"hospital_id" validate:"required" label:"所属医院id"`
|
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:是)
|
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:是)
|
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:"擅长"`
|
BeGoodAt string `json:"be_good_at" form:"be_good_at" validate:"required" label:"擅长"`
|
||||||
BriefIntroduction string `json:"brief_introduction" form:"brief_introduction" validate:"required" label:"医生简介"`
|
BriefIntroduction string `json:"brief_introduction" form:"brief_introduction" validate:"required" label:"医生简介"`
|
||||||
LicenseCert []string `json:"license_cert" form:"license_cert" 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"`
|
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:是)
|
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:是)
|
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:"擅长"`
|
BeGoodAt string `json:"be_good_at" form:"be_good_at" validate:"required" label:"擅长"`
|
||||||
BriefIntroduction string `json:"brief_introduction" form:"brief_introduction" 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:"医师执业证"`
|
LicenseCert []string `json:"license_cert" form:"license_cert" validate:"required" label:"医师执业证"`
|
||||||
|
|||||||
@ -2,13 +2,14 @@ package router
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"hospital-admin-api/api/controller"
|
"hospital-admin-api/api/controller"
|
||||||
"hospital-admin-api/api/exception"
|
"hospital-admin-api/api/exception"
|
||||||
"hospital-admin-api/api/middlewares"
|
"hospital-admin-api/api/middlewares"
|
||||||
"hospital-admin-api/config"
|
"hospital-admin-api/config"
|
||||||
"hospital-admin-api/consts"
|
"hospital-admin-api/consts"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Init 初始化路由
|
// Init 初始化路由
|
||||||
@ -531,6 +532,15 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
|||||||
|
|
||||||
// 处方详情
|
// 处方详情
|
||||||
prescriptionGroup.GET("/:order_prescription_id", api.OrderPrescription.GetOrderPrescription)
|
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("", api.Export.OrderPrescription)
|
||||||
|
|
||||||
|
// 抄方的处方
|
||||||
|
prescriptionGroup.POST("/transfer", api.Export.OrderTransferPrescription)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 药品
|
// 药品
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package service
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gorm.io/gorm"
|
|
||||||
"hospital-admin-api/api/dao"
|
"hospital-admin-api/api/dao"
|
||||||
"hospital-admin-api/api/dto"
|
"hospital-admin-api/api/dto"
|
||||||
"hospital-admin-api/api/model"
|
"hospital-admin-api/api/model"
|
||||||
@ -12,6 +11,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InquiryConfigService 问诊配置
|
// InquiryConfigService 问诊配置
|
||||||
@ -372,7 +373,6 @@ func (r *DoctorInquiryConfigService) PutDoctorInquiryConfig(inquiryConfigId int6
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改医生服务设置-疑难会诊
|
// 修改医生服务设置-疑难会诊
|
||||||
if doctorInquiryConfig.InquiryType == 1 && doctorInquiryConfig.InquiryMode == 6 {
|
if doctorInquiryConfig.InquiryType == 1 && doctorInquiryConfig.InquiryMode == 6 {
|
||||||
// 获取医生服务设置-疑难会诊
|
// 获取医生服务设置-疑难会诊
|
||||||
@ -408,9 +408,7 @@ func (r *DoctorInquiryConfigService) PutDoctorInquiryConfig(inquiryConfigId int6
|
|||||||
return false, errors.New("修改失败")
|
return false, errors.New("修改失败")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tx.Commit()
|
tx.Commit()
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,6 +42,9 @@ func (b *AdminService) Login(LoginRequest requests.Login) (*dto.Login, error) {
|
|||||||
return nil, errors.New("您的账号已被禁用,请联系管理员处理")
|
return nil, errors.New("您的账号已被禁用,请联系管理员处理")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
roleDao := dao.AdminRoleDao{}
|
||||||
|
adminRole, err := roleDao.GetAdminRoleFirstById(adminUser.RoleID)
|
||||||
|
|
||||||
token := &utils.Token{
|
token := &utils.Token{
|
||||||
UserId: strconv.FormatInt(adminUser.UserID, 10),
|
UserId: strconv.FormatInt(adminUser.UserID, 10),
|
||||||
RoleId: strconv.FormatInt(adminUser.RoleID, 10),
|
RoleId: strconv.FormatInt(adminUser.RoleID, 10),
|
||||||
@ -60,6 +63,7 @@ func (b *AdminService) Login(LoginRequest requests.Login) (*dto.Login, error) {
|
|||||||
NickName: adminUser.NickName,
|
NickName: adminUser.NickName,
|
||||||
Avatar: adminUser.Avatar,
|
Avatar: adminUser.Avatar,
|
||||||
Token: jwt,
|
Token: jwt,
|
||||||
|
RoleName: adminRole.RoleName,
|
||||||
}
|
}
|
||||||
|
|
||||||
result.GetLoginFullAvatar()
|
result.GetLoginFullAvatar()
|
||||||
|
|||||||
@ -1571,13 +1571,13 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) {
|
|||||||
ConsigneeTel: v.ConsigneeTel,
|
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 {
|
// 医生电话
|
||||||
// 医生电话
|
if v.OrderInquiry.UserDoctor.User != nil {
|
||||||
data.DoctorMobile = v.UserDoctor.User.Mobile
|
data.DoctorMobile = v.OrderInquiry.UserDoctor.User.Mobile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1830,9 +1830,9 @@ func (r *ExportService) OrderPrescription(d []*model.OrderPrescription) (string,
|
|||||||
DoctorAdvice: v.DoctorAdvice,
|
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 {
|
if v.UserPharmacist != nil {
|
||||||
|
|||||||
@ -82,5 +82,15 @@ func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int6
|
|||||||
// 加载药品订单id
|
// 加载药品订单id
|
||||||
g.LoadOrderProductId(orderProduct)
|
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
|
return g, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,9 +68,24 @@ func (r *OrderProductService) GetOrderProduct(orderProductId int64) (g *dto.Orde
|
|||||||
// 加载医生数据
|
// 加载医生数据
|
||||||
g.UserDoctor = userDoctor
|
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)
|
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)
|
g.LoadOrderPrescription(orderPrescription)
|
||||||
|
|
||||||
|
|||||||
@ -175,6 +175,11 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDo
|
|||||||
userDoctorData["is_sys_diagno_cooperation"] = req.IsSysDiagnoCooperation
|
userDoctorData["is_sys_diagno_cooperation"] = req.IsSysDiagnoCooperation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理是否接受抄方
|
||||||
|
if userDoctor.IsTransferPrescription != req.IsTransferPrescription {
|
||||||
|
userDoctorData["is_transfer_prescription"] = req.IsTransferPrescription
|
||||||
|
}
|
||||||
|
|
||||||
// 是否推荐
|
// 是否推荐
|
||||||
if userDoctor.IsRecommend != req.IsRecommend {
|
if userDoctor.IsRecommend != req.IsRecommend {
|
||||||
userDoctorData["is_recommend"] = req.IsRecommend
|
userDoctorData["is_recommend"] = req.IsRecommend
|
||||||
@ -970,6 +975,7 @@ func (r *UserDoctorService) AddUserDoctor(userId string, req requests.AddUserDoc
|
|||||||
HospitalID: hospitalId,
|
HospitalID: hospitalId,
|
||||||
IsPlatformDeepCooperation: req.IsPlatformDeepCooperation,
|
IsPlatformDeepCooperation: req.IsPlatformDeepCooperation,
|
||||||
IsSysDiagnoCooperation: req.IsSysDiagnoCooperation,
|
IsSysDiagnoCooperation: req.IsSysDiagnoCooperation,
|
||||||
|
IsTransferPrescription: req.IsTransferPrescription,
|
||||||
BeGoodAt: req.BeGoodAt,
|
BeGoodAt: req.BeGoodAt,
|
||||||
BriefIntroduction: req.BriefIntroduction,
|
BriefIntroduction: req.BriefIntroduction,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user