瀏覽代碼

merg:分支合并

zhangxinlei1996 3 年之前
父節點
當前提交
872c5993fc

+ 8 - 1
README.md

@@ -1 +1,8 @@
-# 领域化产品
+# 领域化产品
+
+
+
+
+
+## 注意事项 
+- github.com/zeromicro/go-zero  与旧版本(github.com/tal-tech/go-zero)不兼容  需使用新版goctl生成代码。

+ 19 - 2
api/medical/internal/logic/distributor/claimdistributorlogic.go

@@ -1,6 +1,7 @@
 package distributor
 package distributor
 
 
 import (
 import (
+	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
 	"context"
 	"context"
 
 
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
@@ -23,8 +24,24 @@ func NewClaimDistributorLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
 	}
 	}
 }
 }
 
 
+// ClaimDistributor 我认领的经销商列表
 func (l *ClaimDistributorLogic) ClaimDistributor(req *types.ClaimDistributorReq) (resp *types.CommonRes, err error) {
 func (l *ClaimDistributorLogic) ClaimDistributor(req *types.ClaimDistributorReq) (resp *types.CommonRes, err error) {
-	// todo: add your logic here and delete this line
+	rs, _ := l.svcCtx.Medical.ClaimedDistributorList(l.ctx, &medical.ClaimedReq{
+		AppId:    req.AppId,
+		UserId:   int64(req.UserId),
+		Page:     int64(req.Page),
+		PageSize: int64(req.PageSize),
+	})
+	var result interface{}
+	result = map[string]interface{}{
+		"list":  rs.Data.List,
+		"total": rs.Data.Total,
+	}
+
+	return &types.CommonRes{
+		Error_msg:  rs.ErrorMsg,
+		Error_code: int(rs.ErrorCode),
+		Data:       result,
+	}, nil
 
 
-	return
 }
 }

+ 21 - 5
api/medical/internal/logic/institution/claiminstitutionlogic.go

@@ -1,11 +1,10 @@
 package institution
 package institution
 
 
 import (
 import (
-	"context"
-
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/types"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/types"
-
+	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
+	"context"
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/logx"
 )
 )
 
 
@@ -23,8 +22,25 @@ func NewClaimInstitutionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
 	}
 	}
 }
 }
 
 
+// ClaimInstitution 我认领的医疗机构列表
 func (l *ClaimInstitutionLogic) ClaimInstitution(req *types.ClaimInstitutionReq) (resp *types.CommonRes, err error) {
 func (l *ClaimInstitutionLogic) ClaimInstitution(req *types.ClaimInstitutionReq) (resp *types.CommonRes, err error) {
-	// todo: add your logic here and delete this line
+	rs, _ := l.svcCtx.Medical.ClaimedInstitutionList(l.ctx, &medical.ClaimedReq{
+		AppId:    req.AppId,
+		UserId:   int64(req.UserId),
+		Page:     int64(req.Page),
+		PageSize: int64(req.PageSize),
+	})
+	var result interface{}
+
+	result = map[string]interface{}{
+		"list":  rs.Data.List,
+		"total": rs.Data.Total,
+	}
+
+	return &types.CommonRes{
+		Error_msg:  rs.ErrorMsg,
+		Error_code: int(rs.ErrorCode),
+		Data:       result,
+	}, nil
 
 
-	return
 }
 }

+ 14 - 2
api/medical/internal/logic/public/claimlogic.go

@@ -1,6 +1,8 @@
 package public
 package public
 
 
 import (
 import (
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
 	"context"
 	"context"
 
 
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
@@ -23,8 +25,18 @@ func NewClaimLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ClaimLogic
 	}
 	}
 }
 }
 
 
+// Claim 认领
 func (l *ClaimLogic) Claim(req *types.ClaimReq) (resp *types.CommonRes, err error) {
 func (l *ClaimLogic) Claim(req *types.ClaimReq) (resp *types.CommonRes, err error) {
-	// todo: add your logic here and delete this line
 
 
-	return
+	rs, _ := l.svcCtx.Medical.Claim(l.ctx, &medical.ClaimReq{
+		UserId: int64(req.UserId),
+		EntId:  encrypt.SE.Decode4Hex(req.EntId),
+		Type:   int64(req.Type),
+		AppId:  req.AppId,
+	})
+
+	return &types.CommonRes{
+		Error_msg:  rs.ErrorMsg,
+		Error_code: int(rs.ErrorCode),
+	}, nil
 }
 }

+ 16 - 2
api/medical/internal/logic/public/isclaimedlogic.go

@@ -1,6 +1,8 @@
 package public
 package public
 
 
 import (
 import (
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
 	"context"
 	"context"
 
 
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
@@ -23,8 +25,20 @@ func NewIsClaimedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IsClaim
 	}
 	}
 }
 }
 
 
+// IsClaimed 是否认领
 func (l *IsClaimedLogic) IsClaimed(req *types.IsClaimedReq) (resp *types.CommonRes, err error) {
 func (l *IsClaimedLogic) IsClaimed(req *types.IsClaimedReq) (resp *types.CommonRes, err error) {
-	// todo: add your logic here and delete this line
 
 
-	return
+	rs, _ := l.svcCtx.Medical.IsClaimed(l.ctx, &medical.IsClaimedReq{
+		UserId: int64(req.UserId),
+		EntId:  encrypt.SE.Decode4Hex(req.CompanyId),
+		Type:   int64(req.Type),
+	})
+	return &types.CommonRes{
+		Error_msg:  rs.ErrorMsg,
+		Error_code: int(rs.ErrorCode),
+		Data: map[string]interface{}{
+			"status": rs.Data.Status,
+		},
+	}, nil
+
 }
 }

+ 12 - 2
api/medical/internal/logic/public/unclaimedlogic.go

@@ -1,6 +1,9 @@
 package public
 package public
 
 
 import (
 import (
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
 	"context"
 	"context"
 
 
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/api/medical/internal/svc"
@@ -23,8 +26,15 @@ func NewUnclaimedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Unclaim
 	}
 	}
 }
 }
 
 
+// Unclaimed 取消认领
 func (l *UnclaimedLogic) Unclaimed(req *types.UnclaimedReq) (resp *types.CommonRes, err error) {
 func (l *UnclaimedLogic) Unclaimed(req *types.UnclaimedReq) (resp *types.CommonRes, err error) {
-	// todo: add your logic here and delete this line
+	rs, _ := l.svcCtx.Medical.UnClaimed(l.ctx, &medical.UnclaimedReq{
+		UserId: int64(req.UserId),
+		Id:     common.Int64All(encrypt.SE.Decode4Hex(req.Id)),
+	})
 
 
-	return
+	return &types.CommonRes{
+		Error_msg:  rs.ErrorMsg,
+		Error_code: int(rs.ErrorCode),
+	}, nil
 }
 }

+ 17 - 17
api/medical/internal/types/types.go

@@ -45,16 +45,17 @@ type PortraitReq struct {
 }
 }
 
 
 type ClaimInstitutionReq struct {
 type ClaimInstitutionReq struct {
-	UserId      string `header:"newUserId"`           // 用户id
-	CompanyName string `json:"company_name,optional"` // 要搜索的医疗机构
-	Page        int    `json:"page,optional"`         // 页码
-	PageSize    int    `json:"page_size,optional"`    // 每页条数
+	UserId   int    `header:"newUserId"`          // 用户id
+	Page     int    `json:"page,default=0"`       // 页码
+	PageSize int    `json:"page_size,default=10"` // 每页条数
+	AppId    string `header:"appId"`              // appid
 }
 }
 
 
 type ClaimDistributorReq struct {
 type ClaimDistributorReq struct {
-	UserId   string `header:"newUserId"`        // 用户id
-	Page     int    `json:"page,optional"`      // 页码
-	PageSize int    `json:"page_size,optional"` // 每页条数
+	UserId   int    `header:"newUserId"`          // 用户id
+	Page     int    `json:"page,default=0"`       // 页码
+	PageSize int    `json:"page_size,default=10"` // 每页条数
+	AppId    string `header:"appId"`              // appid
 }
 }
 
 
 type DistributorProductsReq struct {
 type DistributorProductsReq struct {
@@ -64,22 +65,21 @@ type DistributorProductsReq struct {
 }
 }
 
 
 type ClaimReq struct {
 type ClaimReq struct {
-	Type    int    `json:"type"`        // 1 医疗机构 2 经销商
-	EntId   string `json:"entid"`       // 企业标识
-	EntName string `json:"ent_name"`    // 企业名称
-	Address string `json:"address"`     // 所在地
-	UserId  string `header:"newUserId"` // 用户id
+	Type   int    `json:"type,options=1|2"` // 1 医疗机构 2 经销商
+	EntId  string `json:"ent_id"`           // 企业标识
+	UserId int    `header:"newUserId"`      // 用户id
+	AppId  string `header:"appId"`          // appid
 }
 }
 
 
 type UnclaimedReq struct {
 type UnclaimedReq struct {
-	UserId string `header:"newUserId"` // 用户id
-	Id     int    `json:"id"`
+	UserId int    `header:"newUserId"` // 用户id
+	Id     string `json:"id"`
 }
 }
 
 
 type IsClaimedReq struct {
 type IsClaimedReq struct {
-	UserId    string `header:"newUserId"` // 用户id
-	CompanyId string `json:"company_id"`  // 机构id
-	Type      int    `json:"type"`        // 1 医疗机构 2 经销商
+	UserId    int    `header:"newUserId"`      // 用户id
+	CompanyId string `json:"company_id"`       // 机构id
+	Type      int    `json:"type,options=1|2"` // 1 医疗机构 2 经销商
 }
 }
 
 
 type GetNewMsgListReq struct {
 type GetNewMsgListReq struct {

+ 20 - 19
api/medical/medical.api

@@ -43,17 +43,20 @@ type PortraitReq {
 }
 }
 // 我认领的医疗机构请求
 // 我认领的医疗机构请求
 type ClaimInstitutionReq {
 type ClaimInstitutionReq {
-	UserId      string `header:"newUserId"`           // 用户id
-	CompanyName string `json:"company_name,optional"` // 要搜索的医疗机构
-	Page        int    `json:"page,optional"`         // 页码
-	PageSize    int    `json:"page_size,optional"`    // 每页条数
+	UserId   int    `header:"newUserId"`          // 用户id
+	Page     int    `json:"page,default=0"`       // 页码
+	PageSize int    `json:"page_size,default=10"` // 每页条数
+	AppId    string `header:"appId"`              // appid
+
 }
 }
 
 
 // 我认领的经销商请求
 // 我认领的经销商请求
 type ClaimDistributorReq {
 type ClaimDistributorReq {
-	UserId   string `header:"newUserId"`        // 用户id
-	Page     int    `json:"page,optional"`      // 页码
-	PageSize int    `json:"page_size,optional"` // 每页条数
+	UserId   int    `header:"newUserId"`          // 用户id
+	Page     int    `json:"page,default=0"`       // 页码
+	PageSize int    `json:"page_size,default=10"` // 每页条数
+	AppId    string `header:"appId"`              // appid
+
 }
 }
 
 
 // 获取经销商医械信息请求
 // 获取经销商医械信息请求
@@ -64,25 +67,23 @@ type DistributorProductsReq {
 }
 }
 // 认领
 // 认领
 type ClaimReq {
 type ClaimReq {
-	Type    int    `json:"type"`        // 1 医疗机构 2 经销商
-	EntId   string `json:"entid"`       // 企业标识
-	EntName string `json:"ent_name"`    // 企业名称
-	Address string `json:"address"`     // 所在地
-	UserId  string `header:"newUserId"` // 用户id
-
+	Type   int    `json:"type,options=1|2"` // 1 医疗机构 2 经销商
+	EntId  string `json:"ent_id"`           // 企业标识
+	UserId int    `header:"newUserId"`      // 用户id
+	AppId  string `header:"appId"`          // appid
 }
 }
 
 
 // 取消认领
 // 取消认领
 type UnclaimedReq {
 type UnclaimedReq {
-	UserId string `header:"newUserId"` // 用户id
-	Id     int    `json:"id"`
+	UserId int    `header:"newUserId"` // 用户id
+	Id     string `json:"id"`
 }
 }
 
 
 // 是否是认领过的
 // 是否是认领过的
 type IsClaimedReq {
 type IsClaimedReq {
-	UserId    string `header:"newUserId"` // 用户id
-	CompanyId string `json:"company_id"`  // 机构id
-	Type      int    `json:"type"`        // 1 医疗机构 2 经销商
+	UserId    int    `header:"newUserId"`      // 用户id
+	CompanyId string `json:"company_id"`       // 机构id
+	Type      int    `json:"type,options=1|2"` // 1 医疗机构 2 经销商
 }
 }
 
 
 // 获取机构信息请求
 // 获取机构信息请求
@@ -102,7 +103,7 @@ service medical-api {
 	@handler searchInstitution
 	@handler searchInstitution
 	post /search/institution (SearchInstitutionReq) returns (CommonRes); 	    // 搜索医疗机构
 	post /search/institution (SearchInstitutionReq) returns (CommonRes); 	    // 搜索医疗机构
 	@handler getFilterItem
 	@handler getFilterItem
-	post /getFilterItem () returns (CommonRes); 	                            // 获取医疗机构筛选条件
+	post /getFilterItem  returns (CommonRes); 	                            // 获取医疗机构筛选条件
 	@handler portraitInstitution
 	@handler portraitInstitution
 	post /portrait/institution (PortraitReq) returns (CommonRes); 	// 医疗机构画像-医院信息 不确定是否需要
 	post /portrait/institution (PortraitReq) returns (CommonRes); 	// 医疗机构画像-医院信息 不确定是否需要
 	@handler claimInstitution
 	@handler claimInstitution

+ 2 - 2
entity/code.go

@@ -4,9 +4,9 @@ package entity
 const (
 const (
 	CODE_MEDICAL_INSTITUTION_LEVEL = "code_level"
 	CODE_MEDICAL_INSTITUTION_LEVEL = "code_level"
 	CODE_MEDICAL_INSTITUTION_TYPE  = "code_type"
 	CODE_MEDICAL_INSTITUTION_TYPE  = "code_type"
-	DOMAIN_ENT_FOLLOW              = "domain_ent_follow"
 	DOMAIN_CAPITAL_RETENTION       = "domain_capital_retention"
 	DOMAIN_CAPITAL_RETENTION       = "domain_capital_retention"
-	TableDomainEntClaim            = "domain_ent_claim"
+	TableDomainEntClaim            = "domain_ent_claim" // 认领表
+	TableCompanyBasInfo            = "company_baseinfo" // 企业信息表
 )
 )
 
 
 //返回状态
 //返回状态

+ 6 - 6
entity/db.go

@@ -21,13 +21,13 @@ type EsStruct struct {
 }
 }
 
 
 var (
 var (
-	Mysql       *mysql.Mysql
-	BaseMysql   *mysql.Mysql
-	CommonMysql *mysql.Mysql
+	Mysql            *mysql.Mysql
+	BaseMysql        *mysql.Mysql
+	GlobalCommonData *mysql.Mysql
 )
 )
 
 
 type Conn struct {
 type Conn struct {
-	Mysql       *mysql.Mysql
-	BaseMysql   *mysql.Mysql
-	CommonMysql *mysql.Mysql
+	Mysql            *mysql.Mysql
+	BaseMysql        *mysql.Mysql
+	GlobalCommonData *mysql.Mysql
 }
 }

+ 9 - 13
entity/model.go

@@ -1,17 +1,13 @@
 package entity
 package entity
 
 
 type EntClaim struct {
 type EntClaim struct {
-	Id              string `json:"id,omitempty"`          // id
-	AppId           string `json:"appid"`                 // appid
-	UserId          int    `json:"user_id"`               // 用户id
-	EntId           string `json:"ent_id"`                // 企业id
-	EntName         string `json:"ent_name"`              // 企业名称
-	Status          int    `json:"status"`                // '状态;-1:取消认领 1:认领'
-	Type            int    `json:"type"`                  // '类型;1:医疗机构 2:经销商'
-	Address         string `json:"address"`               // 企业地址
-	EstablishDate   string `json:"establish_date"`        // 成立日期
-	RegisterCapital string `json:"regist_capital"`        // 注册资本
-	Phone           string `json:"phone"`                 // 联系方式
-	UpdateTime      string `json:"update_time,omitempty"` // 修改时间
-	CreateTime      string `json:"create_time"`           // 创建时间
+	Id         string `json:"id,omitempty"`          // id
+	AppId      string `json:"appid"`                 // appid
+	UserId     int    `json:"user_id"`               // 用户id
+	EntId      string `json:"ent_id"`                // 企业id
+	EntName    string `json:"ent_name"`              // 企业名称
+	Status     int    `json:"status"`                // '状态;-1:取消认领 1:认领'
+	Type       int    `json:"type"`                  // '类型;1:医疗机构 2:经销商'
+	UpdateTime string `json:"update_time,omitempty"` // 修改时间
+	CreateTime string `json:"create_time"`           // 创建时间
 }
 }

+ 1 - 0
go.mod

@@ -5,6 +5,7 @@ go 1.16
 require (
 require (
 	app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b
 	app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b
 	github.com/go-sql-driver/mysql v1.6.0
 	github.com/go-sql-driver/mysql v1.6.0
+	github.com/mitchellh/mapstructure v1.1.2
 	github.com/zeromicro/go-zero v1.4.0
 	github.com/zeromicro/go-zero v1.4.0
 	google.golang.org/grpc v1.48.0
 	google.golang.org/grpc v1.48.0
 	google.golang.org/protobuf v1.28.1
 	google.golang.org/protobuf v1.28.1

+ 1 - 4
go.sum

@@ -1,4 +1,3 @@
-app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d h1:WPsYuuptAd3UEgN+jPzpnsDe/OvcshDUUtOTZPYGSJ8=
 app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d/go.mod h1:91/lSD/hS+ckMVP3WdidRzDhC60lLMdyce9QHy0cSMA=
 app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d/go.mod h1:91/lSD/hS+ckMVP3WdidRzDhC60lLMdyce9QHy0cSMA=
 app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b h1:7EtDV0o2XsluZI0ftgb2Twa/QlX7HxHP2SKhtyfnJV4=
 app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b h1:7EtDV0o2XsluZI0ftgb2Twa/QlX7HxHP2SKhtyfnJV4=
 app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b/go.mod h1:HelrO6tcD9TcKb/HOP2BLbzppyDz2kpQSFhPMQTUgbQ=
 app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b/go.mod h1:HelrO6tcD9TcKb/HOP2BLbzppyDz2kpQSFhPMQTUgbQ=
@@ -282,7 +281,6 @@ github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/
 github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
 github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
 github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
 github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
 github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
 github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
-github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
 github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
 github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
 github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
 github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
 github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
 github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
@@ -316,7 +314,6 @@ github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
 github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
 github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
 github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
 github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
 github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
 github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
-github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
 github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
 github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
 github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
 github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
@@ -329,6 +326,7 @@ github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOq
 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
 github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
 github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
 github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
 github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
+github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
 github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
 github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
 github.com/mkevac/debugcharts v0.0.0-20191222103121-ae1c48aa8615/go.mod h1:Ad7oeElCZqA1Ufj0U9/liOF4BtVepxRcTvr2ey7zTvM=
 github.com/mkevac/debugcharts v0.0.0-20191222103121-ae1c48aa8615/go.mod h1:Ad7oeElCZqA1Ufj0U9/liOF4BtVepxRcTvr2ey7zTvM=
 github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c=
 github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c=
@@ -352,7 +350,6 @@ github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI
 github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
 github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
 github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
 github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
 github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
 github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
-github.com/olivere/elastic v6.2.37+incompatible h1:UfSGJem5czY+x/LqxgeCBgjDn6St+z8OnsCuxwD3L0U=
 github.com/olivere/elastic v6.2.37+incompatible/go.mod h1:J+q1zQJTgAz9woqsbVRqGeB5G1iqDKVBWLNSYW8yfJ8=
 github.com/olivere/elastic v6.2.37+incompatible/go.mod h1:J+q1zQJTgAz9woqsbVRqGeB5G1iqDKVBWLNSYW8yfJ8=
 github.com/olivere/elastic/v7 v7.0.22/go.mod h1:VDexNy9NjmtAkrjNoI7tImv7FR4tf5zUA3ickqu5Pc8=
 github.com/olivere/elastic/v7 v7.0.22/go.mod h1:VDexNy9NjmtAkrjNoI7tImv7FR4tf5zUA3ickqu5Pc8=
 github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=

+ 8 - 8
rpc/medical/etc/medical.yaml

@@ -18,16 +18,16 @@ BaseMysqlMain:
   passWord: '=PDT49#80Z!RVv52_z'
   passWord: '=PDT49#80Z!RVv52_z'
   maxOpenConns: 5
   maxOpenConns: 5
   maxIdleConns: 5
   maxIdleConns: 5
-MysqlCommon:
-  dbName: global_common_data
-  address: 192.168.3.217:4000
-  userName: root
-  passWord: '=PDT49#80Z!RVv52_z'
-  maxOpenConns: 5
-  maxIdleConns: 5
 Es:
 Es:
   addr: http://192.168.3.206:9800
   addr: http://192.168.3.206:9800
   size: 5
   size: 5
   index: bidding
   index: bidding
   type: bidding
   type: bidding
-Timeout:  5000
+GlobalCommonData:
+  dbName: global_common_data
+  address: 192.168.3.217:4000
+  userName: root
+  passWord: =PDT49#80Z!RVv52_z
+  maxOpenConns: 5
+  maxIdleConns: 5
+Timeout:  5000

+ 11 - 17
rpc/medical/init/init.go

@@ -34,9 +34,6 @@ func init() {
 			MaxIdleConns: mm.MaxIdleConns,
 			MaxIdleConns: mm.MaxIdleConns,
 		}
 		}
 		entity.Mysql.Init()
 		entity.Mysql.Init()
-		//medical_fileld_data
-		qwe := entity.Mysql.SelectBySql("select * from code_level limit 1")
-		log.Println("~~~~", qwe)
 	}
 	}
 	nn := C.BaseMysqlMain
 	nn := C.BaseMysqlMain
 	if nn.Address != "" {
 	if nn.Address != "" {
@@ -50,23 +47,19 @@ func init() {
 			MaxIdleConns: nn.MaxIdleConns,
 			MaxIdleConns: nn.MaxIdleConns,
 		}
 		}
 		entity.BaseMysql.Init()
 		entity.BaseMysql.Init()
-		qwe := entity.BaseMysql.SelectBySql("select * from appointment limit 1")
-		log.Println("~~~~", qwe)
 	}
 	}
-
-	if C.MysqlCommon.Address != "" {
+	commonConfig := C.GlobalCommonData
+	if nn.Address != "" {
 		log.Println("--初始化 mysql--")
 		log.Println("--初始化 mysql--")
-		entity.CommonMysql = &mysql.Mysql{
-			Address:      C.MysqlCommon.Address,
-			UserName:     C.MysqlCommon.UserName,
-			PassWord:     C.MysqlCommon.PassWord,
-			DBName:       C.MysqlCommon.DbName,
-			MaxOpenConns: C.MysqlCommon.MaxOpenConns,
-			MaxIdleConns: C.MysqlCommon.MaxIdleConns,
+		entity.GlobalCommonData = &mysql.Mysql{
+			Address:      commonConfig.Address,
+			UserName:     commonConfig.UserName,
+			PassWord:     commonConfig.PassWord,
+			DBName:       commonConfig.DbName,
+			MaxOpenConns: commonConfig.MaxOpenConns,
+			MaxIdleConns: commonConfig.MaxIdleConns,
 		}
 		}
-		entity.CommonMysql.Init()
-		qwe := entity.CommonMysql.SelectBySql("select * from code_area limit 1")
-		log.Println("~~~~", qwe)
+		entity.GlobalCommonData.Init()
 	}
 	}
 	//初始化 elasticsearch
 	//初始化 elasticsearch
 	es := C.Es
 	es := C.Es
@@ -89,4 +82,5 @@ func init() {
 		// 	}
 		// 	}
 		// }
 		// }
 	}
 	}
+
 }
 }

+ 7 - 0
rpc/medical/internal/config/config.go

@@ -7,8 +7,15 @@ import (
 
 
 type Config struct {
 type Config struct {
 	zrpc.RpcServerConf
 	zrpc.RpcServerConf
+<<<<<<< HEAD
 	MysqlMain     entity.MysqlMainStruct
 	MysqlMain     entity.MysqlMainStruct
 	BaseMysqlMain entity.MysqlMainStruct
 	BaseMysqlMain entity.MysqlMainStruct
 	Es            entity.EsStruct
 	Es            entity.EsStruct
 	MysqlCommon   entity.MysqlMainStruct
 	MysqlCommon   entity.MysqlMainStruct
+=======
+	MysqlMain        entity.MysqlMainStruct
+	BaseMysqlMain    entity.MysqlMainStruct
+	GlobalCommonData entity.MysqlMainStruct
+	Es               entity.EsStruct
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
 }
 }

+ 52 - 26
rpc/medical/internal/logic/claimeddistributorlistlogic.go

@@ -1,10 +1,13 @@
 package logic
 package logic
 
 
 import (
 import (
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
 	"context"
 	"context"
+	"fmt"
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/logx"
 )
 )
 
 
@@ -23,32 +26,55 @@ func NewClaimedDistributorListLogic(ctx context.Context, svcCtx *svc.ServiceCont
 }
 }
 
 
 // ClaimedDistributorList 我认领的经销商列表
 // ClaimedDistributorList 我认领的经销商列表
-func (l *ClaimedDistributorListLogic) ClaimedDistributorList(in *medical.ClaimedReq) (*medical.CommonResp, error) {
-	//rs, total := l.svcCtx.EntClaimSrv.DistributorList(int(in.UserId), in.AppId, int(in.Page), int(in.PageSize))
-	//resultList := []medical.ClaimReq{}
-	//if rs!=nil{
-	//	//for i:=0;i<len(*rs);i++{
-	//	//	resultList = append(resultList,
-	//	//		medical.ClaimReq{
-	//	//		Id: common.Int64All((*rs)[i]["id"]),
-	//	//		AppId: (*rs)[i]["appid"],
-	//	//		Id: common.Int64All((*rs)[i]["ent_id"]),
-	//	//		Id: common.Int64All((*rs)[i]["ent_name"]),
-	//	//		Id: common.Int64All((*rs)[i]["address"]),
-	//	//		Id: common.Int64All((*rs)[i]["establish_date"]),
-	//	//		Id: common.Int64All((*rs)[i]["regist_capital"]),
-	//	//		Id: common.Int64All((*rs)[i]["phone"]),
-	//	//		Id: common.Int64All((*rs)[i]["update_time"]),
-	//	//		: common.Int64All((*rs)[i]["create_time"]),
-	//	//
-	//	//		}
-	//	//		)
-	//	//}
-	//}
-
-	return &medical.CommonResp{
+func (l *ClaimedDistributorListLogic) ClaimedDistributorList(in *medical.ClaimedReq) (*medical.EntClaimListResp, error) {
+	rs, total := l.svcCtx.EntClaimSrv.DistributorList(int(in.UserId), in.AppId, int(in.Page), int(in.PageSize))
+	resultList := medical.EntClaimListStruct{}
+	if rs != nil {
+		// 补充信息
+		// 获取id  构造查询条件
+		var entIds []interface{}
+		for i := 0; i < len(*rs); i++ {
+			entIds = append(entIds, common.ObjToString((*rs)[i]["ent_id"]))
+		}
+		// 查询信息
+		entRs := l.svcCtx.EntClaimSrv.GetInstitutionByIds(entIds)
+		//处理成map
+		entInfos := map[string]map[string]interface{}{}
+		if entRs != nil {
+			for i := 0; i < len(*entRs); i++ {
+				idTmp := common.ObjToString((*entRs)[i]["company_id"])
+				entInfos[idTmp] = (*entRs)[i]
+			}
+		}
+		// 拼接信息
+		for i := 0; i < len(*rs); i++ {
+			entId := common.ObjToString((*rs)[i]["ent_id"])
+			info := map[string]interface{}{}
+			if tmp, ok := entInfos[entId]; ok {
+				info = tmp
+			}
+			resultList.List = append(resultList.List,
+				&medical.EntClaim{
+					Id:            encrypt.SE.Encode2Hex(fmt.Sprintf("%v", (*rs)[i]["id"])),
+					AppId:         common.ObjToString((*rs)[i]["appid"]),
+					EntId:         encrypt.SE.Encode2Hex(entId),
+					EntName:       common.ObjToString((*rs)[i]["ent_name"]),
+					Address:       common.ObjToString(info["company_address"]),
+					EstablishDate: common.ObjToString(info["establish_date"]),
+					Capital:       common.ObjToString(info["capital"]),
+					CompanyPhone:  common.ObjToString(info["company_phone"]),
+					UpdateTime:    common.ObjToString((*rs)[i]["update_time"]),
+					CreateTime:    common.ObjToString((*rs)[i]["create_time"])},
+			)
+		}
+		resultList.Total = int64(total)
+	} else {
+		resultList.List = []*medical.EntClaim{}
+		resultList.Total = 0
+	}
+	return &medical.EntClaimListResp{
 		ErrorMsg:  "",
 		ErrorMsg:  "",
-		ErrorCode: entity.ERRORCODE,
-		Data:      nil,
+		ErrorCode: entity.SUCCESSCODE,
+		Data:      &resultList,
 	}, nil
 	}, nil
 }
 }

+ 56 - 3
rpc/medical/internal/logic/claimedinstitutionlistlogic.go

@@ -1,7 +1,11 @@
 package logic
 package logic
 
 
 import (
 import (
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
 	"context"
 	"context"
+	"fmt"
 
 
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
@@ -24,8 +28,57 @@ func NewClaimedInstitutionListLogic(ctx context.Context, svcCtx *svc.ServiceCont
 }
 }
 
 
 // ClaimedInstitutionList 我认领的医疗机构列表
 // ClaimedInstitutionList 我认领的医疗机构列表
-func (l *ClaimedInstitutionListLogic) ClaimedInstitutionList(in *medical.ClaimedReq) (*medical.CommonResp, error) {
-	// todo: add your logic here and delete this line
+func (l *ClaimedInstitutionListLogic) ClaimedInstitutionList(in *medical.ClaimedReq) (*medical.EntClaimListResp, error) {
+	rs, total := l.svcCtx.EntClaimSrv.InstitutionList(int(in.UserId), in.AppId, int(in.Page), int(in.PageSize))
+	resultList := medical.EntClaimListStruct{}
 
 
-	return &medical.CommonResp{}, nil
+	if rs != nil {
+		// 补充信息
+		// 获取id  构造查询条件
+		var entIds []interface{}
+		for i := 0; i < len(*rs); i++ {
+			entIds = append(entIds, common.ObjToString((*rs)[i]["ent_id"]))
+		}
+		// 查询信息
+		entRs := l.svcCtx.EntClaimSrv.GetInstitutionByIds(entIds)
+		//处理成map
+		entInfos := map[string]map[string]interface{}{}
+		if entRs != nil {
+			for i := 0; i < len(*entRs); i++ {
+				idTmp := common.ObjToString((*entRs)[i]["company_id"])
+				entInfos[idTmp] = (*entRs)[i]
+			}
+		}
+		// 拼接信息
+		for i := 0; i < len(*rs); i++ {
+			entId := common.ObjToString((*rs)[i]["ent_id"])
+			info := map[string]interface{}{}
+			if tmp, ok := entInfos[entId]; ok {
+				info = tmp
+			}
+
+			resultList.List = append(resultList.List,
+				&medical.EntClaim{
+					Id:            encrypt.SE.Encode2Hex(fmt.Sprintf("%v", (*rs)[i]["id"])),
+					AppId:         common.ObjToString((*rs)[i]["appid"]),
+					EntId:         encrypt.SE.Encode2Hex(entId),
+					EntName:       common.ObjToString((*rs)[i]["ent_name"]),
+					Address:       common.ObjToString(info["company_address"]),
+					EstablishDate: common.ObjToString(info["establish_date"]),
+					Capital:       common.ObjToString(info["capital"]),
+					CompanyPhone:  common.ObjToString(info["company_phone"]),
+					UpdateTime:    common.ObjToString((*rs)[i]["update_time"]),
+					CreateTime:    common.ObjToString((*rs)[i]["create_time"])},
+			)
+		}
+		resultList.Total = int64(total)
+	} else {
+		resultList.List = []*medical.EntClaim{}
+		resultList.Total = 0
+	}
+	return &medical.EntClaimListResp{
+		ErrorMsg:  "",
+		ErrorCode: entity.SUCCESSCODE,
+		Data:      &resultList,
+	}, nil
 }
 }

+ 23 - 15
rpc/medical/internal/logic/claimlogic.go

@@ -3,11 +3,10 @@ package logic
 import (
 import (
 	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/date"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
-	"context"
-
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
-
+	"context"
+	"github.com/mitchellh/mapstructure"
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/logx"
 )
 )
 
 
@@ -27,19 +26,28 @@ func NewClaimLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ClaimLogic
 
 
 // Claim 认领(经销商/医疗机构)
 // Claim 认领(经销商/医疗机构)
 func (l *ClaimLogic) Claim(in *medical.ClaimReq) (*medical.CommonResp, error) {
 func (l *ClaimLogic) Claim(in *medical.ClaimReq) (*medical.CommonResp, 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
+	}
 
 
 	rs := l.svcCtx.EntClaimSrv.Claim(&entity.EntClaim{
 	rs := l.svcCtx.EntClaimSrv.Claim(&entity.EntClaim{
-		AppId:           in.AppId,
-		UserId:          int(in.UserId),
-		EntId:           in.EntId,
-		EntName:         in.EntName,
-		Status:          entity.StatusClaimed,
-		Type:            int(in.Type),
-		Address:         in.Address,
-		EstablishDate:   in.EstablishDate,
-		RegisterCapital: in.RegisterCapital,
-		Phone:           in.Phone,
-		CreateTime:      date.NowFormat(date.Date_Full_Layout),
+		AppId:      in.AppId,
+		UserId:     int(in.UserId),
+		EntId:      in.EntId,
+		EntName:    tmp.CompanyName,
+		Status:     entity.StatusClaimed,
+		Type:       int(in.Type),
+		CreateTime: date.NowFormat(date.Date_Full_Layout),
 	})
 	})
 	if !rs {
 	if !rs {
 		return &medical.CommonResp{
 		return &medical.CommonResp{
@@ -49,6 +57,6 @@ func (l *ClaimLogic) Claim(in *medical.ClaimReq) (*medical.CommonResp, error) {
 	}
 	}
 	return &medical.CommonResp{
 	return &medical.CommonResp{
 		ErrorMsg:  "",
 		ErrorMsg:  "",
-		ErrorCode: entity.ERRORCODE,
+		ErrorCode: entity.SUCCESSCODE,
 	}, nil
 	}, nil
 }
 }

+ 11 - 5
rpc/medical/internal/logic/isclaimedlogic.go

@@ -1,6 +1,7 @@
 package logic
 package logic
 
 
 import (
 import (
+	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
 	"context"
 	"context"
 
 
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
@@ -23,9 +24,14 @@ func NewIsClaimedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IsClaim
 	}
 	}
 }
 }
 
 
-//  是否认领(经销商/医疗机构)
-func (l *IsClaimedLogic) IsClaimed(in *medical.IsClaimedReq) (*medical.CommonResp, error) {
-	// todo: add your logic here and delete this line
-
-	return &medical.CommonResp{}, nil
+// IsClaimed 是否认领(经销商/医疗机构)
+func (l *IsClaimedLogic) IsClaimed(in *medical.IsClaimedReq) (*medical.IsClaimedResp, error) {
+	rs := l.svcCtx.EntClaimSrv.IsClaimed(int(in.UserId), in.AppId, in.EntId, int(in.Type))
+	return &medical.IsClaimedResp{
+		ErrorCode: entity.SUCCESSCODE,
+		ErrorMsg:  "",
+		Data: &medical.IsClaimedResp_StatusRes{
+			Status: rs,
+		},
+	}, nil
 }
 }

+ 13 - 4
rpc/medical/internal/logic/unclaimedlogic.go

@@ -1,6 +1,7 @@
 package logic
 package logic
 
 
 import (
 import (
+	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
 	"context"
 	"context"
 
 
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
@@ -23,9 +24,17 @@ func NewUnClaimedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UnClaim
 	}
 	}
 }
 }
 
 
-//  取消认领(经销商/医疗机构)
+// UnClaimed 取消认领(经销商/医疗机构)
 func (l *UnClaimedLogic) UnClaimed(in *medical.UnclaimedReq) (*medical.CommonResp, error) {
 func (l *UnClaimedLogic) UnClaimed(in *medical.UnclaimedReq) (*medical.CommonResp, error) {
-	// todo: add your logic here and delete this line
-
-	return &medical.CommonResp{}, nil
+	rs := l.svcCtx.EntClaimSrv.Unclaimed(int(in.Id), int(in.UserId))
+	if !rs {
+		return &medical.CommonResp{
+			ErrorMsg:  "操作失败",
+			ErrorCode: entity.ERRORCODE,
+		}, nil
+	}
+	return &medical.CommonResp{
+		ErrorMsg:  "",
+		ErrorCode: entity.SUCCESSCODE,
+	}, nil
 }
 }

+ 3 - 3
rpc/medical/internal/server/medicalserver.go

@@ -71,19 +71,19 @@ func (s *MedicalServer) UnClaimed(ctx context.Context, in *medical.UnclaimedReq)
 }
 }
 
 
 //  是否认领(经销商/医疗机构)
 //  是否认领(经销商/医疗机构)
-func (s *MedicalServer) IsClaimed(ctx context.Context, in *medical.IsClaimedReq) (*medical.CommonResp, error) {
+func (s *MedicalServer) IsClaimed(ctx context.Context, in *medical.IsClaimedReq) (*medical.IsClaimedResp, error) {
 	l := logic.NewIsClaimedLogic(ctx, s.svcCtx)
 	l := logic.NewIsClaimedLogic(ctx, s.svcCtx)
 	return l.IsClaimed(in)
 	return l.IsClaimed(in)
 }
 }
 
 
 //  我认领的经销商列表
 //  我认领的经销商列表
-func (s *MedicalServer) ClaimedDistributorList(ctx context.Context, in *medical.ClaimedReq) (*medical.CommonResp, error) {
+func (s *MedicalServer) ClaimedDistributorList(ctx context.Context, in *medical.ClaimedReq) (*medical.EntClaimListResp, error) {
 	l := logic.NewClaimedDistributorListLogic(ctx, s.svcCtx)
 	l := logic.NewClaimedDistributorListLogic(ctx, s.svcCtx)
 	return l.ClaimedDistributorList(in)
 	return l.ClaimedDistributorList(in)
 }
 }
 
 
 //  我认领的医疗机构列表
 //  我认领的医疗机构列表
-func (s *MedicalServer) ClaimedInstitutionList(ctx context.Context, in *medical.ClaimedReq) (*medical.CommonResp, error) {
+func (s *MedicalServer) ClaimedInstitutionList(ctx context.Context, in *medical.ClaimedReq) (*medical.EntClaimListResp, error) {
 	l := logic.NewClaimedInstitutionListLogic(ctx, s.svcCtx)
 	l := logic.NewClaimedInstitutionListLogic(ctx, s.svcCtx)
 	return l.ClaimedInstitutionList(in)
 	return l.ClaimedInstitutionList(in)
 }
 }

+ 1 - 3
rpc/medical/internal/svc/servicecontext.go

@@ -4,7 +4,6 @@ import (
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/config"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/config"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service"
-	"fmt"
 )
 )
 
 
 type ServiceContext struct {
 type ServiceContext struct {
@@ -13,9 +12,8 @@ type ServiceContext struct {
 }
 }
 
 
 func NewServiceContext(c config.Config) *ServiceContext {
 func NewServiceContext(c config.Config) *ServiceContext {
-	fmt.Println(entity.BaseMysql, entity.BaseMysql == nil)
 	return &ServiceContext{
 	return &ServiceContext{
 		Config:      c,
 		Config:      c,
-		EntClaimSrv: service.NewEntClaimSrv(&entity.Conn{Mysql: entity.Mysql, BaseMysql: entity.BaseMysql}), // 手动添加 认领相关
+		EntClaimSrv: service.NewEntClaimSrv(&entity.Conn{Mysql: entity.Mysql, BaseMysql: entity.BaseMysql, GlobalCommonData: entity.GlobalCommonData}), // 手动添加 认领相关
 	}
 	}
 }
 }

+ 45 - 12
rpc/medical/medical.proto

@@ -15,7 +15,7 @@ message Response {
 message CommonResp{
 message CommonResp{
   int64           ErrorCode = 1;  // 响应代码
   int64           ErrorCode = 1;  // 响应代码
   string          ErrorMsg = 2;   // 响应信息
   string          ErrorMsg = 2;   // 响应信息
-  google.protobuf.Any Data = 3;   // 响应数据
+  bytes           Data = 3;   // 响应数据
 }
 }
 message CommonReq {
 message CommonReq {
     int64           userId  =1;
     int64           userId  =1;
@@ -137,17 +137,12 @@ message PortraitResp{
 }
 }
 // 认领
 // 认领
 message ClaimReq{
 message ClaimReq{
-  int64 Id = 10;
   int64 UserId = 1 ;// 用户id
   int64 UserId = 1 ;// 用户id
   string EntId = 2 ;// 公司id
   string EntId = 2 ;// 公司id
-  string EntName = 3 ;// 公司名称
-  int64 Type = 4 ;// 类型;1:医疗机构 2:经销商'
-  string Address = 5 ;// 企业地址
-  string EstablishDate = 6 ;// 成立日期
-  string RegisterCapital = 7 ;// 注册资本
-  string Phone = 8 ;// 联系方式
-  string AppId = 9 ;//appid
+  int64 Type = 3 ;// 类型;1:医疗机构 2:经销商'
+  string AppId = 4 ;//appid
 }
 }
+
 // 取消认领
 // 取消认领
 message UnclaimedReq{
 message UnclaimedReq{
   int64  UserId = 1 ;// 用户id
   int64  UserId = 1 ;// 用户id
@@ -157,8 +152,18 @@ message UnclaimedReq{
 // 是否是认领的
 // 是否是认领的
 message IsClaimedReq{
 message IsClaimedReq{
   int64  UserId = 1 ;// 用户id
   int64  UserId = 1 ;// 用户id
-  int64  Id = 2; // 认领记录id
+  string  EntId = 2; // 认领记录id
   string AppId = 3 ;//appid
   string AppId = 3 ;//appid
+  int64  Type = 4;// 1-医疗机构 2-经销商
+}
+message IsClaimedResp{
+  int64  ErrorCode = 1;  // 响应代码
+  string ErrorMsg = 2;   // 响应信息
+  message StatusRes{
+    bool status = 1;
+  }
+  StatusRes Data =3;
+
 }
 }
 // 我认领的
 // 我认领的
 message ClaimedReq{
 message ClaimedReq{
@@ -194,6 +199,32 @@ message NewMsgList{
 	repeated string winner=7;//中标单位
 	repeated string winner=7;//中标单位
 }
 }
 
 
+message  EntClaim{
+  string  id = 10;
+  int64  user_id = 1 ;// 用户id
+  string ent_id = 2 ;// 公司id
+  string ent_name = 3 ;// 公司名称
+  int64  type = 4 ;// 类型;1:医疗机构 2:经销商'
+  string address = 5 ;// 企业地址
+  string establish_date = 6 ;// 成立日期
+  string capital = 7 ;// 注册资本
+  string company_phone = 8 ;// 联系方式
+  string appId = 9 ;//appid
+  string create_time = 11 ;//创建时间
+  string update_time = 12 ;//更新时间
+}
+// 列表
+message  EntClaimListStruct{
+  repeated EntClaim list =1;
+  int64    total = 2;
+}
+// 关注列表响应
+message  EntClaimListResp{
+  int64           ErrorCode = 1;  // 响应代码
+  string          ErrorMsg = 2;   // 响应信息
+  EntClaimListStruct Data =3;
+}
+
 service Medical {
 service Medical {
       //搜索医疗机构
       //搜索医疗机构
       rpc Institution(SearchInstitutionReq) returns(CompanyResp);
       rpc Institution(SearchInstitutionReq) returns(CompanyResp);
@@ -212,11 +243,13 @@ service Medical {
       // 取消认领(经销商/医疗机构)
       // 取消认领(经销商/医疗机构)
       rpc UnClaimed(UnclaimedReq) returns(CommonResp);
       rpc UnClaimed(UnclaimedReq) returns(CommonResp);
       // 是否认领(经销商/医疗机构)
       // 是否认领(经销商/医疗机构)
-      rpc IsClaimed(IsClaimedReq) returns(CommonResp);
+      rpc IsClaimed(IsClaimedReq) returns(IsClaimedResp);
       // 我认领的经销商列表
       // 我认领的经销商列表
-      rpc ClaimedDistributorList(ClaimedReq) returns(CommonResp);
+      rpc ClaimedDistributorList(ClaimedReq) returns(EntClaimListResp);
       // 我认领的医疗机构列表
       // 我认领的医疗机构列表
       rpc ClaimedInstitutionList(ClaimedReq) returns(CommonResp);
       rpc ClaimedInstitutionList(ClaimedReq) returns(CommonResp);
       // 招标动态
       // 招标动态
       rpc GetNewMsg(GetNewMsgReq) returns (GetNewMsgResp);
       rpc GetNewMsg(GetNewMsgReq) returns (GetNewMsgResp);
+      //
+      rpc ClaimedInstitutionList(ClaimedReq) returns(EntClaimListResp);
 }
 }

+ 9 - 5
rpc/medical/medical/medical.go

@@ -29,13 +29,17 @@ type (
 		//  取消认领(经销商/医疗机构)
 		//  取消认领(经销商/医疗机构)
 		UnClaimed(ctx context.Context, in *UnclaimedReq, opts ...grpc.CallOption) (*CommonResp, error)
 		UnClaimed(ctx context.Context, in *UnclaimedReq, opts ...grpc.CallOption) (*CommonResp, error)
 		//  是否认领(经销商/医疗机构)
 		//  是否认领(经销商/医疗机构)
-		IsClaimed(ctx context.Context, in *IsClaimedReq, opts ...grpc.CallOption) (*CommonResp, error)
+		IsClaimed(ctx context.Context, in *IsClaimedReq, opts ...grpc.CallOption) (*IsClaimedResp, error)
 		//  我认领的经销商列表
 		//  我认领的经销商列表
-		ClaimedDistributorList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*CommonResp, error)
+		ClaimedDistributorList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*EntClaimListResp, error)
 		//  我认领的医疗机构列表
 		//  我认领的医疗机构列表
+<<<<<<< HEAD
 		ClaimedInstitutionList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*CommonResp, error)
 		ClaimedInstitutionList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*CommonResp, error)
 		//  招标动态
 		//  招标动态
 		GetNewMsg(ctx context.Context, in *GetNewMsgReq, opts ...grpc.CallOption) (*GetNewMsgResp, error)
 		GetNewMsg(ctx context.Context, in *GetNewMsgReq, opts ...grpc.CallOption) (*GetNewMsgResp, error)
+=======
+		ClaimedInstitutionList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*EntClaimListResp, error)
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
 	}
 	}
 
 
 	defaultMedical struct {
 	defaultMedical struct {
@@ -98,19 +102,19 @@ func (m *defaultMedical) UnClaimed(ctx context.Context, in *UnclaimedReq, opts .
 }
 }
 
 
 //  是否认领(经销商/医疗机构)
 //  是否认领(经销商/医疗机构)
-func (m *defaultMedical) IsClaimed(ctx context.Context, in *IsClaimedReq, opts ...grpc.CallOption) (*CommonResp, error) {
+func (m *defaultMedical) IsClaimed(ctx context.Context, in *IsClaimedReq, opts ...grpc.CallOption) (*IsClaimedResp, error) {
 	client := NewMedicalClient(m.cli.Conn())
 	client := NewMedicalClient(m.cli.Conn())
 	return client.IsClaimed(ctx, in, opts...)
 	return client.IsClaimed(ctx, in, opts...)
 }
 }
 
 
 //  我认领的经销商列表
 //  我认领的经销商列表
-func (m *defaultMedical) ClaimedDistributorList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*CommonResp, error) {
+func (m *defaultMedical) ClaimedDistributorList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*EntClaimListResp, error) {
 	client := NewMedicalClient(m.cli.Conn())
 	client := NewMedicalClient(m.cli.Conn())
 	return client.ClaimedDistributorList(ctx, in, opts...)
 	return client.ClaimedDistributorList(ctx, in, opts...)
 }
 }
 
 
 //  我认领的医疗机构列表
 //  我认领的医疗机构列表
-func (m *defaultMedical) ClaimedInstitutionList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*CommonResp, error) {
+func (m *defaultMedical) ClaimedInstitutionList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*EntClaimListResp, error) {
 	client := NewMedicalClient(m.cli.Conn())
 	client := NewMedicalClient(m.cli.Conn())
 	return client.ClaimedInstitutionList(ctx, in, opts...)
 	return client.ClaimedInstitutionList(ctx, in, opts...)
 }
 }

文件差異過大導致無法顯示
+ 683 - 65
rpc/medical/medical/medical.pb.go


+ 21 - 13
rpc/medical/medical/medical_grpc.pb.go

@@ -39,13 +39,17 @@ type MedicalClient interface {
 	// 取消认领(经销商/医疗机构)
 	// 取消认领(经销商/医疗机构)
 	UnClaimed(ctx context.Context, in *UnclaimedReq, opts ...grpc.CallOption) (*CommonResp, error)
 	UnClaimed(ctx context.Context, in *UnclaimedReq, opts ...grpc.CallOption) (*CommonResp, error)
 	// 是否认领(经销商/医疗机构)
 	// 是否认领(经销商/医疗机构)
-	IsClaimed(ctx context.Context, in *IsClaimedReq, opts ...grpc.CallOption) (*CommonResp, error)
+	IsClaimed(ctx context.Context, in *IsClaimedReq, opts ...grpc.CallOption) (*IsClaimedResp, error)
 	// 我认领的经销商列表
 	// 我认领的经销商列表
-	ClaimedDistributorList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*CommonResp, error)
+	ClaimedDistributorList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*EntClaimListResp, error)
 	// 我认领的医疗机构列表
 	// 我认领的医疗机构列表
+<<<<<<< HEAD
 	ClaimedInstitutionList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*CommonResp, error)
 	ClaimedInstitutionList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*CommonResp, error)
 	// 招标动态
 	// 招标动态
 	GetNewMsg(ctx context.Context, in *GetNewMsgReq, opts ...grpc.CallOption) (*GetNewMsgResp, error)
 	GetNewMsg(ctx context.Context, in *GetNewMsgReq, opts ...grpc.CallOption) (*GetNewMsgResp, error)
+=======
+	ClaimedInstitutionList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*EntClaimListResp, error)
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
 }
 }
 
 
 type medicalClient struct {
 type medicalClient struct {
@@ -128,8 +132,8 @@ func (c *medicalClient) UnClaimed(ctx context.Context, in *UnclaimedReq, opts ..
 	return out, nil
 	return out, nil
 }
 }
 
 
-func (c *medicalClient) IsClaimed(ctx context.Context, in *IsClaimedReq, opts ...grpc.CallOption) (*CommonResp, error) {
-	out := new(CommonResp)
+func (c *medicalClient) IsClaimed(ctx context.Context, in *IsClaimedReq, opts ...grpc.CallOption) (*IsClaimedResp, error) {
+	out := new(IsClaimedResp)
 	err := c.cc.Invoke(ctx, "/medical.Medical/IsClaimed", in, out, opts...)
 	err := c.cc.Invoke(ctx, "/medical.Medical/IsClaimed", in, out, opts...)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
@@ -137,8 +141,8 @@ func (c *medicalClient) IsClaimed(ctx context.Context, in *IsClaimedReq, opts ..
 	return out, nil
 	return out, nil
 }
 }
 
 
-func (c *medicalClient) ClaimedDistributorList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*CommonResp, error) {
-	out := new(CommonResp)
+func (c *medicalClient) ClaimedDistributorList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*EntClaimListResp, error) {
+	out := new(EntClaimListResp)
 	err := c.cc.Invoke(ctx, "/medical.Medical/ClaimedDistributorList", in, out, opts...)
 	err := c.cc.Invoke(ctx, "/medical.Medical/ClaimedDistributorList", in, out, opts...)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
@@ -146,8 +150,8 @@ func (c *medicalClient) ClaimedDistributorList(ctx context.Context, in *ClaimedR
 	return out, nil
 	return out, nil
 }
 }
 
 
-func (c *medicalClient) ClaimedInstitutionList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*CommonResp, error) {
-	out := new(CommonResp)
+func (c *medicalClient) ClaimedInstitutionList(ctx context.Context, in *ClaimedReq, opts ...grpc.CallOption) (*EntClaimListResp, error) {
+	out := new(EntClaimListResp)
 	err := c.cc.Invoke(ctx, "/medical.Medical/ClaimedInstitutionList", in, out, opts...)
 	err := c.cc.Invoke(ctx, "/medical.Medical/ClaimedInstitutionList", in, out, opts...)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
@@ -185,13 +189,17 @@ type MedicalServer interface {
 	// 取消认领(经销商/医疗机构)
 	// 取消认领(经销商/医疗机构)
 	UnClaimed(context.Context, *UnclaimedReq) (*CommonResp, error)
 	UnClaimed(context.Context, *UnclaimedReq) (*CommonResp, error)
 	// 是否认领(经销商/医疗机构)
 	// 是否认领(经销商/医疗机构)
-	IsClaimed(context.Context, *IsClaimedReq) (*CommonResp, error)
+	IsClaimed(context.Context, *IsClaimedReq) (*IsClaimedResp, error)
 	// 我认领的经销商列表
 	// 我认领的经销商列表
-	ClaimedDistributorList(context.Context, *ClaimedReq) (*CommonResp, error)
+	ClaimedDistributorList(context.Context, *ClaimedReq) (*EntClaimListResp, error)
 	// 我认领的医疗机构列表
 	// 我认领的医疗机构列表
+<<<<<<< HEAD
 	ClaimedInstitutionList(context.Context, *ClaimedReq) (*CommonResp, error)
 	ClaimedInstitutionList(context.Context, *ClaimedReq) (*CommonResp, error)
 	// 招标动态
 	// 招标动态
 	GetNewMsg(context.Context, *GetNewMsgReq) (*GetNewMsgResp, error)
 	GetNewMsg(context.Context, *GetNewMsgReq) (*GetNewMsgResp, error)
+=======
+	ClaimedInstitutionList(context.Context, *ClaimedReq) (*EntClaimListResp, error)
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
 	mustEmbedUnimplementedMedicalServer()
 	mustEmbedUnimplementedMedicalServer()
 }
 }
 
 
@@ -223,13 +231,13 @@ func (UnimplementedMedicalServer) Claim(context.Context, *ClaimReq) (*CommonResp
 func (UnimplementedMedicalServer) UnClaimed(context.Context, *UnclaimedReq) (*CommonResp, error) {
 func (UnimplementedMedicalServer) UnClaimed(context.Context, *UnclaimedReq) (*CommonResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method UnClaimed not implemented")
 	return nil, status.Errorf(codes.Unimplemented, "method UnClaimed not implemented")
 }
 }
-func (UnimplementedMedicalServer) IsClaimed(context.Context, *IsClaimedReq) (*CommonResp, error) {
+func (UnimplementedMedicalServer) IsClaimed(context.Context, *IsClaimedReq) (*IsClaimedResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method IsClaimed not implemented")
 	return nil, status.Errorf(codes.Unimplemented, "method IsClaimed not implemented")
 }
 }
-func (UnimplementedMedicalServer) ClaimedDistributorList(context.Context, *ClaimedReq) (*CommonResp, error) {
+func (UnimplementedMedicalServer) ClaimedDistributorList(context.Context, *ClaimedReq) (*EntClaimListResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ClaimedDistributorList not implemented")
 	return nil, status.Errorf(codes.Unimplemented, "method ClaimedDistributorList not implemented")
 }
 }
-func (UnimplementedMedicalServer) ClaimedInstitutionList(context.Context, *ClaimedReq) (*CommonResp, error) {
+func (UnimplementedMedicalServer) ClaimedInstitutionList(context.Context, *ClaimedReq) (*EntClaimListResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ClaimedInstitutionList not implemented")
 	return nil, status.Errorf(codes.Unimplemented, "method ClaimedInstitutionList not implemented")
 }
 }
 func (UnimplementedMedicalServer) GetNewMsg(context.Context, *GetNewMsgReq) (*GetNewMsgResp, error) {
 func (UnimplementedMedicalServer) GetNewMsg(context.Context, *GetNewMsgReq) (*GetNewMsgResp, error) {

+ 2 - 2
service/InstitutionService_test.go

@@ -11,7 +11,7 @@ var EntClaimSrv EntClaimService
 
 
 func init() {
 func init() {
 	entity.Mysql = &mysql.Mysql{
 	entity.Mysql = &mysql.Mysql{
-		Address:      "192.168.3.217:4000",
+		Address:      "192.168.3.14:4000",
 		UserName:     "root",
 		UserName:     "root",
 		PassWord:     "=PDT49#80Z!RVv52_z",
 		PassWord:     "=PDT49#80Z!RVv52_z",
 		DBName:       "field_medical_data",
 		DBName:       "field_medical_data",
@@ -20,7 +20,7 @@ func init() {
 	}
 	}
 	entity.Mysql.Init()
 	entity.Mysql.Init()
 	BaseMysqlConn := &mysql.Mysql{
 	BaseMysqlConn := &mysql.Mysql{
-		Address:      "192.168.3.217:4000",
+		Address:      "192.168.3.14:4000",
 		UserName:     "root",
 		UserName:     "root",
 		PassWord:     "=PDT49#80Z!RVv52_z",
 		PassWord:     "=PDT49#80Z!RVv52_z",
 		DBName:       "base_service",
 		DBName:       "base_service",

+ 25 - 3
service/claim.go

@@ -21,6 +21,9 @@ func NewEntClaimSrv(conn *entity.Conn) *EntClaimService {
 
 
 // Claim 认领
 // Claim 认领
 func (e *EntClaimService) Claim(data *entity.EntClaim) bool {
 func (e *EntClaimService) Claim(data *entity.EntClaim) bool {
+	if e.IsClaimed(data.UserId, data.AppId, data.EntId, data.Type) {
+		return true
+	}
 	return e.BaseMysql.Insert(entity.TableDomainEntClaim, common.StructToMapMore(data)) > 0
 	return e.BaseMysql.Insert(entity.TableDomainEntClaim, common.StructToMapMore(data)) > 0
 }
 }
 
 
@@ -50,7 +53,7 @@ func (e *EntClaimService) Unclaimed(id, userId int) bool {
 }
 }
 
 
 // IsClaimed 是否认领
 // IsClaimed 是否认领
-func (e *EntClaimService) IsClaimed(userId int, appId string, entId int, typeCode int) bool {
+func (e *EntClaimService) IsClaimed(userId int, appId string, entId string, typeCode int) bool {
 	query := map[string]interface{}{
 	query := map[string]interface{}{
 		"user_id": userId,
 		"user_id": userId,
 		"type":    typeCode,
 		"type":    typeCode,
@@ -69,7 +72,7 @@ func (e *EntClaimService) DistributorList(userId int, appId string, page int, pa
 		"type":    entity.TypeDistributor,
 		"type":    entity.TypeDistributor,
 		"status":  entity.StatusClaimed,
 		"status":  entity.StatusClaimed,
 	}
 	}
-	field := "id,appid,user_id,ent_id,ent_name,address,create_time"
+	field := "id,appid,user_id,ent_id,ent_name,create_time"
 	order := "create_time desc"
 	order := "create_time desc"
 	total := e.BaseMysql.Count(entity.TableDomainEntClaim, query)
 	total := e.BaseMysql.Count(entity.TableDomainEntClaim, query)
 	if total == 0 {
 	if total == 0 {
@@ -86,7 +89,7 @@ func (e *EntClaimService) InstitutionList(userId int, appId string, page int, pa
 		"type":    entity.TypeInstitution,
 		"type":    entity.TypeInstitution,
 		"status":  entity.StatusClaimed,
 		"status":  entity.StatusClaimed,
 	}
 	}
-	field := "id,appid,user_id,ent_id,ent_name,address,create_time"
+	field := "id,appid,user_id,ent_id,ent_name,create_time"
 	order := "create_time desc"
 	order := "create_time desc"
 	total := e.BaseMysql.Count(entity.TableDomainEntClaim, query)
 	total := e.BaseMysql.Count(entity.TableDomainEntClaim, query)
 	if total == 0 {
 	if total == 0 {
@@ -94,3 +97,22 @@ func (e *EntClaimService) InstitutionList(userId int, appId string, page int, pa
 	}
 	}
 	return e.BaseMysql.Find(entity.TableDomainEntClaim, query, field, order, (page-1)*pageSize, pageSize), int(total)
 	return e.BaseMysql.Find(entity.TableDomainEntClaim, query, field, order, (page-1)*pageSize, pageSize), int(total)
 }
 }
+
+// GetInstitution 获取机构信息
+func (e EntClaimService) GetInstitution(id string) *map[string]interface{} {
+	query := map[string]interface{}{
+		"company_id": id,
+	}
+	field := "company_name,establish_date,company_address,capital,company_phone"
+	return e.GlobalCommonData.FindOne(entity.TableCompanyBasInfo, query, field, "")
+}
+
+// GetInstitutionByIds GetInstitution 获取机构信息
+func (e EntClaimService) GetInstitutionByIds(ids []interface{}) *[]map[string]interface{} {
+	query := map[string]interface{}{
+
+		"company_id": map[string]interface{}{"in": ids},
+	}
+	field := "company_id,company_name,establish_date,company_address,capital,company_phone"
+	return e.GlobalCommonData.Find(entity.TableCompanyBasInfo, query, field, "", 0, 0)
+}

+ 62 - 13
service/claim_test.go

@@ -1,8 +1,10 @@
 package service
 package service
 
 
 import (
 import (
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
 	"bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
-	"reflect"
+	"fmt"
 	"testing"
 	"testing"
 )
 )
 
 
@@ -18,7 +20,11 @@ func TestEntClaimService_Claim(t *testing.T) {
 		want bool
 		want bool
 	}{
 	}{
 		{"认领医疗机构", args{
 		{"认领医疗机构", args{
-			data: &entity.EntClaim{UserId: 1, AppId: "10000", EntId: "11", EntName: "877", Status: entity.StatusClaimed, Type: entity.TypeInstitution, Address: "2223", EstablishDate: "2022", RegisterCapital: "dd", Phone: "18238182402", CreateTime: "2022-08-19 15:08:00"},
+			data: &entity.EntClaim{UserId: 1, AppId: "10000", EntId: "1122", EntName: "877", Status: entity.StatusClaimed, Type: entity.TypeInstitution, CreateTime: "2022-08-19 15:08:00"},
+		}, true,
+		},
+		{"认领医疗机构-2", args{
+			data: &entity.EntClaim{UserId: 2, AppId: "10000", EntId: "7", EntName: "8757", Status: entity.StatusClaimed, Type: entity.TypeDistributor, CreateTime: "2022-08-19 15:08:00"},
 		}, true,
 		}, true,
 		},
 		},
 	}
 	}
@@ -30,6 +36,7 @@ func TestEntClaimService_Claim(t *testing.T) {
 			}
 			}
 		})
 		})
 	}
 	}
+
 }
 }
 
 
 // 我认领的经销商的列表
 // 我认领的经销商的列表
@@ -46,14 +53,17 @@ func TestEntClaimService_DistributorList(t *testing.T) {
 		want *[]map[string]interface{}
 		want *[]map[string]interface{}
 	}{
 	}{
 		{
 		{
-			name: "我认领的医疗机构", args: args{userId: 1, appId: "10000", page: 1, pageSize: 10}, want: nil,
+			name: "我认领的经销商", args: args{userId: 1, appId: "10000", page: 0, pageSize: 10}, want: nil,
+		},
+		{
+			name: "我认领的经销商-2", args: args{userId: 8, appId: "10000", page: 0, pageSize: 10}, want: nil,
 		},
 		},
 	}
 	}
 	for _, tt := range tests {
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
 		t.Run(tt.name, func(t *testing.T) {
-			if got, _ := EntClaimSrv.DistributorList(tt.args.userId, tt.args.appId, tt.args.page, tt.args.pageSize); !reflect.DeepEqual(got, tt.want) {
-				t.Errorf("DistributorList() = %v, want %v", got, tt.want)
-			}
+			got, total := EntClaimSrv.DistributorList(tt.args.userId, tt.args.appId, tt.args.page, tt.args.pageSize)
+			fmt.Println(got, total)
+			t.Log(got, total)
 		})
 		})
 	}
 	}
 }
 }
@@ -71,13 +81,17 @@ func TestEntClaimService_InstitutionList(t *testing.T) {
 		args args
 		args args
 		want *[]map[string]interface{}
 		want *[]map[string]interface{}
 	}{
 	}{
-		// TODO: Add test cases.
+		{
+			name: "我认领的医疗机构", args: args{userId: 22, appId: "10000", page: 0, pageSize: 10}, want: nil,
+		},
+		{
+			name: "我认领的医疗机构-2", args: args{userId: 3, appId: "10000", page: 0, pageSize: 10}, want: nil,
+		},
 	}
 	}
 	for _, tt := range tests {
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
 		t.Run(tt.name, func(t *testing.T) {
-			if got, _ := EntClaimSrv.InstitutionList(tt.args.userId, tt.args.appId, tt.args.page, tt.args.pageSize); !reflect.DeepEqual(got, tt.want) {
-				t.Errorf("InstitutionList() = %v, want %v", got, tt.want)
-			}
+			got, total := EntClaimSrv.InstitutionList(tt.args.userId, tt.args.appId, tt.args.page, tt.args.pageSize)
+			t.Log(got, total)
 		})
 		})
 	}
 	}
 }
 }
@@ -87,7 +101,7 @@ func TestEntClaimService_IsClaimed(t *testing.T) {
 	type args struct {
 	type args struct {
 		userId   int
 		userId   int
 		appId    string
 		appId    string
-		entId    int
+		entId    string
 		typeCode int
 		typeCode int
 	}
 	}
 	tests := []struct {
 	tests := []struct {
@@ -95,7 +109,7 @@ func TestEntClaimService_IsClaimed(t *testing.T) {
 		args args
 		args args
 		want bool
 		want bool
 	}{
 	}{
-		// TODO: Add test cases.
+		{"是否认领", args{userId: 1, typeCode: 1, entId: "1", appId: "10000"}, true},
 	}
 	}
 	for _, tt := range tests {
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
 		t.Run(tt.name, func(t *testing.T) {
@@ -117,7 +131,15 @@ func TestEntClaimService_Unclaimed(t *testing.T) {
 		args args
 		args args
 		want bool
 		want bool
 	}{
 	}{
-		// TODO: Add test cases.
+		{
+			"取消认领", args{userId: 1, id: 2}, true,
+		},
+		{
+			"取消认领-2", args{userId: 100, id: 2}, false,
+		},
+		{
+			"取消认领-3", args{userId: 100, id: 900009}, false,
+		},
 	}
 	}
 	for _, tt := range tests {
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
 		t.Run(tt.name, func(t *testing.T) {
@@ -127,3 +149,30 @@ func TestEntClaimService_Unclaimed(t *testing.T) {
 		})
 		})
 	}
 	}
 }
 }
+
+// 获取企业基本信息
+func TestEntClaimService_GetInstitution(t *testing.T) {
+	type args struct {
+		id string
+	}
+	tests := []struct {
+		name string
+		args args
+		want *map[string]interface{}
+	}{
+		{
+			"获取企业基本信息", args{id: ""}, nil,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got := EntClaimSrv.GetInstitution(tt.args.id)
+			t.Log(got)
+
+		})
+	}
+}
+func TestName(t *testing.T) {
+	s := encrypt.SE.Encode2Hex(common.ObjToString("90009"))
+	fmt.Print(s)
+}

+ 60 - 0
service/coverage.html

@@ -59,9 +59,13 @@
 				
 				
 				<option value="file1">bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/InstitutionService.go (100.0%)</option>
 				<option value="file1">bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/InstitutionService.go (100.0%)</option>
 				
 				
+<<<<<<< HEAD
 				<option value="file2">bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go (27.6%)</option>
 				<option value="file2">bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go (27.6%)</option>
 				
 				
 				<option value="file3">bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/portrait.go (88.1%)</option>
 				<option value="file3">bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/portrait.go (88.1%)</option>
+=======
+				<option value="file2">bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go (93.5%)</option>
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
 				
 				
 				</select>
 				</select>
 			</div>
 			</div>
@@ -115,7 +119,11 @@ func (b AuthService) UserAuthInfoSave(in *medical.UserInfo) (bool, string) <span
                         "ent_name":   in.EntName,
                         "ent_name":   in.EntName,
                 }
                 }
                 ok1 := entity.BaseMysql.Update(entity.DOMAIN_CAPITAL_RETENTION, map[string]interface{}{"user_id": in.UserId, "appid": in.Appid}, data)
                 ok1 := entity.BaseMysql.Update(entity.DOMAIN_CAPITAL_RETENTION, map[string]interface{}{"user_id": in.UserId, "appid": in.Appid}, data)
+<<<<<<< HEAD
                 if ok1 </span><span class="cov8" title="1">{
                 if ok1 </span><span class="cov8" title="1">{
+=======
+                if ok1 </span><span class="cov1" title="1">{
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
                         return true, ""
                         return true, ""
                 }</span> else<span class="cov0" title="0"> {
                 }</span> else<span class="cov0" title="0"> {
                         log.Println(fmt.Sprintf("认证修改失败:入参:%v:%v,", in.UserId, data))
                         log.Println(fmt.Sprintf("认证修改失败:入参:%v:%v,", in.UserId, data))
@@ -188,36 +196,65 @@ type EntClaimService struct {
 }
 }
 
 
 // NewEntClaimSrv 创建一个EntClaimSrv实例
 // NewEntClaimSrv 创建一个EntClaimSrv实例
+<<<<<<< HEAD
 func NewEntClaimSrv(conn *entity.Conn) *EntClaimService <span class="cov8" title="1">{
 func NewEntClaimSrv(conn *entity.Conn) *EntClaimService <span class="cov8" title="1">{
+=======
+func NewEntClaimSrv(conn *entity.Conn) *EntClaimService <span class="cov1" title="1">{
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
         return &amp;EntClaimService{
         return &amp;EntClaimService{
                 conn,
                 conn,
         }
         }
 }</span>
 }</span>
 
 
 // Claim 认领
 // Claim 认领
+<<<<<<< HEAD
 func (e *EntClaimService) Claim(data *entity.EntClaim) bool <span class="cov8" title="1">{
 func (e *EntClaimService) Claim(data *entity.EntClaim) bool <span class="cov8" title="1">{
         return e.BaseMysql.Insert(entity.TableDomainEntClaim, common.StructToMapMore(data)) &gt; 0
         return e.BaseMysql.Insert(entity.TableDomainEntClaim, common.StructToMapMore(data)) &gt; 0
 }</span>
 }</span>
 
 
 // Unclaimed // 取消认领
 // Unclaimed // 取消认领
 func (e *EntClaimService) Unclaimed(id, userId int) bool <span class="cov0" title="0">{
 func (e *EntClaimService) Unclaimed(id, userId int) bool <span class="cov0" title="0">{
+=======
+func (e *EntClaimService) Claim(data *entity.EntClaim) bool <span class="cov6" title="2">{
+        if e.IsClaimed(data.UserId, data.AppId, data.EntId, data.Type) </span><span class="cov0" title="0">{
+                return true
+        }</span>
+        <span class="cov6" title="2">return e.BaseMysql.Insert(entity.TableDomainEntClaim, common.StructToMapMore(data)) &gt; 0</span>
+}
+
+// Unclaimed // 取消认领
+func (e *EntClaimService) Unclaimed(id, userId int) bool <span class="cov10" title="3">{
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
         query := map[string]interface{}{
         query := map[string]interface{}{
                 "id": id,
                 "id": id,
         }
         }
         // 1. 查询该条数据
         // 1. 查询该条数据
         rs := e.BaseMysql.FindOne(entity.TableDomainEntClaim, query, "user_id", "")
         rs := e.BaseMysql.FindOne(entity.TableDomainEntClaim, query, "user_id", "")
+<<<<<<< HEAD
         if rs == nil || len(*rs) == 0 </span><span class="cov0" title="0">{
         if rs == nil || len(*rs) == 0 </span><span class="cov0" title="0">{
+=======
+        if rs == nil || len(*rs) == 0 </span><span class="cov1" title="1">{
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
                 logx.Errorf("取消认领:无效的id %v", id)
                 logx.Errorf("取消认领:无效的id %v", id)
                 return false
                 return false
         }</span>
         }</span>
         // 2. 存在则判断是否是该用户的
         // 2. 存在则判断是否是该用户的
+<<<<<<< HEAD
         <span class="cov0" title="0">rsUerId := common.IntAll((*rs)["user_id"])
         <span class="cov0" title="0">rsUerId := common.IntAll((*rs)["user_id"])
         if rsUerId != userId </span><span class="cov0" title="0">{
         if rsUerId != userId </span><span class="cov0" title="0">{
+=======
+        <span class="cov6" title="2">rsUerId := common.IntAll((*rs)["user_id"])
+        if rsUerId != userId </span><span class="cov1" title="1">{
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
                 logx.Errorf("取消认领:id[%v]与用户id[%v]不匹配 ", id, userId)
                 logx.Errorf("取消认领:id[%v]与用户id[%v]不匹配 ", id, userId)
                 return false
                 return false
         }</span>
         }</span>
         // 3. 取消认领
         // 3. 取消认领
+<<<<<<< HEAD
         <span class="cov0" title="0">update := map[string]interface{}{
         <span class="cov0" title="0">update := map[string]interface{}{
+=======
+        <span class="cov1" title="1">update := map[string]interface{}{
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
                 "status":      entity.StatusUnClaimed,
                 "status":      entity.StatusUnClaimed,
                 "update_time": date.NowFormat(date.Date_Full_Layout),
                 "update_time": date.NowFormat(date.Date_Full_Layout),
         }
         }
@@ -225,7 +262,11 @@ func (e *EntClaimService) Unclaimed(id, userId int) bool <span class="cov0" titl
 }
 }
 
 
 // IsClaimed 是否认领
 // IsClaimed 是否认领
+<<<<<<< HEAD
 func (e *EntClaimService) IsClaimed(userId int, appId string, entId int, typeCode int) bool <span class="cov0" title="0">{
 func (e *EntClaimService) IsClaimed(userId int, appId string, entId int, typeCode int) bool <span class="cov0" title="0">{
+=======
+func (e *EntClaimService) IsClaimed(userId int, appId string, entId string, typeCode int) bool <span class="cov10" title="3">{
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
         query := map[string]interface{}{
         query := map[string]interface{}{
                 "user_id": userId,
                 "user_id": userId,
                 "type":    typeCode,
                 "type":    typeCode,
@@ -236,7 +277,11 @@ func (e *EntClaimService) IsClaimed(userId int, appId string, entId int, typeCod
 }</span>
 }</span>
 
 
 // DistributorList 关注的经销商列表
 // DistributorList 关注的经销商列表
+<<<<<<< HEAD
 func (e *EntClaimService) DistributorList(userId int, appId string, page int, pageSize int) (*[]map[string]interface{}, int) <span class="cov8" title="1">{
 func (e *EntClaimService) DistributorList(userId int, appId string, page int, pageSize int) (*[]map[string]interface{}, int) <span class="cov8" title="1">{
+=======
+func (e *EntClaimService) DistributorList(userId int, appId string, page int, pageSize int) (*[]map[string]interface{}, int) <span class="cov6" title="2">{
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
 
 
         query := map[string]interface{}{
         query := map[string]interface{}{
                 "user_id": userId,
                 "user_id": userId,
@@ -247,14 +292,22 @@ func (e *EntClaimService) DistributorList(userId int, appId string, page int, pa
         field := "id,appid,user_id,ent_id,ent_name,address,create_time"
         field := "id,appid,user_id,ent_id,ent_name,address,create_time"
         order := "create_time desc"
         order := "create_time desc"
         total := e.BaseMysql.Count(entity.TableDomainEntClaim, query)
         total := e.BaseMysql.Count(entity.TableDomainEntClaim, query)
+<<<<<<< HEAD
         if total == 0 </span><span class="cov8" title="1">{
         if total == 0 </span><span class="cov8" title="1">{
+=======
+        if total == 0 </span><span class="cov6" title="2">{
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
                 return nil, 0
                 return nil, 0
         }</span>
         }</span>
         <span class="cov0" title="0">return e.BaseMysql.Find(entity.TableDomainEntClaim, query, field, order, (page-1)*pageSize, pageSize), int(total)</span>
         <span class="cov0" title="0">return e.BaseMysql.Find(entity.TableDomainEntClaim, query, field, order, (page-1)*pageSize, pageSize), int(total)</span>
 }
 }
 
 
 // InstitutionList  我关注的医疗机构列表
 // InstitutionList  我关注的医疗机构列表
+<<<<<<< HEAD
 func (e *EntClaimService) InstitutionList(userId int, appId string, page int, pageSize int) (*[]map[string]interface{}, int) <span class="cov0" title="0">{
 func (e *EntClaimService) InstitutionList(userId int, appId string, page int, pageSize int) (*[]map[string]interface{}, int) <span class="cov0" title="0">{
+=======
+func (e *EntClaimService) InstitutionList(userId int, appId string, page int, pageSize int) (*[]map[string]interface{}, int) <span class="cov6" title="2">{
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
         query := map[string]interface{}{
         query := map[string]interface{}{
                 "user_id": userId,
                 "user_id": userId,
                 "appid":   appId,
                 "appid":   appId,
@@ -264,6 +317,7 @@ func (e *EntClaimService) InstitutionList(userId int, appId string, page int, pa
         field := "id,appid,user_id,ent_id,ent_name,address,create_time"
         field := "id,appid,user_id,ent_id,ent_name,address,create_time"
         order := "create_time desc"
         order := "create_time desc"
         total := e.BaseMysql.Count(entity.TableDomainEntClaim, query)
         total := e.BaseMysql.Count(entity.TableDomainEntClaim, query)
+<<<<<<< HEAD
         if total == 0 </span><span class="cov0" title="0">{
         if total == 0 </span><span class="cov0" title="0">{
                 return nil, 0
                 return nil, 0
         }</span>
         }</span>
@@ -450,6 +504,12 @@ func EncodeId(sid string) string <span class="cov0" title="0">{
                 return ""
                 return ""
         }</span>
         }</span>
         <span class="cov0" title="0">return encrypt.EncodeArticleId2ByCheck(sid)</span>
         <span class="cov0" title="0">return encrypt.EncodeArticleId2ByCheck(sid)</span>
+=======
+        if total == 0 </span><span class="cov1" title="1">{
+                return nil, 0
+        }</span>
+        <span class="cov1" title="1">return e.BaseMysql.Find(entity.TableDomainEntClaim, query, field, order, (page-1)*pageSize, pageSize), int(total)</span>
+>>>>>>> 10627a5dbc739e87e4aa15f75c91adb5de38af2d
 }
 }
 </pre>
 </pre>
 		
 		

+ 17 - 1
service/test_cover.out

@@ -1,5 +1,4 @@
 mode: count
 mode: count
-bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/InstitutionService.go:10.93,16.2 3 1
 bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:14.76,19.17 2 4
 bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:14.76,19.17 2 4
 bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:29.2,29.34 1 2
 bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:29.2,29.34 1 2
 bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:19.17,20.32 1 2
 bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:19.17,20.32 1 2
@@ -13,3 +12,20 @@ bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:47.8
 bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:62.13,64.4 1 1
 bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:62.13,64.4 1 1
 bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:64.9,67.4 2 0
 bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:64.9,67.4 2 0
 bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:72.82,78.2 2 2
 bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/AuthService.go:72.82,78.2 2 2
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/InstitutionService.go:10.93,16.2 3 1
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:16.57,20.2 1 1
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:23.61,24.65 1 2
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:27.2,27.89 1 2
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:24.65,26.3 1 0
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:31.58,37.32 3 3
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:42.2,43.23 2 2
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:48.2,52.70 2 1
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:37.32,40.3 2 1
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:43.23,46.3 2 1
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:56.96,64.2 2 3
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:67.126,78.16 5 2
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:81.2,81.115 1 0
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:78.16,80.3 1 2
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:85.126,95.16 5 2
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:98.2,98.115 1 1
+bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service/claim.go:95.16,97.3 1 1

+ 81 - 0
test/api_test.http

@@ -0,0 +1,81 @@
+### 认领
+POST http://{{host}}:8888/domain/claim
+Content-Type: application/json
+#Cookie:
+newUserId:22
+appId:10000
+
+{
+"ent_id": "1057165a5d1556510256475a470a554c030255534557480d0645065555004658",
+"type": 1
+}
+> {%
+client.test("Request executed successfully", function() {
+  client.assert(response.status === 200, "Response status is not 200");
+});
+%}
+
+### 取消认领
+POST http://{{host}}:8888/domain/unclaimed
+Content-Type: application/json
+#Cookie:
+newUserId:22
+appId:10000
+
+{
+  "id":"4d5f405e5c" ,
+  "type": 1
+}
+> {%
+client.test("Request executed successfully", function() {
+  client.assert(response.status === 200, "Response status is not 200");
+});
+%}
+
+### 是否认领过
+POST http://{{host}}:8888/domain/isClaimed
+Content-Type: application/json
+#Cookie:
+newUserId:22
+appId:10000
+
+{
+  "company_id": "1057165a5d1556510256475a470a554c030255534557480d0645065555004658",
+  "type": 1
+}
+> {%
+client.test("Request executed successfully", function() {
+  client.assert(response.status === 200, "Response status is not 200");
+});
+%}
+
+
+### 我认领的经销商
+POST http://{{host}}:8888/domain/claim/distributor
+Content-Type: application/json
+#Cookie:
+newUserId:22
+appId:10000
+
+> {%
+client.test("Request executed successfully", function() {
+  client.assert(response.status === 200, "Response status is not 200");
+});
+%}
+
+
+
+### 我认领的医疗机构
+POST http://{{host}}:8888/domain/claim/institution
+Content-Type: application/json
+#Cookie:
+newUserId:22
+appId:10000
+
+
+> {%
+client.test("Request executed successfully", function() {
+  client.assert(response.status === 200, "Response status is not 200");
+});
+%}
+

+ 41 - 3
test/rpc_test.http

@@ -1,8 +1,46 @@
+### 我认领的经销商列表
 GRPC {{host}}:8080/medical.Medical/ClaimedDistributorList
 GRPC {{host}}:8080/medical.Medical/ClaimedDistributorList
 
 
 {
 {
-  "AppId": "1000",
-  "UserId": 1,
+  "AppId": "10000",
+  "UserId": 22,
+  "Page": 0,
+  "PageSize": 10
+}
+
+### 我认领的医疗机构列表
+GRPC {{host}}:8080/medical.Medical/ClaimedInstitutionList
+
+{
+  "AppId": "10000",
+  "UserId": 22,
   "Page": 0,
   "Page": 0,
   "PageSize": 10
   "PageSize": 10
-}
+}
+
+### 认领
+GRPC {{host}}:8080/medical.Medical/Claim
+
+{
+  "AppId": "10000",
+  "UserId": 1,
+  "EntId": "30d041422855fda867a356b3994a67ea",
+  "Type": 1
+}
+### 取消认领
+GRPC {{host}}:8080/medical.Medical/UnClaimed
+
+{
+  "UserId": 1,
+  "Id": 1,
+  "AppId": "10000"
+}
+### 是否认领
+GRPC {{host}}:8080/medical.Medical/IsClaimed
+
+{
+  "AppId": "10000",
+  "UserId": 1,
+  "Type": 1,
+  "EntId": "1"
+}

部分文件因文件數量過多而無法顯示