From 296199e76009722e9256971f5edbf6889d35ff70 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 13 Sep 2023 19:09:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8A=E6=8A=A5=E5=A4=84?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/controller/department.go | 2 +- api/controller/order.go | 30 +++- api/dao/hospitalDepartmentCustom.go | 14 +- api/dao/orderPrescriptionIcd.go | 89 ++++++++++ api/dao/product.go | 73 ++++++++ api/dao/userPharmacist.go | 81 +++++++++ api/dao/userPharmacistInfo.go | 98 ++++++++++ api/model/orderPrescriptionIcd.go | 35 ++++ api/model/product.go | 49 +++++ api/model/userPharmacist.go | 45 +++++ api/model/userPharmacistInfo.go | 46 +++++ api/service/order.go | 265 +++++++++++++++++++++++++++- api/service/userDoctor.go | 6 +- extend/prescription/prescription.go | 104 +++++------ 14 files changed, 867 insertions(+), 70 deletions(-) create mode 100644 api/dao/orderPrescriptionIcd.go create mode 100644 api/dao/product.go create mode 100644 api/dao/userPharmacist.go create mode 100644 api/dao/userPharmacistInfo.go create mode 100644 api/model/orderPrescriptionIcd.go create mode 100644 api/model/product.go create mode 100644 api/model/userPharmacist.go create mode 100644 api/model/userPharmacistInfo.go diff --git a/api/controller/department.go b/api/controller/department.go index 151d780..adb6408 100644 --- a/api/controller/department.go +++ b/api/controller/department.go @@ -27,7 +27,7 @@ func (b *Department) GetDepartmentCustomList(c *gin.Context) { return } - hospitalDepartmentCustomDao := dao.HospitalDepartmentCustom{} + hospitalDepartmentCustomDao := dao.HospitalDepartmentCustomDao{} hospitalDepartmentCustom, err := hospitalDepartmentCustomDao.GetHospitalDepartmentCustomListByMaps(departmentRequest.GetDepartmentCustomList) if err != nil { diff --git a/api/controller/order.go b/api/controller/order.go index 63ae910..b33d237 100644 --- a/api/controller/order.go +++ b/api/controller/order.go @@ -1,18 +1,36 @@ package controller import ( - "fmt" "github.com/gin-gonic/gin" "hospital-admin-api/api/responses" - "hospital-admin-api/extend/prescription" + "hospital-admin-api/api/service" + "strconv" ) type Order struct{} +// ReportPreOrder 上报处方平台 func (r *Order) ReportPreOrder(c *gin.Context) { - token, err := prescription.NoticePreOrderCancel("124") - if err != nil { - responses.OkWithData(err.Error(), c) + id := c.Param("order_product_id") + if id == "" { + responses.FailWithMessage("缺少参数", c) + return } - fmt.Println(token) + + // 将 id 转换为 int64 类型 + orderProductId, err := strconv.ParseInt(id, 10, 64) + if err != nil { + responses.Fail(c) + return + } + + // 业务处理 + orderService := service.OrderService{} + _, err = orderService.ReportPreProduct(orderProductId) + if err != nil { + responses.FailWithMessage(err.Error(), c) + return + } + + responses.Ok(c) } diff --git a/api/dao/hospitalDepartmentCustom.go b/api/dao/hospitalDepartmentCustom.go index 2f4e332..caf411b 100644 --- a/api/dao/hospitalDepartmentCustom.go +++ b/api/dao/hospitalDepartmentCustom.go @@ -7,11 +7,11 @@ import ( "hospital-admin-api/global" ) -type HospitalDepartmentCustom struct { +type HospitalDepartmentCustomDao struct { } // GetHospitalDepartmentCustomById 获取自定义科室数据-自定义科室id -func (r *HospitalDepartmentCustom) GetHospitalDepartmentCustomById(departmentCustomId int64) (m *model.HospitalDepartmentCustom, err error) { +func (r *HospitalDepartmentCustomDao) GetHospitalDepartmentCustomById(departmentCustomId int64) (m *model.HospitalDepartmentCustom, err error) { err = global.Db.First(&m, departmentCustomId).Error if err != nil { return nil, err @@ -20,7 +20,7 @@ func (r *HospitalDepartmentCustom) GetHospitalDepartmentCustomById(departmentCus } // AddHospitalDepartmentCustom 新增自定义科室 -func (r *HospitalDepartmentCustom) AddHospitalDepartmentCustom(tx *gorm.DB, model *model.HospitalDepartmentCustom) (*model.HospitalDepartmentCustom, error) { +func (r *HospitalDepartmentCustomDao) AddHospitalDepartmentCustom(tx *gorm.DB, model *model.HospitalDepartmentCustom) (*model.HospitalDepartmentCustom, error) { if err := tx.Create(model).Error; err != nil { return nil, err } @@ -28,7 +28,7 @@ func (r *HospitalDepartmentCustom) AddHospitalDepartmentCustom(tx *gorm.DB, mode } // GetHospitalDepartmentCustomList 获取自定义科室列表 -func (r *HospitalDepartmentCustom) GetHospitalDepartmentCustomList(maps interface{}) (m []*model.HospitalDepartmentCustom, err error) { +func (r *HospitalDepartmentCustomDao) GetHospitalDepartmentCustomList(maps interface{}) (m []*model.HospitalDepartmentCustom, err error) { err = global.Db.Where(maps).Find(&m).Error if err != nil { return nil, err @@ -37,7 +37,7 @@ func (r *HospitalDepartmentCustom) GetHospitalDepartmentCustomList(maps interfac } // DeleteHospitalDepartmentCustomById 删除自定义科室-自定义科室id -func (r *HospitalDepartmentCustom) DeleteHospitalDepartmentCustomById(tx *gorm.DB, departmentCustomId int64) error { +func (r *HospitalDepartmentCustomDao) DeleteHospitalDepartmentCustomById(tx *gorm.DB, departmentCustomId int64) error { if err := tx.Delete(&model.HospitalDepartmentCustom{}, departmentCustomId).Error; err != nil { return err } @@ -45,7 +45,7 @@ func (r *HospitalDepartmentCustom) DeleteHospitalDepartmentCustomById(tx *gorm.D } // EditHospitalDepartmentCustomById 修改自定义科室-自定义科室id -func (r *HospitalDepartmentCustom) EditHospitalDepartmentCustomById(tx *gorm.DB, departmentCustomId int64, data interface{}) error { +func (r *HospitalDepartmentCustomDao) EditHospitalDepartmentCustomById(tx *gorm.DB, departmentCustomId int64, data interface{}) error { err := tx.Model(&model.HospitalDepartmentCustom{}).Where("department_custom_id = ?", departmentCustomId).Updates(data).Error if err != nil { return err @@ -54,7 +54,7 @@ func (r *HospitalDepartmentCustom) EditHospitalDepartmentCustomById(tx *gorm.DB, } // GetHospitalDepartmentCustomListByMaps 获取自定义科室列表 -func (r *HospitalDepartmentCustom) GetHospitalDepartmentCustomListByMaps(departmentRequest requests.GetDepartmentCustomList) (m []*model.HospitalDepartmentCustom, err error) { +func (r *HospitalDepartmentCustomDao) GetHospitalDepartmentCustomListByMaps(departmentRequest requests.GetDepartmentCustomList) (m []*model.HospitalDepartmentCustom, err error) { result := global.Db if departmentRequest.DepartmentId != "" { result = result.Where("department_id = ?", departmentRequest.DepartmentId) diff --git a/api/dao/orderPrescriptionIcd.go b/api/dao/orderPrescriptionIcd.go new file mode 100644 index 0000000..37378fc --- /dev/null +++ b/api/dao/orderPrescriptionIcd.go @@ -0,0 +1,89 @@ +package dao + +import ( + "gorm.io/gorm" + "gorm.io/gorm/clause" + "hospital-admin-api/api/model" + "hospital-admin-api/global" +) + +type OrderPrescriptionIcdDao struct { +} + +// GetOrderPrescriptionIcdById 获取处方关联疾病数据-处方关联疾病id +func (r *OrderPrescriptionIcdDao) GetOrderPrescriptionIcdById(PrescriptionIcdId int64) (m *model.OrderPrescriptionIcd, err error) { + err = global.Db.First(&m, PrescriptionIcdId).Error + if err != nil { + return nil, err + } + return m, nil +} + +func (r *OrderPrescriptionIcdDao) GetOrderPrescriptionIcdByOrderPrescriptionId(orderPrescriptionId int64) (m *model.OrderPrescriptionIcd, err error) { + err = global.Db.Where("order_prescription_id = ?", orderPrescriptionId).First(&m).Error + if err != nil { + return nil, err + } + return m, nil +} + +func (r *OrderPrescriptionIcdDao) GetOrderPrescriptionIcdListByOrderPrescriptionId(orderPrescriptionId int64) (m []*model.OrderPrescriptionIcd, err error) { + err = global.Db.Where("order_prescription_id = ?", orderPrescriptionId).Find(&m).Error + if err != nil { + return nil, err + } + return m, nil +} + +// GetOrderPrescriptionIcdPreloadById 获取处方关联疾病数据-加载全部关联-处方关联疾病id +func (r *OrderPrescriptionIcdDao) GetOrderPrescriptionIcdPreloadById(PrescriptionIcdId int64) (m *model.OrderPrescriptionIcd, err error) { + err = global.Db.Preload(clause.Associations).First(&m, PrescriptionIcdId).Error + if err != nil { + return nil, err + } + return m, nil +} + +// DeleteOrderPrescriptionIcd 删除处方关联疾病 +func (r *OrderPrescriptionIcdDao) DeleteOrderPrescriptionIcd(tx *gorm.DB, maps interface{}) error { + err := tx.Where(maps).Delete(&model.OrderPrescriptionIcd{}).Error + if err != nil { + return err + } + return nil +} + +// EditOrderPrescriptionIcd 修改处方关联疾病 +func (r *OrderPrescriptionIcdDao) EditOrderPrescriptionIcd(tx *gorm.DB, maps interface{}, data interface{}) error { + err := tx.Model(&model.OrderPrescriptionIcd{}).Where(maps).Updates(data).Error + if err != nil { + return err + } + return nil +} + +// EditOrderPrescriptionIcdByOrderPrescriptionId 修改处方关联疾病-处方关联疾病id +func (r *OrderPrescriptionIcdDao) EditOrderPrescriptionIcdByOrderPrescriptionId(tx *gorm.DB, PrescriptionIcdId int64, data interface{}) error { + err := tx.Model(&model.OrderPrescriptionIcd{}).Where("order_prescription_id = ?", PrescriptionIcdId).Updates(data).Error + if err != nil { + return err + } + return nil +} + +// GetOrderPrescriptionIcdList 获取处方关联疾病列表 +func (r *OrderPrescriptionIcdDao) GetOrderPrescriptionIcdList(maps interface{}) (m []*model.OrderPrescriptionIcd, err error) { + err = global.Db.Where(maps).Find(&m).Error + if err != nil { + return nil, err + } + return m, nil +} + +// AddOrderPrescriptionIcd 新增处方关联疾病 +func (r *OrderPrescriptionIcdDao) AddOrderPrescriptionIcd(tx *gorm.DB, model *model.OrderPrescriptionIcd) (*model.OrderPrescriptionIcd, error) { + if err := tx.Create(model).Error; err != nil { + return nil, err + } + return model, nil +} diff --git a/api/dao/product.go b/api/dao/product.go new file mode 100644 index 0000000..bb089f4 --- /dev/null +++ b/api/dao/product.go @@ -0,0 +1,73 @@ +package dao + +import ( + "gorm.io/gorm" + "gorm.io/gorm/clause" + "hospital-admin-api/api/model" + "hospital-admin-api/global" +) + +type ProductDao struct { +} + +// GetProductById 获取商品数据-商品id +func (r *ProductDao) GetProductById(productId int64) (m *model.Product, err error) { + err = global.Db.First(&m, productId).Error + if err != nil { + return nil, err + } + return m, nil +} + +// GetProductPreloadById 获取商品数据-加载全部关联-商品id +func (r *ProductDao) GetProductPreloadById(productId int64) (m *model.Product, err error) { + err = global.Db.Preload(clause.Associations).First(&m, productId).Error + if err != nil { + return nil, err + } + return m, nil +} + +// DeleteProduct 删除商品 +func (r *ProductDao) DeleteProduct(tx *gorm.DB, maps interface{}) error { + err := tx.Where(maps).Delete(&model.Product{}).Error + if err != nil { + return err + } + return nil +} + +// EditProduct 修改商品 +func (r *ProductDao) EditProduct(tx *gorm.DB, maps interface{}, data interface{}) error { + err := tx.Model(&model.Product{}).Where(maps).Updates(data).Error + if err != nil { + return err + } + return nil +} + +// EditProductByUserId 修改商品-商品id +func (r *ProductDao) EditProductByUserId(tx *gorm.DB, productId int64, data interface{}) error { + err := tx.Model(&model.Product{}).Where("product_id = ?", productId).Updates(data).Error + if err != nil { + return err + } + return nil +} + +// GetProductList 获取商品列表 +func (r *ProductDao) GetProductList(maps interface{}) (m []*model.Product, err error) { + err = global.Db.Where(maps).Find(&m).Error + if err != nil { + return nil, err + } + return m, nil +} + +// AddProduct 新增商品 +func (r *ProductDao) AddProduct(tx *gorm.DB, model *model.Product) (*model.Product, error) { + if err := tx.Create(model).Error; err != nil { + return nil, err + } + return model, nil +} diff --git a/api/dao/userPharmacist.go b/api/dao/userPharmacist.go new file mode 100644 index 0000000..570d5de --- /dev/null +++ b/api/dao/userPharmacist.go @@ -0,0 +1,81 @@ +package dao + +import ( + "gorm.io/gorm" + "gorm.io/gorm/clause" + "hospital-admin-api/api/model" + "hospital-admin-api/global" +) + +type UserPharmacistDao struct { +} + +// GetUserPharmacistById 获取药师数据-药师id +func (r *UserPharmacistDao) GetUserPharmacistById(pharmacistId int64) (m *model.UserPharmacist, err error) { + err = global.Db.First(&m, pharmacistId).Error + if err != nil { + return nil, err + } + return m, nil +} + +func (r *UserPharmacistDao) GetUserPharmacistByUserId(userId int64) (m *model.UserPharmacist, err error) { + err = global.Db.Where("user_id = ?", userId).First(&m).Error + if err != nil { + return nil, err + } + return m, nil +} + +// GetUserPharmacistPreloadById 获取药师数据-加载全部关联-药师id +func (r *UserPharmacistDao) GetUserPharmacistPreloadById(pharmacistId int64) (m *model.UserPharmacist, err error) { + err = global.Db.Preload(clause.Associations).First(&m, pharmacistId).Error + if err != nil { + return nil, err + } + return m, nil +} + +// DeleteUserPharmacist 删除药师 +func (r *UserPharmacistDao) DeleteUserPharmacist(tx *gorm.DB, maps interface{}) error { + err := tx.Where(maps).Delete(&model.UserPharmacist{}).Error + if err != nil { + return err + } + return nil +} + +// EditUserPharmacist 修改药师 +func (r *UserPharmacistDao) EditUserPharmacist(tx *gorm.DB, maps interface{}, data interface{}) error { + err := tx.Model(&model.UserPharmacist{}).Where(maps).Updates(data).Error + if err != nil { + return err + } + return nil +} + +// EditUserPharmacistByUserId 修改药师-药师id +func (r *UserPharmacistDao) EditUserPharmacistByUserId(tx *gorm.DB, userId int64, data interface{}) error { + err := tx.Model(&model.UserPharmacist{}).Where("user_id = ?", userId).Updates(data).Error + if err != nil { + return err + } + return nil +} + +// GetUserPharmacistList 获取药师列表 +func (r *UserPharmacistDao) GetUserPharmacistList(maps interface{}) (m []*model.UserPharmacist, err error) { + err = global.Db.Where(maps).Find(&m).Error + if err != nil { + return nil, err + } + return m, nil +} + +// AddUserPharmacist 新增药师 +func (r *UserPharmacistDao) AddUserPharmacist(tx *gorm.DB, model *model.UserPharmacist) (*model.UserPharmacist, error) { + if err := tx.Create(model).Error; err != nil { + return nil, err + } + return model, nil +} diff --git a/api/dao/userPharmacistInfo.go b/api/dao/userPharmacistInfo.go new file mode 100644 index 0000000..4e62dff --- /dev/null +++ b/api/dao/userPharmacistInfo.go @@ -0,0 +1,98 @@ +package dao + +import ( + "gorm.io/gorm" + "gorm.io/gorm/clause" + "hospital-admin-api/api/model" + "hospital-admin-api/global" +) + +type UserPharmacistInfoDao struct { +} + +// GetUserPharmacistInfoById 获取药师详情数据-药师详情id +func (r *UserPharmacistInfoDao) GetUserPharmacistInfoById(infoId int64) (m *model.UserPharmacistInfo, err error) { + err = global.Db.First(&m, infoId).Error + if err != nil { + return nil, err + } + return m, nil +} + +func (r *UserPharmacistInfoDao) GetUserPharmacistInfoByUserId(userId int64) (m *model.UserPharmacistInfo, err error) { + err = global.Db.Where("user_id = ?", userId).First(&m).Error + if err != nil { + return nil, err + } + return m, nil +} + +func (r *UserPharmacistInfoDao) GetUserPharmacistInfoByPharmacistId(pharmacistId int64) (m *model.UserPharmacistInfo, err error) { + err = global.Db.Where("pharmacist_id = ?", pharmacistId).First(&m).Error + if err != nil { + return nil, err + } + return m, nil +} + +// GetUserPharmacistInfoPreloadById 获取药师详情数据-加载全部关联-药师详情id +func (r *UserPharmacistInfoDao) GetUserPharmacistInfoPreloadById(infoId int64) (m *model.UserPharmacistInfo, err error) { + err = global.Db.Preload(clause.Associations).First(&m, infoId).Error + if err != nil { + return nil, err + } + return m, nil +} + +// DeleteUserPharmacistInfo 删除药师详情 +func (r *UserPharmacistInfoDao) DeleteUserPharmacistInfo(tx *gorm.DB, maps interface{}) error { + err := tx.Where(maps).Delete(&model.UserPharmacistInfo{}).Error + if err != nil { + return err + } + return nil +} + +// EditUserPharmacistInfo 修改药师详情 +func (r *UserPharmacistInfoDao) EditUserPharmacistInfo(tx *gorm.DB, maps interface{}, data interface{}) error { + err := tx.Model(&model.UserPharmacistInfo{}).Where(maps).Updates(data).Error + if err != nil { + return err + } + return nil +} + +// EditUserPharmacistInfoByUserId 修改药师详情-药师详情id +func (r *UserPharmacistInfoDao) EditUserPharmacistInfoByUserId(tx *gorm.DB, userId int64, data interface{}) error { + err := tx.Model(&model.UserPharmacistInfo{}).Where("user_id = ?", userId).Updates(data).Error + if err != nil { + return err + } + return nil +} + +// EditUserPharmacistInfoByPharmacistId 修改药师详情-药师详情id +func (r *UserPharmacistInfoDao) EditUserPharmacistInfoByPharmacistId(tx *gorm.DB, pharmacistId int64, data interface{}) error { + err := tx.Model(&model.UserPharmacistInfo{}).Where("pharmacist_id = ?", pharmacistId).Updates(data).Error + if err != nil { + return err + } + return nil +} + +// GetUserPharmacistInfoList 获取药师详情列表 +func (r *UserPharmacistInfoDao) GetUserPharmacistInfoList(maps interface{}) (m []*model.UserPharmacistInfo, err error) { + err = global.Db.Where(maps).Find(&m).Error + if err != nil { + return nil, err + } + return m, nil +} + +// AddUserPharmacistInfo 新增药师详情 +func (r *UserPharmacistInfoDao) AddUserPharmacistInfo(tx *gorm.DB, model *model.UserPharmacistInfo) (*model.UserPharmacistInfo, error) { + if err := tx.Create(model).Error; err != nil { + return nil, err + } + return model, nil +} diff --git a/api/model/orderPrescriptionIcd.go b/api/model/orderPrescriptionIcd.go new file mode 100644 index 0000000..4522294 --- /dev/null +++ b/api/model/orderPrescriptionIcd.go @@ -0,0 +1,35 @@ +package model + +import ( + "gorm.io/gorm" + "hospital-admin-api/global" + "time" +) + +// OrderPrescriptionIcd 订单-处方关联疾病表 +type OrderPrescriptionIcd struct { + PrescriptionIcdId int64 `gorm:"column:prescription_icd_id;type:bigint(19);primary_key;comment:主键id" json:"prescription_icd_id"` + OrderPrescriptionId int64 `gorm:"column:order_prescription_id;type:bigint(19);comment:订单-处方id" json:"order_prescription_id"` + IcdId int64 `gorm:"column:icd_id;type:bigint(19);comment:疾病id(icd)" json:"icd_id"` + IcdName string `gorm:"column:icd_name;type:varchar(255);comment:疾病名称(icd)" json:"icd_name"` + IcdCode string `gorm:"column:icd_code;type:varchar(255);comment:icd编码" json:"icd_code"` + Model +} + +func (m *OrderPrescriptionIcd) TableName() string { + return "gdxz_order_prescription_icd" +} + +func (m *OrderPrescriptionIcd) BeforeCreate(tx *gorm.DB) error { + if m.PrescriptionIcdId == 0 { + m.PrescriptionIcdId = global.Snowflake.Generate().Int64() + } + + m.CreatedAt = LocalTime(time.Now()) + tx.Statement.SetColumn("CreatedAt", m.CreatedAt) + + m.UpdatedAt = LocalTime(time.Now()) + tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt) + + return nil +} diff --git a/api/model/product.go b/api/model/product.go new file mode 100644 index 0000000..05e681e --- /dev/null +++ b/api/model/product.go @@ -0,0 +1,49 @@ +package model + +import ( + "gorm.io/gorm" + "hospital-admin-api/global" + "time" +) + +// Product 商品表 +type Product struct { + ProductId int64 `gorm:"column:product_id;type:bigint(19);primary_key;comment:主键id" json:"product_id"` + ProductPlatformId int64 `gorm:"column:product_platform_id;type:bigint(19);comment:处方平台商品id" json:"product_platform_id"` + ProductName string `gorm:"column:product_name;type:varchar(255);comment:商品名称" json:"product_name"` + CommonName string `gorm:"column:common_name;type:varchar(100);comment:商品通用名" json:"common_name"` + ProductPrice float64 `gorm:"column:product_price;type:decimal(10,2);comment:商品价格" json:"product_price"` + MnemonicCode string `gorm:"column:mnemonic_code;type:varchar(50);comment:商品助记码(首字母简拼)" json:"mnemonic_code"` + ProductType int `gorm:"column:product_type;type:tinyint(4);default:1;comment:药品类型(0:未知 1:中成药 2:西药)" json:"product_type"` + ProductPlatformCode string `gorm:"column:product_platform_code;type:varchar(100);comment:处方平台商品编码" json:"product_platform_code"` + ProductPharmacyCode string `gorm:"column:product_pharmacy_code;type:varchar(100);comment:第三方药店商品编码" json:"product_pharmacy_code"` + ProductCoverImg string `gorm:"column:product_cover_img;type:varchar(255);comment:商品封面图" json:"product_cover_img"` + ProductSpec string `gorm:"column:product_spec;type:varchar(255);comment:商品规格" json:"product_spec"` + LicenseNumber string `gorm:"column:license_number;type:varchar(30);comment:批准文号" json:"license_number"` + Manufacturer string `gorm:"column:manufacturer;type:varchar(255);comment:生产厂家" json:"manufacturer"` + SingleUnit string `gorm:"column:single_unit;type:varchar(50);comment:单次剂量(例:1次1包)" json:"single_unit"` + SingleUse string `gorm:"column:single_use;type:varchar(50);comment:单次用法(例:口服)" json:"single_use"` + PackagingUnit string `gorm:"column:packaging_unit;type:varchar(20);comment:基本包装单位(例:盒/瓶)" json:"packaging_unit"` + FrequencyUse string `gorm:"column:frequency_use;type:varchar(50);comment:使用频率(例:1天3次)" json:"frequency_use"` + AvailableDays float64 `gorm:"column:available_days;type:float(10,2);comment:可用天数(3)" json:"available_days"` + ProductRemarks string `gorm:"column:product_remarks;type:varchar(255);comment:商品备注" json:"product_remarks"` + Model +} + +func (m *Product) TableName() string { + return "gdxz_product" +} + +func (m *Product) BeforeCreate(tx *gorm.DB) error { + if m.ProductId == 0 { + m.ProductId = global.Snowflake.Generate().Int64() + } + + m.CreatedAt = LocalTime(time.Now()) + tx.Statement.SetColumn("CreatedAt", m.CreatedAt) + + m.UpdatedAt = LocalTime(time.Now()) + tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt) + + return nil +} diff --git a/api/model/userPharmacist.go b/api/model/userPharmacist.go new file mode 100644 index 0000000..eca865c --- /dev/null +++ b/api/model/userPharmacist.go @@ -0,0 +1,45 @@ +package model + +import ( + "gorm.io/gorm" + "hospital-admin-api/global" + "time" +) + +// UserPharmacist 用户-药师表 +type UserPharmacist struct { + PharmacistId int64 `gorm:"column:pharmacist_id;type:bigint(19);primary_key;comment:主键id" json:"pharmacist_id"` + UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id" json:"user_id"` + UserName string `gorm:"column:user_name;type:varchar(50);comment:用户名称" json:"user_name"` + OpenId string `gorm:"column:open_id;type:varchar(100);comment:微信open_id" json:"open_id"` + UnionId string `gorm:"column:union_id;type:varchar(100);comment:微信开放平台唯一标识" json:"union_id"` + WxSessionKey string `gorm:"column:wx_session_key;type:varchar(255);comment:微信会话密钥" json:"wx_session_key"` + Status int `gorm:"column:status;type:tinyint(1);default:1;comment:状态(0:禁用 1:正常 2:删除)" json:"status"` + IsOnline int `gorm:"column:is_online;type:tinyint(1);default:0;comment:是否在线(0:不在线 1:在线)" json:"is_online"` + Avatar string `gorm:"column:avatar;type:varchar(255);comment:头像" json:"avatar"` + PharmacistTitle int `gorm:"column:pharmacist_title;type:tinyint(1);comment:职称" json:"pharmacist_title"` + DepartmentCustomId int64 `gorm:"column:department_custom_id;type:bigint(19);comment:科室id-自定义" json:"department_custom_id"` + DepartmentCustomName string `gorm:"column:department_custom_name;type:varchar(100);comment:科室名称(如未自己输入,填入标准科室名称)" json:"department_custom_name"` + DepartmentCustomMobile string `gorm:"column:department_custom_mobile;type:varchar(30);comment:科室电话" json:"department_custom_mobile"` + MedicalInstitution string `gorm:"column:medical_institution;type:varchar(255);comment:医疗机构名称" json:"medical_institution"` + WorkerDate string `gorm:"column:worker_date;type:varchar(255);comment:医龄" json:"worker_date"` + Model +} + +func (m *UserPharmacist) TableName() string { + return "gdxz_user_pharmacist" +} + +func (m *UserPharmacist) BeforeCreate(tx *gorm.DB) error { + if m.PharmacistId == 0 { + m.PharmacistId = global.Snowflake.Generate().Int64() + } + + m.CreatedAt = LocalTime(time.Now()) + tx.Statement.SetColumn("CreatedAt", m.CreatedAt) + + m.UpdatedAt = LocalTime(time.Now()) + tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt) + + return nil +} diff --git a/api/model/userPharmacistInfo.go b/api/model/userPharmacistInfo.go new file mode 100644 index 0000000..2ebf2f5 --- /dev/null +++ b/api/model/userPharmacistInfo.go @@ -0,0 +1,46 @@ +package model + +import ( + "gorm.io/gorm" + "hospital-admin-api/global" + "time" +) + +// UserPharmacistInfo 药师-详情表 +type UserPharmacistInfo struct { + InfoId int64 `gorm:"column:info_id;type:bigint(19);primary_key;comment:主键id" json:"info_id"` + UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id" json:"user_id"` + PharmacistId int64 `gorm:"column:pharmacist_id;type:bigint(19);comment:药师id" json:"pharmacist_id"` + CardType int `gorm:"column:card_type;type:tinyint(1);comment:类型(1:身份证 2:护照 3:港澳通行证 4:台胞证)" json:"card_type"` + CardName string `gorm:"column:card_name;type:varchar(30);comment:证件姓名" json:"card_name"` + CardNameMask string `gorm:"column:card_name_mask;type:varchar(30);comment:证件姓名(掩码)" json:"card_name_mask"` + CardNum string `gorm:"column:card_num;type:varchar(50);comment:证件号码" json:"card_num"` + CardNumMask string `gorm:"column:card_num_mask;type:varchar(50);comment:证件号码(掩码)" json:"card_num_mask"` + LicenseCert string `gorm:"column:license_cert;type:varchar(255);comment:医师执业证(逗号分隔)" json:"license_cert"` + QualificationCert string `gorm:"column:qualification_cert;type:varchar(255);comment:医师资格证(逗号分隔)" json:"qualification_cert"` + QualificationCertNum string `gorm:"column:qualification_cert_num;type:varchar(255);comment:医师资格证号(逗号分隔)" json:"qualification_cert_num"` + WorkCert string `gorm:"column:work_cert;type:varchar(255);comment:医师工作证(逗号分隔)" json:"work_cert"` + MultiPointImages string `gorm:"column:multi_point_images;type:varchar(255);comment:多点执业备案信息(逗号分隔)" json:"multi_point_images"` + IdCardFront string `gorm:"column:id_card_front;type:varchar(255);comment:身份证正面图片" json:"id_card_front"` + IdCardBack string `gorm:"column:id_card_back;type:varchar(255);comment:身份证背面图片" json:"id_card_back"` + SignImage string `gorm:"column:sign_image;type:varchar(255);comment:签名图片" json:"sign_image"` + Model +} + +func (m *UserPharmacistInfo) TableName() string { + return "gdxz_user_pharmacist_info" +} + +func (m *UserPharmacistInfo) BeforeCreate(tx *gorm.DB) error { + if m.InfoId == 0 { + m.InfoId = global.Snowflake.Generate().Int64() + } + + m.CreatedAt = LocalTime(time.Now()) + tx.Statement.SetColumn("CreatedAt", m.CreatedAt) + + m.UpdatedAt = LocalTime(time.Now()) + tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt) + + return nil +} diff --git a/api/service/order.go b/api/service/order.go index 9dfc2c6..77db679 100644 --- a/api/service/order.go +++ b/api/service/order.go @@ -1,6 +1,267 @@ package service -// ReportPreProduct 商品订单上报处方平台 -func ReportPreProduct() { +import ( + "errors" + "fmt" + "hospital-admin-api/api/dao" + "hospital-admin-api/extend/prescription" + "hospital-admin-api/utils" + "strings" + "time" +) +type OrderService struct { +} + +// ReportPreProduct 商品订单上报处方平台 +func (r *OrderService) ReportPreProduct(orderProductId int64) (bool, error) { + // 获取药品订单详情 + orderProductDao := dao.OrderProductDao{} + orderProduct, err := orderProductDao.GetOrderProductPreloadById(orderProductId) + if err != nil || orderProduct == nil { + return false, errors.New("订单数据错误") + } + + // 已上报 + if orderProduct.ReportPreStatus == 1 { + return false, errors.New("订单已上报") + } + + // 检测订单状态 + if orderProduct.OrderProductStatus == 1 { + return false, errors.New("订单处于待支付状态,无法取消") + } + + if orderProduct.OrderProductStatus == 3 { + return false, errors.New("订单已发货,无法取消") + } + + if orderProduct.OrderProductStatus == 4 { + return false, errors.New("订单已签收,无法取消") + } + + if orderProduct.OrderProductStatus == 5 { + return false, errors.New("订单已取消,无法取消") + } + + // 检测支付状态 + if orderProduct.PayStatus != 2 { + return false, errors.New("订单支付状态错误") + } + + // 检测订单退款状态 + if orderProduct.RefundStatus == 1 { + return false, errors.New("订单申请退款中,无法取消") + } + + if orderProduct.RefundStatus == 2 { + return false, errors.New("订单正在退款中,无法取消") + } + + if orderProduct.RefundStatus == 3 { + return false, errors.New("订单已退款成功,无法取消") + } + + if orderProduct.RefundStatus == 6 { + return false, errors.New("订单退款异常,请联系技术人员") + } + + // 获取处方数据 + orderPrescriptionDao := dao.OrderPrescriptionDao{} + orderPrescription, _ := orderPrescriptionDao.GetById(orderProduct.OrderPrescriptionId) + if orderPrescription == nil { + return false, errors.New("数据错误,无处方数据") + } + + // 获取问诊订单数据 + orderInquiryDao := dao.OrderInquiryDao{} + orderInquiry, _ := orderInquiryDao.GetOrderInquiryById(orderProduct.OrderInquiryId) + if orderInquiry == nil { + return false, errors.New("数据错误,无问诊订单数据") + } + + // 获取问诊病例数据 + orderInquiryCaseDao := dao.OrderInquiryCaseDao{} + orderInquiryCase, _ := orderInquiryCaseDao.GetOrderInquiryCaseByOrderInquiryId(orderProduct.OrderInquiryId) + if orderInquiryCase == nil { + return false, errors.New("数据错误,无问诊病例") + } + + // 获取商品订单列表数据 + orderProductItemDao := dao.OrderProductItemDao{} + orderProductItems, err := orderProductItemDao.GetOrderProductItemByOrderProductId(orderProductId) + if err != nil || len(orderProductItems) == 0 { + return false, errors.New("数据错误,无药品数据") + } + + // 获取就诊患者用户数据 + userDao := dao.UserDao{} + user, err := userDao.GetUserById(orderInquiry.UserId) + if err != nil && user == nil { + return false, errors.New("就诊患者数据错误") + } + + // 获取家庭成员-基本信息 + patientFamilyDao := dao.PatientFamilyDao{} + patientFamily, _ := patientFamilyDao.GetPatientFamilyById(orderInquiry.FamilyId) + if patientFamily == nil { + return false, errors.New("数据错误,无家庭成员数据") + } + + // 获取处方关联疾病数据 + orderPrescriptionIcdDao := dao.OrderPrescriptionIcdDao{} + orderPrescriptionIcds, _ := orderPrescriptionIcdDao.GetOrderPrescriptionIcdListByOrderPrescriptionId(orderPrescription.OrderPrescriptionId) + if err != nil || len(orderPrescriptionIcds) == 0 { + return false, errors.New("数据错误,无处方关联疾病数据") + } + + // 获取医生数据 + userDoctorDao := dao.UserDoctorDao{} + userDoctor, _ := userDoctorDao.GetUserDoctorById(orderPrescription.DoctorId) + if userDoctor == nil { + return false, errors.New("数据错误,无医生数据") + } + + // 获取医生详情数据 + userDoctorInfoDao := dao.UserDoctorInfoDao{} + userDoctorInfo, _ := userDoctorInfoDao.GetUserDoctorInfoByDoctorId(orderPrescription.DoctorId) + if userDoctorInfo == nil { + return false, errors.New("数据错误,无医生详情数据") + } + + // 获取药师数据 + userPharmacistDao := dao.UserPharmacistDao{} + userPharmacist, _ := userPharmacistDao.GetUserPharmacistById(orderPrescription.PharmacistId) + if userPharmacist == nil { + return false, errors.New("数据错误,无药师数据") + } + + // 获取药师详情数据 + userPharmacistInfoDao := dao.UserPharmacistInfoDao{} + userPharmacistInfo, _ := userPharmacistInfoDao.GetUserPharmacistInfoByPharmacistId(orderPrescription.PharmacistId) + if userPharmacistInfo == nil { + return false, errors.New("数据错误,无药师详情数据") + } + + // 获取医生科室数据 + hospitalDepartmentCustomDao := dao.HospitalDepartmentCustomDao{} + hospitalDepartmentCustom, _ := hospitalDepartmentCustomDao.GetHospitalDepartmentCustomById(userDoctor.DepartmentCustomId) + if hospitalDepartmentCustom == nil { + return false, errors.New("数据错误,无医生科室数据") + } + + // 处理疾病数据 + icdNameSlice := make([]string, 0) + for _, orderPrescriptionIcd := range orderPrescriptionIcds { + if orderPrescriptionIcd.IcdName != "" { + icdNameSlice = append(icdNameSlice, orderPrescriptionIcd.IcdName) + } + } + + icdNameStr := strings.Join(icdNameSlice, ";") + + // 处理上传数据-药品数据 + drugRequests := make([]prescription.DrugRequest, len(orderProductItems)) + orderDrugRequests := make([]prescription.OrderDrugRequest, len(orderProductItems)) + for i, o := range orderProductItems { + // 获取商品数据 + productDao := dao.ProductDao{} + product, _ := productDao.GetProductById(o.ProductId) + if product == nil { + return false, errors.New("数据错误,无药品数据") + } + + useDays := o.Amount * 7 + if product.AvailableDays != 0 { + useDays = int(product.AvailableDays) + } + + // 药品数据1 + drugRequest := prescription.DrugRequest{ + DrugCode: product.ProductPlatformCode, // 药品编码 + ApprovalNumber: product.LicenseNumber, // 批准文号 + DrugName: product.ProductName, // 药品名称 + Specifications: product.ProductSpec, // 药品规格 + Price: product.ProductPrice, // 药品单价 + PackingCount: o.Amount, // 药品数量 + SurplusPackingCount: 0, // 处方药品剩余使用数量 + PackingUnit: product.PackagingUnit, // 药品单位 + SingleDosage: 1, // 单次用量 + SingleDosageUnit: "片", // 单次用量单位 + UseName: product.SingleUse, // 用法名称 + FrequencyName: product.FrequencyUse, // 频次名称 + UseDays: useDays, // 使用天数 + } + drugRequests[i] = drugRequest + + // 药品数据2 + orderDrugRequest := prescription.OrderDrugRequest{ + DrugCode: product.ProductPlatformCode, // 药品编码 + ApprovalNumber: product.LicenseNumber, // 批准文号 + DrugName: product.ProductName, // 药品名称 + Specifications: product.ProductSpec, // 药品规格 + Price: product.ProductPrice, // 药品单价 + DrugCount: o.Amount, // 药品数量 + PackingUnit: product.PackagingUnit, // 药品单位 + } + orderDrugRequests[i] = orderDrugRequest + } + + // 处理上传数据-处方数据 + presRequests := make([]prescription.PresRequest, 1) + presRequest := prescription.PresRequest{ + PrescriptionNo: orderPrescription.PrescriptionCode, // // 处方编号 + PrescriptionSubType: 1, // 处方类型 0:无类型 1:普 通处方 2:儿科处 方 + PatientName: orderPrescription.PatientName, // 就诊人姓名 + PatientPhone: user.Mobile, // 就诊人联系方式 + IdCard: patientFamily.IdNumber, // 身份证号 + Advice: orderPrescription.DoctorAdvice, // 医嘱 + DiagnosisName: icdNameStr, // 诊断 + ThirdDoctorName: userDoctor.UserName, // 开方医生姓名 + ThirdDeptName: hospitalDepartmentCustom.DepartmentName, // 开方科室名称 + ThirdDoctorNameImg: utils.AddOssDomain(userDoctorInfo.SignImage), + PrescriptionTime: time.Time(orderPrescription.DoctorCreatedTime).Format("2006-01-02 15:04:05"), + ThirdFirstPharmacist: userPharmacist.UserName, + ThirdFirstPharmacistImg: utils.AddOssDomain(userPharmacistInfo.SignImage), + ThirdFirstTime: time.Time(orderPrescription.PharmacistVerifyTime).Format("2006-01-02 15:04:05"), + ThirdLastPharmacist: userPharmacist.UserName, + ThirdLastPharmacistImg: utils.AddOssDomain(userPharmacistInfo.SignImage), + ThirdLastTime: time.Time(orderPrescription.PharmacistVerifyTime).Format("2006-01-02 15:04:05"), + ThirdSignImg: utils.AddOssDomain("/basic/file/hospital_signature.png"), + ReferenceCharge: orderProduct.AmountTotal, + ChiefComplaint: orderInquiryCase.DiseaseDesc, + HistoryPresent: orderInquiryCase.DiseaseClassName, + PastHistory: orderInquiryCase.FamilyHistory, + PhysicalExamination: "无", + SupplementaryExamination: "无", + AllergicHistory: orderInquiryCase.AllergyHistory, + DrugList: drugRequests, + OrderDrugList: orderDrugRequests, + } + + presRequests[0] = presRequest + + // 处理上传数据-基础数据 + ReportPreRequest := prescription.ReportPreRequest{ + TerminalCode: "ZD-10003", + OrderNo: orderProduct.OrderProductNo, // 订单编号 + TransactNo: orderProduct.EscrowTradeNo, // 流水单号 + PayDate: time.Time(orderProduct.PayTime).Format("2006-01-02 15:04:05"), // 支付时间 + Money: orderProduct.PaymentAmountTotal, // 订单金额 + Freight: orderProduct.LogisticsFee, // 运费(单位:元) + TakeTypeCode: 2, // 取货方式 1 自提 2 快递,目前只支持快递,传固定值 2 + BuyerName: orderProduct.ConsigneeName, // 收货人姓名 + BuyerPhone: orderProduct.ConsigneeTel, // 收货人联系方式 + BuyerAddress: orderProduct.Address, // 收货人地址 + ProvinceCode: fmt.Sprintf("%d", orderProduct.ProvinceId), // 收货地址(省) 编码 + ProvinceName: orderProduct.Province, // 收货地址(省) 名称 + CityCode: fmt.Sprintf("%d", orderProduct.CityId), // 收货地址(市) 编码 + CityName: orderProduct.City, // 收货地址(市) 名称 + DistrictCode: fmt.Sprintf("%d", orderProduct.CountyId), // 收货地址(区 县)编码 + DistrictName: orderProduct.County, // 收货地址(区 县)名称 + PresList: presRequests, + } + + fmt.Println(ReportPreRequest) + return true, nil } diff --git a/api/service/userDoctor.go b/api/service/userDoctor.go index 08dc9d3..eda5083 100644 --- a/api/service/userDoctor.go +++ b/api/service/userDoctor.go @@ -168,7 +168,7 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDo } if userDoctor.DepartmentCustomId != departmentCustomId || userDoctor.DepartmentCustomName != req.DepartmentCustomName { // 获取科室数据 - hospitalDepartmentCustomDao := dao.HospitalDepartmentCustom{} + hospitalDepartmentCustomDao := dao.HospitalDepartmentCustomDao{} hospitalDepartmentCustom, err := hospitalDepartmentCustomDao.GetHospitalDepartmentCustomById(departmentCustomId) if err != nil || hospitalDepartmentCustom == nil { return false, errors.New("科室错误") @@ -802,7 +802,7 @@ func (r *UserDoctorService) AddUserDoctor(userId string, req requests.AddUserDoc } // 获取科室数据 - hospitalDepartmentCustomDao := dao.HospitalDepartmentCustom{} + hospitalDepartmentCustomDao := dao.HospitalDepartmentCustomDao{} hospitalDepartmentCustom, err := hospitalDepartmentCustomDao.GetHospitalDepartmentCustomById(departmentCustomId) if err != nil || hospitalDepartmentCustom == nil { return false, errors.New("科室错误") @@ -1611,7 +1611,7 @@ func (r *UserDoctorService) PutMulti(doctorId int64, req requests.PutMulti) (boo userCaCert, _ := userCaCertDao.GetUserCaCertByUserId(userDoctor.UserId) // 获取自定义科室数据 - hospitalDepartmentCustomDao := dao.HospitalDepartmentCustom{} + hospitalDepartmentCustomDao := dao.HospitalDepartmentCustomDao{} hospitalDepartmentCustom, err := hospitalDepartmentCustomDao.GetHospitalDepartmentCustomById(userDoctor.DepartmentCustomId) if err != nil || hospitalDepartmentCustom == nil { tx.Rollback() diff --git a/extend/prescription/prescription.go b/extend/prescription/prescription.go index 06d33c9..a335060 100644 --- a/extend/prescription/prescription.go +++ b/extend/prescription/prescription.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "errors" + "fmt" "hospital-admin-api/config" "hospital-admin-api/global" "io" @@ -32,60 +33,60 @@ type noticePreOrderCancelResponse struct { ResultDesc string `json:"resultDesc"` // 描述 } -// ReportPreRequest 上报处方请求值 +// ReportPreRequest 上报处方请求值-基础数据 type ReportPreRequest struct { - TerminalCode string `json:"terminalCode"` // 终端代码 - OrderNo string `json:"orderNo"` // 订单编号 - TransactNo string `json:"transactNo"` // 流水单号 - PayDate string `json:"payDate"` // 支付时间 - Money float64 `json:"money"` // 订单金额 - Freight float64 `json:"freight"` // 运费(单位:元) - TakeTypeCode int `json:"takeTypeCode"` // 取货方式 1 自提 2 快递,目前只支持快递,传固定值 2 - BuyerName string `json:"buyerName"` // 收货人姓名 - BuyerPhone string `json:"buyerPhone"` // 收货人联系方式 - BuyerAddress string `json:"buyerAddress"` // 收货人地址 - ProvinceCode string `json:"provinceCode"` // 收货地址(省) 编码 - ProvinceName string `json:"provinceName"` // 收货地址(省) 名称 - CityCode string `json:"cityCode"` // 收货地址(市) 编码 - CityName string `json:"cityName"` // 收货地址(市) 名称 - DistrictCode string `json:"districtCode"` // 收货地址(区 县)编码 - DistrictName string `json:"districtName"` // 收货地址(区 县)名称 - PresList []Pres `json:"presList"` // 处方列表 + TerminalCode string `json:"terminalCode"` // 终端代码 + OrderNo string `json:"orderNo"` // 订单编号 + TransactNo string `json:"transactNo"` // 流水单号 + PayDate string `json:"payDate"` // 支付时间 + Money float64 `json:"money"` // 订单金额 + Freight float64 `json:"freight"` // 运费(单位:元) + TakeTypeCode int `json:"takeTypeCode"` // 取货方式 1 自提 2 快递,目前只支持快递,传固定值 2 + BuyerName string `json:"buyerName"` // 收货人姓名 + BuyerPhone string `json:"buyerPhone"` // 收货人联系方式 + BuyerAddress string `json:"buyerAddress"` // 收货人地址 + ProvinceCode string `json:"provinceCode"` // 收货地址(省) 编码 + ProvinceName string `json:"provinceName"` // 收货地址(省) 名称 + CityCode string `json:"cityCode"` // 收货地址(市) 编码 + CityName string `json:"cityName"` // 收货地址(市) 名称 + DistrictCode string `json:"districtCode"` // 收货地址(区 县)编码 + DistrictName string `json:"districtName"` // 收货地址(区 县)名称 + PresList []PresRequest `json:"presList"` // 处方列表 } -// Pres 上报处方请求值 -type Pres struct { - PrescriptionNo string `json:"prescriptionNo"` // 处方编号 - PrescriptionSubType int `json:"prescriptionSubType"` // 处方类型 0:无类型 1:普通处方 2:儿科处方 - PatientName string `json:"patientName"` // 就诊人姓名 - PatientPhone string `json:"patientPhone"` // 就诊人联系方式 - IdCard string `json:"idCard"` // 身份证号 - Advice string `json:"advice"` // 医嘱 - DiagnosisName string `json:"diagnosisName"` // 诊断 - ThirdDoctorName string `json:"thirdDoctorName"` // 开方医生姓名 - ThirdDeptName string `json:"thirdDeptName"` // 开方科室名称 - ThirdDoctorNameImg string `json:"thirdDoctorNameImg"` // 开方医生签名链接 - PrescriptionTime string `json:"prescriptionTime"` // 开方时间 - ThirdFirstPharmacist string `json:"thirdFirstPharmacist"` // 初审药师姓名 - ThirdFirstPharmacistImg string `json:"thirdFirstPharmacistImg"` // 初审药师签名链接 - ThirdFirstTime string `json:"thirdFirstTime"` // 初审时间 - ThirdLastPharmacist string `json:"thirdLastPharmacist"` // 终审药师姓名 - ThirdLastPharmacistImg string `json:"thirdLastPharmacistImg"` // 终审药师签名链接 - ThirdLastTime string `json:"ThirdLastTime"` // 终审时间 - ThirdSignImg string `json:"thirdSignImg"` // 处方签章链接 - ReferenceCharge float64 `json:"referenceCharge"` // 处方费用(不包含运费) - ChiefComplaint string `json:"chiefComplaint"` // 主诉 - HistoryPresent string `json:"historyPresent"` // 现病史 - PastHistory string `json:"pastHistory"` // 既往史 - PhysicalExamination string `json:"physicalExamination"` // 体格检查 - SupplementaryExamination string `json:"supplementaryExamination"` // 辅助检查 - AllergicHistory string `json:"allergicHistory"` // 过敏史 - DrugList []Drug `json:"drugList"` // 药品列表 - OrderDrugList []OrderDrug `json:"orderDrugList"` // 订单药品列表 +// PresRequest 上报处方请求值-处方数据 +type PresRequest struct { + PrescriptionNo string `json:"prescriptionNo"` // 处方编号 + PrescriptionSubType int `json:"prescriptionSubType"` // 处方类型 0:无类型 1:普通处方 2:儿科处方 + PatientName string `json:"patientName"` // 就诊人姓名 + PatientPhone string `json:"patientPhone"` // 就诊人联系方式 + IdCard string `json:"idCard"` // 身份证号 + Advice string `json:"advice"` // 医嘱 + DiagnosisName string `json:"diagnosisName"` // 诊断 + ThirdDoctorName string `json:"thirdDoctorName"` // 开方医生姓名 + ThirdDeptName string `json:"thirdDeptName"` // 开方科室名称 + ThirdDoctorNameImg string `json:"thirdDoctorNameImg"` // 开方医生签名链接 + PrescriptionTime string `json:"prescriptionTime"` // 开方时间 + ThirdFirstPharmacist string `json:"thirdFirstPharmacist"` // 初审药师姓名 + ThirdFirstPharmacistImg string `json:"thirdFirstPharmacistImg"` // 初审药师签名链接 + ThirdFirstTime string `json:"thirdFirstTime"` // 初审时间 + ThirdLastPharmacist string `json:"thirdLastPharmacist"` // 终审药师姓名 + ThirdLastPharmacistImg string `json:"thirdLastPharmacistImg"` // 终审药师签名链接 + ThirdLastTime string `json:"ThirdLastTime"` // 终审时间 + ThirdSignImg string `json:"thirdSignImg"` // 处方签章链接 + ReferenceCharge float64 `json:"referenceCharge"` // 处方费用(不包含运费) + ChiefComplaint string `json:"chiefComplaint"` // 主诉 + HistoryPresent string `json:"historyPresent"` // 现病史 + PastHistory string `json:"pastHistory"` // 既往史 + PhysicalExamination string `json:"physicalExamination"` // 体格检查 + SupplementaryExamination string `json:"supplementaryExamination"` // 辅助检查 + AllergicHistory string `json:"allergicHistory"` // 过敏史 + DrugList []DrugRequest `json:"drugList"` // 药品列表 + OrderDrugList []OrderDrugRequest `json:"orderDrugList"` // 订单药品列表 } -// Drug 上报处方请求值 -type Drug struct { +// DrugRequest 上报处方请求值-药品数据1 +type DrugRequest struct { DrugCode string `json:"drugCode"` // 药品编码 ApprovalNumber string `json:"approvalNumber"` // 批准文号 DrugName string `json:"drugName"` // 药品名称 @@ -101,8 +102,8 @@ type Drug struct { UseDays int `json:"useDays"` // 使用天数 } -// OrderDrug 上报处方请求值 -type OrderDrug struct { +// OrderDrugRequest 上报处方请求值-药品数据2 +type OrderDrugRequest struct { DrugCode string `json:"drugCode"` // 药品编码 ApprovalNumber string `json:"approvalNumber"` // 批准文号 DrugName string `json:"drugName"` // 药品名称 @@ -253,6 +254,7 @@ func NoticePreOrderCancel(orderNo string) (bool, error) { return false, err } + fmt.Println(response) if response.ResultCode != "1000" { if response.ResultDesc != "" { return false, errors.New(response.ResultDesc)