新增 医生综合信息接口

master
冯凯 2023-11-02 15:04:43 +08:00
parent 33b22a5cb6
commit 6a21214ade
12 changed files with 515 additions and 0 deletions

View File

@ -0,0 +1,58 @@
package com.health.system.common.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/2 10:10
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Appraise {
/*
id
*/
private Integer appraiseId;
/*
*/
private Long createUser;
/*
*/
private Date createTime;
/*
id
*/
private Long doctorId;
/*
*/
private String appraiseComment;
/*
*/
private Integer professionScore;
/*
*/
private Integer satisficationScore;
}

View File

@ -0,0 +1,34 @@
package com.health.system.common.domain;
import lombok.Data;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/2 10:38
*/
@Data
public class ComprehensiveAppraise {
/*
id
*/
private Integer comprehensiveId;
/*
id
*/
private Long doctorId;
/*
*/
private Integer positiveNum;
/*
*/
private Integer serviceNum;
}

View File

@ -0,0 +1,28 @@
package com.health.system.common.domain;
import lombok.Data;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/2 10:36
*/
@Data
public class Gift {
/*
id
*/
private Integer GiftId;
/*
*/
private String giftImage;
/*
*/
private Integer giftPrice;
}

View File

@ -0,0 +1,31 @@
package com.health.system.common.domain.response;
import com.health.system.common.domain.Appraise;
import com.health.system.common.domain.Patient;
import com.health.system.common.domain.SysUser;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/2 10:41
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AppraiseResponse extends Appraise {
/*
*/
private SysUser sysUser;
/*
*/
private Integer sumAppraiseAmount;
}

View File

@ -0,0 +1,21 @@
package com.health.system.common.domain.response;
import com.health.system.common.domain.ComprehensiveAppraise;
import lombok.Data;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/2 10:45
*/
@Data
public class ComprehensiveAppraiseRes extends ComprehensiveAppraise {
/*
*/
private Integer positiveRate;
}

View File

@ -0,0 +1,21 @@
package com.health.system.common.domain.response;
import com.health.system.common.domain.Gift;
import lombok.Data;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/2 11:28
*/
@Data
public class GiftResponse {
private Integer giftId;
private String giftImage;
private Integer sumNum;
}

View File

@ -0,0 +1,75 @@
package com.health.system.server.controller;
import com.dtflys.forest.annotation.Get;
import com.health.common.core.domain.Result;
import com.health.system.common.domain.response.AppraiseResponse;
import com.health.system.common.domain.response.ComprehensiveAppraiseRes;
import com.health.system.common.domain.response.GiftResponse;
import com.health.system.server.service.DoctorInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/2 10:49
*/
@RestController
@RequestMapping("/doctor")
public class DoctorInformationController {
/*
service
*/
@Autowired
private DoctorInformationService doctorInformationService;
/**
* @description: id
* @param: doctorId
* @return: Result
* @author
* @date: 2023/11/2 10:53
*/
@GetMapping("/search/appraiseList/byDoctorId/{doctorId}")
public Result<List<AppraiseResponse>> searchAppraiseListByDoctorId(@PathVariable Long doctorId){
List<AppraiseResponse> appraiseResponseList=doctorInformationService.searchAppraiseListByDoctorId(doctorId);
return Result.success(appraiseResponseList);
}
/**
* @description: id
* @param: doctorId
* @return: Result<List<GiftResponse>>
* @author
* @date: 2023/11/2 14:59
*/
@GetMapping("/search/giftList/byDoctorId/{doctorId}")
public Result<List<GiftResponse>> searchGiftListByDoctorId(@PathVariable Integer doctorId){
List<GiftResponse> giftResponseMap=doctorInformationService.searchGiftListByDoctorId(doctorId);
return Result.success(giftResponseMap);
}
/**
* @description: id
* @param: doctorId
* @return: Result<ComprehensiveAppraiseRes>
* @author
* @date: 2023/11/2 13:32
*/
@GetMapping("/search/comprehensiveAppraise/byDoctroId/{doctorId}")
public Result<ComprehensiveAppraiseRes> searchComprehensiveAppraiseByDoctorId(@PathVariable Integer doctorId){
ComprehensiveAppraiseRes comprehensiveAppraiseRes=doctorInformationService.searchComprehensiveAppraiseByDoctorId(doctorId);
return Result.success(comprehensiveAppraiseRes);
}
}

View File

@ -4,6 +4,7 @@ import com.health.common.core.domain.Result;
import com.health.system.common.domain.BankCard;
import com.health.system.server.config.ForestClientInterface;
import com.health.system.server.service.SysBankCardService;
import com.health.wallet.remote.RemoteWalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -24,6 +25,7 @@ import java.util.Map;
@RestController
@RequestMapping("/bankCard")
public class SysBankCardController {
/*
*/
@ -38,6 +40,7 @@ public class SysBankCardController {
@PostMapping("/bindUserBank")
public Result bindUserBank(@RequestParam("bankImage") MultipartFile bankImage) throws IOException {
//获取银行卡照片的字节流
Boolean flag=sysBankCardService.bindUserBank(bankImage);
return flag==true?Result.success("","银行卡绑定成功"):Result.error("","银行卡绑定失败");
}

View File

@ -0,0 +1,47 @@
package com.health.system.server.mapper;
import com.health.system.common.domain.response.AppraiseResponse;
import com.health.system.common.domain.response.ComprehensiveAppraiseRes;
import com.health.system.common.domain.response.GiftResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author
* @version 1.0
* @description:mapper
* @date 2023/11/2 10:52
*/
@Mapper
public interface DoctorInformationMapper {
/**
* @description: id
* @param: doctorId
* @return: Result
* @author
* @date: 2023/11/2 10:53
*/
List<AppraiseResponse> searchAppraiseListByDoctorId(@Param("doctorId") Long doctorId);
/**
* @description: id
* @param: doctorId
* @return: Result<List<GiftResponse>>
* @author
* @date: 2023/11/2 14:59
*/
List<GiftResponse> searchGiftListByDoctorId(@Param("doctorId") Integer doctorId);
/**
* @description: id
* @param: doctorId
* @return: Result<ComprehensiveAppraiseRes>
* @author
* @date: 2023/11/2 13:32
*/
ComprehensiveAppraiseRes searchComprehensiveAppraiseByDoctorId(@Param("doctorId") Integer doctorId);
}

View File

@ -0,0 +1,45 @@
package com.health.system.server.service;
import com.health.system.common.domain.response.AppraiseResponse;
import com.health.system.common.domain.response.ComprehensiveAppraiseRes;
import com.health.system.common.domain.response.GiftResponse;
import java.util.List;
import java.util.Map;
/**
* @author
* @version 1.0
* @description:service
* @date 2023/11/2 10:51
*/
public interface DoctorInformationService {
/**
* @description: id
* @param: doctorId
* @return: Result
* @author
* @date: 2023/11/2 10:53
*/
List<AppraiseResponse> searchAppraiseListByDoctorId(Long doctorId);
/**
* @description: id
* @param: doctorId
* @return: Result<List<GiftResponse>>
* @author
* @date: 2023/11/2 14:59
*/
List<GiftResponse> searchGiftListByDoctorId(Integer doctorId);
/**
* @description: id
* @param: doctorId
* @return: Result<ComprehensiveAppraiseRes>
* @author
* @date: 2023/11/2 13:32
*/
ComprehensiveAppraiseRes searchComprehensiveAppraiseByDoctorId(Integer doctorId);
}

View File

@ -0,0 +1,91 @@
package com.health.system.server.service.impl;
import com.health.common.redis.service.RedisService;
import com.health.system.common.domain.response.AppraiseResponse;
import com.health.system.common.domain.response.ComprehensiveAppraiseRes;
import com.health.system.common.domain.response.GiftResponse;
import com.health.system.server.mapper.DoctorInformationMapper;
import com.health.system.server.service.DoctorInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author
* @version 1.0
* @description:service
* @date 2023/11/2 10:51
*/
@Service
public class DoctorInformationServiceImpl implements DoctorInformationService {
/*
mapper
*/
@Autowired
private DoctorInformationMapper doctorInformationMapper;
@Autowired
private RedisService redisService;
/**
* @description: id
* @param: doctorId
* @return: Result
* @author
* @date: 2023/11/2 10:53
*/
@Override
public List<AppraiseResponse> searchAppraiseListByDoctorId(Long doctorId) {
//先从缓存中获取
if (redisService.hasKey("DoctorAppraise:"+doctorId)){
List<AppraiseResponse> appraiseResponseList = redisService.getCacheList("DoctorAppraise:" + doctorId);
return appraiseResponseList;
}
//没有再从数据库中查询获取
List<AppraiseResponse> appraiseResponseList= doctorInformationMapper.searchAppraiseListByDoctorId(doctorId);
//然后再放入缓存当中
redisService.setCacheList("DoctorAppraise:"+doctorId,appraiseResponseList);
return appraiseResponseList;
}
/**
* @description: id
* @param: doctorId
* @return: Result<List<GiftResponse>>
* @author
* @date: 2023/11/2 14:59
*/
@Override
public List<GiftResponse> searchGiftListByDoctorId(Integer doctorId) {
if (redisService.hasKey("giftCountList:"+doctorId)){
List<GiftResponse> giftResponseList = redisService.getCacheList("giftCountList:" + doctorId);
return giftResponseList;
}
List<GiftResponse> giftResponseList = doctorInformationMapper.searchGiftListByDoctorId(doctorId);
redisService.setCacheList("giftCountList:"+doctorId,giftResponseList);
return giftResponseList;
}
/**
* @description: id
* @param: doctorId
* @return: Result<ComprehensiveAppraiseRes>
* @author
* @date: 2023/11/2 13:32
*/
@Override
public ComprehensiveAppraiseRes searchComprehensiveAppraiseByDoctorId(Integer doctorId) {
if (redisService.hasKey("comprehensive:"+doctorId)){
ComprehensiveAppraiseRes comprehensiveAppraiseRes=redisService.getCacheObject("comprehensive:"+doctorId);
return comprehensiveAppraiseRes;
}
ComprehensiveAppraiseRes comprehensiveAppraiseRes=doctorInformationMapper.searchComprehensiveAppraiseByDoctorId(doctorId);
return comprehensiveAppraiseRes;
}
}

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.health.system.server.mapper.DoctorInformationMapper">
<resultMap id="appraiseRes" type="com.health.system.common.domain.response.AppraiseResponse">
<id column="appraise_id" property="appraiseId"></id>
<result column="appraise_comment" property="appraiseComment"></result>
<result column="create_user" property="createUser"></result>
<result column="create_time" property="createTime"></result>
<result column="doctor_id" property="doctorId"></result>
<result column="profession_score" property="professionScore"></result>
<result column="satisfication_score" property="satisficationScore"></result>
<collection property="sysUser" ofType="com.health.system.common.domain.SysUser">
<id column="user_id" property="userId"></id>
<result column="user_name" property="userName"/>
<result column="email" property="email"/>
<result column="phone_number" property="phonenumber"/>
<result column="avatar" property="avatar"/>
</collection>
</resultMap>
<resultMap id="comprehensiveAppraise" type="com.health.system.common.domain.response.ComprehensiveAppraiseRes">
<id column="comprehensive_id" property="comprehensiveId"></id>
<result column="doctor_id" property="doctorId"/>
<result column="positive_num" property="positiveNum"/>
<result column="service_num" property="serviceNum"/>
<result column="positive_rate" property="positiveRate"/>
</resultMap>
<sql id="giftListRes">
select gd.gift_id,g.gift_image,count(*) as sum_num from tb_gift_doctor gd LEFT JOIN tb_gift g on gd.gift_id=g.gift_id GROUP BY gd.gift_id
</sql>
<sql id="AppraiseListByDoctorId">
select appraise_id,a.create_user,a.create_time,doctor_id,appraise_comment,profession_rate,satisfication_rate, s.user_id,s.user_name,s.email,s.phonenumber,s.avatar
from tb_appraise a left join sys_user s
on a.create_user=s.user_id
</sql>
<sql id="comprehensiveAppraise">
select comprehentsive_id,doctro_id,positive_num,service_num,positive_num/service_num*100 as positive_rate from tb_comprehensive_information
</sql>
<!--根据医生id查询评价列表-->
<select id="searchAppraiseListByDoctorId"
resultMap="appraiseRes">
<include refid="AppraiseListByDoctorId"/>
where a.create_user=1
</select>
<!--根据医生id查询获取医生礼物统计列表数据-->
<select id="searchGiftListByDoctorId" resultType="com.health.system.common.domain.response.GiftResponse">
select gd.gift_id,g.gift_image,count(*) as sum_num from tb_gift_doctor gd LEFT JOIN tb_gift g on gd.gift_id=g.gift_id where gd.doctor_id=#{doctorId} GROUP BY gd.gift_id
</select>
<!--根据医生id查询医生综合评价-->
<select id="searchComprehensiveAppraiseByDoctorId"
resultMap="comprehensiveAppraise">
<include refid="AppraiseListByDoctorId"/>
where doctor_id=#{doctorId}
</select>
</mapper>