修正返回目录
This commit is contained in:
+69
-106
@@ -5,11 +5,10 @@ import (
|
||||
"fmt"
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses/orderEvaluationResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryCouponResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryRefundResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryCaseResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryResponse"
|
||||
"hospital-admin-api/config"
|
||||
"hospital-admin-api/extend/weChat"
|
||||
@@ -272,7 +271,7 @@ func ReturnInquiryCoupon(tx *gorm.DB, orderInquiryId int64) bool {
|
||||
}
|
||||
|
||||
// GetOrderInquiry 问诊订单详情
|
||||
func (r *OrderInquiryService) GetOrderInquiry(orderInquiryId int64) (getOrderInquiryResponse *orderInquiryResponse.GetOrderInquiry, err error) {
|
||||
func (r *OrderInquiryService) GetOrderInquiry(orderInquiryId int64) (g *dto.OrderInquiryDto, err error) {
|
||||
// 获取问诊订单数据
|
||||
orderInquiryDao := dao.OrderInquiryDao{}
|
||||
orderInquiry, err := orderInquiryDao.GetOrderInquiryPreloadById(orderInquiryId)
|
||||
@@ -281,48 +280,91 @@ func (r *OrderInquiryService) GetOrderInquiry(orderInquiryId int64) (getOrderInq
|
||||
}
|
||||
|
||||
// 获取问诊订单优惠卷
|
||||
orderInquiryCoupon, err := r.GetOrderInquiryCoupon(orderInquiryId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
orderInquiryCouponDao := dao.OrderInquiryCouponDao{}
|
||||
orderInquiryCoupon, err := orderInquiryCouponDao.GetOrderInquiryCouponByOrderInquiryId(orderInquiryId)
|
||||
|
||||
// 获取问诊病例
|
||||
orderInquiryCaseService := OrderInquiryCaseService{}
|
||||
orderInquiryCase, err := orderInquiryCaseService.GetOrderInquiryCaseByOrderInquiryId(orderInquiryId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
orderInquiryCaseDao := dao.OrderInquiryCaseDao{}
|
||||
orderInquiryCase, err := orderInquiryCaseDao.GetOrderInquiryCaseByOrderInquiryId(orderInquiryId)
|
||||
if orderInquiryCase == nil {
|
||||
return nil, errors.New("数据错误,无问诊病例")
|
||||
}
|
||||
|
||||
// 获取退款数据
|
||||
orderInquiryRefund, err := r.GetOrderInquiryRefund(orderInquiryId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
orderInquiryRefundDao := dao.OrderInquiryRefundDao{}
|
||||
orderInquiryRefund, err := orderInquiryRefundDao.GetOrderInquiryRefundByOrderInquiryId(orderInquiryId)
|
||||
|
||||
// 获取订单评价
|
||||
orderEvaluation, err := r.GetOrderEvaluation(orderInquiryId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
orderEvaluationDao := dao.OrderEvaluationDao{}
|
||||
orderEvaluation, err := orderEvaluationDao.GetOrderEvaluationByOrderInquiryId(orderInquiryId)
|
||||
if orderEvaluation == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// 医生数据
|
||||
userDoctorService := UserDoctorService{}
|
||||
userDoctor, err := userDoctorService.GetOrderInquiryUserDoctor(orderInquiry.DoctorId)
|
||||
userDoctor, err := userDoctorService.GetUserDoctorById(orderInquiry.DoctorId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 处理医生id
|
||||
var doctorId string
|
||||
if orderInquiry.DoctorId != 0 {
|
||||
doctorId = fmt.Sprintf("%v", orderInquiry.DoctorId)
|
||||
// 处理返回值
|
||||
g = dto.GetOrderInquiryDto(orderInquiry)
|
||||
|
||||
// 加载医生数据
|
||||
g.UserDoctor = userDoctor
|
||||
|
||||
// 加载订单退款数据
|
||||
g.LoadOrderInquiryRefund(orderInquiryRefund)
|
||||
|
||||
// 加载问诊订单优惠卷
|
||||
g.LoadOrderInquiryCoupon(orderInquiryCoupon)
|
||||
|
||||
// 加载问诊病例
|
||||
g.LoadOrderInquiryCase(orderInquiryCase)
|
||||
|
||||
// 加载订单评价
|
||||
g.LoadOrderEvaluation(orderEvaluation)
|
||||
return g, nil
|
||||
}
|
||||
|
||||
// GetOrderInquiryCaseByOrderInquiryId 获取问诊订单病例-问诊订单
|
||||
func (r *OrderInquiryService) GetOrderInquiryCaseByOrderInquiryId(orderInquiryId int64) (u *orderInquiryCaseResponse.OrderInquiryCase, err error) {
|
||||
orderInquiryCaseDao := dao.OrderInquiryCaseDao{}
|
||||
orderInquiryCase, err := orderInquiryCaseDao.GetOrderInquiryCaseByOrderInquiryId(orderInquiryId)
|
||||
if orderInquiryCase == nil {
|
||||
return nil, errors.New("数据错误,无问诊病例")
|
||||
}
|
||||
|
||||
u = &orderInquiryCaseResponse.OrderInquiryCase{
|
||||
InquiryCaseId: strconv.FormatInt(orderInquiryCase.InquiryCaseId, 10),
|
||||
UserId: strconv.FormatInt(orderInquiryCase.UserId, 10),
|
||||
PatientId: strconv.FormatInt(orderInquiryCase.PatientId, 10),
|
||||
OrderInquiryId: strconv.FormatInt(orderInquiryCase.OrderInquiryId, 10),
|
||||
FamilyId: strconv.FormatInt(orderInquiryCase.FamilyId, 10),
|
||||
Name: orderInquiryCase.Name,
|
||||
Sex: orderInquiryCase.Sex,
|
||||
Age: orderInquiryCase.Age,
|
||||
DiseaseClassName: orderInquiryCase.DiseaseClassName,
|
||||
DiseaseDesc: orderInquiryCase.DiseaseDesc,
|
||||
}
|
||||
|
||||
return u, nil
|
||||
}
|
||||
|
||||
// GetOrderInquiryById 问诊订单详情-问诊订单id
|
||||
func (r *OrderInquiryService) GetOrderInquiryById(orderInquiryId int64) (res *orderInquiryResponse.OrderInquiry, err error) {
|
||||
// 获取问诊订单数据
|
||||
orderInquiryDao := dao.OrderInquiryDao{}
|
||||
orderInquiry, err := orderInquiryDao.GetOrderInquiryPreloadById(orderInquiryId)
|
||||
if err != nil || orderInquiry == nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
getOrderInquiryResponse = &orderInquiryResponse.GetOrderInquiry{
|
||||
res = &orderInquiryResponse.OrderInquiry{
|
||||
OrderInquiryId: strconv.FormatInt(orderInquiry.OrderInquiryId, 10),
|
||||
UserId: strconv.FormatInt(orderInquiry.UserId, 10),
|
||||
DoctorId: doctorId,
|
||||
PatientId: strconv.FormatInt(orderInquiry.PatientId, 10),
|
||||
FamilyId: strconv.FormatInt(orderInquiry.FamilyId, 10),
|
||||
InquiryType: orderInquiry.InquiryType,
|
||||
@@ -352,88 +394,9 @@ func (r *OrderInquiryService) GetOrderInquiry(orderInquiryId int64) (getOrderInq
|
||||
PatientNameMask: orderInquiry.PatientNameMask,
|
||||
PatientSex: orderInquiry.PatientSex,
|
||||
PatientAge: orderInquiry.PatientAge,
|
||||
OrderInquiryCoupon: orderInquiryCoupon,
|
||||
OrderInquiryCase: orderInquiryCase,
|
||||
OrderInquiryRefund: orderInquiryRefund,
|
||||
OrderEvaluation: orderEvaluation,
|
||||
UserDoctor: userDoctor,
|
||||
CreatedAt: orderInquiry.CreatedAt,
|
||||
UpdatedAt: orderInquiry.UpdatedAt,
|
||||
}
|
||||
|
||||
return getOrderInquiryResponse, nil
|
||||
}
|
||||
|
||||
// GetOrderInquiryCoupon 获取问诊订单优惠卷
|
||||
func (r *OrderInquiryService) GetOrderInquiryCoupon(orderInquiryId int64) (u *orderInquiryCouponResponse.OrderInquiryCoupon, err error) {
|
||||
orderInquiryCouponDao := dao.OrderInquiryCouponDao{}
|
||||
orderInquiryCoupon, err := orderInquiryCouponDao.GetOrderInquiryCouponByOrderInquiryId(orderInquiryId)
|
||||
if orderInquiryCoupon == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
u = &orderInquiryCouponResponse.OrderInquiryCoupon{
|
||||
OrderCouponId: strconv.FormatInt(orderInquiryCoupon.OrderCouponId, 10),
|
||||
OrderInquiryId: strconv.FormatInt(orderInquiryCoupon.OrderInquiryId, 10),
|
||||
UserCouponId: strconv.FormatInt(orderInquiryCoupon.UserCouponId, 10),
|
||||
CouponName: orderInquiryCoupon.CouponName,
|
||||
CouponUsePrice: orderInquiryCoupon.CouponUsePrice,
|
||||
CreatedAt: orderInquiryCoupon.CreatedAt,
|
||||
UpdatedAt: orderInquiryCoupon.UpdatedAt,
|
||||
}
|
||||
|
||||
return u, nil
|
||||
}
|
||||
|
||||
// GetOrderInquiryRefund 获取问诊订单退款数据
|
||||
func (r *OrderInquiryService) GetOrderInquiryRefund(orderInquiryId int64) (u *orderInquiryRefundResponse.OrderInquiryRefund, err error) {
|
||||
orderInquiryRefundDao := dao.OrderInquiryRefundDao{}
|
||||
orderInquiryRefund, err := orderInquiryRefundDao.GetOrderInquiryRefundByOrderInquiryId(orderInquiryId)
|
||||
if orderInquiryRefund == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
u = &orderInquiryRefundResponse.OrderInquiryRefund{
|
||||
InquiryRefundId: strconv.FormatInt(orderInquiryRefund.InquiryRefundId, 10),
|
||||
PatientId: strconv.FormatInt(orderInquiryRefund.PatientId, 10),
|
||||
OrderInquiryId: strconv.FormatInt(orderInquiryRefund.OrderInquiryId, 10),
|
||||
InquiryNo: orderInquiryRefund.InquiryNo,
|
||||
InquiryRefundNo: orderInquiryRefund.InquiryRefundNo,
|
||||
RefundId: orderInquiryRefund.RefundId,
|
||||
InquiryRefundStatus: orderInquiryRefund.InquiryRefundStatus,
|
||||
RefundTotal: orderInquiryRefund.RefundTotal,
|
||||
RefundReason: orderInquiryRefund.RefundReason,
|
||||
SuccessTime: orderInquiryRefund.SuccessTime,
|
||||
CreatedAt: orderInquiryRefund.CreatedAt,
|
||||
UpdatedAt: orderInquiryRefund.UpdatedAt,
|
||||
}
|
||||
|
||||
return u, nil
|
||||
}
|
||||
|
||||
// GetOrderEvaluation 获取问诊订单评价数据
|
||||
func (r *OrderInquiryService) GetOrderEvaluation(orderInquiryId int64) (u *orderEvaluationResponse.OrderEvaluation, err error) {
|
||||
orderEvaluationDao := dao.OrderEvaluationDao{}
|
||||
orderEvaluation, err := orderEvaluationDao.GetOrderEvaluationByOrderInquiryId(orderInquiryId)
|
||||
if orderEvaluation == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
u = &orderEvaluationResponse.OrderEvaluation{
|
||||
EvaluationId: strconv.FormatInt(orderEvaluation.EvaluationId, 10),
|
||||
DoctorId: strconv.FormatInt(orderEvaluation.DoctorId, 10),
|
||||
PatientId: strconv.FormatInt(orderEvaluation.PatientId, 10),
|
||||
OrderInquiryId: strconv.FormatInt(orderEvaluation.OrderInquiryId, 10),
|
||||
NameMask: orderEvaluation.NameMask,
|
||||
ReplyQuality: orderEvaluation.ReplyQuality,
|
||||
ServiceAttitude: orderEvaluation.ServiceAttitude,
|
||||
ReplyProgress: orderEvaluation.ReplyProgress,
|
||||
AvgScore: orderEvaluation.AvgScore,
|
||||
Type: orderEvaluation.Type,
|
||||
Content: orderEvaluation.Content,
|
||||
CreatedAt: orderEvaluation.CreatedAt,
|
||||
UpdatedAt: orderEvaluation.UpdatedAt,
|
||||
}
|
||||
|
||||
return u, nil
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses/adminResponse"
|
||||
"hospital-admin-api/extend/aliyun"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
@@ -16,7 +16,7 @@ type AdminService struct {
|
||||
}
|
||||
|
||||
// Login 登陆
|
||||
func (b *AdminService) Login(LoginRequest requests.Login) (*adminResponse.Login, error) {
|
||||
func (b *AdminService) Login(LoginRequest requests.Login) (*dto.Login, error) {
|
||||
// 获取用户信息
|
||||
AdminUserDao := dao.AdminUserDao{}
|
||||
adminUser, err := AdminUserDao.GetAdminUserFirstByAccess(LoginRequest.Access)
|
||||
@@ -55,14 +55,14 @@ func (b *AdminService) Login(LoginRequest requests.Login) (*adminResponse.Login,
|
||||
return nil, errors.New("登陆失败")
|
||||
}
|
||||
|
||||
result := &adminResponse.Login{
|
||||
result := &dto.Login{
|
||||
UserId: strconv.FormatInt(adminUser.UserID, 10),
|
||||
NickName: adminUser.NickName,
|
||||
Avatar: adminUser.Avatar,
|
||||
Token: jwt,
|
||||
}
|
||||
|
||||
result.GetFullAvatar()
|
||||
result.GetLoginFullAvatar()
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
+10
-78
@@ -2,12 +2,8 @@ package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/responses/orderInquiryCaseResponse"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
"strings"
|
||||
"hospital-admin-api/api/dto"
|
||||
)
|
||||
|
||||
// CaseService 病例
|
||||
@@ -15,7 +11,7 @@ type CaseService struct {
|
||||
}
|
||||
|
||||
// GetOrderInquiryCaseByInquiryCaseId 获取病例-问诊订单
|
||||
func (r *CaseService) GetOrderInquiryCaseByInquiryCaseId(inquiryCaseId int64) (u *orderInquiryCaseResponse.OrderInquiryCase, err error) {
|
||||
func (r *CaseService) GetOrderInquiryCaseByInquiryCaseId(inquiryCaseId int64) (g *dto.OrderInquiryCaseDto, err error) {
|
||||
orderInquiryCaseDao := dao.OrderInquiryCaseDao{}
|
||||
orderInquiryCase, err := orderInquiryCaseDao.GetOrderInquiryCaseById(inquiryCaseId)
|
||||
if orderInquiryCase == nil {
|
||||
@@ -35,80 +31,16 @@ func (r *CaseService) GetOrderInquiryCaseByInquiryCaseId(inquiryCaseId int64) (u
|
||||
inquiryCaseProducts, err := inquiryCaseProductDao.GetInquiryCaseProductListByInquiryCaseId(orderInquiryCase.InquiryCaseId)
|
||||
|
||||
// 处理返回数据
|
||||
u = &orderInquiryCaseResponse.OrderInquiryCase{
|
||||
InquiryCaseId: strconv.FormatInt(orderInquiryCase.InquiryCaseId, 10),
|
||||
UserId: strconv.FormatInt(orderInquiryCase.UserId, 10),
|
||||
PatientId: strconv.FormatInt(orderInquiryCase.PatientId, 10),
|
||||
OrderInquiryId: strconv.FormatInt(orderInquiryCase.OrderInquiryId, 10),
|
||||
FamilyId: strconv.FormatInt(orderInquiryCase.FamilyId, 10),
|
||||
Relation: orderInquiryCase.Relation,
|
||||
Status: orderInquiryCase.Status,
|
||||
Name: orderInquiryCase.Name,
|
||||
Sex: orderInquiryCase.Sex,
|
||||
Age: orderInquiryCase.Age,
|
||||
Height: orderInquiryCase.Height,
|
||||
Weight: orderInquiryCase.Weight,
|
||||
DiseaseClassId: strconv.FormatInt(orderInquiryCase.DiseaseClassId, 10),
|
||||
DiseaseClassName: orderInquiryCase.DiseaseClassName,
|
||||
DiagnosisDate: orderInquiryCase.DiagnosisDate,
|
||||
DiseaseDesc: orderInquiryCase.DiseaseDesc,
|
||||
IsAllergyHistory: orderInquiryCase.IsAllergyHistory,
|
||||
AllergyHistory: orderInquiryCase.AllergyHistory,
|
||||
IsFamilyHistory: orderInquiryCase.IsFamilyHistory,
|
||||
FamilyHistory: orderInquiryCase.FamilyHistory,
|
||||
IsPregnant: orderInquiryCase.IsPregnant,
|
||||
Pregnant: orderInquiryCase.Pregnant,
|
||||
IsTaboo: orderInquiryCase.IsTaboo,
|
||||
CreatedAt: orderInquiryCase.CreatedAt,
|
||||
UpdatedAt: orderInquiryCase.UpdatedAt,
|
||||
}
|
||||
g = dto.GetOrderInquiryCaseDto(orderInquiryCase)
|
||||
|
||||
if patientFamilyHealth != nil {
|
||||
u.DiagnosisHospital = patientFamilyHealth.DiagnosisHospital
|
||||
u.IsTakeMedicine = patientFamilyHealth.IsTakeMedicine
|
||||
u.DrugsName = patientFamilyHealth.DrugsName
|
||||
}
|
||||
// 加载健康属性
|
||||
g.LoadPatientFamilyHealthAttr(patientFamilyHealth)
|
||||
|
||||
if patientFamilyPersonal != nil {
|
||||
u.DrinkWineStatus = patientFamilyPersonal.DrinkWineStatus
|
||||
u.SmokeStatus = patientFamilyPersonal.SmokeStatus
|
||||
u.ChemicalCompoundStatus = patientFamilyPersonal.ChemicalCompoundStatus
|
||||
u.ChemicalCompoundDescribe = patientFamilyPersonal.ChemicalCompoundDescribe
|
||||
u.IsOperation = patientFamilyPersonal.IsOperation
|
||||
u.Operation = patientFamilyPersonal.Operation
|
||||
}
|
||||
// 加载个人情况属性
|
||||
g.LoadPatientFamilyPersonalAttr(patientFamilyPersonal)
|
||||
|
||||
// 处理复诊凭证
|
||||
var diagnoseImages []*string
|
||||
if orderInquiryCase.DiagnoseImages != "" {
|
||||
diagnoseImages := strings.Split(orderInquiryCase.DiagnoseImages, ",")
|
||||
// 加载用药意向
|
||||
g.LoadInquiryCaseProduct(inquiryCaseProducts)
|
||||
|
||||
for i, image := range diagnoseImages {
|
||||
diagnoseImages[i] = utils.AddOssDomain(image)
|
||||
}
|
||||
}
|
||||
|
||||
u.DiagnoseImages = diagnoseImages
|
||||
|
||||
// 处理用药意向
|
||||
var product []*string
|
||||
if inquiryCaseProducts != nil {
|
||||
for _, inquiryCaseProduct := range inquiryCaseProducts {
|
||||
// 获取商品数据
|
||||
productDao := dao.ProductDao{}
|
||||
productData, err := productDao.GetProductById(inquiryCaseProduct.ProductId)
|
||||
if err != nil {
|
||||
return nil, errors.New("数据错误")
|
||||
}
|
||||
|
||||
caseProductNum := fmt.Sprintf("%d", inquiryCaseProduct.CaseProductNum)
|
||||
productName := productData.ProductName + productData.ProductSpec + "(" + caseProductNum + productData.PackagingUnit + ")"
|
||||
|
||||
product = append(product, &productName)
|
||||
}
|
||||
}
|
||||
|
||||
u.Product = product
|
||||
|
||||
return u, nil
|
||||
return g, nil
|
||||
}
|
||||
|
||||
+5
-5
@@ -3,9 +3,9 @@ package service
|
||||
import (
|
||||
"errors"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses/deptResponse"
|
||||
"hospital-admin-api/global"
|
||||
"strconv"
|
||||
)
|
||||
@@ -14,7 +14,7 @@ type DeptService struct {
|
||||
}
|
||||
|
||||
// GetDeptList 获取部门列表
|
||||
func (r *DeptService) GetDeptList() ([]*deptResponse.GetDeptList, error) {
|
||||
func (r *DeptService) GetDeptList() ([]*dto.AdminDeptDto, error) {
|
||||
// 获取全部部门
|
||||
adminDeptDao := dao.AdminDeptDao{}
|
||||
|
||||
@@ -25,11 +25,11 @@ func (r *DeptService) GetDeptList() ([]*deptResponse.GetDeptList, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
deptMap := make(map[int64]*deptResponse.GetDeptList)
|
||||
var deptTree []*deptResponse.GetDeptList
|
||||
deptMap := make(map[int64]*dto.AdminDeptDto)
|
||||
var deptTree []*dto.AdminDeptDto
|
||||
|
||||
for _, dept := range adminDept {
|
||||
node := &deptResponse.GetDeptList{
|
||||
node := &dto.AdminDeptDto{
|
||||
DeptId: strconv.FormatInt(dept.DeptId, 10),
|
||||
ParentId: strconv.FormatInt(dept.ParentId, 10),
|
||||
DeptName: dept.DeptName,
|
||||
|
||||
+5
-5
@@ -4,9 +4,9 @@ import (
|
||||
"errors"
|
||||
"github.com/gin-gonic/gin"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses/menuResponse"
|
||||
"hospital-admin-api/global"
|
||||
"strconv"
|
||||
)
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
type MenuService struct{}
|
||||
|
||||
// GetMenuList 获取菜单列表
|
||||
func (r *MenuService) GetMenuList() ([]*menuResponse.GetMenuList, error) {
|
||||
func (r *MenuService) GetMenuList() ([]*dto.AdminMenuDto, error) {
|
||||
// 获取全部菜单
|
||||
AdminMenuDao := dao.AdminMenuDao{}
|
||||
adminMenu, _ := AdminMenuDao.GetAdminMenuListSortOrderNum()
|
||||
@@ -22,11 +22,11 @@ func (r *MenuService) GetMenuList() ([]*menuResponse.GetMenuList, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
menuMap := make(map[int64]*menuResponse.GetMenuList)
|
||||
var menuTree []*menuResponse.GetMenuList
|
||||
menuMap := make(map[int64]*dto.AdminMenuDto)
|
||||
var menuTree []*dto.AdminMenuDto
|
||||
|
||||
for _, menu := range adminMenu {
|
||||
node := &menuResponse.GetMenuList{
|
||||
node := &dto.AdminMenuDto{
|
||||
MenuId: strconv.FormatInt(menu.MenuId, 10),
|
||||
MenuName: menu.MenuName,
|
||||
MenuTitle: menu.MenuTitle,
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/responses/orderInquiryCaseResponse"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type OrderInquiryCaseService struct {
|
||||
}
|
||||
|
||||
// GetOrderInquiryCaseByOrderInquiryId 获取问诊订单病例-问诊订单
|
||||
func (r *OrderInquiryCaseService) GetOrderInquiryCaseByOrderInquiryId(orderInquiryId int64) (u *orderInquiryCaseResponse.OrderInquiryCase, err error) {
|
||||
orderInquiryCaseDao := dao.OrderInquiryCaseDao{}
|
||||
orderInquiryCase, err := orderInquiryCaseDao.GetOrderInquiryCaseByOrderInquiryId(orderInquiryId)
|
||||
if orderInquiryCase == nil {
|
||||
return nil, errors.New("数据错误,无问诊病例")
|
||||
}
|
||||
|
||||
u = &orderInquiryCaseResponse.OrderInquiryCase{
|
||||
InquiryCaseId: strconv.FormatInt(orderInquiryCase.InquiryCaseId, 10),
|
||||
UserId: strconv.FormatInt(orderInquiryCase.UserId, 10),
|
||||
PatientId: strconv.FormatInt(orderInquiryCase.PatientId, 10),
|
||||
OrderInquiryId: strconv.FormatInt(orderInquiryCase.OrderInquiryId, 10),
|
||||
FamilyId: strconv.FormatInt(orderInquiryCase.FamilyId, 10),
|
||||
Name: orderInquiryCase.Name,
|
||||
Sex: orderInquiryCase.Sex,
|
||||
Age: orderInquiryCase.Age,
|
||||
DiseaseClassName: orderInquiryCase.DiseaseClassName,
|
||||
DiseaseDesc: orderInquiryCase.DiseaseDesc,
|
||||
}
|
||||
|
||||
return u, nil
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/responses/orderPrescriptionIcdResponse"
|
||||
"hospital-admin-api/api/responses/orderPrescriptionProductResponse"
|
||||
"hospital-admin-api/api/responses/orderPrescriptionResponse"
|
||||
)
|
||||
|
||||
@@ -47,3 +51,124 @@ func (r *OrderPrescriptionService) GetOrderPrescriptionById(OrderPrescriptionId
|
||||
}
|
||||
return u, nil
|
||||
}
|
||||
|
||||
// GetOrderPrescription 处方详情
|
||||
func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int64) (getOrderPrescriptionResponse *orderPrescriptionResponse.GetOrderPrescription, err error) {
|
||||
orderPrescriptionDao := dao.OrderPrescriptionDao{}
|
||||
orderPrescription, err := orderPrescriptionDao.GetById(OrderPrescriptionId)
|
||||
if orderPrescription == nil {
|
||||
return nil, errors.New("处方错误")
|
||||
}
|
||||
|
||||
// 获取处方关联疾病数据
|
||||
orderPrescriptionIcds, err := r.GetOrderPrescriptionIcdByOrderPrescriptionId(OrderPrescriptionId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
fmt.Println(orderPrescriptionIcds)
|
||||
// 获取问诊病例
|
||||
orderInquiryService := OrderInquiryService{}
|
||||
orderInquiryCase, err := orderInquiryService.GetOrderInquiryCaseByOrderInquiryId(orderPrescription.OrderInquiryId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
fmt.Println(orderInquiryCase)
|
||||
|
||||
// 获取处方关联问诊数据
|
||||
orderInquiry, err := orderInquiryService.GetOrderInquiryById(orderPrescription.OrderInquiryId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
fmt.Println(orderInquiry)
|
||||
|
||||
// 获取处方商品数据
|
||||
orderPrescriptionProducts, err := r.GetOrderPrescriptionProductByOrderPrescriptionId(OrderPrescriptionId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
fmt.Println(orderPrescriptionProducts)
|
||||
|
||||
// 获取医生数据
|
||||
userDoctorService := UserDoctorService{}
|
||||
userDoctor, err := userDoctorService.GetUserDoctorById(orderPrescription.DoctorId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
fmt.Println(userDoctor)
|
||||
|
||||
// 获取药师数据
|
||||
|
||||
result := &orderPrescriptionResponse.GetOrderPrescription{
|
||||
|
||||
CreatedAt: model.LocalTime{},
|
||||
UpdatedAt: model.LocalTime{},
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetOrderPrescriptionIcdByOrderPrescriptionId 获取处方关联疾病数据-处方id
|
||||
func (r *OrderPrescriptionService) GetOrderPrescriptionIcdByOrderPrescriptionId(OrderPrescriptionId int64) (res *orderPrescriptionIcdResponse.OrderPrescriptionIcd, err error) {
|
||||
orderPrescriptionIcdDao := dao.OrderPrescriptionIcdDao{}
|
||||
orderPrescriptionIcd, err := orderPrescriptionIcdDao.GetOrderPrescriptionIcdById(OrderPrescriptionId)
|
||||
if orderPrescriptionIcd == nil {
|
||||
return nil, errors.New("处方病例错误")
|
||||
}
|
||||
|
||||
result := &orderPrescriptionIcdResponse.OrderPrescriptionIcd{
|
||||
PrescriptionIcdId: fmt.Sprintf("%d", orderPrescriptionIcd.PrescriptionIcdId),
|
||||
OrderPrescriptionId: fmt.Sprintf("%d", orderPrescriptionIcd.OrderPrescriptionId),
|
||||
IcdId: fmt.Sprintf("%d", orderPrescriptionIcd.IcdId),
|
||||
IcdName: orderPrescriptionIcd.IcdName,
|
||||
IcdCode: orderPrescriptionIcd.IcdCode,
|
||||
CreatedAt: orderPrescriptionIcd.CreatedAt,
|
||||
UpdatedAt: orderPrescriptionIcd.UpdatedAt,
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetOrderPrescriptionProductByOrderPrescriptionId 获取处方关联商品数据-处方id
|
||||
func (r *OrderPrescriptionService) GetOrderPrescriptionProductByOrderPrescriptionId(orderPrescriptionId int64) (res []*orderPrescriptionProductResponse.OrderPrescriptionProduct, err error) {
|
||||
orderPrescriptionProductDao := dao.OrderPrescriptionProductDao{}
|
||||
orderPrescriptionProducts, err := orderPrescriptionProductDao.GetOrderPrescriptionProductListByOrderPrescriptionId(orderPrescriptionId)
|
||||
if err != nil {
|
||||
return nil, errors.New("数据错误,无处方药品数据")
|
||||
}
|
||||
|
||||
if len(orderPrescriptionProducts) == 0 {
|
||||
return nil, errors.New("数据错误,无处方药品数据")
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
items := make([]*orderPrescriptionProductResponse.OrderPrescriptionProduct, len(orderPrescriptionProducts))
|
||||
|
||||
if len(orderPrescriptionProducts) > 0 {
|
||||
for i, v := range orderPrescriptionProducts {
|
||||
// 将原始结构体转换为新结构体
|
||||
item := &orderPrescriptionProductResponse.OrderPrescriptionProduct{
|
||||
PrescriptionProductId: fmt.Sprintf("%d", v.OrderPrescriptionId),
|
||||
OrderPrescriptionId: fmt.Sprintf("%d", v.OrderPrescriptionId),
|
||||
ProductId: fmt.Sprintf("%d", v.ProductId),
|
||||
UseStatus: v.UseStatus,
|
||||
PrescriptionProductNum: v.PrescriptionProductNum,
|
||||
ProductName: v.ProductName,
|
||||
ProductSpec: v.ProductSpec,
|
||||
LicenseNumber: v.LicenseNumber,
|
||||
Manufacturer: v.Manufacturer,
|
||||
SingleUnit: v.SingleUnit,
|
||||
SingleUse: v.SingleUse,
|
||||
PackagingUnit: v.PackagingUnit,
|
||||
FrequencyUse: v.FrequencyUse,
|
||||
AvailableDays: v.AvailableDays,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
items[i] = item
|
||||
}
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
+39
-75
@@ -2,11 +2,10 @@ package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses/orderProductResponse"
|
||||
"hospital-admin-api/config"
|
||||
"hospital-admin-api/extend/weChat"
|
||||
"hospital-admin-api/global"
|
||||
@@ -18,7 +17,7 @@ type OrderProductService struct {
|
||||
}
|
||||
|
||||
// GetOrderProduct 药品订单详情
|
||||
func (r *OrderProductService) GetOrderProduct(orderProductId int64) (getOrderProductResponse *orderProductResponse.GetOrderProduct, err error) {
|
||||
func (r *OrderProductService) GetOrderProduct(orderProductId int64) (g *dto.OrderProductDto, err error) {
|
||||
// 获取药品订单数据
|
||||
orderProductDao := dao.OrderProductDao{}
|
||||
orderProduct, err := orderProductDao.GetOrderProductPreloadById(orderProductId)
|
||||
@@ -27,95 +26,60 @@ func (r *OrderProductService) GetOrderProduct(orderProductId int64) (getOrderPro
|
||||
}
|
||||
|
||||
// 获取退款数据
|
||||
orderProductRefundService := OrderProductRefundService{}
|
||||
orderProductRefund, err := orderProductRefundService.GetOrderProductRefundByOrderProductId(orderProductId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
orderProductRefundDao := dao.OrderProductRefundDao{}
|
||||
orderProductRefund, err := orderProductRefundDao.GetOrderProductRefundByOrderProductId(orderProductId)
|
||||
|
||||
// 获取商品数据
|
||||
orderProductItemService := OrderProductItemService{}
|
||||
orderProductItem, err := orderProductItemService.GetOrderProductItemByOrderProductId(orderProductId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
orderProductItemDao := dao.OrderProductItemDao{}
|
||||
orderProductItems, err := orderProductItemDao.GetOrderProductItemByOrderProductId(orderProductId)
|
||||
if err != nil || len(orderProductItems) == 0 {
|
||||
return nil, errors.New("数据错误,无药品数据")
|
||||
}
|
||||
|
||||
// 获取物流数据
|
||||
orderProductLogisticsService := OrderProductLogisticsService{}
|
||||
orderProductLogistics, err := orderProductLogisticsService.GetOrderProductLogisticsByOrderProductId(orderProductId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
orderProductLogisticsDao := dao.OrderProductLogisticsDao{}
|
||||
orderProductLogistics, err := orderProductLogisticsDao.GetOrderProductLogisticsByOrderProductId(orderProductId)
|
||||
|
||||
// 获取处方数据
|
||||
orderPrescriptionService := OrderPrescriptionService{}
|
||||
orderPrescription, err := orderPrescriptionService.GetOrderPrescriptionById(orderProduct.OrderPrescriptionId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
orderPrescriptionDao := dao.OrderPrescriptionDao{}
|
||||
orderPrescription, err := orderPrescriptionDao.GetById(orderProduct.OrderPrescriptionId)
|
||||
|
||||
// 获取问诊病例
|
||||
orderInquiryCaseService := OrderInquiryCaseService{}
|
||||
orderInquiryCase, err := orderInquiryCaseService.GetOrderInquiryCaseByOrderInquiryId(orderProduct.OrderInquiryId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
orderInquiryCaseDao := dao.OrderInquiryCaseDao{}
|
||||
orderInquiryCase, err := orderInquiryCaseDao.GetOrderInquiryCaseByOrderInquiryId(orderProduct.OrderInquiryId)
|
||||
if orderInquiryCase == nil {
|
||||
return nil, errors.New("数据错误,无问诊病例")
|
||||
}
|
||||
|
||||
// 医生数据
|
||||
userDoctorService := UserDoctorService{}
|
||||
userDoctor, err := userDoctorService.GetOrderInquiryUserDoctor(orderProduct.DoctorId)
|
||||
userDoctor, err := userDoctorService.GetUserDoctorById(orderProduct.DoctorId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
getOrderProductResponse = &orderProductResponse.GetOrderProduct{
|
||||
OrderProductId: fmt.Sprintf("%v", orderProduct.OrderProductId),
|
||||
OrderInquiryId: fmt.Sprintf("%v", orderProduct.OrderInquiryId),
|
||||
OrderPrescriptionId: fmt.Sprintf("%v", orderProduct.OrderPrescriptionId),
|
||||
DoctorId: fmt.Sprintf("%v", orderProduct.DoctorId),
|
||||
PatientId: fmt.Sprintf("%v", orderProduct.PatientId),
|
||||
FamilyId: fmt.Sprintf("%v", orderProduct.FamilyId),
|
||||
OrderProductNo: orderProduct.OrderProductNo,
|
||||
EscrowTradeNo: orderProduct.EscrowTradeNo,
|
||||
OrderProductStatus: orderProduct.OrderProductStatus,
|
||||
PayChannel: orderProduct.PayChannel,
|
||||
PayStatus: orderProduct.PayStatus,
|
||||
CancelReason: orderProduct.CancelReason,
|
||||
AmountTotal: orderProduct.AmountTotal,
|
||||
PaymentAmountTotal: orderProduct.PaymentAmountTotal,
|
||||
LogisticsFee: orderProduct.LogisticsFee,
|
||||
LogisticsNo: orderProduct.LogisticsNo,
|
||||
LogisticsCompanyCode: orderProduct.LogisticsCompanyCode,
|
||||
DeliveryTime: orderProduct.DeliveryTime,
|
||||
PayTime: orderProduct.PayTime,
|
||||
Remarks: orderProduct.Remarks,
|
||||
RefundStatus: orderProduct.RefundStatus,
|
||||
CancelTime: orderProduct.CancelTime,
|
||||
CancelRemarks: orderProduct.CancelRemarks,
|
||||
ReportPreStatus: orderProduct.ReportPreStatus,
|
||||
ReportPreTime: orderProduct.ReportPreTime,
|
||||
ReportPreFailReason: orderProduct.ReportPreFailReason,
|
||||
ProvinceId: orderProduct.ProvinceId,
|
||||
Province: orderProduct.Province,
|
||||
CityId: orderProduct.CityId,
|
||||
City: orderProduct.City,
|
||||
CountyId: orderProduct.CountyId,
|
||||
County: orderProduct.County,
|
||||
AddressMask: orderProduct.AddressMask,
|
||||
ConsigneeNameMask: orderProduct.ConsigneeNameMask,
|
||||
ConsigneeTelMask: orderProduct.ConsigneeTelMask,
|
||||
CreatedAt: orderProduct.CreatedAt,
|
||||
UpdatedAt: orderProduct.UpdatedAt,
|
||||
OrderProductRefund: orderProductRefund,
|
||||
OrderProductItem: orderProductItem,
|
||||
OrderProductLogistics: orderProductLogistics,
|
||||
UserDoctor: userDoctor,
|
||||
OrderPrescription: orderPrescription,
|
||||
OrderInquiryCase: orderInquiryCase,
|
||||
}
|
||||
g = dto.GetOrderProductDto(orderProduct)
|
||||
|
||||
return getOrderProductResponse, nil
|
||||
// 加载医生数据
|
||||
g.UserDoctor = userDoctor
|
||||
|
||||
// 加载问诊病例
|
||||
g.LoadOrderInquiryCase(orderInquiryCase)
|
||||
|
||||
// 加载处方数据
|
||||
g.LoadOrderPrescription(orderPrescription)
|
||||
|
||||
// 加载物流数据
|
||||
g.LoadOrderProductLogistics(orderProductLogistics)
|
||||
|
||||
// 加载商品数据
|
||||
g.LoadOrderProductItem(orderProductItems)
|
||||
|
||||
// 加载退款数据
|
||||
g.LoadOrderProductRefund(orderProductRefund)
|
||||
|
||||
return g, nil
|
||||
}
|
||||
|
||||
// CancelOrderProduct 取消药品订单
|
||||
@@ -305,7 +269,7 @@ func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct
|
||||
}
|
||||
|
||||
// GetOrderProductConsignee 获取药品订单收货人数据
|
||||
func (r *OrderProductService) GetOrderProductConsignee(orderProductId int64) (*orderProductResponse.GetOrderProductConsignee, error) {
|
||||
func (r *OrderProductService) GetOrderProductConsignee(orderProductId int64) (*dto.OrderProductConsigneeDto, error) {
|
||||
// 获取药品订单数据
|
||||
orderProductDao := dao.OrderProductDao{}
|
||||
orderProduct, err := orderProductDao.GetOrderProductById(orderProductId)
|
||||
@@ -314,7 +278,7 @@ func (r *OrderProductService) GetOrderProductConsignee(orderProductId int64) (*o
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
u := orderProductResponse.GetOrderProductConsigneeResponse(orderProduct)
|
||||
u := dto.GetOrderProductConsigneeDtoDto(orderProduct)
|
||||
|
||||
return u, nil
|
||||
}
|
||||
|
||||
@@ -4,10 +4,8 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/responses/patientFamilyResponse"
|
||||
"hospital-admin-api/api/responses/userResponse"
|
||||
"hospital-admin-api/utils"
|
||||
)
|
||||
|
||||
type PatientFamilyService struct {
|
||||
@@ -69,7 +67,7 @@ func (r *PatientFamilyService) GetPatientFamilyListByPatientId(patientId int64)
|
||||
}
|
||||
|
||||
// GetPatientFamily 家庭成员详情
|
||||
func (r *PatientFamilyService) GetPatientFamily(familyId int64) (getPatientFamilyResponse *patientFamilyResponse.GetPatientFamily, err error) {
|
||||
func (r *PatientFamilyService) GetPatientFamily(familyId int64) (g *dto.PatientFamilyDto, err error) {
|
||||
patientFamilyDao := dao.PatientFamilyDao{}
|
||||
patientFamily, err := patientFamilyDao.GetPatientFamilyById(familyId)
|
||||
if err != nil || patientFamily == nil {
|
||||
@@ -90,45 +88,11 @@ func (r *PatientFamilyService) GetPatientFamily(familyId int64) (getPatientFamil
|
||||
return nil, errors.New("用户错误")
|
||||
}
|
||||
|
||||
var userData *userResponse.User
|
||||
if userPatient.User != nil {
|
||||
userData = userResponse.UserResponse(user)
|
||||
// 处理返回数据
|
||||
g = dto.GetPatientFamilyDto(patientFamily)
|
||||
|
||||
// 加密患者手机号
|
||||
userData.Mobile = utils.MaskPhoneStr(userData.Mobile)
|
||||
userData.WxMobile = utils.MaskPhoneStr(userData.WxMobile)
|
||||
}
|
||||
// 加载用户数据-加密
|
||||
g.LoadMaskUser(user)
|
||||
|
||||
getPatientFamilyResponse = &patientFamilyResponse.GetPatientFamily{
|
||||
FamilyId: fmt.Sprintf("%d", patientFamily.FamilyId),
|
||||
PatientId: fmt.Sprintf("%d", patientFamily.PatientId),
|
||||
Relation: patientFamily.Relation,
|
||||
Status: &patientFamily.Status,
|
||||
IsDefault: &patientFamily.IsDefault,
|
||||
CardName: patientFamily.CardName,
|
||||
CardNameMask: patientFamily.CardNameMask,
|
||||
MobileMask: patientFamily.MobileMask,
|
||||
Type: &patientFamily.Type,
|
||||
IdNumberMask: patientFamily.IdNumberMask,
|
||||
Sex: &patientFamily.Sex,
|
||||
Age: patientFamily.Age,
|
||||
ProvinceId: fmt.Sprintf("%d", patientFamily.ProvinceId),
|
||||
Province: patientFamily.Province,
|
||||
CityId: fmt.Sprintf("%d", patientFamily.CityId),
|
||||
City: patientFamily.City,
|
||||
CountyId: fmt.Sprintf("%d", patientFamily.CountyId),
|
||||
County: patientFamily.County,
|
||||
Height: patientFamily.Height,
|
||||
Weight: patientFamily.Weight,
|
||||
MaritalStatus: &patientFamily.MaritalStatus,
|
||||
NationId: fmt.Sprintf("%d", patientFamily.NationId),
|
||||
NationName: patientFamily.NationName,
|
||||
JobId: fmt.Sprintf("%d", patientFamily.JobId),
|
||||
JobName: patientFamily.JobName,
|
||||
User: userData,
|
||||
CreatedAt: model.LocalTime{},
|
||||
UpdatedAt: model.LocalTime{},
|
||||
}
|
||||
|
||||
return getPatientFamilyResponse, nil
|
||||
return g, nil
|
||||
}
|
||||
|
||||
+7
-7
@@ -4,9 +4,9 @@ import (
|
||||
"errors"
|
||||
"github.com/gin-gonic/gin"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses/roleResponse"
|
||||
"hospital-admin-api/global"
|
||||
"strconv"
|
||||
)
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
type RoleService struct{}
|
||||
|
||||
// GetRoleMenuList 获取角色菜单
|
||||
func (r *RoleService) GetRoleMenuList(roleId int64, isAdmin bool) ([]*roleResponse.GetRoleMenuList, error) {
|
||||
func (r *RoleService) GetRoleMenuList(roleId int64, isAdmin bool) ([]*dto.AdminRoleMenuDto, error) {
|
||||
// 获取角色菜单
|
||||
adminRoleMenuDao := dao.AdminRoleMenuDao{}
|
||||
adminMenuDao := dao.AdminMenuDao{}
|
||||
@@ -41,7 +41,7 @@ func (r *RoleService) GetRoleMenuList(roleId int64, isAdmin bool) ([]*roleRespon
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var getRoleMenuListResponse []*roleResponse.GetRoleMenuList
|
||||
var getRoleMenuListResponse []*dto.AdminRoleMenuDto
|
||||
|
||||
if len(menuIDs) > 0 {
|
||||
// 构建菜单树
|
||||
@@ -81,15 +81,15 @@ func (r *RoleService) GetRoleMenuButtonList(roleId int64) ([]string, error) {
|
||||
}
|
||||
|
||||
// 获取角色菜单-构建菜单树
|
||||
func buildMenuTree(menuIds []int64, menuData []*model.AdminMenu) []*roleResponse.GetRoleMenuList {
|
||||
menuMap := make(map[int64]*roleResponse.GetRoleMenuList)
|
||||
rootNodes := make([]*roleResponse.GetRoleMenuList, 0)
|
||||
func buildMenuTree(menuIds []int64, menuData []*model.AdminMenu) []*dto.AdminRoleMenuDto {
|
||||
menuMap := make(map[int64]*dto.AdminRoleMenuDto)
|
||||
rootNodes := make([]*dto.AdminRoleMenuDto, 0)
|
||||
|
||||
// 构建菜单映射
|
||||
for _, menu := range menuData {
|
||||
for _, v := range menuIds {
|
||||
if v == menu.MenuId {
|
||||
node := &roleResponse.GetRoleMenuList{
|
||||
node := &dto.AdminRoleMenuDto{
|
||||
MenuId: strconv.FormatInt(menu.MenuId, 10),
|
||||
MenuName: menu.MenuName,
|
||||
MenuTitle: menu.MenuTitle,
|
||||
|
||||
+62
-251
@@ -3,14 +3,9 @@ package service
|
||||
import (
|
||||
"errors"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses/doctorBankCardResponse"
|
||||
"hospital-admin-api/api/responses/doctorExpertiseResponse"
|
||||
"hospital-admin-api/api/responses/hospitalResponse"
|
||||
"hospital-admin-api/api/responses/userDoctorInfoResponse"
|
||||
"hospital-admin-api/api/responses/userDoctorResponse"
|
||||
"hospital-admin-api/api/responses/userResponse"
|
||||
"hospital-admin-api/config"
|
||||
"hospital-admin-api/extend/ca"
|
||||
"hospital-admin-api/extend/tencentIm"
|
||||
@@ -26,7 +21,7 @@ type UserDoctorService struct {
|
||||
}
|
||||
|
||||
// GetUserDoctor 医生详情
|
||||
func (r *UserDoctorService) GetUserDoctor(doctorId int64) (getUserDoctorResponse *userDoctorResponse.GetUserDoctor, err error) {
|
||||
func (r *UserDoctorService) GetUserDoctor(doctorId int64) (getUserDoctorResponse *dto.UserDoctorDto, err error) {
|
||||
// 获取医生数据
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDoctor, err := userDoctorDao.GetUserDoctorPreloadById(doctorId)
|
||||
@@ -43,69 +38,29 @@ func (r *UserDoctorService) GetUserDoctor(doctorId int64) (getUserDoctorResponse
|
||||
}
|
||||
|
||||
// 获取医生银行卡
|
||||
doctorBankCard, err := userDoctorService.GetUserDoctorBankByDoctorId(doctorId)
|
||||
if err != nil {
|
||||
doctorBankCardDao := dao.DoctorBankCardDao{}
|
||||
doctorBankCard, err := doctorBankCardDao.GetDoctorBankCardByDoctorId(doctorId)
|
||||
if err != nil && doctorBankCard == nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
var userDoctorInfo *userDoctorInfoResponse.UserDoctorInfo
|
||||
if userDoctor.UserDoctorInfo != nil {
|
||||
userDoctorInfo = userDoctorInfoResponse.UserDoctorInfoResponse(userDoctor.UserDoctorInfo)
|
||||
}
|
||||
getUserDoctorResponse = dto.GetUserDoctorDto(userDoctor)
|
||||
|
||||
// 医院
|
||||
var hospital *hospitalResponse.Hospital
|
||||
if userDoctor.Hospital != nil {
|
||||
hospital = hospitalResponse.HospitalResponse(userDoctor.Hospital)
|
||||
}
|
||||
// 加载用户
|
||||
getUserDoctorResponse.LoadUser(userDoctor.User)
|
||||
|
||||
// 用户
|
||||
var user *userResponse.User
|
||||
if userDoctor.User != nil {
|
||||
user = userResponse.UserResponse(userDoctor.User)
|
||||
}
|
||||
// 加载医院
|
||||
getUserDoctorResponse.LoadHospital(userDoctor.Hospital)
|
||||
|
||||
getUserDoctorResponse = &userDoctorResponse.GetUserDoctor{
|
||||
DoctorID: strconv.Itoa(int(userDoctor.DoctorId)),
|
||||
UserID: strconv.Itoa(int(userDoctor.UserId)),
|
||||
UserName: userDoctor.UserName,
|
||||
Status: userDoctor.Status,
|
||||
IDCardStatus: userDoctor.Status,
|
||||
IdenAuthStatus: userDoctor.IdenAuthStatus,
|
||||
IdenAuthTime: userDoctor.IdenAuthTime,
|
||||
IdenAuthFailReason: userDoctor.IdenAuthFailReason,
|
||||
MultiPointStatus: userDoctor.MultiPointStatus,
|
||||
MultiPointTime: userDoctor.MultiPointTime,
|
||||
MultiPointFailReason: userDoctor.MultiPointFailReason,
|
||||
IsBindBank: userDoctor.IsBindBank,
|
||||
IsRecommend: userDoctor.IsRecommend,
|
||||
Avatar: utils.AddOssDomain(userDoctor.Avatar),
|
||||
DoctorTitle: userDoctor.DoctorTitle,
|
||||
DepartmentCustomID: strconv.Itoa(int(userDoctor.DepartmentCustomId)),
|
||||
DepartmentCustomName: userDoctor.DepartmentCustomName,
|
||||
DepartmentCustomMobile: userDoctor.DepartmentCustomMobile,
|
||||
HospitalID: strconv.Itoa(int(userDoctor.HospitalID)),
|
||||
ServedPatientsNum: userDoctor.ServedPatientsNum,
|
||||
PraiseRate: userDoctor.PraiseRate,
|
||||
AvgResponseTime: userDoctor.AvgResponseTime,
|
||||
NumberOfFans: userDoctor.NumberOfFans,
|
||||
IsImgExpertReception: userDoctor.IsImgExpertReception,
|
||||
IsImgWelfareReception: userDoctor.IsImgWelfareReception,
|
||||
IsImgQuickReception: userDoctor.IsImgQuickReception,
|
||||
IsPlatformDeepCooperation: userDoctor.IsPlatformDeepCooperation,
|
||||
IsSysDiagnoCooperation: userDoctor.IsSysDiagnoCooperation,
|
||||
QrCode: utils.AddOssDomain(userDoctor.QrCode),
|
||||
BeGoodAt: userDoctor.BeGoodAt,
|
||||
BriefIntroduction: userDoctor.BriefIntroduction,
|
||||
CreatedAt: userDoctor.CreatedAt,
|
||||
UpdatedAt: userDoctor.UpdatedAt,
|
||||
User: user,
|
||||
Hospital: hospital,
|
||||
UserDoctorInfo: userDoctorInfo,
|
||||
DoctorExpertise: doctorExpertise, // 专长
|
||||
DoctorBankCard: doctorBankCard, // 银行卡
|
||||
}
|
||||
// 加载医生专长
|
||||
getUserDoctorResponse.DoctorExpertise = doctorExpertise
|
||||
|
||||
// 加载医生银行卡
|
||||
getUserDoctorResponse.LoadDoctorBankCard(doctorBankCard)
|
||||
|
||||
// 加载医生详情
|
||||
getUserDoctorResponse.LoadUserDoctorInfo(userDoctor.UserDoctorInfo)
|
||||
|
||||
return getUserDoctorResponse, nil
|
||||
}
|
||||
@@ -1114,7 +1069,7 @@ func (r *UserDoctorService) AddUserDoctor(userId string, req requests.AddUserDoc
|
||||
}
|
||||
|
||||
// GetUserDoctorExpertiseByDoctorId 获取医生专长
|
||||
func (r *UserDoctorService) GetUserDoctorExpertiseByDoctorId(doctorId int64) ([]*doctorExpertiseResponse.DoctorExpertise, error) {
|
||||
func (r *UserDoctorService) GetUserDoctorExpertiseByDoctorId(doctorId int64) ([]*dto.DoctorExpertiseDto, error) {
|
||||
DiseaseClassExpertiseDao := dao.DiseaseClassExpertiseDao{}
|
||||
|
||||
// 获取医生专长
|
||||
@@ -1124,96 +1079,31 @@ func (r *UserDoctorService) GetUserDoctorExpertiseByDoctorId(doctorId int64) ([]
|
||||
return nil, errors.New("用户数据错误")
|
||||
}
|
||||
|
||||
doctorExpertisesResponses := make([]*doctorExpertiseResponse.DoctorExpertise, len(doctorExpertises))
|
||||
// 处理返回值
|
||||
responses := make([]*dto.DoctorExpertiseDto, len(doctorExpertises))
|
||||
|
||||
if len(doctorExpertises) > 0 {
|
||||
for i, v := range doctorExpertises {
|
||||
response := dto.GetDoctorExpertiseDto(v)
|
||||
|
||||
// 获取专长
|
||||
diseaseClassExpertise, err := DiseaseClassExpertiseDao.GetDiseaseClassExpertiseById(v.ExpertiseId)
|
||||
if err != nil || diseaseClassExpertise == nil {
|
||||
return nil, errors.New("专长数据错误")
|
||||
}
|
||||
|
||||
doctorExpertisesResponse := &doctorExpertiseResponse.DoctorExpertise{
|
||||
DoctorId: strconv.FormatInt(doctorId, 10),
|
||||
ExpertiseId: strconv.FormatInt(v.ExpertiseId, 10),
|
||||
ExpertiseName: diseaseClassExpertise.ExpertiseName,
|
||||
}
|
||||
response.LoadExpertiseName(diseaseClassExpertise)
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
doctorExpertisesResponses[i] = doctorExpertisesResponse
|
||||
responses[i] = response
|
||||
}
|
||||
}
|
||||
|
||||
return doctorExpertisesResponses, nil
|
||||
}
|
||||
|
||||
// GetUserDoctorBankByDoctorId 获取医生银行卡
|
||||
func (r *UserDoctorService) GetUserDoctorBankByDoctorId(doctorId int64) (doctorBankCardResponse.DoctorBankCard, error) {
|
||||
var doctorExpertisesResponse doctorBankCardResponse.DoctorBankCard
|
||||
// 获取医生银行卡
|
||||
doctorBankCardDao := dao.DoctorBankCardDao{}
|
||||
doctorBankCard, err := doctorBankCardDao.GetDoctorBankCardByDoctorId(doctorId)
|
||||
if err != nil && doctorBankCard == nil {
|
||||
return doctorExpertisesResponse, nil
|
||||
}
|
||||
|
||||
doctorExpertisesResponse = doctorBankCardResponse.DoctorBankCard{
|
||||
BankCardId: strconv.FormatInt(doctorBankCard.BankCardId, 10),
|
||||
DoctorId: strconv.FormatInt(doctorBankCard.DoctorId, 10),
|
||||
BankId: strconv.FormatInt(doctorBankCard.BankId, 10),
|
||||
BankCardCodeMask: doctorBankCard.BankCardCodeMask,
|
||||
ProvinceId: doctorBankCard.ProvinceId,
|
||||
Province: doctorBankCard.Province,
|
||||
CityId: doctorBankCard.CityId,
|
||||
City: doctorBankCard.City,
|
||||
CountyId: doctorBankCard.CountyId,
|
||||
County: doctorBankCard.County,
|
||||
}
|
||||
|
||||
return doctorExpertisesResponse, nil
|
||||
}
|
||||
|
||||
// GetDoctorIdenFailReasonByDoctorId 获取医生审核失败原因
|
||||
func (r *UserDoctorService) GetDoctorIdenFailReasonByDoctorId(doctorId int64) (*userDoctorResponse.IdenAuthFailReason, error) {
|
||||
doctorIdenFailDao := dao.DoctorIdenFailDao{}
|
||||
doctorIdenFail, err := doctorIdenFailDao.GetDoctorIdenFailListByDoctorId(doctorId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
var idenAuthFailReason userDoctorResponse.IdenAuthFailReason
|
||||
|
||||
if len(doctorIdenFail) > 0 {
|
||||
for _, v := range doctorIdenFail {
|
||||
switch v.FieldName {
|
||||
case "avatar":
|
||||
idenAuthFailReason.AvatarReason = v.FailReason
|
||||
case "department_custom_mobile":
|
||||
idenAuthFailReason.DepartmentCustomMobileReason = v.FailReason
|
||||
case "department_custom_name":
|
||||
idenAuthFailReason.DepartmentCustomNameReason = v.FailReason
|
||||
case "brief_introduction":
|
||||
idenAuthFailReason.BriefIntroductionReason = v.FailReason
|
||||
case "be_good_at":
|
||||
idenAuthFailReason.BeGoodAtReason = v.FailReason
|
||||
case "license_cert":
|
||||
idenAuthFailReason.LicenseCertReason = v.FailReason
|
||||
case "qualification_cert":
|
||||
idenAuthFailReason.QualificationCertReason = v.FailReason
|
||||
case "work_cert":
|
||||
idenAuthFailReason.WorkCertReason = v.FailReason
|
||||
default:
|
||||
return nil, errors.New("审核失败原因数据错误")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &idenAuthFailReason, nil
|
||||
return responses, nil
|
||||
}
|
||||
|
||||
// GetUserDoctorPending 身份审核-医生详情
|
||||
func (r *UserDoctorService) GetUserDoctorPending(doctorId int64) (g *userDoctorResponse.GetUserDoctorPending, err error) {
|
||||
func (r *UserDoctorService) GetUserDoctorPending(doctorId int64) (g *dto.UserDoctorPendingDto, err error) {
|
||||
// 获取医生数据
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDoctor, err := userDoctorDao.GetUserDoctorPreloadById(doctorId)
|
||||
@@ -1230,59 +1120,29 @@ func (r *UserDoctorService) GetUserDoctorPending(doctorId int64) (g *userDoctorR
|
||||
}
|
||||
|
||||
// 获取医生审核失败原因
|
||||
var IdenAuthFailReason *userDoctorResponse.IdenAuthFailReason
|
||||
if userDoctor.IdenAuthStatus == 3 {
|
||||
IdenAuthFailReason, err = userDoctorService.GetDoctorIdenFailReasonByDoctorId(doctorId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
doctorIdenFailDao := dao.DoctorIdenFailDao{}
|
||||
doctorIdenFail, err := doctorIdenFailDao.GetDoctorIdenFailListByDoctorId(doctorId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
var userDoctorInfo *userDoctorInfoResponse.UserDoctorInfo
|
||||
if userDoctor.UserDoctorInfo != nil {
|
||||
userDoctorInfo = userDoctorInfoResponse.UserDoctorInfoResponse(userDoctor.UserDoctorInfo)
|
||||
}
|
||||
g = dto.GetUserDoctorPendingDto(userDoctor)
|
||||
|
||||
// 医院
|
||||
var hospital *hospitalResponse.Hospital
|
||||
if userDoctor.Hospital != nil {
|
||||
hospital = hospitalResponse.HospitalResponse(userDoctor.Hospital)
|
||||
}
|
||||
// 加载用户
|
||||
g.LoadUser(userDoctor.User)
|
||||
|
||||
// 用户
|
||||
var user *userResponse.User
|
||||
if userDoctor.User != nil {
|
||||
user = userResponse.UserResponse(userDoctor.User)
|
||||
}
|
||||
// 加载医院
|
||||
g.LoadHospital(userDoctor.Hospital)
|
||||
|
||||
g = &userDoctorResponse.GetUserDoctorPending{
|
||||
DoctorID: strconv.Itoa(int(userDoctor.DoctorId)),
|
||||
UserID: strconv.Itoa(int(userDoctor.UserId)),
|
||||
UserName: userDoctor.UserName,
|
||||
Status: userDoctor.Status,
|
||||
IDCardStatus: userDoctor.Status,
|
||||
IdenAuthStatus: userDoctor.IdenAuthStatus,
|
||||
IdenAuthTime: userDoctor.IdenAuthTime,
|
||||
IdenAuthFailReason: IdenAuthFailReason,
|
||||
Avatar: utils.AddOssDomain(userDoctor.Avatar),
|
||||
DoctorTitle: userDoctor.DoctorTitle,
|
||||
DepartmentCustomID: strconv.Itoa(int(userDoctor.DepartmentCustomId)),
|
||||
DepartmentCustomName: userDoctor.DepartmentCustomName,
|
||||
DepartmentCustomMobile: userDoctor.DepartmentCustomMobile,
|
||||
HospitalID: strconv.Itoa(int(userDoctor.HospitalID)),
|
||||
BeGoodAt: userDoctor.BeGoodAt,
|
||||
BriefIntroduction: userDoctor.BriefIntroduction,
|
||||
IsPlatformDeepCooperation: userDoctor.IsPlatformDeepCooperation,
|
||||
IsEnterpriseDeepCooperation: userDoctor.IsEnterpriseDeepCooperation,
|
||||
IsSysDiagnoCooperation: userDoctor.IsSysDiagnoCooperation,
|
||||
IsRecommend: userDoctor.IsRecommend,
|
||||
CreatedAt: userDoctor.CreatedAt,
|
||||
UpdatedAt: userDoctor.UpdatedAt,
|
||||
User: user,
|
||||
Hospital: hospital,
|
||||
UserDoctorInfo: userDoctorInfo,
|
||||
DoctorExpertise: doctorExpertise, // 专长
|
||||
}
|
||||
// 加载医生专长
|
||||
g.DoctorExpertise = doctorExpertise
|
||||
|
||||
// 加载医生详情
|
||||
g.LoadUserDoctorInfo(userDoctor.UserDoctorInfo)
|
||||
|
||||
// 加载医生审核失败原因
|
||||
g.IdenAuthFailReason = dto.GetIdenAuthFailReasonDto(doctorIdenFail)
|
||||
|
||||
return g, nil
|
||||
}
|
||||
@@ -1508,7 +1368,7 @@ func (r *UserDoctorService) PutUserDoctorPending(doctorId int64, req requests.Pu
|
||||
}
|
||||
|
||||
// GetMulti 多点-医生详情
|
||||
func (r *UserDoctorService) GetMulti(doctorId int64) (g *userDoctorResponse.GetMulti, err error) {
|
||||
func (r *UserDoctorService) GetMulti(doctorId int64) (g *dto.UserDoctorDto, err error) {
|
||||
// 获取医生数据
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDoctor, err := userDoctorDao.GetUserDoctorPreloadById(doctorId)
|
||||
@@ -1517,46 +1377,16 @@ func (r *UserDoctorService) GetMulti(doctorId int64) (g *userDoctorResponse.GetM
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
var userDoctorInfo *userDoctorInfoResponse.UserDoctorInfo
|
||||
if userDoctor.UserDoctorInfo != nil {
|
||||
userDoctorInfo = userDoctorInfoResponse.UserDoctorInfoResponse(userDoctor.UserDoctorInfo)
|
||||
}
|
||||
g = dto.GetUserDoctorDto(userDoctor)
|
||||
|
||||
// 医院
|
||||
var hospital *hospitalResponse.Hospital
|
||||
if userDoctor.Hospital != nil {
|
||||
hospital = hospitalResponse.HospitalResponse(userDoctor.Hospital)
|
||||
}
|
||||
// 加载用户
|
||||
g.LoadUser(userDoctor.User)
|
||||
|
||||
// 用户
|
||||
var user *userResponse.User
|
||||
if userDoctor.User != nil {
|
||||
user = userResponse.UserResponse(userDoctor.User)
|
||||
}
|
||||
// 加载医院
|
||||
g.LoadHospital(userDoctor.Hospital)
|
||||
|
||||
g = &userDoctorResponse.GetMulti{
|
||||
DoctorID: strconv.Itoa(int(userDoctor.DoctorId)),
|
||||
UserID: strconv.Itoa(int(userDoctor.UserId)),
|
||||
UserName: userDoctor.UserName,
|
||||
Status: userDoctor.Status,
|
||||
IDCardStatus: userDoctor.Status,
|
||||
MultiPointStatus: userDoctor.MultiPointStatus,
|
||||
MultiPointTime: userDoctor.MultiPointTime,
|
||||
MultiPointFailReason: userDoctor.MultiPointFailReason,
|
||||
Avatar: utils.AddOssDomain(userDoctor.Avatar),
|
||||
DoctorTitle: userDoctor.DoctorTitle,
|
||||
DepartmentCustomID: strconv.Itoa(int(userDoctor.DepartmentCustomId)),
|
||||
DepartmentCustomName: userDoctor.DepartmentCustomName,
|
||||
DepartmentCustomMobile: userDoctor.DepartmentCustomMobile,
|
||||
HospitalID: strconv.Itoa(int(userDoctor.HospitalID)),
|
||||
BeGoodAt: userDoctor.BeGoodAt,
|
||||
BriefIntroduction: userDoctor.BriefIntroduction,
|
||||
CreatedAt: userDoctor.CreatedAt,
|
||||
UpdatedAt: userDoctor.UpdatedAt,
|
||||
User: user,
|
||||
Hospital: hospital,
|
||||
UserDoctorInfo: userDoctorInfo,
|
||||
}
|
||||
// 加载医生详情
|
||||
g.LoadUserDoctorInfo(userDoctor.UserDoctorInfo)
|
||||
|
||||
return g, nil
|
||||
}
|
||||
@@ -1739,8 +1569,8 @@ func (r *UserDoctorService) PutMulti(doctorId int64, req requests.PutMulti) (boo
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// GetOrderInquiryUserDoctor 获取医生数据-问诊订单
|
||||
func (r *UserDoctorService) GetOrderInquiryUserDoctor(doctorId int64) (u *userDoctorResponse.OrderInquiryUserDoctor, err error) {
|
||||
// GetUserDoctorById 获取医生数据-医生id
|
||||
func (r *UserDoctorService) GetUserDoctorById(doctorId int64) (g *dto.UserDoctorDto, err error) {
|
||||
if doctorId == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -1750,33 +1580,14 @@ func (r *UserDoctorService) GetOrderInquiryUserDoctor(doctorId int64) (u *userDo
|
||||
return nil, errors.New("医生数据错误")
|
||||
}
|
||||
|
||||
// 医院
|
||||
var hospital *hospitalResponse.Hospital
|
||||
if userDoctor.Hospital != nil {
|
||||
hospital = hospitalResponse.HospitalResponse(userDoctor.Hospital)
|
||||
}
|
||||
// 处理返回值
|
||||
g = dto.GetUserDoctorDto(userDoctor)
|
||||
|
||||
var userDoctorInfo *userDoctorInfoResponse.UserDoctorInfo
|
||||
if userDoctor.UserDoctorInfo != nil {
|
||||
userDoctorInfo = userDoctorInfoResponse.UserDoctorInfoResponse(userDoctor.UserDoctorInfo)
|
||||
}
|
||||
// 加载医院
|
||||
g.LoadHospital(userDoctor.Hospital)
|
||||
|
||||
u = &userDoctorResponse.OrderInquiryUserDoctor{
|
||||
DoctorID: strconv.Itoa(int(userDoctor.DoctorId)),
|
||||
UserID: strconv.Itoa(int(userDoctor.UserId)),
|
||||
UserName: userDoctor.UserName,
|
||||
Status: userDoctor.Status,
|
||||
IDCardStatus: userDoctor.Status,
|
||||
MultiPointStatus: userDoctor.MultiPointStatus,
|
||||
Avatar: utils.AddOssDomain(userDoctor.Avatar),
|
||||
DoctorTitle: userDoctor.DoctorTitle,
|
||||
DepartmentCustomName: userDoctor.DepartmentCustomName,
|
||||
HospitalID: strconv.Itoa(int(userDoctor.HospitalID)),
|
||||
CreatedAt: userDoctor.CreatedAt,
|
||||
UpdatedAt: userDoctor.UpdatedAt,
|
||||
Hospital: hospital,
|
||||
UserDoctorInfo: userDoctorInfo,
|
||||
}
|
||||
// 加载医生详情
|
||||
g.LoadUserDoctorInfo(userDoctor.UserDoctorInfo)
|
||||
|
||||
return u, nil
|
||||
return g, nil
|
||||
}
|
||||
|
||||
+11
-36
@@ -2,22 +2,17 @@ package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses/patientFamilyResponse"
|
||||
"hospital-admin-api/api/responses/userPatientResponse"
|
||||
"hospital-admin-api/api/responses/userResponse"
|
||||
"hospital-admin-api/api/responses/userShipAddressResponse"
|
||||
"hospital-admin-api/global"
|
||||
"hospital-admin-api/utils"
|
||||
)
|
||||
|
||||
type UserPatientService struct {
|
||||
}
|
||||
|
||||
// GetUserPatient 患者详情
|
||||
func (r *UserPatientService) GetUserPatient(patientId int64) (getUserPatientResponse *userPatientResponse.GetUserPatient, err error) {
|
||||
func (r *UserPatientService) GetUserPatient(patientId int64) (g *dto.UserPatientDto, err error) {
|
||||
// 获取患者数据
|
||||
userPatientDao := dao.UserPatientDao{}
|
||||
userPatient, err := userPatientDao.GetUserPatientPreloadById(patientId)
|
||||
@@ -25,39 +20,19 @@ func (r *UserPatientService) GetUserPatient(patientId int64) (getUserPatientResp
|
||||
return nil, errors.New("患者错误")
|
||||
}
|
||||
|
||||
// 患者收货地址
|
||||
var userShipAddress []*userShipAddressResponse.UserShipAddress
|
||||
if userPatient.UserShipAddress != nil {
|
||||
userShipAddress = userShipAddressResponse.GetUserShipAddressListResponse(userPatient.UserShipAddress)
|
||||
}
|
||||
// 处理返回数据
|
||||
g = dto.GetUserPatientDto(userPatient)
|
||||
|
||||
// 获取家庭成员数据
|
||||
var patientFamilysResponse []*patientFamilyResponse.GetUserPatient
|
||||
if userPatient.PatientFamily != nil {
|
||||
patientFamilysResponse = patientFamilyResponse.GetUserPatientResponse(userPatient.PatientFamily)
|
||||
}
|
||||
// 加载用户手机号
|
||||
g.LoadPatientMobile(userPatient.User)
|
||||
|
||||
// 获取用户数据
|
||||
var user *userResponse.User
|
||||
if userPatient.User != nil {
|
||||
user = userResponse.UserResponse(userPatient.User)
|
||||
}
|
||||
// 加载用户收货地址
|
||||
g.LoadUserShipAddress(userPatient.UserShipAddress)
|
||||
|
||||
getUserPatientResponse = &userPatientResponse.GetUserPatient{
|
||||
PatientId: fmt.Sprintf("%d", userPatient.PatientId),
|
||||
UserId: fmt.Sprintf("%d", userPatient.UserId),
|
||||
UserName: userPatient.UserName,
|
||||
Status: &userPatient.Status,
|
||||
Avatar: utils.AddOssDomain(userPatient.Avatar),
|
||||
Mobile: user.Mobile,
|
||||
DisableReason: userPatient.DisableReason,
|
||||
PatientFamily: patientFamilysResponse,
|
||||
UserShipAddress: userShipAddress,
|
||||
CreatedAt: userPatient.CreatedAt,
|
||||
UpdatedAt: userPatient.UpdatedAt,
|
||||
}
|
||||
// 加载家庭成员数据
|
||||
g.LoadMaskPatientFamily(userPatient.PatientFamily)
|
||||
|
||||
return getUserPatientResponse, nil
|
||||
return g, nil
|
||||
}
|
||||
|
||||
// PutUserDoctorStatus 修改患者状态
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package service
|
||||
|
||||
type UserPharmacistService struct {
|
||||
}
|
||||
Reference in New Issue
Block a user