portraitlogic.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/entity"
  6. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/internal/svc"
  7. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/rpc/medical/medical"
  8. "bp.jydev.jianyu360.cn/ApplicationCenter/medicalField/service"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type PortraitLogic struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. logx.Logger
  15. }
  16. func NewPortraitLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PortraitLogic {
  17. return &PortraitLogic{
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. Logger: logx.WithContext(ctx),
  21. }
  22. }
  23. // 医疗机构画像
  24. func (l *PortraitLogic) Portrait(in *medical.PortraitReq) (*medical.PortraitResp, error) {
  25. // todo: add your logic here and delete this line
  26. resp := &medical.PortraitResp{}
  27. portrait := service.NewPortrait(&entity.Conn{
  28. Mysql: entity.Mysql,
  29. BaseMysql: entity.BaseMysql,
  30. CommonMysql: entity.CommonMysql,
  31. })
  32. info, err := portrait.Info(in.CompanyId, in.UserId)
  33. if err != nil || info == nil {
  34. l.Error(fmt.Sprintf("%+v", in), err.Error())
  35. resp.ErrorMsg = err.Error()
  36. resp.ErrorCode = -1
  37. } else {
  38. resp.Address = info.Address
  39. resp.Area = info.Area
  40. resp.Beds = info.Beds
  41. resp.BusinessType = info.BusinessType
  42. resp.CompanyName = info.CompanyName
  43. resp.Departnames = info.Departnames
  44. resp.Doctorsnum = info.Doctorsnum
  45. resp.Equipment = info.Equipment
  46. resp.EstablishDate = info.EstablishDate
  47. resp.Follow = info.Follow
  48. resp.Level = info.Level
  49. resp.MiType = info.MiType
  50. resp.VisitPerday = info.VisitPerday
  51. resp.Website = info.Website
  52. resp.City = info.City
  53. resp.District = info.District
  54. }
  55. return resp, nil
  56. }