药品列表增加药房信息展示及筛选
This commit is contained in:
+18
-22
@@ -12,7 +12,10 @@ type ProductPlatformDto struct {
|
||||
ProductType int `json:"product_type"` // 药品类型(0:未知 1:中成药 2:西药)
|
||||
ProductPlatformCode string `json:"product_platform_code"` // 处方平台商品编码
|
||||
ProductPharmacyCode string `json:"product_pharmacy_code"` // 第三方药店商品编码
|
||||
PharmacyId string `json:"pharmacy_id"` // 所属药房ID
|
||||
PharmacyCode string `json:"pharmacy_code"` // 第三方药房编码
|
||||
PharmacyName string `json:"pharmacy_name"` // 所属药房名称
|
||||
Pharmacy *PharmacyDto `json:"pharmacy"` // 所属药房详情
|
||||
ProductSpec string `json:"product_spec"` // 商品规格
|
||||
LicenseNumber string `json:"license_number"` // 批准文号
|
||||
Manufacturer string `json:"manufacturer"` // 生产厂家
|
||||
@@ -27,14 +30,16 @@ type ProductPlatformDto struct {
|
||||
|
||||
// GetProductPlatformDto 平台商品详情
|
||||
func GetProductPlatformDto(m *model.ProductPlatform) *ProductPlatformDto {
|
||||
return &ProductPlatformDto{
|
||||
dto := &ProductPlatformDto{
|
||||
ProductPlatformId: fmt.Sprintf("%d", m.ProductPlatformId),
|
||||
ProductName: m.ProductName,
|
||||
ProductPrice: m.ProductPrice,
|
||||
ProductType: m.ProductType,
|
||||
ProductPlatformCode: m.ProductPlatformCode,
|
||||
ProductPharmacyCode: m.ProductPharmacyCode,
|
||||
PharmacyId: "0",
|
||||
PharmacyCode: m.PharmacyCode,
|
||||
PharmacyName: "",
|
||||
ProductSpec: m.ProductSpec,
|
||||
LicenseNumber: m.LicenseNumber,
|
||||
Manufacturer: m.Manufacturer,
|
||||
@@ -45,6 +50,17 @@ func GetProductPlatformDto(m *model.ProductPlatform) *ProductPlatformDto {
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
|
||||
if m.Pharmacy != nil {
|
||||
dto.Pharmacy = GetPharmacyDto(m.Pharmacy)
|
||||
dto.PharmacyId = fmt.Sprintf("%d", m.Pharmacy.PharmacyId)
|
||||
dto.PharmacyName = m.Pharmacy.PharmacyName
|
||||
if dto.PharmacyCode == "" {
|
||||
dto.PharmacyCode = m.Pharmacy.PharmacyCode
|
||||
}
|
||||
}
|
||||
|
||||
return dto
|
||||
}
|
||||
|
||||
// GetProductPlatformListDto 平台商品列表
|
||||
@@ -54,27 +70,7 @@ func GetProductPlatformListDto(m []*model.ProductPlatform) []*ProductPlatformDto
|
||||
|
||||
if len(m) > 0 {
|
||||
for i, v := range m {
|
||||
response := &ProductPlatformDto{
|
||||
ProductPlatformId: fmt.Sprintf("%d", v.ProductPlatformId),
|
||||
ProductName: v.ProductName,
|
||||
ProductPrice: v.ProductPrice,
|
||||
ProductType: v.ProductType,
|
||||
ProductPlatformCode: v.ProductPlatformCode,
|
||||
ProductPharmacyCode: v.ProductPharmacyCode,
|
||||
PharmacyCode: v.PharmacyCode,
|
||||
ProductSpec: v.ProductSpec,
|
||||
LicenseNumber: v.LicenseNumber,
|
||||
Manufacturer: v.Manufacturer,
|
||||
SingleUnit: v.SingleUnit,
|
||||
PackagingUnit: v.PackagingUnit,
|
||||
PackagingCount: v.PackagingCount,
|
||||
RetailUnit: v.RetailUnit,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
responses[i] = GetProductPlatformDto(v)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user