新增患者详情
This commit is contained in:
@@ -2,8 +2,6 @@ package orderProductItemResponse
|
||||
|
||||
import (
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type OrderProductItem struct {
|
||||
@@ -22,36 +20,3 @@ type OrderProductItem struct {
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
|
||||
// GetOrderProductItemListResponse 获取订单商品列表
|
||||
func GetOrderProductItemListResponse(u []*model.OrderProductItem) []*OrderProductItem {
|
||||
// 处理返回值
|
||||
orderProductItemResponses := make([]*OrderProductItem, len(u))
|
||||
|
||||
if len(u) > 0 {
|
||||
for i, v := range u {
|
||||
// 将原始结构体转换为新结构体
|
||||
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,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
orderProductItemResponses[i] = orderProductItemResponse
|
||||
}
|
||||
}
|
||||
|
||||
return orderProductItemResponses
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package patientFamilyResponse
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/model"
|
||||
)
|
||||
|
||||
type PatientFamily struct {
|
||||
FamilyId string `json:"family_id"` // 主键id
|
||||
PatientId string `json:"patient_id"` // 患者id
|
||||
Relation *int `json:"relation"` // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他)
|
||||
Status *int `json:"status"` // 状态(1:正常 2:删除)
|
||||
IsDefault *int `json:"is_default"` // 是否默认(0:否 1:是)
|
||||
CardName string `json:"card_name"` // 姓名
|
||||
CardNameMask string `json:"card_name_mask"` // 姓名(掩码)
|
||||
Mobile string `json:"mobile"` // 电话
|
||||
MobileMask string `json:"mobile_mask"` // 电话(掩码)
|
||||
Type *int `json:"type"` // 身份类型(1:身份证 2:护照 3:港澳通行证 4:台胞证)
|
||||
IdNumber string `json:"id_number"` // 证件号码
|
||||
IdNumberMask string `json:"id_number_mask"` // 证件号码(掩码)
|
||||
Sex *int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
||||
Age int `json:"age"` // 年龄
|
||||
ProvinceId string `json:"province_id"` // 省份id
|
||||
Province string `json:"province"` // 省份
|
||||
CityId string `json:"city_id"` // 城市id
|
||||
City string `json:"city"` // 城市
|
||||
CountyId string `json:"county_id"` // 区县id
|
||||
County string `json:"county"` // 区县
|
||||
Height string `json:"height"` // 身高(cm)
|
||||
Weight string `json:"weight"` // 体重(kg)
|
||||
MaritalStatus *int `json:"marital_status"` // 婚姻状况(0:未婚 1:已婚 2:离异)
|
||||
NationId string `json:"nation_id"` // 民族
|
||||
NationName string `json:"nation_name"` // 民族名称
|
||||
JobId string `json:"job_id"` // 职业
|
||||
JobName string `json:"job_name"` // 职业名称
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// GetUserPatient 患者详情
|
||||
type GetUserPatient struct {
|
||||
FamilyId string `json:"family_id"` // 主键id
|
||||
PatientId string `json:"patient_id"` // 患者id
|
||||
Relation *int `json:"relation"` // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他)
|
||||
Status *int `json:"status"` // 状态(1:正常 2:删除)
|
||||
IsDefault *int `json:"is_default"` // 是否默认(0:否 1:是)
|
||||
CardNameMask string `json:"card_name_mask"` // 姓名(掩码)
|
||||
MobileMask string `json:"mobile_mask"` // 电话(掩码)
|
||||
IdNumberMask string `json:"id_number_mask"` // 证件号码(掩码)
|
||||
Sex *int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
||||
Age int `json:"age"` // 年龄
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// GetUserPatientResponse 获取患者详情
|
||||
func GetUserPatientResponse(patientFamilys []*model.PatientFamily) []*GetUserPatient {
|
||||
// 处理返回值
|
||||
items := make([]*GetUserPatient, len(patientFamilys))
|
||||
|
||||
if len(patientFamilys) > 0 {
|
||||
for i, v := range patientFamilys {
|
||||
// 将原始结构体转换为新结构体
|
||||
item := &GetUserPatient{
|
||||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
Relation: &v.Relation,
|
||||
Status: &v.Status,
|
||||
IsDefault: &v.IsDefault,
|
||||
CardNameMask: v.CardNameMask,
|
||||
IdNumberMask: v.IdNumberMask,
|
||||
Sex: &v.Sex,
|
||||
Age: v.Age,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
items[i] = item
|
||||
}
|
||||
}
|
||||
|
||||
return items
|
||||
}
|
||||
@@ -3,10 +3,12 @@ package userPatientResponse
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/responses/patientFamilyResponse"
|
||||
"hospital-admin-api/api/responses/userShipAddressResponse"
|
||||
"hospital-admin-api/utils"
|
||||
)
|
||||
|
||||
// getUserPatientPage 获取医生列表-分页
|
||||
// getUserPatientPage 获取患者列表-分页
|
||||
type getUserPatientPage struct {
|
||||
PatientId string `json:"patient_id"` // 主键id
|
||||
UserId string `json:"user_id"` // 用户id;NOT NULL
|
||||
@@ -14,11 +16,26 @@ type getUserPatientPage struct {
|
||||
Status int `json:"status"` // 状态(0:禁用 1:正常 2:删除)
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
DisableReason string `json:"disable_reason"` // 禁用理由
|
||||
PatientFamilyCount int `json:"patient_family_count"` // 家庭成员数量
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// GetUserPatient 患者详情
|
||||
type GetUserPatient struct {
|
||||
PatientId string `json:"patient_id"` // 主键id
|
||||
UserId string `json:"user_id"` // 用户id;NOT NULL
|
||||
UserName string `json:"user_name"` // 用户名称
|
||||
Status *int `json:"status"` // 状态(0:禁用 1:正常 2:删除)
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
PatientFamily []*patientFamilyResponse.GetUserPatient `json:"patient_family"` // 家庭成员
|
||||
UserShipAddress []*userShipAddressResponse.UserShipAddress `json:"user_ship_address"` // 收货地址
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// GetUserPatientPageResponse 获取用户列表-分页
|
||||
func GetUserPatientPageResponse(userPatient []*model.UserPatient) []getUserPatientPage {
|
||||
// 处理返回值
|
||||
@@ -28,13 +45,14 @@ func GetUserPatientPageResponse(userPatient []*model.UserPatient) []getUserPatie
|
||||
for i, v := range userPatient {
|
||||
// 将原始结构体转换为新结构体
|
||||
response := getUserPatientPage{
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
UserId: fmt.Sprintf("%d", v.UserId),
|
||||
UserName: v.UserName,
|
||||
Status: v.Status,
|
||||
Avatar: utils.AddOssDomain(v.Avatar),
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||
UserId: fmt.Sprintf("%d", v.UserId),
|
||||
UserName: v.UserName,
|
||||
Status: v.Status,
|
||||
Avatar: utils.AddOssDomain(v.Avatar),
|
||||
DisableReason: v.DisableReason,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
if v.PatientFamily != nil {
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package userShipAddressResponse
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/model"
|
||||
)
|
||||
|
||||
type UserShipAddress struct {
|
||||
AddressId string `json:"address_id"` // 主键id
|
||||
UserId string `json:"user_id"` // 用户id;NOT NULL
|
||||
ProvinceId string `json:"province_id"` // 省份id
|
||||
Province string `json:"province"` // 省份
|
||||
CityId string `json:"city_id"` // 城市id
|
||||
City string `json:"city"` // 城市
|
||||
CountyId string `json:"county_id"` // 区县id
|
||||
County string `json:"county"` // 区县
|
||||
ConsigneeTownId string `json:"consignee_town_id"` // 镇id
|
||||
ConsigneeTown string `json:"consignee_town"` // 镇
|
||||
Address string `json:"address"` // 详细地址
|
||||
AddressMask string `json:"address_mask"` // 详细地址(掩码)
|
||||
ConsigneeName string `json:"consignee_name"` // 收货人姓名;NOT NULL
|
||||
ConsigneeNameMask string `json:"consignee_name_mask"` // 收货人姓名(掩码)
|
||||
ConsigneeTel string `json:"consignee_tel"` // 收货人电话;NOT NULL
|
||||
ConsigneeTelMask string `json:"consignee_tel_mask"` // 收货人电话(掩码)
|
||||
ConsigneeZipCode string `json:"consignee_zip_code"` // 收货邮编
|
||||
IsDefault *int `json:"is_default"` // 默认地址(0:否 1:是)
|
||||
Tag *int `json:"tag"` // 地址标签(1:家 2:公司 3:学校 4:其他)
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
|
||||
// GetUserShipAddressListResponse 获取收货地址列表
|
||||
func GetUserShipAddressListResponse(userShipAddress []*model.UserShipAddress) []*UserShipAddress {
|
||||
// 处理返回值
|
||||
items := make([]*UserShipAddress, len(userShipAddress))
|
||||
|
||||
if len(userShipAddress) > 0 {
|
||||
for i, v := range userShipAddress {
|
||||
// 将原始结构体转换为新结构体
|
||||
item := &UserShipAddress{
|
||||
AddressId: fmt.Sprintf("%d", v.AddressId),
|
||||
UserId: fmt.Sprintf("%d", v.UserId),
|
||||
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,
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user