|
@@ -7,7 +7,6 @@ import (
|
|
|
"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
|
|
|
"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
|
|
|
"context"
|
|
|
- "github.com/mitchellh/mapstructure"
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
)
|
|
|
|
|
@@ -27,25 +26,21 @@ func NewClaimLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ClaimLogic
|
|
|
|
|
|
// Claim 认领(经销商/医疗机构)
|
|
|
func (l *ClaimLogic) Claim(in *medical.ClaimReq) (*medical.ClaimResp, error) {
|
|
|
- tmp := struct {
|
|
|
- CompanyName string `mapstructure:"company_name,omitempty"`
|
|
|
- EstablishDate string `mapstructure:"establish_date,omitempty"`
|
|
|
- CompanyAddress string `mapstructure:"company_address,omitempty"`
|
|
|
- CompanyPhone string `mapstructure:"company_phone,omitempty"`
|
|
|
- Capital string `mapstructure:"capital,omitempty"`
|
|
|
- }{}
|
|
|
// 查询基本信息
|
|
|
baseInfo := l.svcCtx.EntClaimSrv.GetInstitution(in.EntId)
|
|
|
- err := mapstructure.Decode(*baseInfo, &tmp)
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
+ if baseInfo == nil || len(*baseInfo) == 0 {
|
|
|
+ return &medical.ClaimResp{
|
|
|
+ ErrorMsg: "无效的企业id",
|
|
|
+ ErrorCode: entity.ERRORCODE,
|
|
|
+ ResourceNum: 0,
|
|
|
+ ResourceIds: 0,
|
|
|
+ }, nil
|
|
|
}
|
|
|
-
|
|
|
rs := l.svcCtx.EntClaimSrv.Claim(&entity.EntClaim{
|
|
|
AppId: in.AppId,
|
|
|
UserId: int(in.UserId),
|
|
|
EntId: in.EntId,
|
|
|
- EntName: tmp.CompanyName,
|
|
|
+ EntName: common.ObjToString((*baseInfo)["company_name"]),
|
|
|
Status: entity.StatusClaimed,
|
|
|
Type: int(in.Type),
|
|
|
CreateTime: date.NowFormat(date.Date_Full_Layout),
|