修正返回目录,新增处方详情。删除原response目录
This commit is contained in:
@@ -8,8 +8,6 @@ import (
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses/orderInquiryCaseResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryResponse"
|
||||
"hospital-admin-api/config"
|
||||
"hospital-admin-api/extend/weChat"
|
||||
"hospital-admin-api/global"
|
||||
@@ -324,76 +322,3 @@ func (r *OrderInquiryService) GetOrderInquiry(orderInquiryId int64) (g *dto.Orde
|
||||
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())
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
res = &orderInquiryResponse.OrderInquiry{
|
||||
OrderInquiryId: strconv.FormatInt(orderInquiry.OrderInquiryId, 10),
|
||||
UserId: strconv.FormatInt(orderInquiry.UserId, 10),
|
||||
PatientId: strconv.FormatInt(orderInquiry.PatientId, 10),
|
||||
FamilyId: strconv.FormatInt(orderInquiry.FamilyId, 10),
|
||||
InquiryType: orderInquiry.InquiryType,
|
||||
InquiryMode: orderInquiry.InquiryMode,
|
||||
InquiryStatus: orderInquiry.InquiryStatus,
|
||||
IsDelete: orderInquiry.IsDelete,
|
||||
InquiryRefundStatus: orderInquiry.InquiryRefundStatus,
|
||||
InquiryPayChannel: orderInquiry.InquiryPayChannel,
|
||||
InquiryPayStatus: orderInquiry.InquiryPayStatus,
|
||||
InquiryNo: orderInquiry.InquiryNo,
|
||||
EscrowTradeNo: orderInquiry.EscrowTradeNo,
|
||||
AmountTotal: orderInquiry.AmountTotal,
|
||||
CouponAmountTotal: orderInquiry.CouponAmountTotal,
|
||||
PaymentAmountTotal: orderInquiry.PaymentAmountTotal,
|
||||
PayTime: orderInquiry.PayTime,
|
||||
ReceptionTime: orderInquiry.ReceptionTime,
|
||||
CompleteTime: orderInquiry.CompleteTime,
|
||||
FinishTime: orderInquiry.FinishTime,
|
||||
StatisticsStatus: orderInquiry.StatisticsStatus,
|
||||
StatisticsTime: orderInquiry.StatisticsTime,
|
||||
IsWithdrawal: orderInquiry.IsWithdrawal,
|
||||
WithdrawalTime: orderInquiry.WithdrawalTime,
|
||||
CancelTime: orderInquiry.CancelTime,
|
||||
CancelReason: orderInquiry.CancelReason,
|
||||
CancelRemarks: orderInquiry.CancelRemarks,
|
||||
PatientName: orderInquiry.PatientName,
|
||||
PatientNameMask: orderInquiry.PatientNameMask,
|
||||
PatientSex: orderInquiry.PatientSex,
|
||||
PatientAge: orderInquiry.PatientAge,
|
||||
CreatedAt: orderInquiry.CreatedAt,
|
||||
UpdatedAt: orderInquiry.UpdatedAt,
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@@ -2,58 +2,16 @@ 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"
|
||||
"hospital-admin-api/api/dto"
|
||||
)
|
||||
|
||||
// OrderPrescriptionService 处方
|
||||
type OrderPrescriptionService struct {
|
||||
}
|
||||
|
||||
// GetOrderPrescriptionById 获取处方数据
|
||||
func (r *OrderPrescriptionService) GetOrderPrescriptionById(OrderPrescriptionId int64) (u *orderPrescriptionResponse.OrderPrescription, err error) {
|
||||
orderPrescriptionDao := dao.OrderPrescriptionDao{}
|
||||
orderPrescription, err := orderPrescriptionDao.GetById(OrderPrescriptionId)
|
||||
if orderPrescription == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
u = &orderPrescriptionResponse.OrderPrescription{
|
||||
OrderPrescriptionId: fmt.Sprintf("%d", orderPrescription.OrderPrescriptionId),
|
||||
OrderInquiryId: fmt.Sprintf("%d", orderPrescription.OrderInquiryId),
|
||||
DoctorId: fmt.Sprintf("%d", orderPrescription.DoctorId),
|
||||
PatientId: fmt.Sprintf("%d", orderPrescription.PatientId),
|
||||
FamilyId: fmt.Sprintf("%d", orderPrescription.FamilyId),
|
||||
PharmacistId: fmt.Sprintf("%d", orderPrescription.PharmacistId),
|
||||
PrescriptionStatus: orderPrescription.PrescriptionStatus,
|
||||
PharmacistAuditStatus: orderPrescription.PharmacistAuditStatus,
|
||||
PharmacistVerifyTime: orderPrescription.PharmacistVerifyTime,
|
||||
PharmacistFailReason: orderPrescription.PharmacistFailReason,
|
||||
PlatformAuditStatus: orderPrescription.PlatformAuditStatus,
|
||||
PlatformFailTime: orderPrescription.PlatformFailTime,
|
||||
PlatformFailReason: orderPrescription.PlatformFailReason,
|
||||
IsAutoPharVerify: orderPrescription.IsAutoPharVerify,
|
||||
DoctorCreatedTime: orderPrescription.DoctorCreatedTime,
|
||||
ExpiredTime: orderPrescription.ExpiredTime,
|
||||
IsDelete: orderPrescription.IsDelete,
|
||||
PrescriptionCode: orderPrescription.PrescriptionCode,
|
||||
DoctorName: orderPrescription.DoctorName,
|
||||
PatientName: orderPrescription.PatientName,
|
||||
PatientSex: orderPrescription.PatientSex,
|
||||
PatientAge: orderPrescription.PatientAge,
|
||||
DoctorAdvice: orderPrescription.DoctorAdvice,
|
||||
CreatedAt: orderPrescription.CreatedAt,
|
||||
UpdatedAt: orderPrescription.UpdatedAt,
|
||||
}
|
||||
return u, nil
|
||||
}
|
||||
|
||||
// GetOrderPrescription 处方详情
|
||||
func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int64) (getOrderPrescriptionResponse *orderPrescriptionResponse.GetOrderPrescription, err error) {
|
||||
func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int64) (g *dto.OrderPrescriptionDto, err error) {
|
||||
orderPrescriptionDao := dao.OrderPrescriptionDao{}
|
||||
orderPrescription, err := orderPrescriptionDao.GetById(OrderPrescriptionId)
|
||||
if orderPrescription == nil {
|
||||
@@ -61,114 +19,57 @@ func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int6
|
||||
}
|
||||
|
||||
// 获取处方关联疾病数据
|
||||
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 {
|
||||
orderPrescriptionIcds, err := orderPrescriptionIcdDao.GetOrderPrescriptionIcdListByOrderPrescriptionId(OrderPrescriptionId)
|
||||
if len(orderPrescriptionIcds) <= 0 {
|
||||
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,
|
||||
// 获取问诊病例
|
||||
orderInquiryCaseDao := dao.OrderInquiryCaseDao{}
|
||||
orderInquiryCase, err := orderInquiryCaseDao.GetOrderInquiryCaseByOrderInquiryId(orderPrescription.OrderInquiryId)
|
||||
if orderInquiryCase == nil {
|
||||
return nil, errors.New("数据错误,无问诊病例")
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetOrderPrescriptionProductByOrderPrescriptionId 获取处方关联商品数据-处方id
|
||||
func (r *OrderPrescriptionService) GetOrderPrescriptionProductByOrderPrescriptionId(orderPrescriptionId int64) (res []*orderPrescriptionProductResponse.OrderPrescriptionProduct, err error) {
|
||||
// 获取处方商品数据
|
||||
orderPrescriptionProductDao := dao.OrderPrescriptionProductDao{}
|
||||
orderPrescriptionProducts, err := orderPrescriptionProductDao.GetOrderPrescriptionProductListByOrderPrescriptionId(orderPrescriptionId)
|
||||
orderPrescriptionProducts, err := orderPrescriptionProductDao.GetOrderPrescriptionProductListByOrderPrescriptionId(OrderPrescriptionId)
|
||||
if err != nil {
|
||||
return nil, errors.New("数据错误,无处方药品数据")
|
||||
}
|
||||
|
||||
if len(orderPrescriptionProducts) == 0 {
|
||||
return nil, errors.New("数据错误,无处方药品数据")
|
||||
// 获取医生数据
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDoctor, err := userDoctorDao.GetUserDoctorById(orderPrescription.DoctorId)
|
||||
if err != nil || userDoctor == nil {
|
||||
return nil, errors.New("医生数据错误")
|
||||
}
|
||||
|
||||
// 获取药师数据
|
||||
userPharmacistDao := dao.UserPharmacistDao{}
|
||||
userPharmacist, err := userPharmacistDao.GetUserPharmacistById(orderPrescription.PharmacistId)
|
||||
if err != nil || userPharmacist == nil {
|
||||
return nil, errors.New("药师数据错误")
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
items := make([]*orderPrescriptionProductResponse.OrderPrescriptionProduct, len(orderPrescriptionProducts))
|
||||
g = dto.GetOrderPrescriptionDto(orderPrescription)
|
||||
|
||||
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,
|
||||
}
|
||||
// 加载问诊病例
|
||||
g.LoadOrderInquiryCase(orderInquiryCase)
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
items[i] = item
|
||||
}
|
||||
}
|
||||
return items, nil
|
||||
// 加载处方关联疾病-字符串
|
||||
g.LoadOrderPrescriptionIcdString(orderPrescriptionIcds)
|
||||
|
||||
// 加载医生名称
|
||||
g.LoadDoctorName(userDoctor)
|
||||
|
||||
// 加载药师名称
|
||||
g.LoadPharmacisName(userPharmacist)
|
||||
|
||||
// 加载处方商品数据
|
||||
g.LoadOrderPrescriptionProduct(orderPrescriptionProducts)
|
||||
|
||||
return g, nil
|
||||
}
|
||||
|
||||
@@ -1,54 +1,4 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/responses/orderProductItemResponse"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type OrderProductItemService struct {
|
||||
}
|
||||
|
||||
// GetOrderProductItemByOrderProductId 获取商品列表-问诊订单id
|
||||
func (r *OrderProductItemService) GetOrderProductItemByOrderProductId(orderProductId int64) (u []*orderProductItemResponse.OrderProductItem, err error) {
|
||||
orderProductItemDao := dao.OrderProductItemDao{}
|
||||
orderProductItems, err := orderProductItemDao.GetOrderProductItemByOrderProductId(orderProductId)
|
||||
if err != nil {
|
||||
return nil, errors.New("数据错误,无药品数据")
|
||||
}
|
||||
|
||||
if len(orderProductItems) == 0 {
|
||||
return nil, errors.New("数据错误,无药品数据")
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
items := make([]*orderProductItemResponse.OrderProductItem, len(orderProductItems))
|
||||
|
||||
if len(orderProductItems) > 0 {
|
||||
for i, v := range orderProductItems {
|
||||
// 将原始结构体转换为新结构体
|
||||
item := &orderProductItemResponse.OrderProductItem{
|
||||
ProductItemId: strconv.Itoa(int(v.ProductItemId)),
|
||||
OrderProductId: strconv.Itoa(int(v.OrderProductId)),
|
||||
OrderInquiryId: strconv.Itoa(int(v.OrderInquiryId)),
|
||||
OrderPrescriptionId: strconv.Itoa(int(v.OrderPrescriptionId)),
|
||||
ProductId: strconv.Itoa(int(v.ProductId)),
|
||||
ProductName: v.ProductName,
|
||||
ProductPrice: v.ProductPrice,
|
||||
ProductPlatformCode: v.ProductPlatformCode,
|
||||
Amount: v.Amount,
|
||||
Manufacturer: v.Manufacturer,
|
||||
ProductCoverImg: utils.AddOssDomain(v.ProductCoverImg),
|
||||
ProductSpec: v.ProductSpec,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
items[i] = item
|
||||
}
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
@@ -1,33 +1,4 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/responses/orderProductLogisticsResponse"
|
||||
)
|
||||
|
||||
type OrderProductLogisticsService struct {
|
||||
}
|
||||
|
||||
// GetOrderProductLogisticsByOrderProductId 获取物流数据-药品订单id
|
||||
func (r *OrderProductLogisticsService) GetOrderProductLogisticsByOrderProductId(orderProductId int64) (u *orderProductLogisticsResponse.OrderProductLogistics, err error) {
|
||||
orderProductLogisticsDao := dao.OrderProductLogisticsDao{}
|
||||
orderProductLogistics, err := orderProductLogisticsDao.GetOrderProductLogisticsByOrderProductId(orderProductId)
|
||||
if orderProductLogistics == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
u = &orderProductLogisticsResponse.OrderProductLogistics{
|
||||
LogisticsId: fmt.Sprintf("%d", orderProductLogistics.LogisticsId),
|
||||
OrderProductId: fmt.Sprintf("%d", orderProductLogistics.OrderProductId),
|
||||
LogisticsStatus: orderProductLogistics.LogisticsStatus,
|
||||
LogisticsNo: orderProductLogistics.LogisticsNo,
|
||||
CompanyName: orderProductLogistics.CompanyName,
|
||||
CompanyCode: orderProductLogistics.CompanyCode,
|
||||
LogisticsContent: orderProductLogistics.LogisticsContent,
|
||||
CreatedAt: orderProductLogistics.CreatedAt,
|
||||
UpdatedAt: orderProductLogistics.UpdatedAt,
|
||||
}
|
||||
|
||||
return u, nil
|
||||
}
|
||||
|
||||
@@ -1,36 +1,4 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/responses/orderProductRefundResponse"
|
||||
)
|
||||
|
||||
type OrderProductRefundService struct {
|
||||
}
|
||||
|
||||
// GetOrderProductRefundByOrderProductId 获取退款数据
|
||||
func (r *OrderProductRefundService) GetOrderProductRefundByOrderProductId(orderProductId int64) (u *orderProductRefundResponse.OrderProductRefund, err error) {
|
||||
orderProductRefundDao := dao.OrderProductRefundDao{}
|
||||
orderProductRefund, err := orderProductRefundDao.GetOrderProductRefundByOrderProductId(orderProductId)
|
||||
if orderProductRefund == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
u = &orderProductRefundResponse.OrderProductRefund{
|
||||
ProductRefundId: fmt.Sprintf("%d", orderProductRefund.ProductRefundId),
|
||||
PatientId: fmt.Sprintf("%d", orderProductRefund.PatientId),
|
||||
OrderProductId: fmt.Sprintf("%d", orderProductRefund.OrderProductId),
|
||||
OrderProductNo: orderProductRefund.OrderProductNo,
|
||||
ProductRefundNo: orderProductRefund.ProductRefundNo,
|
||||
RefundId: orderProductRefund.RefundId,
|
||||
ProductRefundStatus: orderProductRefund.ProductRefundStatus,
|
||||
RefundTotal: orderProductRefund.RefundTotal,
|
||||
RefundReason: orderProductRefund.RefundReason,
|
||||
SuccessTime: orderProductRefund.SuccessTime,
|
||||
CreatedAt: orderProductRefund.CreatedAt,
|
||||
UpdatedAt: orderProductRefund.UpdatedAt,
|
||||
}
|
||||
|
||||
return u, nil
|
||||
}
|
||||
|
||||
@@ -2,70 +2,13 @@ package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/responses/patientFamilyResponse"
|
||||
)
|
||||
|
||||
type PatientFamilyService struct {
|
||||
}
|
||||
|
||||
// GetPatientFamilyListByPatientId 获取患者家庭成员-患者id
|
||||
func (r *PatientFamilyService) GetPatientFamilyListByPatientId(patientId int64) (u []*patientFamilyResponse.PatientFamily, err error) {
|
||||
patientFamilyDao := dao.PatientFamilyDao{}
|
||||
patientFamilys, err := patientFamilyDao.GetPatientFamilyListByPatientId(patientId)
|
||||
|
||||
if len(patientFamilys) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
items := make([]*patientFamilyResponse.PatientFamily, len(patientFamilys))
|
||||
|
||||
if len(patientFamilys) > 0 {
|
||||
for i, v := range patientFamilys {
|
||||
// 将原始结构体转换为新结构体
|
||||
item := &patientFamilyResponse.PatientFamily{
|
||||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
Relation: v.Relation,
|
||||
Status: &v.Status,
|
||||
IsDefault: &v.IsDefault,
|
||||
CardName: v.CardName,
|
||||
CardNameMask: v.CardNameMask,
|
||||
Mobile: v.Mobile,
|
||||
MobileMask: v.MobileMask,
|
||||
Type: &v.Type,
|
||||
IdNumber: v.IdNumber,
|
||||
IdNumberMask: v.IdNumberMask,
|
||||
Sex: &v.Sex,
|
||||
Age: v.Age,
|
||||
ProvinceId: fmt.Sprintf("%d", v.ProvinceId),
|
||||
Province: v.Province,
|
||||
CityId: fmt.Sprintf("%d", v.CityId),
|
||||
City: v.City,
|
||||
CountyId: fmt.Sprintf("%d", v.CountyId),
|
||||
County: v.County,
|
||||
Height: v.Height,
|
||||
Weight: v.Weight,
|
||||
MaritalStatus: &v.MaritalStatus,
|
||||
NationId: fmt.Sprintf("%d", v.NationId),
|
||||
NationName: v.NationName,
|
||||
JobId: fmt.Sprintf("%d", v.JobId),
|
||||
JobName: v.JobName,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
items[i] = item
|
||||
}
|
||||
}
|
||||
|
||||
return items, nil
|
||||
}
|
||||
|
||||
// GetPatientFamily 家庭成员详情
|
||||
func (r *PatientFamilyService) GetPatientFamily(familyId int64) (g *dto.PatientFamilyDto, err error) {
|
||||
patientFamilyDao := dao.PatientFamilyDao{}
|
||||
|
||||
@@ -1,57 +1,4 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/responses/userShipAddressResponse"
|
||||
)
|
||||
|
||||
type UserShipAddressService struct {
|
||||
}
|
||||
|
||||
// GetUserShipAddressByUserId 获取用户收货地址-用户id
|
||||
func (r *UserShipAddressService) GetUserShipAddressByUserId(userId int64) (u []*userShipAddressResponse.UserShipAddress, err error) {
|
||||
userShipAddressDao := dao.UserShipAddressDao{}
|
||||
orderProductLogistics, err := userShipAddressDao.GetUserShipAddressListByOrderUserId(userId)
|
||||
|
||||
if len(orderProductLogistics) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
items := make([]*userShipAddressResponse.UserShipAddress, len(orderProductLogistics))
|
||||
|
||||
if len(orderProductLogistics) > 0 {
|
||||
for i, v := range orderProductLogistics {
|
||||
// 将原始结构体转换为新结构体
|
||||
item := &userShipAddressResponse.UserShipAddress{
|
||||
AddressId: fmt.Sprintf("%d", v.AddressId),
|
||||
UserId: fmt.Sprintf("%d", v.AddressId),
|
||||
ProvinceId: fmt.Sprintf("%d", v.AddressId),
|
||||
Province: v.Province,
|
||||
CityId: fmt.Sprintf("%d", v.CityId),
|
||||
City: v.City,
|
||||
CountyId: fmt.Sprintf("%d", v.CountyId),
|
||||
County: v.County,
|
||||
ConsigneeTownId: fmt.Sprintf("%d", v.ConsigneeTownId),
|
||||
ConsigneeTown: v.ConsigneeTown,
|
||||
Address: v.Address,
|
||||
AddressMask: v.AddressMask,
|
||||
ConsigneeName: v.ConsigneeName,
|
||||
ConsigneeNameMask: v.ConsigneeNameMask,
|
||||
ConsigneeTel: v.ConsigneeTel,
|
||||
ConsigneeTelMask: v.ConsigneeTelMask,
|
||||
ConsigneeZipCode: v.ConsigneeZipCode,
|
||||
IsDefault: &v.IsDefault,
|
||||
Tag: &v.Tag,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
items[i] = item
|
||||
}
|
||||
}
|
||||
|
||||
return items, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user