新疆后端项目

This commit is contained in:
DESKTOP-BLB5287\FP
2025-06-30 14:31:09 +08:00
commit 0e52aff1f1
2596 changed files with 261030 additions and 0 deletions
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>health-consultation</artifactId>
<groupId>com.renkang</groupId>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>health-consultation-biz</artifactId>
<dependencies>
<dependency>
<groupId>com.renkang</groupId>
<artifactId>health-consultation-api</artifactId>
</dependency>
<dependency>
<groupId>com.renkang</groupId>
<artifactId>health-emergency-api</artifactId>
</dependency>
<dependency>
<groupId>com.renkang</groupId>
<artifactId>health-im-api</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-system-cloud-api</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-starter-job</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,102 @@
package com.renkang.consultation.api;
import cn.hutool.core.util.StrUtil;
import java.util.concurrent.TimeUnit;
public enum RedisConstants {
//有参定义
// KNOWLEDGE_CATEGORY_LIST("tongzheng:lockget_value_{}_{}",2 ,TimeUnit.SECONDS,"知识库分类"),
KNOWLEDGE_CATEGORY_LIST("knowledge:category_list", 10, TimeUnit.DAYS, "知识库分类"),
KNOWLEDGE_INFO("knowledge:info_{}", 10, TimeUnit.DAYS, "知识库详情"),
NOTICE_USER_TF("notice_user_tf_{}_{}", 10, TimeUnit.DAYS, "用户是否已经选择了下次不再显示"),
HEALTH_INFO("health_info_{}", 10, TimeUnit.DAYS, "健康详情问答"),
TF_JUMP_HOLIDAY("tf_jump_holiday_{}", 10, TimeUnit.DAYS, "是否跳过节假日"),
TF_DATE_DEFAULT("tf_date_default_{}", 10, TimeUnit.DAYS, "是否自定义"),
MY_FOLLOW_DOCTOR_ZSET("mfoll:my_follow_doctor_{}", "用户关注医生列表"),
MY_FOLLOW_HOSPITAL_ZSET("mfoll:my_follow_hospital_{}", "用户关注医院列表"),
DOCTOR_SCORE("doctor_score_{}", 6, TimeUnit.HOURS, "医生评分"),
DOCTOR_REPLY("doctor_reply_{}", 6, TimeUnit.HOURS, "医生回复率"),
DOCTOR_HEAT("doctor_heat_{}", 6, TimeUnit.HOURS, "医生热度"),
// FOLLOW_MY_ZSET("mfoll:follow_my_{}","医生被关注列表"),
END(null, null);
// 键
private String key;
// 备注
private String remark;
// 过期时间
private long expire;
// 单位
private TimeUnit timeUnit;
RedisConstants(String key, String remark) {
this.key = key;
this.expire = Long.MAX_VALUE;
this.timeUnit = TimeUnit.DAYS;
this.remark = remark;
}
RedisConstants(String key, long expire, TimeUnit timeUnit, String remark) {
this.key = key;
this.expire = expire;
this.timeUnit = timeUnit;
this.remark = remark;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getKey(Object... params) {
return StrUtil.format(this.key, params);
}
public long getExpire() {
return expire;
}
public void setExpire(long expire) {
this.expire = expire;
}
public TimeUnit getTimeUnit() {
return timeUnit;
}
public void setTimeUnit(TimeUnit timeUnit) {
this.timeUnit = timeUnit;
}
public String getRemark() {
return remark;
}
}
@@ -0,0 +1,62 @@
package com.renkang.consultation.api;
/**
* @author Junqiang Zhu
* @date 2023-04-20 17:05
*/
public interface RequestPrefix {
String BASE = "/api/consult";
String consultResidentHospital = BASE + "/consultResidentHospital";
String conResource = BASE + "/conResource";
String knowledgeCategory = BASE + "/knowledgeCategory";
String CON_COST_STATISTICS = BASE + "/conCostStatistics";
String CON_SERVICE = BASE + "/conService";
String knowledge = BASE + "/knowledge";
String notice = BASE + "/notice";
String familyMembers = BASE + "/familyMembers";
String healthInfo = BASE + "/healthInfo";
String conHelper = BASE + "/conHelper";
String medicalRecords = BASE + "/medicalRecords";
String conDoctorScheduling = BASE + "/conDoctorScheduling";
String conDoctorSchedulingDate = BASE + "/conDoctorSchedulingDate";
String conDoctor = BASE + "/conDoctor";
String conDoctorFollow = BASE + "/conDoctorFollow";
String conSession = BASE + "/conSession";
String conEvaluate = BASE + "/conEvaluate";
String conHospitalFollow = BASE + "/conHospitalFollow";
String msgRecord = BASE + "/msgRecord";
String es = BASE + "/es";
String department = BASE + "/conDepartment";
String conSicks = BASE + "/conSicks";
String conSessionVideoInfo = BASE + "/conSessionVideoInfo";
String sessionReservationDate = BASE + "/sessionReservationDate";
}
@@ -0,0 +1,47 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.service.ConDoctorApiService;
import com.renkang.consultation.vo.SimpleDoctorVo;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* @author stan
* @since 2024-11-27 09:31
*/
@RestController
@RequestMapping("api/anon")
public class ConAnonController {
@Autowired
private ConDoctorApiService conDoctorApiService;
/**
* app首页-医生列表
*
* @return data
*/
@GetMapping("list/doctor/intervene/home/v2")
public Result<Map<String, Object>> listDoctorInterveneHomeV2(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "6") Integer pageSize) {
return conDoctorApiService.listDoctorInterveneHomeV2(pageNo, pageSize);
}
/**
* 干预首页-医生列表
* @return data
*/
@GetMapping("list/doctor/intervene/home")
public Result<List<SimpleDoctorVo>> listDoctorInterveneHome(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "6") Integer pageSize) {
return Result.ok(conDoctorApiService.listDoctorInterveneHome(pageNo, pageSize));
}
}
@@ -0,0 +1,109 @@
package com.renkang.consultation.api.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.entity.ConCostStatistics;
import com.renkang.consultation.service.IConCostStatisticsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(RequestPrefix.CON_COST_STATISTICS)
public class ConCostStatisticsApiController {
@Autowired
private IConCostStatisticsService conCostStatisticsService;
/**
* 收益记录 提现记录
*
* @param pageNo
* @param pageSize
* @param date
* @param type
* @return
*/
@Operation(summary = "全部记录 收益记录 提现记录", description = "全部记录 收益记录 提现记录")
@Parameters({
@Parameter(name = "pageNo", description = "分页参数", required = true),
@Parameter(name = "pageSize", description = "分页参数", required = true),
@Parameter(name = "date", description = "选择日期yyyy-mm 不填默认为全部", required = false),
@Parameter(name = "type", description = "1收益记录 2提现记录 3全部记录 不填默认为3全部", required = false)
})
@RequestMapping(value = "/findlistpage", method = RequestMethod.GET)
public Result<IPage<ConCostStatistics>> findlistpage(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "date", defaultValue = "1") String date,
@RequestParam(name = "type", defaultValue = "3") String type) {
Page<ConCostStatistics> page = new Page<>(pageNo, pageSize);
IPage<ConCostStatistics> pageList = conCostStatisticsService.findlistpage(page, date, type);
return Result.OK(pageList);
}
/**
* 通过id查询
*
* @param id
* @return
*/
@Operation(summary = "记录详情 提现详情", description = "记录详情 提现详情")
@GetMapping(value = "/queryById")
public Result<ConCostStatistics> queryById(@RequestParam(name = "id", required = true) String id) {
ConCostStatistics conCostStatistics = conCostStatisticsService.getById(id);
if (conCostStatistics == null) {
return Result.error("未找到对应数据");
}
return Result.OK(conCostStatistics);
}
@Operation(summary = "收益统计", description = "收益统计")
@GetMapping(value = "/getStatistics")
public Result<?> getStatistics() {
Map hashMap = new HashMap<>();
BigDecimal sumIncome = conCostStatisticsService.getSumIncome();
BigDecimal sumPaymentMoney = conCostStatisticsService.getSumPaymentMoney();
BigDecimal unsettled = sumIncome.subtract(sumPaymentMoney);
hashMap.put("sumIncome", sumIncome);
hashMap.put("sumPaymentMoney", sumPaymentMoney);
hashMap.put("unsettled", unsettled);
return Result.OK(hashMap);
}
@Operation(summary = "类别统计")
@GetMapping(value = "/groupByTypehList")
public Result<?> groupByTypehList(@RequestParam(name = "date") String date) {
List<Map<String, Object>> mapList = new ArrayList<>();
Map<String, Object> hashMap = new HashMap<>();
hashMap.put("content_type", "图文咨询");
String inProgressPicture = conCostStatisticsService.groupByTypehListNew(date, "1", "1");
String completedPicture = conCostStatisticsService.groupByTypehListNew(date, "1", "2");
hashMap.put("inProgress", inProgressPicture);
hashMap.put("completed", completedPicture);
Map<String, Object> hashMap1 = new HashMap<>();
hashMap1.put("content_type", "视频咨询");
String inProgressVideo = conCostStatisticsService.groupByTypehListNew(date, "2", "1");
String completedVideo = conCostStatisticsService.groupByTypehListNew(date, "2", "2");
hashMap1.put("inProgress", inProgressVideo);
hashMap1.put("completed", completedVideo);
hashMap.put("total", Long.valueOf(hashMap.get("inProgress").toString()) + Long.valueOf(hashMap.get("completed").toString()));
hashMap1.put("total", Long.valueOf(hashMap1.get("inProgress").toString()) + Long.valueOf(hashMap1.get("completed").toString()));
mapList.add(hashMap);
mapList.add(hashMap1);
return Result.OK(mapList);
}
}
@@ -0,0 +1,135 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConDepartmentApiService;
import com.renkang.consultation.entity.ConDepartmentDO;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(RequestPrefix.department)
public class ConDepartmentApiController {
@Autowired
private ConDepartmentApiService conDepartmentApiService;
@Operation(summary = "查询部门", description = "查询部门")
@GetMapping("/selectDepartList")
public Result<List<ConDepartmentDO>> selectDepartList(@RequestParam(value = "parentId", required = true) String parentId) {
return conDepartmentApiService.selectDepartList(parentId);
}
/**
* 新的查询科室接口
* @param parentId
* @return
*/
@Operation(summary = "查询部门 新", description = "查询部门 新")
@GetMapping("/selectDepartListNew")
public Result<Map<String,Object>> selectDepartListNew(@RequestParam(value = "parentId", required = true) String parentId) {
return conDepartmentApiService.selectDepartListNew(parentId);
}
/**
* 查询部门 第三版
* @param parentId
* @return
*/
@Operation(summary = "查询部门 第三版", description = "查询部门 第三版")
@GetMapping("/selectDepartListVersionThree")
public Result<Map<String,Object>> selectDepartListVersionThree(@RequestParam(value = "parentId", required = true) String parentId) {
return conDepartmentApiService.selectDepartListVersionThree(parentId);
}
@Operation(summary = "查询部门 疾病", description = "查询部门 疾病")
@GetMapping("/selectDepartListSick")
public Result<Map<String,Object>> selectDepartListSick(@RequestParam(value = "parentId", required = true) String parentId) {
return conDepartmentApiService.selectDepartListSick(parentId);
}
@Operation(summary = "搜索部门", description = "搜索部门")
@GetMapping("/searchDepartList")
public Result<List<ConDepartmentDO>> searchDepartList(@RequestParam(value = "name", required = true) String name) {
return conDepartmentApiService.searchDepartList(name);
}
/**
* 查询科室 疾病使用 第二版
* @return
*/
@Operation(summary = "查询部门 疾病 第二版", description = "查询部门 疾病 第二版")
@GetMapping("/selectDepartListSickVersionTwo")
public Result<List<ConDepartmentDO>> selectDepartListSickVersionTwo() {
return conDepartmentApiService.selectDepartListSickVersionTwo();
}
/**
* 查询部门 根据医院id
* @param hospitalId
* @return
*/
@Operation(summary = "查询部门 根据医院id", description = "查询部门 根据医院id")
@GetMapping("/selectDepartListByHospitalId")
public Result<List<ConDepartmentDO>> selectDepartListByHospitalId(@RequestParam(value = "hospitalId", required = false) String hospitalId) {
return conDepartmentApiService.selectDepartListByHospitalId(hospitalId);
}
/**
* 查询部门 根据医院id 第二版
* @param hospitalId
* @param departmentId
* @return
*/
@Operation(summary = "查询部门 根据医院id 第二版", description = "查询部门 根据医院id 第二版")
@GetMapping("/selectDepartListByHospitalIdVersionTwo")
public Result<Map<String,Object>> selectDepartListByHospitalIdVersionTwo(@RequestParam(value = "hospitalId" ,required = false) String hospitalId,
@RequestParam(value = "departmentId") String departmentId) {
return conDepartmentApiService.selectDepartListByHospitalIdVersionTwo(hospitalId,departmentId);
}
/**
* 跑数据 科室
* @return
*/
@Operation(summary = "跑数据 科室", description = "跑数据 科室")
@GetMapping("/runDepartmentData")
public Result<Map<String,Object>> runDepartmentData() {
return conDepartmentApiService.runDepartmentData();
}
/**
* 跑数据 医生
* @return
*/
@Operation(summary = "跑数据 医生", description = "跑数据 医生")
@GetMapping("/runDepartmentDoctorDate")
public Result<String> runDepartmentDoctorDate() {
return conDepartmentApiService.runDepartmentDoctorDate();
}
/**
* 跑数据 疾病
* @return
*/
@Operation(summary = "跑数据 疾病", description = "跑数据 疾病")
@GetMapping("/runDepartmentSickData")
public Result<String> runDepartmentSickData() {
return conDepartmentApiService.runDepartmentSickData();
}
}
@@ -0,0 +1,249 @@
package com.renkang.consultation.api.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.utils.StringUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConDoctorApiService;
import com.renkang.consultation.dto.ConDoctorDTO;
import com.renkang.consultation.dto.ConDoctorSearchDTO;
import com.renkang.consultation.entity.ConDoctor;
import com.renkang.consultation.entity.ConDoctorDO;
import com.renkang.consultation.entity.ConDoctorExAndUser;
import com.renkang.consultation.service.IConDoctorService;
import com.renkang.consultation.util.TempUtil;
import com.renkang.consultation.vo.ConDoctorVO;
import io.swagger.v3.oas.annotations.Operation;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.util.DictUtil;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.util.RSAEncryptUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(RequestPrefix.conDoctor)
public class ConDoctorApiController {
@Autowired
private ConDoctorApiService conDoctorApiService;
@Autowired
private IConDoctorService conDoctorService;
@Autowired
private ISysBaseAPI isysBaseApi;
@Autowired
private DictUtil dictUtil;
/**
* 分页列表查询
*
* @param dto 查询条件
* @return
*/
@GetMapping(value = "/list")
public Result<IPage<ConDoctorVO>> queryPageList(ConDoctorDTO dto) {
Page<ConDoctor> page = new Page<ConDoctor>(dto.getPageNo(), dto.getPageSize());
IPage<ConDoctorVO> pageList = conDoctorService.queryPageList(page, dto);
return Result.OK(pageList);
}
/**
* 编辑
*/
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody @Validated ConDoctorExAndUser conDoctorExAndUser) {
return conDoctorService.updateByDoctorUser(conDoctorExAndUser);
}
@Operation(summary = "修改专家端密码")
@RequestMapping(value = "/updatePassword", method = RequestMethod.PUT)
public Result<?> updatePassword(@RequestBody JSONObject json) {
if(ObjectUtil.isEmpty(json)){
return Result.error("未找到对应数据");
}
String password = json.get("password").toString();
String oldpassword = json.get("oldpassword").toString();
String confirmpassword = json.get("confirmpassword").toString();
if(ObjectUtil.isEmpty(password)){
return Result.error("密码为空");
}
if(ObjectUtil.isEmpty(oldpassword)){
return Result.error("密码为空");
}
if(ObjectUtil.isEmpty(confirmpassword)){
return Result.error("密码为空");
}
String passwordKey = RSAEncryptUtils.decrypt1(password, CommonConstant.PRIVATE_KEY);
String oldpasswordKey = RSAEncryptUtils.decrypt1(oldpassword, CommonConstant.PRIVATE_KEY);
String confirmpasswordKey = RSAEncryptUtils.decrypt1(confirmpassword, CommonConstant.PRIVATE_KEY);
json.put("password",passwordKey);
json.put("oldpassword",oldpasswordKey);
json.put("confirmpassword",confirmpasswordKey);
return isysBaseApi.updatePassword(json);
}
/**
* 专家端查询专家信息
*
* @return
*/
@Operation(summary = "专家端查询专家信息")
@GetMapping(value = "/queryDoctor")
public Result<ConDoctor> queryById() {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ConDoctor conDoctor = conDoctorService.getById(sysUser.getId());
if (conDoctor == null) {
return Result.error("未找到对应数据");
}
if (!StringUtils.isEmpty(conDoctor.getGoodAtSickness())) {
conDoctor.setGoodAtSicknessName(conDoctorApiService.selectSickName(conDoctor.getGoodAtSickness()));
}
String doctorTitle = dictUtil.queryDictItemListByCodeAndType("z_doct_lev", conDoctor.getDoctorTitle());
conDoctor.setDoctorTitle(doctorTitle);
//历史原因,反转字段,以后看情况改 TODO
TempUtil.reversalDocInfo(conDoctor);
return Result.OK(conDoctor);
}
@Operation(summary = "专家端 擅长病种接口 个人擅长 个人简介修改")
@RequestMapping(value = "/update", method = {RequestMethod.POST})
public Result<?> update(@RequestBody @Validated ConDoctor conDoctor) {
if (conDoctor.getDoctorTitle()==null||("").equals(conDoctor.getDoctorTitle())){
ConDoctor doctor = conDoctorService.getById(conDoctor.getId());
conDoctor.setDoctorTitle(doctor.getDoctorTitle());
}
boolean flag = conDoctorService.updateById(conDoctor);
if (flag){
return Result.ok("更新成功!");
}
return Result.error("更新失败!");
}
@Operation(summary = "查询医生信息", description = "查询医生信息")
@GetMapping("/selectDoctorInfo")
public Result<ConDoctorDO> selectDoctorInfo(@RequestParam(value = "doctorId", required = true) String doctorId) {
Result<ConDoctorDO> conDoctorResult = conDoctorApiService.selectDoctorInfoAndSchedule(doctorId);
if(conDoctorResult!=null && conDoctorResult.getResult()!=null){
ConDoctorDO conDoctor = conDoctorResult.getResult();
//历史原因,反转字段,以后看情况改 TODO
TempUtil.reversalDocInfo(conDoctor);
conDoctorResult.setResult(conDoctor);
}
return conDoctorResult;
}
// @Operation(summary="查询医生信息和评价", description="查询医生信息和评价")
// @GetMapping("/selectDoctorInfoAndJudgement")
// public Result<Map<String ,Object>> selectDoctorInfoAndJudgement(@RequestParam(value = "doctorId", required = true) String doctorId){
//
// return conDoctorApiService.selectDoctorInfoAndJudgement(doctorId);
// }
@Operation(summary = "获取医生平均分和人数", description = "获取医生平均分")
@GetMapping("/selectDoctorAverageScore")
public Result<Map<String, String>> selectDoctorAverageScore(@RequestParam(value = "doctorId", required = true) String doctorId) {
return conDoctorApiService.selectDoctorAverageScore(doctorId);
}
@Operation(summary = "查询医生信息", description = "查询医生信息")
@GetMapping("/selectDoctorByHospitalId")
public Result<List<ConDoctorDO>> selectDoctorByHospitalId(@RequestParam(value = "hospitalId", required = true) String hospitalId,
@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
Result<List<ConDoctorDO>> conDoctorResult = conDoctorApiService.selectDoctorByHospitalId(hospitalId, pageNo, pageSize);
if(conDoctorResult!=null && !CollectionUtils.isEmpty(conDoctorResult.getResult())){
conDoctorResult.getResult().forEach(conDoctor -> {
//历史原因,反转字段,以后看情况改 TODO
TempUtil.reversalDocInfo(conDoctor);
});
}
return conDoctorResult;
}
@Operation(summary = "查询推荐医生信息", description = "查询推荐医生信息")
@GetMapping("/selectDoctorRecommend")
public Result<Map<String, Object>> selectDoctorRecommend(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "6") Integer pageSize) {
//旧版接口也需要修改推荐医生接口
return conDoctorApiService.selectDoctorRecommendNew(pageNo,pageSize);
}
@Operation(summary = "公用根据字典key查询字典列表", description = "公用根据字典key查询字典列表")
@GetMapping("/selectDictList")
public Result<List<DictModel>> selectDictList(@RequestParam(value = "dictKey") String dictKey) {
return conDoctorApiService.selectDictList(dictKey);
}
@Operation(summary = "根据医生名称 医院 科室 疾病搜索", description = "公用根据字典key查询字典列表")
@GetMapping("/selectDictListByNHDS")
public Result<List<ConDoctorDO>> selectDictListByNHDS(@RequestParam(value = "doctorName") String doctorName,
@RequestParam(value = "hospitalId") String hospitalId,
@RequestParam(value = "departmentId") String departmentId,
@RequestParam(value = "sickId") String sickId,
@RequestParam(value = "tfSort") String tfSort,
@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
Result<List<ConDoctorDO>> conDoctorResult = conDoctorApiService.selectDictListByNHDS(doctorName, hospitalId, departmentId, sickId, tfSort, pageNo, pageSize);
if(conDoctorResult!=null && !CollectionUtils.isEmpty(conDoctorResult.getResult())){
conDoctorResult.getResult().forEach(conDoctor -> {
//历史原因,反转字段,以后看情况改 TODO
TempUtil.reversalDocInfo(conDoctor);
});
}
return conDoctorResult;
}
/**
* 根据科室 疾病 数组 搜索医生列表
* @return
*/
@Operation(summary = "根据科室 疾病 数组 搜索医生列表", description = "根据科室 疾病 数组 搜索医生列表")
@PostMapping("/selectDictListBySickAndDepartment")
public Result<List<ConDoctorDO>> selectDictListBySickAndDepartment(@RequestBody @Validated ConDoctorSearchDTO conDoctorSearchDTO) {
Result<List<ConDoctorDO>> conDoctorResult = conDoctorApiService.selectDictListBySickAndDepartment(conDoctorSearchDTO);
if(conDoctorResult!=null && !CollectionUtils.isEmpty(conDoctorResult.getResult())){
conDoctorResult.getResult().forEach(conDoctor -> {
//历史原因,反转字段,以后看情况改 TODO
TempUtil.reversalDocInfo(conDoctor);
});
}
return conDoctorResult;
}
/**
* 查询推荐医生信息 新
* @return
*/
@Operation(summary = "查询推荐医生信息", description = "查询推荐医生信息")
@GetMapping("/selectDoctorRecommendNew")
public Result<Map<String, Object>> selectDoctorRecommendNew(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "6") int pageSize) {
return conDoctorApiService.selectDoctorRecommendNew(pageNo,pageSize);
}
}
@@ -0,0 +1,38 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConDoctorFollowApiService;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(RequestPrefix.conDoctorFollow)
public class ConDoctorFollowApiController {
@Autowired
private ConDoctorFollowApiService conDoctorFollowApiService;
@Operation(summary = "关注", description = "关注")
@GetMapping("/followDoctor")
public Result<String> followDoctor(@RequestParam(value = "doctorId", required = true) String doctorId) {
return conDoctorFollowApiService.followOrCancelDoctor(doctorId);
}
@Operation(summary = "取消关注", description = "取消关注")
@GetMapping("/cancelDoctor")
public Result<String> cancelDoctor(@RequestParam(value = "doctorId", required = true) String doctorId) {
return conDoctorFollowApiService.cancelDoctor(doctorId);
}
}
@@ -0,0 +1,65 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConDoctorSchedulingApiService;
import com.renkang.consultation.entity.ConDoctorSchedulingDO;
import com.renkang.consultation.entity.ConDoctorSchedulingListDO;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping(RequestPrefix.conDoctorScheduling)
public class ConDoctorSchedulingApiController {
@Autowired
private ConDoctorSchedulingApiService conDoctorSchedulingApiService;
@Operation(summary = "插入排班 第一种列表的方式", description = "插入排班 第一种列表的方式")
@PostMapping("/insertDoctorScheduling")
public Result<String> insertDoctorScheduling(@RequestBody @Validated ConDoctorSchedulingListDO conDoctorSchedulingListDO) {
return conDoctorSchedulingApiService.insertDoctorScheduling(conDoctorSchedulingListDO);
}
@Operation(summary = "插入排班 第一种单个的方式", description = "插入排班 第一种单个的方式")
@PostMapping("/insertDoctorSchedulingSingle")
public Result<String> insertDoctorSchedulingSingle(@RequestBody @Validated ConDoctorSchedulingDO conDoctorSchedulingDO) {
return conDoctorSchedulingApiService.insertDoctorSchedulingSingle(conDoctorSchedulingDO);
}
@Operation(summary = "查询排班", description = "查询排班")
@GetMapping("/selectDoctorScheduling")
public Result<Map<String, Object>> selectDoctorScheduling() {
return conDoctorSchedulingApiService.selectDoctorScheduling();
}
/**
* 插入排班 第一种列表的方式 跑数据
* @return
*/
@Operation(summary = "插入排班 第一种列表的方式 跑数据", description = "插入排班 第一种列表的方式 跑数据")
@PostMapping("/insertDoctorSchedulingRunData")
public Result<String> insertDoctorSchedulingRunData() {
return conDoctorSchedulingApiService.insertDoctorSchedulingRunData();
}
@Operation(summary = "插入排班 初始化排班", description = "插入排班 初始化排班")
@PostMapping("/initDoctorSchedulingData")
public Result<String> initDoctorSchedulingData() {
return conDoctorSchedulingApiService.initDoctorSchedulingData();
}
}
@@ -0,0 +1,29 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConDoctorSchedulingDateApiService;
import com.renkang.consultation.entity.ConDoctorSchedulingDateListDO;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(RequestPrefix.conDoctorSchedulingDate)
public class ConDoctorSchedulingDateApiController {
@Autowired
private ConDoctorSchedulingDateApiService conDoctorSchedulingDateApiService;
@Operation(summary = "查询可预约时间", description = "查询可预约时间")
@GetMapping("/selectSchedulingDateListByDoctorId")
public Result<List<ConDoctorSchedulingDateListDO>> selectSchedulingDateListByDoctorId(@RequestParam(value = "doctorId", required = true) String doctorId) {
return conDoctorSchedulingDateApiService.selectSchedulingDateListByDoctorId(doctorId);
}
}
@@ -0,0 +1,71 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConEvaluateApiService;
import com.renkang.consultation.entity.ConEvaluate;
import com.renkang.consultation.entity.ConEvaluateDO;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(RequestPrefix.conEvaluate)
public class ConEvaluateApiController {
@Autowired
private ConEvaluateApiService conEvaluateApiService;
/**
* 评分
*
* @param conEvaluate
* @return
*/
@Operation(summary = "评分", description = "评分")
@PostMapping("/insertConEvaluate")
public Result<String> insertConEvaluate(@RequestBody @Validated ConEvaluate conEvaluate) {
return conEvaluateApiService.insertConEvaluate(conEvaluate);
}
/**
* 评分列表
*
* @param doctorId
* @param pageNo
* @param pageSize
* @return
*/
@Operation(summary = "评分列表", description = "评分列表")
@GetMapping("/selectConEvaluateList")
public Result<List<ConEvaluateDO>> selectConEvaluateList(@RequestParam(value = "doctorId", required = true) String doctorId,
@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
return conEvaluateApiService.selectConEvaluateList(doctorId, pageNo, pageSize);
}
/**
* 评分列表 根据医院查询
*
* @param hospitalId
* @param pageNo
* @param pageSize
* @return
*/
@Operation(summary = "评分列表 根据医院查询", description = "评分列表 根据医院查询")
@GetMapping("/selectConEvaluateListByHospitalId")
public Result<List<ConEvaluateDO>> selectConEvaluateListByHospitalId(@RequestParam(value = "hospitalId", required = true) String hospitalId,
@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
return conEvaluateApiService.selectConEvaluateListByHospitalId(hospitalId, pageNo, pageSize);
}
}
@@ -0,0 +1,72 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConFamilyMembersApiService;
import com.renkang.consultation.entity.ConFamilyMembersAndMedicalRecordsDO;
import com.renkang.consultation.entity.ConFamilyMembersDO;
import com.renkang.emergency.bean.request.SingleParam;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(RequestPrefix.familyMembers)
public class ConFamilyMembersApiController {
@Autowired
private ConFamilyMembersApiService conFamilyMembersApiService;
@Operation(summary = "插入成员", description = "插入成员")
@PostMapping("/insertFamilyMembers")
public Result<String> insertFamilyMembers(@RequestBody @Validated ConFamilyMembersDO conFamilyMembersDO) {
return conFamilyMembersApiService.insertFamilyMembers(conFamilyMembersDO);
}
@Operation(summary = "修改成员", description = "修改成员")
@PostMapping("/updateFamilyMembers")
public Result<String> updateFamilyMembers(@RequestBody @Validated ConFamilyMembersDO conFamilyMembersDO) {
return conFamilyMembersApiService.updateFamilyMembers(conFamilyMembersDO);
}
@Operation(summary = "查询成员和疾病列表", description = "查询成员和疾病列表")
@GetMapping("/selectMenberList")
public Result<List<ConFamilyMembersAndMedicalRecordsDO>> selectMenberList(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
return conFamilyMembersApiService.selectMenberList(pageNo, pageSize);
}
@Operation(summary = "查询成员列表", description = "查询成员列表")
@GetMapping("/selectMenberOnlyList")
public Result<List<ConFamilyMembersAndMedicalRecordsDO>> selectMenberOnlyList(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
return conFamilyMembersApiService.selectMenberOnlyList(pageNo, pageSize);
}
@Operation(summary = "根据id查询成员信息", description = "根据id查询成员信息")
@GetMapping("/selectMenberById")
public Result<ConFamilyMembersDO> selectMenberById(@RequestParam(value = "id", required = true) String id) {
return conFamilyMembersApiService.selectMenberById(id);
}
@Operation(summary = "删除成员信息", description = "删除成员信息")
@PostMapping("/removeMemberById")
public Result<String> removeMemberById(@RequestBody @Validated SingleParam<List<String>> ids) {
return conFamilyMembersApiService.removeMemberById(ids);
}
}
@@ -0,0 +1,54 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConHealthInfoApiService;
import com.renkang.consultation.entity.ConHealthInfoAnswerListDO;
import com.renkang.consultation.entity.ConHealthInfoAnswerSingleDO;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(RequestPrefix.healthInfo)
public class ConHealthInfoApiController {
@Autowired
private ConHealthInfoApiService conHealthInfoApiService;
@Operation(summary = "查询问题列表", description = "查询问题列表")
@GetMapping("/selectHealthInfo")
public Result<List<Object>> selectHealthInfo(@RequestParam(value = "memberId", required = true) String memberId) {
return conHealthInfoApiService.selectHealthInfo(memberId);
}
@Operation(summary = "添加回答", description = "添加回答")
@PostMapping("/inserOrUpdatetHealthInfoAnswer")
public Result<String> inserOrUpdatetHealthInfoAnswer(@RequestBody ConHealthInfoAnswerListDO conHealthInfoListDO) {
return conHealthInfoApiService.inserOrUpdatetHealthInfoAnswer(conHealthInfoListDO);
}
@Operation(summary = "删除问题", description = "删除问题")
@GetMapping("/removeHealthInfo")
public Result<String> removeHealthInfo(@RequestParam(value = "memberId", required = true) String memberId) {
return conHealthInfoApiService.removeHealthInfo(memberId);
}
@Operation(summary = "医生端 查询用户基本健康信息", description = "医生端 查询用户基本健康信息")
@GetMapping("/selectHealthInfoDoctor")
public Result<List<ConHealthInfoAnswerSingleDO>> selectHealthInfoDoctor(@RequestParam(value = "memberId", required = true) String memberId) {
return conHealthInfoApiService.selectHealthInfoDoctor(memberId);
}
}
@@ -0,0 +1,52 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConHelperApiService;
import com.renkang.consultation.vo.ConHelperCustomUserVO;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(RequestPrefix.conHelper)
public class ConHelperApiController {
@Autowired
private ConHelperApiService conHelperApiService;
@Operation(summary = "查询小助手", description = "查询问题列表")
@GetMapping("/selectHelperInfo")
public Result<String> selectHelperInfo() {
return conHelperApiService.selectHelperInfo();
}
/**
* 查询小助手
* @param helpId
* @return
*/
@Operation(summary = "查询小助手", description = "查询小助手")
@GetMapping("/selectHelperInfoDesc")
public Result<ConHelperCustomUserVO> selectHelperInfoDesc(@RequestParam(value = "helpId") String helpId) {
return conHelperApiService.selectHelperInfoDesc(helpId);
}
/**
* 查询是否小助手
* @param helpId
* @return
*/
@Operation(summary = "查询是否小助手", description = "查询是否小助手")
@GetMapping("/selectTfHelper")
public Result<Boolean> selectTfHelper(@RequestParam(value = "helpId") String helpId) {
return conHelperApiService.selectTfHelper(helpId);
}
}
@@ -0,0 +1,37 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConHospitalFollowApiService;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(RequestPrefix.conHospitalFollow)
public class ConHospitalFollowApiController {
@Autowired
private ConHospitalFollowApiService conHospitalFollowApiService;
@Operation(summary = "关注", description = "关注")
@GetMapping("/followHostital")
public Result<String> followHostital(@RequestParam(value = "hospitalId", required = true) String hospitalId) {
return conHospitalFollowApiService.followOrCancelHospital(hospitalId);
}
@Operation(summary = "取消关注", description = "取消关注")
@GetMapping("/cancelHostital")
public Result<String> cancelHostital(@RequestParam(value = "hospitalId", required = true) String hospitalId) {
return conHospitalFollowApiService.cancelHospital(hospitalId);
}
}
@@ -0,0 +1,67 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConKnowledgeApiService;
import com.renkang.consultation.entity.ConKnowledgeDO;
import com.renkang.consultation.entity.ConKnowledgeListDO;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(RequestPrefix.knowledge)
public class ConKnowledgeApiController {
@Autowired
private ConKnowledgeApiService conKnowledgeApiService;
@Operation(summary = "查询推荐列表", description = "查询推荐列表")
@GetMapping("/selectKnowledgeRecommendList")
public Result<List<ConKnowledgeListDO>> selectKnowledgeRecommendList(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
return conKnowledgeApiService.selectKnowledgeRecommendList(pageNo, pageSize);
}
@Operation(summary = "根据分类查询", description = "根据分类查询")
@GetMapping("/selectKnowledgeListByClass")
public Result<List<ConKnowledgeListDO>> selectKnowledgeListByClass(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "classId", required = true) String classId) {
return conKnowledgeApiService.selectKnowledgeListByClass(pageNo, pageSize, classId);
}
@Operation(summary = "根据id查看详情", description = "根据id查看详情")
@GetMapping("/selectKnowledgeById")
public Result<ConKnowledgeDO> selectKnowledgeById(@RequestParam(value = "id", required = true) String id) {
return conKnowledgeApiService.selectKnowledgeById(id);
}
/**
* 搜索知识库
*
* @param pageNo
* @param pageSize
* @return
*/
@Operation(summary = "搜索知识库", description = "搜索知识库")
@GetMapping("/searchKnowledgeList")
public Result<List<ConKnowledgeListDO>> searchKnowledgeList(@RequestParam(value = "title") String title,
@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
return conKnowledgeApiService.searchKnowledgeList(title, pageNo, pageSize);
}
}
@@ -0,0 +1,28 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConKnowledgeCategoryApiService;
import com.renkang.consultation.entity.ConKnowledgeCategoryDO;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(RequestPrefix.knowledgeCategory)
public class ConKnowledgeCategoryApiController {
@Autowired
private ConKnowledgeCategoryApiService conKnowledgeCategoryApiService;
@GetMapping("/selectKnowledgeCategory")
public Result<List<ConKnowledgeCategoryDO>> selectKnowledgeCategory() {
return conKnowledgeCategoryApiService.selectKnowledgeCategory();
}
}
@@ -0,0 +1,58 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConMedicalRecordsApiService;
import com.renkang.consultation.entity.ConMedicalRecordsDO;
import com.renkang.consultation.entity.ConMedicalRecordsListDO;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(RequestPrefix.medicalRecords)
public class ConMedicalRecordsApiController {
@Autowired
private ConMedicalRecordsApiService conMedicalRecordsApiService;
@Operation(summary = "插入疾病档案", description = "插入疾病档案")
@PostMapping("/insertConMedicalRecords")
public Result<String> insertConMedicalRecords(@RequestBody @Validated ConMedicalRecordsDO conMedicalRecordsDO) {
return conMedicalRecordsApiService.insertConMedicalRecords(conMedicalRecordsDO);
}
@Operation(summary = "查询档案详情 ", description = "查询档案详情")
@GetMapping("/selectConMedicalRecordsById")
public Result<ConMedicalRecordsDO> selectConMedicalRecordsById(@RequestParam(value = "id", required = true) String id) {
return conMedicalRecordsApiService.selectConMedicalRecordsById(id);
}
@Operation(summary = "查询档案详情 专家端", description = "查询档案详情")
@GetMapping("/selectConMedicalRecordsByIdDoctor")
public Result<Map<String, Object>> selectConMedicalRecordsByIdDoctor(@RequestParam(value = "id", required = true) String id) {
return conMedicalRecordsApiService.selectConMedicalRecordsByIdDoctor(id);
}
/**
* 根据家庭成员id查询档案列表
*
* @param memberId
* @return
*/
@Operation(summary = "根据家庭成员id查询档案列表", description = "根据家庭成员id查询档案列表")
@GetMapping("/selectConMedicalRecordsByMemberId")
public Result<List<ConMedicalRecordsListDO>> selectConMedicalRecordsByMemberId(@RequestParam(value = "memberId", required = true) String memberId) {
return conMedicalRecordsApiService.selectConMedicalRecordsByMemberId(memberId);
}
}
@@ -0,0 +1,49 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConNoticeApiService;
import com.renkang.consultation.dto.NoticeOnOrOff;
import com.renkang.consultation.entity.ConNoticeDO;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(RequestPrefix.notice)
public class ConNoticeApiController {
@Autowired
private ConNoticeApiService conNoticeApiService;
@Operation(summary = "查询咨询须知", description = "查询咨询须知")
@GetMapping("/selectUserNotice")
public Result<ConNoticeDO> selectUserNotice(@RequestParam(value = "type", required = true) String type) {
return conNoticeApiService.selectUserNotice(type);
}
@Operation(summary = "以后不再显示", description = "以后不再显示")
@GetMapping("/chooseToDontShowUp")
public Result<String> chooseToDontShowUp(@RequestParam(value = "id") String id,
@RequestParam(value = "notShow") String notShow) {
return conNoticeApiService.chooseToDontShowUp(id, notShow);
}
/**
* 启用须知
*/
@PostMapping("/on")
public Result<String> on(@RequestBody NoticeOnOrOff notice) {
try {
conNoticeApiService.on(notice);
return Result.ok("修改成功");
} catch (Exception e) {
return Result.error(e.getMessage());
}
}
}
@@ -0,0 +1,68 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConResourceApiService;
import com.renkang.consultation.entity.ConResourceDO;
import com.renkang.consultation.mapper.ConResourceMapper;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping(RequestPrefix.conResource)
public class ConResourceApiController {
@Autowired
private ConResourceApiService conResourceApiService;
@Autowired
private ConResourceMapper conResourceMapper;
@Operation(summary = "医院详情", description = "医院详情")
@GetMapping("/hospitalDetail")
public Result<ConResourceDO> hospitalDetail(@RequestParam(value = "id") String id) {
return conResourceApiService.hospitalDetail(id);
}
@Operation(summary = "获取医生平均分和人数", description = "获取医生平均分")
@GetMapping("/selectHostitalAverageScore")
public Result<Map<String, String>> selectHostitalAverageScore(@RequestParam(value = "hospitalId") String hospitalId) {
return conResourceApiService.selectHostitalAverageScore(hospitalId);
}
@Operation(summary = "查询医院列表", description = "查询医院列表")
@GetMapping("/selectHospitalList")
public Result<Map<String, Object>> selectHospitalList() {
return conResourceApiService.selectHospitalList();
}
/**
* 查询医院列表 过滤没有医生的医院
* @return
*/
@Operation(summary = "查询医院列表 过滤没有医生的医院", description = "查询医院列表 过滤没有医生的医院")
@GetMapping("/selectHospitalListVersionTwo")
public Result<Map<String, Object>> selectHospitalListVersionTwo() {
return conResourceApiService.selectHospitalListVersionTwo();
}
@Operation(summary = "testData", description = "testData")
@GetMapping("/testData")
public Result<Map<String, Object>> testData() {
return conResourceApiService.testData();
}
}
@@ -0,0 +1,93 @@
package com.renkang.consultation.api.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConServiceApiService;
import com.renkang.consultation.entity.ConDoctor;
import com.renkang.consultation.entity.ConService;
import com.renkang.consultation.mapper.ConDoctorMapper;
import com.renkang.consultation.service.IConServiceService;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
@RestController
@RequestMapping(RequestPrefix.CON_SERVICE)
public class ConServiceApiController {
@Autowired
private IConServiceService conServiceService;
@Autowired
private ConServiceApiService conServiceApiService;
@Autowired
private ConDoctorMapper conDoctorMapper;
/**
* 分页列表查询
*/
@GetMapping(value = "/list")
public Result<IPage<ConService>> queryPageList(ConService conService,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (!StringUtils.hasLength(conService.getDoctorId())) {
conService.setDoctorId(sysUser.getId());
}
conService.setStatus(1);
conService.setDelFlag(0);
QueryWrapper<ConService> queryWrapper = QueryGenerator.initQueryWrapper(conService, req.getParameterMap());
queryWrapper.lambda().orderByDesc(ConService::getCreateTime);
Page<ConService> page = new Page<ConService>(pageNo, pageSize);
IPage<ConService> pageList = conServiceService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*/
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ConService conService) {
try {
conService.setStatus(1);
//获取当前登录用户
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
conService.setDoctorId(sysUser.getId());
conServiceApiService.add(conService);
return Result.OK("添加成功!");
} catch (Exception e) {
return Result.error(e.getMessage());
}
}
/**
* 编辑
*/
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody ConService conService) {
conServiceService.updateById(conService);
ConService conServiceOnly = conServiceService.getById(conService.getId());
Date date = com.renkang.consultation.util.DateUtils.changeDate(new Date());
if(conServiceOnly != null && date.getTime() >= conServiceOnly.getStartDay().getTime() && date.getTime() <= conServiceOnly.getEndDay().getTime()){
LambdaUpdateWrapper<ConDoctor> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(ConDoctor::getId, conServiceOnly.getDoctorId())
.set(ConDoctor::getDoctorStatus, "1");
conDoctorMapper.update(null, updateWrapper);
}
return Result.OK("编辑成功!");
}
}
@@ -0,0 +1,483 @@
package com.renkang.consultation.api.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConSessionApiService;
import com.renkang.consultation.bean.SessionUserFilter;
import com.renkang.consultation.bean.UserSessionCount;
import com.renkang.consultation.entity.ConSessionDO;
import com.renkang.consultation.entity.ConSessionPictureTextDO;
import com.renkang.consultation.entity.ListImIds;
import com.renkang.im.entity.ImMsgRecordAll;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.DictModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Date;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(RequestPrefix.conSession)
public class ConSessionApiController {
@Autowired
private ConSessionApiService conSessionApiService;
@Operation(summary = "预约", description = "预约")
@PostMapping("/insertTelephoneSession")
public Result<String> insertTelephoneSession(@RequestBody @Validated ConSessionDO conSessionDO) {
return conSessionApiService.insertTelephoneSession(conSessionDO);
}
@Operation(summary = "图文预约", description = "图文预约")
@PostMapping("/insertPictureTextSession")
public Result<Map<String, Object>> insertPictureTextSession(@RequestBody @Validated ConSessionPictureTextDO conSessionPictureTextDO) {
return conSessionApiService.insertPictureTextSession(conSessionPictureTextDO);
}
/**
* 专家咨询小助手
*
* @return
*/
@Operation(summary = "专家咨询小助手", description = "专家咨询小助手")
@GetMapping("/insertProfessorAndHelperSession")
public Result<Map<String, Object>> insertProfessorAndHelperSession() {
return conSessionApiService.insertProfessorAndHelperSession();
}
/**
* 专家咨询小助手 展示小助手Id
*
* @return
*/
@Operation(summary = "专家咨询小助手 展示", description = "专家咨询小助手")
@GetMapping("/insertProfessorAndHelperSessionShow")
public Result<String> insertProfessorAndHelperSessionShow() {
return conSessionApiService.insertProfessorAndHelperSessionShow();
}
/**
* 用户咨询小助手
*
* @return
*/
@Operation(summary = "用户咨询小助手", description = "用户咨询小助手")
@GetMapping("/insertUserAndHelperSession")
public Result<Map<String, Object>> insertUserAndHelperSession() {
return conSessionApiService.insertUserAndHelperSession();
}
@Operation(summary = "进行中的咨询数量", description = "进行中的咨询数量")
@GetMapping("/sessioningNum")
public Result<String> sessioningNum() {
return conSessionApiService.sessioningNum();
}
@Operation(summary = "结束图文咨询", description = "结束图文咨询")
@GetMapping("/endPictureTextSession")
public Result<String> endPictureTextSession(@RequestParam(value = "id") String id) {
return conSessionApiService.endPictureTextSession(id);
}
@Operation(summary = "预约详情", description = "预约详情")
@GetMapping("/sessionDetail")
public Result<Map<String, Object>> sessionDetail(@RequestParam(value = "id") String id) {
return conSessionApiService.sessionDetail(id);
}
@Operation(summary = "取消预约", description = "取消预约")
@GetMapping("/cancelSession")
public Result<String> cancelSession(@RequestParam(value = "id") String id) {
return conSessionApiService.cancelSession(id);
}
@Operation(summary = "查询咨询列表", description = "查询咨询列表")
@GetMapping("/selectSessionListByDoctorId")
public Result<List<ConSessionDO>> selectSessionListByDoctorId(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "type") String type,
@RequestParam(value = "status") String status) {
return conSessionApiService.selectSessionListByDoctorId(pageNo, pageSize, type, status);
}
@Operation(summary = "查询咨询列表 用户端", description = "查询咨询列表 用户端")
@GetMapping("/selectSessionListByUserId")
public Result<List<ConSessionDO>> selectSessionListByUserId(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "type") String type,
@RequestParam(value = "status") String status) {
return conSessionApiService.selectSessionListByUserId(pageNo, pageSize, type, status);
}
/**
* 查询咨询列表 用户端 v2
*
* @param pageNo
* @param pageSize
* @param type
* @param status
* @return
*/
@Operation(summary = "查询咨询列表 用户端", description = "查询咨询列表 用户端")
@GetMapping("/selectSessionListByUserIdVersionTwo")
public Result<List<ConSessionDO>> selectSessionListByUserIdVersionTwo(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "type") String type,
@RequestParam(value = "status") String status) {
return conSessionApiService.selectSessionListByUserIdVersionTwo(pageNo, pageSize, type, status);
}
@Operation(summary = "查询咨询列表 用户端", description = "查询咨询列表 用户端")
@GetMapping("/selectSessionListByUserIdVersionThree")
public Result<List<ConSessionDO>> selectSessionListByUserIdVersionThree(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "type") String type,
@RequestParam(value = "status") String status) {
return conSessionApiService.selectSessionListByUserIdVersionThree(pageNo, pageSize, type, status);
}
@Operation(summary = "用户端 查询咨询列表(040910版)", description = "用户端 查询咨询列表(040910版)")
@PostMapping("/listForUser")
public Result<IPage<ConSessionDO>> listForUser(@Valid @RequestBody SessionUserFilter filter) {
return Result.ok(conSessionApiService.listForUser(filter));
}
@Operation(summary = "用户端 我的-咨询分类数量(040910版)", description = "用户端 我的-咨询分类数量(040910版)")
@GetMapping("/countForUser")
public Result<UserSessionCount> countForUser() {
return Result.ok(conSessionApiService.countForUser());
}
/**
* 查询咨询列表图文 用户端
*
* @param list
* @return
*/
@Operation(summary = "查询咨询列表图文 用户端", description = "查询咨询列表图文 用户端")
@PostMapping("/selectSessionListPictureByUserId")
public Result<List<ConSessionDO>> selectSessionListPictureByUserId(@RequestBody ListImIds list) {
return conSessionApiService.selectSessionListPictureByUserId(list);
}
@Operation(summary = "咨询详情 专家端", description = "咨询详情 专家端")
@GetMapping("/sessionDetailDoctor")
public Result<Map<String, Object>> sessionDetailDoctor(@RequestParam(value = "id") String id) {
return conSessionApiService.sessionDetailDoctor(id);
}
@Operation(summary = "咨询详情 已完成 专家端", description = "咨询详情 已完成 专家端")
@GetMapping("/sessionDetailDoctorFinish")
public Result<Map<String, Object>> sessionDetailDoctorFinish(@RequestParam(value = "id") String id) {
return conSessionApiService.sessionDetailDoctorFinish(id);
}
@Operation(summary = "咨询详情 开始 专家端", description = "咨询详情 开始 专家端")
@GetMapping("/sessionDetailDoctorStart")
public Result<Map<String, Object>> sessionDetailDoctorStart(@RequestParam(value = "id") String id) {
return conSessionApiService.sessionDetailDoctorStart(id);
}
@Operation(summary = "咨询详情 全部 专家端", description = "咨询详情 全部 专家端")
@GetMapping("/sessionDetailDoctorAll")
public Result<Map<String, Object>> sessionDetailDoctorAll(@RequestParam(value = "id") String id) {
return conSessionApiService.sessionDetailDoctorAll(id);
}
@Operation(summary = "咨询列表搜索", description = "咨询列表搜索")
@GetMapping("/sessionDetailDoctorSearch")
public Result<List<ConSessionDO>> sessionDetailDoctorSearch(@RequestParam(value = "memberName") String memberName,
@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
return conSessionApiService.sessionDetailDoctorSearch(memberName, pageNo, pageSize);
}
@Operation(summary = "医生拒绝会话", description = "医生拒绝会话")
@GetMapping("/sessionReject")
public Result<String> sessionReject(@RequestParam(value = "id") String id,
@RequestParam(value = "rejectReason") String rejectReason,
@RequestParam(value = "reasonType") String reasonType) {
return conSessionApiService.sessionReject(id, rejectReason, reasonType);
}
@Operation(summary = "医生接受会话", description = "医生接受会话")
@GetMapping("/sessionConfirm")
public Result<String> sessionConfirm(@RequestParam(value = "id") String id,
@RequestParam(value = "startTime") long startTime,
@RequestParam(value = "endTime") long endTime) {
return conSessionApiService.sessionConfirm(id, startTime, endTime);
}
@Operation(summary = "完成咨询", description = "完成咨询")
@GetMapping("/finishSession")
public Result<String> finishSession(@RequestParam(value = "id") String id) {
return conSessionApiService.finishSession(id);
}
@Operation(summary = "拒绝原因", description = "拒绝原因")
@GetMapping("/selectRejectReason")
public Result<List<DictModel>> selectRejectReason() {
return conSessionApiService.selectRejectReason();
}
@Operation(summary = "根据群组id查询咨询", description = "根据群组id查询咨询")
@PostMapping("/selectSessionByImId")
public Result<List<ConSessionDO>> selectSessionByImId(@RequestBody ListImIds list) {
return conSessionApiService.selectSessionByImId(list);
}
@Operation(summary = "查询音视频预约待处理", description = "查询音视频预约待处理")
@GetMapping("/selectSessionVideoUnByDoctorId")
public Result<String> selectSessionVideoUnByDoctorId() {
return conSessionApiService.selectSessionVideoUnByDoctorId();
}
/**
* 专家端 查询进行中的消息数
*
* @return
*/
@Operation(summary = "专家端 查询进行中的消息数", description = "专家端 查询进行中的消息数")
@GetMapping("/selectSessionProfessorIng")
public Result<Map<String, String>> selectSessionProfessorIng() {
return conSessionApiService.selectSessionProfessorIng();
}
@Operation(summary = "查询音视频预约待处理", description = "查询音视频预约待处理")
@GetMapping("/selectSessionVideoExistDoctor")
public Result<String> selectSessionVideoExistDoctor(@RequestParam(value = "startTime") Long startTime, @RequestParam(value = "endTime") Long endTime) {
return conSessionApiService.selectSessionVideoExistDoctor(startTime, endTime);
}
@Operation(summary = "咨询开始", description = "咨询开始")
@GetMapping("/startPictureTextSession")
public Result<String> startPictureTextSession(@RequestParam(value = "id") String id, @RequestParam(value = "fromAccount") String fromAccount) {
return conSessionApiService.startPictureTextSession(id, fromAccount);
}
@Operation(summary = "会话过期修改状态", description = "会话过期修改状态")
@GetMapping("/sessionSendMessageExpire")
public void sessionSendMessageExpire() {
conSessionApiService.sessionSendMessageExpire();
}
@Operation(summary = "小助手咨询开始", description = "小助手咨询开始")
@GetMapping("/startPictureTextSessionHelper")
public Result<String> startPictureTextSessionHelper(@RequestParam(value = "fromAccount") String fromAccount, @RequestParam(value = "toAccount") String toAccount) {
return conSessionApiService.startPictureTextSessionHelper(fromAccount, toAccount);
}
@Operation(summary = "专家咨询小助手 和 用户咨询小助手 超过四个小时结束", description = "专家咨询小助手 和 用户咨询小助手 超过四个小时结束")
@GetMapping("/endUserAndProfessiorHelper")
public Result<String> endUserAndProfessiorHelper(@RequestParam(value = "expireHour") String expireHour) {
return conSessionApiService.endUserAndProfessiorHelper(expireHour);
}
@Operation(summary = "专家停诊", description = "专家停诊")
@GetMapping("/doctorStopSession")
public Result<String> doctorStopSession(@RequestParam(value = "stopStartTime") Date stopStartTime, @RequestParam(value = "stopEndTime") Date stopEndTime) {
return conSessionApiService.doctorStopSession(stopStartTime, stopEndTime);
}
// public void changeSessionStatusByGroupId(@RequestParam(value = "groupId") String groupId){
//
// return conSessionApiService.changeSessionStatusByGroupId(groupId);
// }
/**
* 根据群组id查询咨询 还有是否回复
* @param list
* @return
*/
@Operation(summary = "根据群组id查询咨询 还有是否回复", description = "根据群组id查询咨询 还有是否回复")
@PostMapping("/selectSessionByImIdNew")
public Result<List<ConSessionDO>> selectSessionByImIdNew(@RequestBody ListImIds list) {
return conSessionApiService.selectSessionByImIdNew(list);
}
@GetMapping("/selectSessionListByGroupId")
public Result<ConSessionDO> selectSessionListByGroupId(@RequestParam(value = "imId") String imId){
return conSessionApiService.selectSessionListByGroupId(imId);
}
@GetMapping("/sekectSessionListByDate")
public Result<List<ConSessionDO>> sekectSessionListByDate(){
return conSessionApiService.sekectSessionListByDate();
}
@Operation(summary = "专家端 查询进行中的消息数", description = "专家端 查询进行中的消息数")
@GetMapping("/selectSessionProfessorIngNew")
public Result<Map<String, String>> selectSessionProfessorIngNew() {
return conSessionApiService.selectSessionProfessorIngNew();
}
@Operation(summary = "查询咨询列表", description = "查询咨询列表")
@GetMapping("/selectSessionListByDoctorIdNew")
public Result<List<ConSessionDO>> selectSessionListByDoctorIdNew(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "type") String type,
@RequestParam(value = "status") String status) {
return conSessionApiService.selectSessionListByDoctorIdNew(pageNo, pageSize, type, status);
}
@Operation(summary = "根据群组id查询咨询 还有是否回复", description = "根据群组id查询咨询 还有是否回复")
@PostMapping("/selectSessionByImIdNewNew")
public Result<List<ConSessionDO>> selectSessionByImIdNewNew(@RequestBody ListImIds list) {
return conSessionApiService.selectSessionByImIdNewNew(list);
}
@Operation(summary = "根据群组id查询咨询 还有是否回复", description = "根据群组id查询咨询 还有是否回复")
@PostMapping("/selectSessionByImIdNewNewAnother")
public Result<List<ConSessionDO>> selectSessionByImIdNewNewAnother(@RequestBody ListImIds list) {
return conSessionApiService.selectSessionByImIdNewNewAnother(list);
}
/**
* app查询聊天记录
* @param groupId
* @param pageNo
* @param pageSize
* @return
*/
@Operation(summary = "app查询聊天记录", description = "app查询聊天记录")
@GetMapping("/selectImMessagePageListSession")
public Result<List<ImMsgRecordAll>> selectImMessagePageListSession(
@RequestParam("groupId") String groupId,
@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize
) {
return conSessionApiService.selectImMessagePageListSession(groupId, pageNo, pageSize);
}
@Operation(summary = "查询咨询列表", description = "查询咨询列表")
@GetMapping("/selectSessionListByDoctorIdNewAnother")
public Result<List<ConSessionDO>> selectSessionListByDoctorIdNewAnother(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "type") String type,
@RequestParam(value = "status") String status) {
return conSessionApiService.selectSessionListByDoctorIdNewAnother(pageNo, pageSize, type, status);
}
@Operation(summary = "专家端 查询进行中的消息数", description = "专家端 查询进行中的消息数")
@GetMapping("/selectSessionProfessorIngNewAnother")
public Result<Map<String, String>> selectSessionProfessorIngNewAnother() {
return conSessionApiService.selectSessionProfessorIngNewAnother();
}
/**
* 青海使用 咨询记录合并
* @param pageNo
* @param pageSize
* @return
*/
@Operation(summary = "查询咨询列表 合并", description = "查询咨询列表 合并")
@GetMapping("/selectSessionListByDoctorIdUnit")
public Result<List<ConSessionDO>> selectSessionListByDoctorIdUnit(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
return conSessionApiService.selectSessionListByDoctorIdUnit(pageNo, pageSize);
}
/**
* 查询咨询全科专家历史
* @param pageNo
* @param pageSize
* @return
*/
@Operation(summary = "查询咨询列表 小助手", description = "查询咨询列表 小助手")
@GetMapping("/selectSessionListByDoctorIdHelper")
public Result<List<ConSessionDO>> selectSessionListByDoctorIdHelper(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
return conSessionApiService.selectSessionListByDoctorIdHelper(pageNo, pageSize);
}
/**
* 查询名片是否过期
* @param sendTime
* @return
*/
@Operation(summary = "查询医生名片过期时间", description = "查询医生名片过期时间")
@GetMapping("/selectDoctorCardExpireTime")
public Result<Integer> selectDoctorCardExpireTime(@RequestParam(value = "sendTime")Long sendTime) {
return conSessionApiService.selectDoctorCardExpireTime(sendTime);
}
/**
* 青海使用用户咨询 全科专家
* @return
*/
@Operation(summary = "用户咨询小助手 新的", description = "用户咨询小助手 新的")
@GetMapping("/insertUserAndHelperSessionNew")
public Result<Map<String, Object>> insertUserAndHelperSessionNew() {
return conSessionApiService.insertUserAndHelperSessionNew();
}
}
@@ -0,0 +1,52 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConSessionReservationApiService;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(RequestPrefix.sessionReservationDate)
public class ConSessionReservationDateApiController {
@Autowired
private ConSessionReservationApiService conSessionReservationApiService;
/**
* 预约时间
*
* @param id
* @param startTime
* @param endTime
* @return
*/
@Operation(summary = "预约时间", description = "预约时间")
@GetMapping("/sessionReservationDate")
public Result<String> sessionReservationDate(@RequestParam(value = "id") String id,
@RequestParam(value = "type") String type,
@RequestParam(value = "startTime") String startTime,
@RequestParam(value = "endTime") String endTime) {
return conSessionReservationApiService.sessionReservationDate(id, type, startTime, endTime);
}
/**
* 结束通话
*
* @param id
* @return
*/
@Operation(summary = "结束通话", description = "结束通话")
@GetMapping("/endPhone")
public Result<String> endPhone(@RequestParam(value = "id") String id) {
return conSessionReservationApiService.endPhone(id);
}
}
@@ -0,0 +1,45 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConSessionVideoInfoApiService;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping(RequestPrefix.conSessionVideoInfo)
public class ConSessionVideoInfoApiController {
@Autowired
private ConSessionVideoInfoApiService conSessionVideoInfoApiService;
/**
* 创建视频群聊
*
* @param sessionId
* @return
*/
@Operation(summary = "创建视频群聊", description = "创建视频群聊")
@GetMapping("/startVideoSession")
public Result<Map<String, Object>> startVideoSession(@RequestParam(value = "sessionId") String sessionId) {
return conSessionVideoInfoApiService.startVideoSession(sessionId);
}
@Operation(summary = "结束视频聊天", description = "结束视频聊天")
@GetMapping("/endVideoSession")
public Result<String> endVideoSession(@RequestParam(value = "sessionId") String sessionId) {
return conSessionVideoInfoApiService.endVideoSession(sessionId);
}
}
@@ -0,0 +1,57 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConSicksApiService;
import com.renkang.consultation.entity.ConSicksDO;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(RequestPrefix.conSicks)
public class ConSicksApiController {
@Autowired
private ConSicksApiService conSicksApiService;
/**
* 根据科室list查询疾病
*
* @param departmentId 科室id
* @return
*/
@Operation(summary = "根据科室查询疾病", description = "根据科室查询疾病")
@GetMapping("/selectSickListByDepartmentId")
public Result<List<ConSicksDO>> selectSickListByDepartmentId(@RequestParam(value = "departmentId") String departmentId) {
return conSicksApiService.selectSickListByDepartmentId(departmentId);
}
@Operation(summary = "根据科室查询疾病 第二版", description = "根据科室查询疾病 第二版")
@GetMapping("/selectSickListByDepartmentIdNew")
public Result<Map<String,Object>> selectSickListByDepartmentIdNew(@RequestParam(value = "departmentId") String departmentId) {
return conSicksApiService.selectSickListByDepartmentIdNew(departmentId);
}
/**
* 根据科室list查询疾病 专家使用单独
*
* @param departmentId 科室id
* @return
*/
@Operation(summary = "根据科室查询疾病 专家使用单独", description = "根据科室查询疾病 专家使用单独")
@GetMapping("/selectSickListByDepartmentIdDoctorSearch")
public Result<List<ConSicksDO>> selectSickListByDepartmentIdDoctorSearch(@RequestParam(value = "departmentId") String departmentId) {
return conSicksApiService.selectSickListByDepartmentIdDoctorSearch(departmentId);
}
}
@@ -0,0 +1,51 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConsultResidentHospitalApiService;
import com.renkang.consultation.entity.ConsultResidentHospitalDO;
import com.renkang.consultation.service.IConsultResidentHospitalService;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(RequestPrefix.consultResidentHospital)
public class ConsultResidentHospitalApiController {
@Autowired
private ConsultResidentHospitalApiService consultResidentHospitalApiService;
@Autowired
private IConsultResidentHospitalService consultResidentHospitalService;
@Operation(summary = "医院详情", description = "医院详情")
@GetMapping("/hospitalDetail")
public Result<ConsultResidentHospitalDO> hospitalDetail(@RequestParam(value = "id", required = true) String id) {
return consultResidentHospitalApiService.hospitalDetail(id);
}
@Operation(summary = "获取医生平均分和人数", description = "获取医生平均分")
@GetMapping("/selectHostitalAverageScore")
public Result<Map<String, String>> selectHostitalAverageScore(@RequestParam(value = "hospitalId", required = true) String hospitalId) {
return consultResidentHospitalApiService.selectHostitalAverageScore(hospitalId);
}
@RequestMapping("/selectHostitalByIds")
public Map<String, String> selectHostitalByIds(@RequestParam("ids") List<String> ids) {
return consultResidentHospitalService.listByIdsConvert(ids);
}
}
@@ -0,0 +1,158 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.ConDepartmentApiService;
import com.renkang.consultation.api.service.ConSicksApiService;
import com.renkang.consultation.entity.*;
import com.renkang.consultation.service.IESService;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.util.DictUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description: ES搜索
* @Author: jeecg-boot
* @Date: 2023-05-09
* @Version: V1.0
*/
@RestController
@RequestMapping(RequestPrefix.es)
@Slf4j
public class ESController {
@Autowired
private IESService iesService;
@Autowired
private DictUtil dictUtil;
@Autowired
private ConDepartmentApiService conDepartmentApiService;
@Autowired
private ConSicksApiService conSicksApiService;
@RequestMapping("/importEsResourceEs")
public Result<String> importEsResourceEs() {
iesService.importEsResource();
return Result.OK("导入成功");
}
@RequestMapping("/importEsDepartmentEs")
public Result<String> importEsDepartmentEs() {
iesService.importEsDepartment();
return Result.OK("导入成功");
}
@RequestMapping("/importEsDoctorEs")
public Result<String> importEsDoctorEs() {
iesService.importEsDoctor();
return Result.OK("导入成功");
}
@RequestMapping("/importEsSicksEs")
public Result<String> importEsSicksEs() {
iesService.importEsSicks();
return Result.OK("导入成功");
}
@Operation(summary = "医院搜索")
@RequestMapping("/searchConResource")
public Result<List<ConResourceDO>> searchConResource(@RequestParam(name = "search", required = false) String search, @RequestParam Integer pageNumber, @RequestParam Integer pageSize) {
List<ConResourceDO> conResourceList = iesService.searchConResource(search, pageNumber, pageSize);
return Result.OK(conResourceList);
}
@Operation(summary = "全部医院列表")
@RequestMapping("/searchConResourceAll")
public Result<List<ConResource>> searchConResourceAll(@RequestParam Integer pageNumber, @RequestParam Integer pageSize) {
List<ConResource> conResourceList = iesService.searchConResourceAll(pageNumber, pageSize);
return Result.OK(conResourceList);
}
@Operation(summary = "医生搜素")
@RequestMapping("/searchConDoctor")
public Result<List<ConDoctorDO>> searchConDoctor(@RequestParam(name = "search", required = false) String search, @RequestParam Integer pageNumber, @RequestParam Integer pageSize) {
List<ConDoctorDO> conDoctorList = iesService.searchConDoctor(search, pageNumber, pageSize);
return Result.OK(conDoctorList);
}
@Operation(summary = "科室搜索")
@RequestMapping("/searchConDepartment")
public Result<List<ConDepartmentDO>> searchConDepartment(@RequestParam(name = "search", required = false) String search, @RequestParam Integer pageNumber, @RequestParam Integer pageSize) {
List<ConDepartmentDO> conDepartmentList = iesService.searchConDepartment(search, pageNumber, pageSize);
return Result.OK(conDepartmentList);
}
@Operation(summary = "全部科室列表")
@RequestMapping("/searchConDepartmentAll")
public Result<List<ConDepartment>> searchConDepartmentAll(@RequestParam Integer pageNumber, @RequestParam Integer pageSize) {
List<ConDepartment> conDepartmentList = iesService.searchConDepartmentAll(pageNumber, pageSize);
return Result.OK(conDepartmentList);
}
@Operation(summary = "疾病搜索")
@RequestMapping("/searchconSicksList")
public Result<List<ConSicksDO>> searchconSicksList(@RequestParam(name = "search", required = false) String search, @RequestParam Integer pageNumber, @RequestParam Integer pageSize) {
List<ConSicksDO> conSicksList = iesService.searchConSicks(search, pageNumber, pageSize);
return Result.OK(conSicksList);
}
@Operation(summary = "全部疾病列表")
@RequestMapping("/searchconSicksAll")
public Result<List<ConSicks>> searchconSicksAll(@RequestParam Integer pageNumber, @RequestParam Integer pageSize) {
List<ConSicks> conSicksList = iesService.searchConSicksAll(pageNumber, pageSize);
return Result.OK(conSicksList);
}
@Operation(summary = "搜索综合")
@RequestMapping("/searchComprehensive")
public Result<Map<String, Object>> searchComprehensive(@RequestParam(name = "search", required = false) String search) {
List<ConResourceDO> conResourceList = iesService.searchConResource(search, 1, 2);
List<ConDepartmentDO> conDepartmentList = iesService.searchConDepartmentNew(search);
List<ConDoctorDO> conDoctorList = iesService.searchConDoctor(search, 1, 2);
List<ConSicksDO> conSicksList = iesService.searchConSicksNew(search);
Map hashMap = new HashMap<>();
hashMap.put("hospitalList", conResourceList);
hashMap.put("DepartmentList", conDepartmentList);
hashMap.put("DoctorList", conDoctorList);
hashMap.put("SicksList", conSicksList);
return Result.OK(hashMap);
}
@Operation(summary = "搜索首页")
@RequestMapping("/searchFirstpage")
public Result<Map> searchFirstpage() {
List<ConResource> conResourceList = iesService.searchConResourceAll(0, 2);
List<ConDepartment> conDepartmentList = conDepartmentApiService.selectIntrduceDepartmentList();
List<ConSicks> conSicksList = conSicksApiService.selectSickByTopAndHaveDoctor();
Map hashMap = new HashMap<>();
hashMap.put("hospitalList", conResourceList);
hashMap.put("DepartmentList", conDepartmentList);
hashMap.put("SicksList", conSicksList);
hashMap.put("hospitalCount", iesService.searchCountResource());
hashMap.put("DepartmentCount", iesService.searchCountDepartment());
hashMap.put("SicksCount", iesService.searchCountSicks());
return Result.OK(hashMap);
}
@Operation(summary = "找医院")
@RequestMapping("/findHospital")
public Result<?> findHospital(@RequestParam(name = "search", required = false) String search) {
return Result.ok(iesService.findHospital(search));
}
}
@@ -0,0 +1,40 @@
package com.renkang.consultation.api.controller;
import com.renkang.consultation.api.RequestPrefix;
import com.renkang.consultation.api.service.MsgRecordApiService;
import com.renkang.consultation.entity.MsgRecord;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(RequestPrefix.msgRecord)
public class MsgRecordApiController {
@Autowired
private MsgRecordApiService msgRecordApiService;
@Operation(summary = "消息列表", description = "消息列表")
@PostMapping("/selectMsgRecordList")
public Result<List<MsgRecord>> selectMsgRecordList(@RequestParam(value = "userId", required = false) String userId,
@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
return msgRecordApiService.selectMsgRecordList(userId, pageNo, pageSize);
}
/**
* 校验token失效
*
* @param token
* @return
*/
@Operation(summary = "校验token失效", description = "校验token失效")
@GetMapping("/selectTokenExpire")
public Result<Boolean> selectTokenExpire(@RequestParam(value = "token", required = true) String token) {
return msgRecordApiService.selectTokenExpire(token);
}
}
@@ -0,0 +1,46 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConDepartment;
import com.renkang.consultation.entity.ConDepartmentDO;
import org.jeecg.common.api.vo.Result;
import java.util.List;
import java.util.Map;
public interface ConDepartmentApiService {
Result<List<ConDepartmentDO>> selectDepartList(String parentId);
Result<List<ConDepartmentDO>> searchDepartList(String name);
Result<Map<String, Object>> selectDepartListNew(String parentId);
Result<Map<String, Object>> selectDepartListSick(String parentId);
List<ConDepartment> selectIntrduceDepartmentList();
Result<Map<String, Object>> selectDepartListVersionThree(String parentId);
Result<List<ConDepartmentDO>> selectDepartListSickVersionTwo();
Result<List<ConDepartmentDO>> selectDepartListByHospitalId(String parentId);
void timeAndInitDepartDoctorNum();
void timeAndInitDepartSickDoctorNum();
void timeAndInitHospitalDoctorNum();
void timeAndInitHospitalDoctorNumLevelTwo();
Result<Map<String,Object>> selectDepartListByHospitalIdVersionTwo(String hospitalId, String departmentId);
Result<Map<String, Object>> runDepartmentData();
public Result<String> runDepartmentDoctorDate();
Result<String> runDepartmentSickData();
}
@@ -0,0 +1,36 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.dto.ConDoctorSearchDTO;
import com.renkang.consultation.entity.ConDoctorDO;
import com.renkang.consultation.vo.SimpleDoctorVo;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.DictModel;
import java.util.List;
import java.util.Map;
public interface ConDoctorApiService {
Result<ConDoctorDO> selectDoctorInfoAndSchedule(String doctorId);
Result<Map<String, Object>> selectDoctorInfoAndJudgement(String doctorId);
Result<Map<String, String>> selectDoctorAverageScore(String doctorId);
Result<List<ConDoctorDO>> selectDoctorByHospitalId(String hospitalId, int pageNo, int pageSize);
Result<Map<String, Object>> selectDoctorRecommend();
Result<List<DictModel>> selectDictList(String dictKey);
Result<List<ConDoctorDO>> selectDictListByNHDS(String doctorName, String hispitalId, String departmentId, String sickId, String tfSort, int pageNo, int pageSize);
List<Map<String, String>> selectSickName(String sickIds);
Result<List<ConDoctorDO>> selectDictListBySickAndDepartment(ConDoctorSearchDTO conDoctorSearchDTO);
Result<Map<String, Object>> selectDoctorRecommendNew(int pageNo, int pageSize);
Result<Map<String, Object>> listDoctorInterveneHomeV2(int pageNo, int pageSize);
List<SimpleDoctorVo> listDoctorInterveneHome(int pageNo, int pageSize);
}
@@ -0,0 +1,9 @@
package com.renkang.consultation.api.service;
import org.jeecg.common.api.vo.Result;
public interface ConDoctorFollowApiService {
Result<String> followOrCancelDoctor(String doctorId);
Result<String> cancelDoctor(String doctorId);
}
@@ -0,0 +1,20 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConDoctorSchedulingDO;
import com.renkang.consultation.entity.ConDoctorSchedulingListDO;
import org.jeecg.common.api.vo.Result;
import java.util.Map;
public interface ConDoctorSchedulingApiService {
Result<String> insertDoctorScheduling(ConDoctorSchedulingListDO conDoctorSchedulingListDO);
Result<Map<String, Object>> selectDoctorScheduling();
Result<String> insertDoctorSchedulingSingle(ConDoctorSchedulingDO conDoctorSchedulingDO);
Result<String> insertDoctorSchedulingRunData();
Result<String> initDoctorSchedulingData();
}
@@ -0,0 +1,10 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConDoctorSchedulingDateListDO;
import org.jeecg.common.api.vo.Result;
import java.util.List;
public interface ConDoctorSchedulingDateApiService {
Result<List<ConDoctorSchedulingDateListDO>> selectSchedulingDateListByDoctorId(String doctorId);
}
@@ -0,0 +1,15 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConEvaluate;
import com.renkang.consultation.entity.ConEvaluateDO;
import org.jeecg.common.api.vo.Result;
import java.util.List;
public interface ConEvaluateApiService {
Result<String> insertConEvaluate(ConEvaluate conEvaluate);
Result<List<ConEvaluateDO>> selectConEvaluateList(String doctorId, int pageNo, int pageSize);
Result<List<ConEvaluateDO>> selectConEvaluateListByHospitalId(String hospitalId, int pageNo, int pageSize);
}
@@ -0,0 +1,23 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConFamilyMembersAndMedicalRecordsDO;
import com.renkang.consultation.entity.ConFamilyMembersDO;
import com.renkang.emergency.bean.request.SingleParam;
import org.jeecg.common.api.vo.Result;
import java.util.List;
public interface ConFamilyMembersApiService {
Result<String> insertFamilyMembers(ConFamilyMembersDO conFamilyMembersDO);
Result<String> updateFamilyMembers(ConFamilyMembersDO conFamilyMembersDO);
Result<List<ConFamilyMembersAndMedicalRecordsDO>> selectMenberList(int pageNo, int pageSize);
Result<ConFamilyMembersDO> selectMenberById(String id);
Result<String> removeMemberById(SingleParam<List<String>> ids);
Result<List<ConFamilyMembersAndMedicalRecordsDO>> selectMenberOnlyList(int pageNo, int pageSize);
}
@@ -0,0 +1,17 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConHealthInfoAnswerListDO;
import com.renkang.consultation.entity.ConHealthInfoAnswerSingleDO;
import org.jeecg.common.api.vo.Result;
import java.util.List;
public interface ConHealthInfoApiService {
Result<List<Object>> selectHealthInfo(String memberId);
Result<String> inserOrUpdatetHealthInfoAnswer(ConHealthInfoAnswerListDO conHealthInfoListDO);
Result<String> removeHealthInfo(String memberId);
Result<List<ConHealthInfoAnswerSingleDO>> selectHealthInfoDoctor(String memberId);
}
@@ -0,0 +1,12 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.vo.ConHelperCustomUserVO;
import org.jeecg.common.api.vo.Result;
public interface ConHelperApiService {
Result<String> selectHelperInfo();
Result<ConHelperCustomUserVO> selectHelperInfoDesc(String helpId);
Result<Boolean> selectTfHelper(String helpId);
}
@@ -0,0 +1,10 @@
package com.renkang.consultation.api.service;
import org.jeecg.common.api.vo.Result;
public interface ConHospitalFollowApiService {
Result<String> followOrCancelHospital(String hospitalId);
Result<String> cancelHospital(String hospitalId);
}
@@ -0,0 +1,18 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConKnowledgeDO;
import com.renkang.consultation.entity.ConKnowledgeListDO;
import org.jeecg.common.api.vo.Result;
import java.util.List;
public interface ConKnowledgeApiService {
Result<List<ConKnowledgeListDO>> selectKnowledgeRecommendList(int pageNo, int pageSize);
Result<List<ConKnowledgeListDO>> selectKnowledgeListByClass(int pageNo, int pageSize, String classId);
Result<ConKnowledgeDO> selectKnowledgeById(String id);
Result<List<ConKnowledgeListDO>> searchKnowledgeList(String title, int pageNo, int pageSize);
}
@@ -0,0 +1,11 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConKnowledgeCategoryDO;
import org.jeecg.common.api.vo.Result;
import java.util.List;
public interface ConKnowledgeCategoryApiService {
Result<List<ConKnowledgeCategoryDO>> selectKnowledgeCategory();
}
@@ -0,0 +1,18 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConMedicalRecordsDO;
import com.renkang.consultation.entity.ConMedicalRecordsListDO;
import org.jeecg.common.api.vo.Result;
import java.util.List;
import java.util.Map;
public interface ConMedicalRecordsApiService {
Result<String> insertConMedicalRecords(ConMedicalRecordsDO conMedicalRecordsDO);
Result<ConMedicalRecordsDO> selectConMedicalRecordsById(String id);
Result<Map<String, Object>> selectConMedicalRecordsByIdDoctor(String id);
Result<List<ConMedicalRecordsListDO>> selectConMedicalRecordsByMemberId(String memberId);
}
@@ -0,0 +1,13 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.dto.NoticeOnOrOff;
import com.renkang.consultation.entity.ConNoticeDO;
import org.jeecg.common.api.vo.Result;
public interface ConNoticeApiService {
Result<ConNoticeDO> selectUserNotice(String type);
Result<String> chooseToDontShowUp(String id, String notShow);
void on(NoticeOnOrOff notice);
}
@@ -0,0 +1,18 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConResourceDO;
import org.jeecg.common.api.vo.Result;
import java.util.Map;
public interface ConResourceApiService {
Result<ConResourceDO> hospitalDetail(String id);
Result<Map<String, String>> selectHostitalAverageScore(String hospitalId);
Result<Map<String, Object>> selectHospitalList();
Result<Map<String, Object>> testData();
Result<Map<String, Object>> selectHospitalListVersionTwo();
}
@@ -0,0 +1,11 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConService;
/**
* @author Junqiang Zhu
* @date 2023-06-06 10:22
*/
public interface ConServiceApiService {
void add(ConService conService);
}
@@ -0,0 +1,118 @@
package com.renkang.consultation.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.renkang.consultation.bean.SessionUserFilter;
import com.renkang.consultation.bean.UserSessionCount;
import com.renkang.consultation.entity.ConSessionDO;
import com.renkang.consultation.entity.ConSessionPictureTextDO;
import com.renkang.consultation.entity.ListImIds;
import com.renkang.im.entity.ImMsgRecordAll;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.DictModel;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface ConSessionApiService {
Result<String> insertTelephoneSession(ConSessionDO conSessionDO);
Result<Map<String, Object>> sessionDetail(String id);
Result<String> cancelSession(String id);
Result<List<ConSessionDO>> selectSessionListByDoctorId(int pageNo, int pageSize, String type, String status);
Result<Map<String, Object>> sessionDetailDoctor(String id);
Result<List<ConSessionDO>> sessionDetailDoctorSearch(String memberName, int pageNo, int pageSize);
Result<String> sessionReject(String id, String rejectReason, String reasonType);
Result<String> sessionConfirm(String id, long startTime, long endTime);
Result<String> finishSession(String id);
Result<List<DictModel>> selectRejectReason();
Result<Map<String, Object>> sessionDetailDoctorFinish(String id);
Result<Map<String, Object>> sessionDetailDoctorStart(String id);
Result<Map<String, Object>> sessionDetailDoctorAll(String id);
Result<List<ConSessionDO>> selectSessionByImId(ListImIds list);
Result<String> selectSessionVideoUnByDoctorId();
Result<String> selectSessionVideoExistDoctor(Long startTime, Long endTime);
Result<List<ConSessionDO>> selectSessionListByUserId(int pageNo, int pageSize, String type, String status);
Result<Map<String, Object>> insertPictureTextSession(ConSessionPictureTextDO conSessionPictureTextDO);
Result<String> endPictureTextSession(String id);
Result<String> sessioningNum();
Result<String> startPictureTextSession(String id, String fromAccount);
void sessionSendMessageExpire();
Result<Map<String, Object>> insertProfessorAndHelperSession();
Result<Map<String, Object>> insertUserAndHelperSession();
Result<List<ConSessionDO>> selectSessionListPictureByUserId(ListImIds list);
Result<String> startPictureTextSessionHelper(String fromAccount, String toAccount);
Result<List<ConSessionDO>> selectSessionListByUserIdVersionTwo(int pageNo, int pageSize, String type, String status);
Result<Map<String, String>> selectSessionProfessorIng();
Result<String> insertProfessorAndHelperSessionShow();
Result<String> endUserAndProfessiorHelper(String expireHour);
Result<String> doctorStopSession(Date stopStartTime, Date stopEndTime);
Result<List<ConSessionDO>> selectSessionListByUserIdVersionThree(int pageNo, int pageSize, String type, String status);
Result<List<ConSessionDO>> selectSessionByImIdNew(ListImIds list);
Result<ConSessionDO> selectSessionListByGroupId(String imId);
Result<List<ConSessionDO>> sekectSessionListByDate();
Result<Map<String, String>> selectSessionProfessorIngNew();
Result<List<ConSessionDO>> selectSessionListByDoctorIdNew(int pageNo, int pageSize, String type, String status);
Result<List<ConSessionDO>> selectSessionByImIdNewNew(ListImIds list);
Result<List<ImMsgRecordAll>> selectImMessagePageListSession(String groupId, int pageNo, int pageSize);
Result<List<ConSessionDO>> selectSessionByImIdNewNewAnother(ListImIds list);
Result<List<ConSessionDO>> selectSessionListByDoctorIdNewAnother(int pageNo, int pageSize, String type, String status);
Result<Map<String, String>> selectSessionProfessorIngNewAnother();
Result<List<ConSessionDO>> selectSessionListByDoctorIdUnit(int pageNo, int pageSize);
Result<List<ConSessionDO>> selectSessionListByDoctorIdHelper(int pageNo, int pageSize);
Result<Integer> selectDoctorCardExpireTime(Long sendTime);
Result<Map<String, Object>> insertUserAndHelperSessionNew();
IPage<ConSessionDO> listForUser(SessionUserFilter filter);
UserSessionCount countForUser();
}
@@ -0,0 +1,9 @@
package com.renkang.consultation.api.service;
import org.jeecg.common.api.vo.Result;
public interface ConSessionReservationApiService {
Result<String> sessionReservationDate(String id, String type, String startTime, String endTime);
Result<String> endPhone(String id);
}
@@ -0,0 +1,11 @@
package com.renkang.consultation.api.service;
import org.jeecg.common.api.vo.Result;
import java.util.Map;
public interface ConSessionVideoInfoApiService {
Result<Map<String, Object>> startVideoSession(String sessionId);
Result<String> endVideoSession(String sessionVideoId);
}
@@ -0,0 +1,25 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConSicks;
import com.renkang.consultation.entity.ConSicksDO;
import org.jeecg.common.api.vo.Result;
import java.util.List;
import java.util.Map;
public interface ConSicksApiService {
/**
* 根据科室list查询疾病
*
* @param departmentId 科室id
* @return
*/
Result<List<ConSicksDO>> selectSickListByDepartmentId(String departmentId);
List<ConSicks> selectSickByTopAndHaveDoctor();
Result<Map<String, Object>> selectSickListByDepartmentIdNew(String departmentId);
public Result<List<ConSicksDO>> selectSickListByDepartmentIdDoctorSearch(String departmentId);
}
@@ -0,0 +1,12 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.ConsultResidentHospitalDO;
import org.jeecg.common.api.vo.Result;
import java.util.Map;
public interface ConsultResidentHospitalApiService {
Result<ConsultResidentHospitalDO> hospitalDetail(String id);
Result<Map<String, String>> selectHostitalAverageScore(String hospitalId);
}
@@ -0,0 +1,14 @@
package com.renkang.consultation.api.service;
import com.renkang.consultation.entity.MsgRecord;
import org.jeecg.common.api.vo.Result;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public interface MsgRecordApiService {
Result<List<MsgRecord>> selectMsgRecordList(String usetId, int pageNo, int pageSize);
Result<Boolean> selectTokenExpire(String token);
}
@@ -0,0 +1,534 @@
package com.renkang.consultation.api.service.impl;
import com.alibaba.druid.util.StringUtils;
import com.renkang.consultation.api.service.ConDepartmentApiService;
import com.renkang.consultation.entity.*;
import com.renkang.consultation.mapper.ConDepartmentMapper;
import com.renkang.consultation.mapper.ConDoctorMapper;
import com.renkang.consultation.mapper.ConResourceMapper;
import com.renkang.consultation.mapper.ConSicksMapper;
import com.xkcoding.http.util.StringUtil;
import org.checkerframework.checker.units.qual.A;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.RedisUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
@Service("conDepartmentApiService")
public class ConDepartmentApiServiceImpl implements ConDepartmentApiService {
@Autowired
private ConDepartmentMapper conDepartmentMapper;
@Autowired
private ConDoctorMapper conDoctorMapper;
@Autowired
private ConSicksMapper conSicksMapper;
@Autowired
private RedisUtil redisUtil;
@Autowired
private ConResourceMapper conResourceMapper;
@Override
public Result<List<ConDepartmentDO>> selectDepartList(String parentId) {
List<ConDepartmentDO> list = conDepartmentMapper.selectDepartmentNameByParentId(parentId, null);
list.forEach(x -> {
int i = conDoctorMapper.selectDoctorByDepartmentId(x.getId());
x.setDoctorNum(i);
int secondDepartNum = conDepartmentMapper.selectSecondDepartMentNum(x.getId());
x.setSecondDepartmentNum(secondDepartNum);
String departmentId = x.getId();
String levelTwoDepartment = conDepartmentMapper.selectDepartmentIdByLevelOneId(x.getId());
if (!com.aliyuncs.utils.StringUtils.isEmpty(levelTwoDepartment)) {
departmentId = departmentId + "," + levelTwoDepartment;
}
int sickNun = conSicksMapper.selectSickNumByDepartment(departmentId);
x.setSickNum(sickNun);
});
return Result.ok(list);
}
@Override
public Result<List<ConDepartmentDO>> searchDepartList(String name) {
List<ConDepartmentDO> list = conDepartmentMapper.selectDepartmentNameByParentId("0", name);
list.forEach(x -> {
int i = conDoctorMapper.selectDoctorByDepartmentId(x.getId());
x.setDoctorNum(i);
int secondDepartNum = conDepartmentMapper.selectSecondDepartMentNum(x.getId());
x.setSecondDepartmentNum(secondDepartNum);
int sickNun = conSicksMapper.selectSickNumByDepartmentId(x.getId());
x.setSickNum(sickNun);
});
return Result.ok(list);
}
@Override
public Result<Map<String, Object>> selectDepartListNew(String parentId) {
List<ConDepartmentDO> list = conDepartmentMapper.selectDepartmentNameByParentId(parentId, null);
int allDoctor = 0;
List<ConDepartmentDO> listNew = new ArrayList<>();
for (ConDepartmentDO conDepartmentDO : list) {
int i = conDoctorMapper.selectDoctorByDepartmentId(conDepartmentDO.getId());
conDepartmentDO.setDoctorNum(i);
allDoctor = allDoctor + i;
int secondDepartNum = conDepartmentMapper.selectSecondDepartMentNum(conDepartmentDO.getId());
conDepartmentDO.setSecondDepartmentNum(secondDepartNum);
String departmentId = conDepartmentDO.getId();
String levelTwoDepartment = conDepartmentMapper.selectDepartmentIdByLevelOneId(conDepartmentDO.getId());
if (!com.aliyuncs.utils.StringUtils.isEmpty(levelTwoDepartment)) {
departmentId = departmentId + "," + levelTwoDepartment;
}
int sickNun = conSicksMapper.selectSickNumByDepartment(departmentId);
conDepartmentDO.setSickNum(sickNun);
if(StringUtils.equals("0",parentId) && secondDepartNum > 0){
listNew.add(conDepartmentDO);
}
if(!StringUtils.equals("0",parentId) && i > 0){
listNew.add(conDepartmentDO);
}
}
if(StringUtil.isNotEmpty(parentId)){
int doctorNum = conDoctorMapper.selectDoctorByDepartmentId(parentId);
allDoctor = allDoctor + doctorNum;
}
Map<String,Object> map = new HashMap<>();
map.put("list",listNew);
map.put("doctorNum",allDoctor);
return Result.ok(map);
}
@Override
public Result<Map<String, Object>> selectDepartListSick(String parentId) {
List<ConDepartmentDO> list = conDepartmentMapper.selectDepartmentNameByParentId(parentId, null);
int allDoctor = 0;
List<ConDepartmentDO> listNew = new ArrayList<>();
for (ConDepartmentDO conDepartmentDO : list) {
int i = conDoctorMapper.selectDoctorByDepartmentId(conDepartmentDO.getId());
conDepartmentDO.setDoctorNum(i);
allDoctor = allDoctor + i;
int secondDepartNum = conDepartmentMapper.selectSecondDepartMentNum(conDepartmentDO.getId());
conDepartmentDO.setSecondDepartmentNum(secondDepartNum);
String departmentId = conDepartmentDO.getId();
String levelTwoDepartment = conDepartmentMapper.selectDepartmentIdByLevelOneId(conDepartmentDO.getId());
if (!com.aliyuncs.utils.StringUtils.isEmpty(levelTwoDepartment)) {
departmentId = departmentId + "," + levelTwoDepartment;
}
int sickNun = conSicksMapper.selectSickNumByDepartment(departmentId);
conDepartmentDO.setSickNum(sickNun);
if(sickNun > 0){
listNew.add(conDepartmentDO);
}
}
if(StringUtil.isNotEmpty(parentId)){
int doctorNum = conDoctorMapper.selectDoctorByDepartmentId(parentId);
allDoctor = allDoctor + doctorNum;
}
Map<String,Object> map = new HashMap<>();
map.put("list",listNew);
map.put("doctorNum",allDoctor);
return Result.ok(map);
}
public List<ConDepartment> selectIntrduceDepartmentList(){
String key = "consulation:departmentHaveDoctor:levelOne";
List<Object> list = redisUtil.lGet(key, 0, 7);
List<ConDepartment> departmentList = new ArrayList<>();
for (Object o : list) {
ConDepartmentDO depeartId = (ConDepartmentDO)o;
ConDepartment conDepartment= new ConDepartment();
BeanUtils.copyProperties(depeartId,conDepartment);
departmentList.add(conDepartment);
}
return departmentList;
}
@Override
public Result<Map<String, Object>> selectDepartListVersionThree(String parentId) {
String key = "";
if(StringUtils.equals("0",parentId)){
key = "consulation:departmentHaveDoctor:levelOne";
} else if(StringUtils.equals("1",parentId)){
key = "consulation:departmentHaveDoctor:AllLevelTwo";
}else{
key = "consulation:departmentHaveDoctor:levelTwo:"+parentId;
}
List<Object> redisList = redisUtil.lGet(key,0,-1);
List<ConDepartmentDO> departmentList = new ArrayList<>();
int allDoctor = 0;
for (Object obj : redisList) {
ConDepartmentDO department = (ConDepartmentDO) obj;
departmentList.add(department);
allDoctor = allDoctor + department.getDoctorNum();
}
Map<String,Object> map = new HashMap<>();
map.put("list",departmentList);
map.put("doctorNum",allDoctor);
return Result.ok(map);
}
@Override
public Result<List<ConDepartmentDO>> selectDepartListSickVersionTwo() {
String key = "consulation:departmentSickHaveDoctor:levelOne";
List<Object> redisList = redisUtil.lGet(key,0,-1);
if(CollectionUtils.isEmpty(redisList)){
return Result.ok(Collections.emptyList());
}
List<ConDepartmentDO> departmentList = redisList.stream().filter(obj -> obj instanceof ConDepartmentDO).map(obj -> (ConDepartmentDO) obj).collect(Collectors.toList());
return Result.ok(departmentList);
}
@Override
public Result<List<ConDepartmentDO>> selectDepartListByHospitalId(String parentId) {
List<ConDepartmentDO> list = new ArrayList<>();
if(StringUtils.isEmpty(parentId)){
list = conDepartmentMapper.selectDepartmentNameByParentId("0", null);
}else{
list = conDepartmentMapper.selectHospitalDepartmentId(parentId);
}
List<ConDepartmentDO> newList = new ArrayList<>();
for (ConDepartmentDO conDepartment : list) {
String departmentId = conDepartment.getId();
String levelTwoDepartment = conDepartmentMapper.selectDepartmentIdByLevelOneId(departmentId);
if (!com.aliyuncs.utils.StringUtils.isEmpty(levelTwoDepartment)) {
departmentId = departmentId + "," + levelTwoDepartment;
}
int i = conDoctorMapper.selectDoctorNumByDepartmentId(departmentId);
if(i > 0){
newList.add(conDepartment);
}
}
return Result.OK(newList);
}
@Override
public void timeAndInitDepartDoctorNum(){
List<ConDepartmentDO> list = conDepartmentMapper.selectDepartmentNameByParentId("0",null);
String key = "consulation:departmentHaveDoctor:levelOne";
String childKey = "consulation:departmentHaveDoctor:levelTwo:";
String allChildKey = "consulation:departmentHaveDoctor:AllLevelTwo";
if(!CollectionUtils.isEmpty(list)){
redisUtil.del(key);
redisUtil.del(allChildKey);
for (ConDepartmentDO conDepartmentDO : list) {
redisUtil.del(childKey + conDepartmentDO.getId());
String levelDepartmentId = conDepartmentDO.getId();
List<ConDepartmentDO> levelTwoDepartment = conDepartmentMapper.selectDepartmentIdByLevelOneIdList(levelDepartmentId);
if (!CollectionUtils.isEmpty(levelTwoDepartment)) {
levelDepartmentId = levelDepartmentId + "," + levelTwoDepartment.stream().map(ConDepartmentDO::getId).collect(Collectors.joining(","));
}
int aa = conDoctorMapper.selectDoctorNumByDepartmentId(levelDepartmentId);
conDepartmentDO.setDoctorNum(aa);
if(aa > 0){
redisUtil.lSet(key,conDepartmentDO);
}
for (ConDepartmentDO departmentDO : levelTwoDepartment) {
int childDoctorNum = conDoctorMapper.selectDoctorByDepartmentId(departmentDO.getId());
departmentDO.setDoctorNum(childDoctorNum);
if(childDoctorNum > 0){
redisUtil.lSet(childKey + conDepartmentDO.getId(),departmentDO);
redisUtil.lSet(allChildKey,departmentDO);
}
}
}
}
}
@Override
public void timeAndInitDepartSickDoctorNum(){
String key = "consulation:departmentSickHaveDoctor:levelOne";
String childKey = "consulation:sickHaveDoctor:department:";
String allChildKey = "consulation:sickHaveDoctor:all";
List<ConDepartmentDO> list = conDepartmentMapper.selectDepartmentNameByParentId("0", null);
redisUtil.del(key);
redisUtil.del(allChildKey);
for (ConDepartmentDO conDepartmentDO : list) {
String departmentId = conDepartmentDO.getId();
String levelTwoDepartment = conDepartmentMapper.selectDepartmentIdByLevelOneId(conDepartmentDO.getId());
if (!com.aliyuncs.utils.StringUtils.isEmpty(levelTwoDepartment)) {
departmentId = departmentId + "," + levelTwoDepartment;
}
List<ConSicksDO> sickId = conSicksMapper.selectSickListByDepartment(departmentId);
String doctorNum = "0";
if(!CollectionUtils.isEmpty(sickId)){
doctorNum = conDoctorMapper.selectDictNuMBySickIds(sickId.stream().map(ConSicksDO::getId).collect(Collectors.toList()));
}
if(!CollectionUtils.isEmpty(sickId) && !StringUtils.equals(doctorNum,"0")){
conDepartmentDO.setDoctorNum(Integer.valueOf(doctorNum));
redisUtil.lSet(key,conDepartmentDO);
}
redisUtil.del(childKey + conDepartmentDO.getId());
for (ConSicksDO conSicksDO : sickId) {
int sickDoctorNum = conDoctorMapper.selectDoctorNumBySickId(conSicksDO.getId());
conSicksDO.setDoctorNum(sickDoctorNum);
if(sickDoctorNum > 0){
redisUtil.lSet(childKey + conDepartmentDO.getId(),conSicksDO);
redisUtil.lSet(allChildKey,conSicksDO);
}
}
}
}
@Override
public void timeAndInitHospitalDoctorNum(){
String hospitalKey = "hospital:department:doctorNum:";
List<ConResourceDO> resourceDOList = conResourceMapper.selectHospitalList();
for (ConResourceDO conResourceDO : resourceDOList) {
redisUtil.del(hospitalKey + conResourceDO.getId());
List<ConDepartmentDO> list = conDepartmentMapper.selectHospitalDepartmentId(conResourceDO.getId());
for (ConDepartmentDO conDepartment : list) {
String departmentId = conDepartment.getId();
String levelTwoDepartment = conDepartmentMapper.selectDepartmentIdByLevelOneId(departmentId);
if (!com.aliyuncs.utils.StringUtils.isEmpty(levelTwoDepartment)) {
departmentId = departmentId + "," + levelTwoDepartment;
}
int i = conDoctorMapper.selectDoctorNumByDepartmentIdAndResourceId(departmentId,conResourceDO.getId());
if(i > 0){
redisUtil.lSet(hospitalKey + conResourceDO.getId(),conDepartment);
}
}
}
}
@Override
public void timeAndInitHospitalDoctorNumLevelTwo(){
String hospitalLevelTwo = "hoispital:levelTwo:department:";
String hospitalLevelTwoAll = "hoispital:levelTwo:allDepartment:";
List<ConResourceDO> resourceDOList = conResourceMapper.selectHospitalList();
String hospitalKey = "hospital:department:doctorNum:";
for (ConResourceDO conResourceDO : resourceDOList) {
redisUtil.del(hospitalLevelTwoAll + conResourceDO.getId());
List<Object> twoDepartment = redisUtil.lGet(hospitalKey + conResourceDO.getId(),0,-1);
for (Object o : twoDepartment) {
ConDepartmentDO department = (ConDepartmentDO) o;
List<ConDepartmentDO> departmentList = conDepartmentMapper.selectDepartmentIdByLevelOneIdList(department.getId());
redisUtil.del(hospitalLevelTwo + conResourceDO.getId() +":"+department.getId());
for (ConDepartmentDO conDepartmentDO : departmentList) {
int doctorNum = conDoctorMapper.selectDoctorByDepartmentIdAndResourceId(conDepartmentDO.getId(),conResourceDO.getId());
if(doctorNum> 0){
redisUtil.lSet(hospitalLevelTwo + conResourceDO.getId() +":"+department.getId(),conDepartmentDO);
redisUtil.lSet(hospitalLevelTwoAll + conResourceDO.getId(),conDepartmentDO);
}
}
}
}
}
@Override
public Result<Map<String,Object>> selectDepartListByHospitalIdVersionTwo(String hospitalId, String departmentId) {
if(StringUtils.isEmpty(hospitalId)){
return this.selectDepartListByHospitalIdJudgmentNotHaveHospital(departmentId);
}else{
return this.selectDepartListByHospitalIdJudgmentHaveHospital(hospitalId,departmentId);
}
}
public Result<Map<String,Object>> selectDepartListByHospitalIdJudgmentHaveHospital(String hospitalId, String departmentId){
Map<String,Object> map = new HashMap<>();
map.put("list",Collections.emptyList());
map.put("doctorNum","0");
String key = "";
if(org.springframework.util.StringUtils.pathEquals(departmentId,"0")){
//医院底下的所有一级科室
key = "hospital:department:doctorNum:"+hospitalId;
}else if(org.springframework.util.StringUtils.pathEquals(departmentId,"1")){
//医院底下所有的二级科室
key = "hoispital:levelTwo:allDepartment:"+hospitalId;
}else{
key = "hoispital:levelTwo:department:" + hospitalId +":"+ departmentId;
}
if(!org.springframework.util.StringUtils.hasLength(key)){
return Result.ok(map);
}
List<Object> redisList = redisUtil.lGet(key,0,-1);
if(CollectionUtils.isEmpty(redisList)){
return Result.ok(map);
}
List<ConDepartmentDO> departmentList = redisList.stream().filter(obj -> obj instanceof ConDepartmentDO).map(obj -> (ConDepartmentDO) obj).collect(Collectors.toList());
map.put("list",departmentList);
return Result.ok(map);
}
public Result<Map<String,Object>> selectDepartListByHospitalIdJudgmentNotHaveHospital(String departmentId){
String key = "";
if(StringUtils.equals("0",departmentId)){
key = "consulation:departmentHaveDoctor:levelOne";
} else if(StringUtils.equals("1",departmentId)){
key = "consulation:departmentHaveDoctor:AllLevelTwo";
}else{
key = "consulation:departmentHaveDoctor:levelTwo:"+departmentId;
}
List<Object> redisList = redisUtil.lGet(key,0,-1);
List<ConDepartmentDO> departmentList = new ArrayList<>();
int allDoctor = 0;
for (Object obj : redisList) {
ConDepartmentDO department = (ConDepartmentDO) obj;
departmentList.add(department);
allDoctor = allDoctor + department.getDoctorNum();
}
Map<String,Object> map = new HashMap<>();
map.put("list",departmentList);
map.put("doctorNum",allDoctor);
return Result.ok(map);
}
@Override
public Result<Map<String, Object>> runDepartmentData() {
List<ConDepartment> list = conDepartmentMapper.selectDepartmentListAll();
for (ConDepartment conDepartment : list) {
String departmentName = conDepartment.getDepartmentName()+"全科";
ConDepartment conDepartmentNew = new ConDepartment();
conDepartmentNew.setDepartmentName(departmentName);
conDepartmentNew.setOfficeLevel("2");
conDepartmentNew.setOfficeparid(conDepartment.getId());
conDepartmentNew.setTfTop(1);
conDepartmentNew.setSort(0);
conDepartmentMapper.insert(conDepartmentNew);
}
return null;
}
public Result<String> runDepartmentDoctorDate(){
List<ConDoctor> list = conDoctorMapper.selectDoctorByResourceIdAll();
for (ConDoctor conDoctor : list) {
String departmentId = conDoctor.getDepartmentId();
ConDepartment conDepartment = conDepartmentMapper.selectDepartmentNameById(departmentId);
if(conDepartment == null){
continue;
}
String departmentName = conDepartment.getDepartmentName()+"全科";
ConDepartment conDepartmentNew = conDepartmentMapper.selectDepartmentNameByName(departmentName);
if(conDepartmentNew == null){
continue;
}
conDoctor.setDepartmentId(conDepartmentNew.getId());
conDoctor.setDepartmentName(conDepartmentNew.getDepartmentName());
conDoctorMapper.updateById(conDoctor);
}
return Result.OK();
}
@Override
public Result<String> runDepartmentSickData() {
List<ConDepartment> list = conDepartmentMapper.selectDepartmentListAll();
for (ConDepartment conDepartment : list) {
String departmentName = conDepartment.getDepartmentName()+"全科";
ConDepartment conDepartmentNew = conDepartmentMapper.selectDepartmentNameByName(departmentName);
if(conDepartmentNew == null){
continue;
}
conSicksMapper.updateSickDepartmentId(conDepartmentNew.getId(),conDepartment.getId());
}
return Result.OK();
}
}
@@ -0,0 +1,617 @@
package com.renkang.consultation.api.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.aliyuncs.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.renkang.consultation.api.service.ConDoctorApiService;
import com.renkang.consultation.api.storge.redis.ConDoctorFollowReidsTunnel;
import com.renkang.consultation.dto.ConDoctorSearchDTO;
import com.renkang.consultation.entity.*;
import com.renkang.consultation.mapper.*;
import com.renkang.consultation.util.TempUtil;
import com.renkang.consultation.vo.SimpleDoctorVo;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.util.DictUtil;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.RedisUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@Service("conDoctorApiService")
public class ConDoctorApiServiceImpl implements ConDoctorApiService {
@Autowired
private ConDoctorMapper conDoctorMapper;
@Autowired
private DictUtil dictUtil;
@Autowired
private ConDepartmentMapper conDepartmentMapper;
@Autowired
private ConDoctorFollowReidsTunnel conDoctorFollowReidsTunnel;
@Autowired
private ConEvaluateMapper conEvaluateMapper;
@Autowired
private ConSessionMapper conSessionMapper;
@Autowired
private ConDoctorFollowMapper conDoctorFollowMapper;
@Autowired
private ConResourceMapper conResourceMapper;
@Autowired
private ConSicksMapper conSicksMapper;
@Autowired
private RedisUtil redisUtil;
@Override
public Result<ConDoctorDO> selectDoctorInfoAndSchedule(String doctorId) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ConDoctor conDoctor = conDoctorMapper.selectDoctorDetailById(doctorId);
if (conDoctor == null) {
return Result.error("查询失败");
}
ConDoctorDO conDoctorDO = BeanUtil.copyProperties(conDoctor, ConDoctorDO.class);
Double tfFollow = conDoctorFollowReidsTunnel.tfFollowDoctor(sysUser.getId(), doctorId);
conDoctorDO.setTfFollow("0");
if (tfFollow != null) {
conDoctorDO.setTfFollow("1");
}
String doctorTitle = dictUtil.queryDictItemListByCodeAndType("z_doct_lev", conDoctor.getDoctorTitle());
conDoctorDO.setDoctorTitle(doctorTitle);
ConDepartment conDepartment = conDepartmentMapper.selectDepartmentNameById(conDoctor.getDepartmentId());
if (conDepartment != null) {
conDoctorDO.setDepartmentName(conDepartment.getDepartmentName());
}
ConResource conResource = conResourceMapper.selectById(conDoctorDO.getResourceId());
if (conResource != null) {
String level = dictUtil.queryDictItemListByCodeAndType("hospital_level", conResource.getLevel());
conDoctorDO.setHospitalLevel(level);
conDoctorDO.setResourceName(conResource.getResourceName());
}
if (!StringUtils.isEmpty(conDoctor.getGoodAtSickness())) {
conDoctorDO.setGoodAtSicknessName(conDoctorMapper.selectSickName(conDoctor.getGoodAtSickness()));
}
String a = averageJudgment(doctorId, new BigDecimal(conDoctor.getUserScore()), new BigDecimal(conDoctor.getUserScoreNum()));
String b = new BigDecimal(averageReply(doctorId, new BigDecimal(conDoctor.getReplyNum()), new BigDecimal(conDoctor.getMessageNum()))).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_DOWN).toPlainString();
String c = averageHeat(doctorId, new BigDecimal(conDoctor.getUserScoreNum()), new BigDecimal(conDoctor.getReplyNum()), new BigDecimal(conDoctor.getMessageNum()));
conDoctorDO.setOverallMerit(a);
conDoctorDO.setResponseRate(b);
conDoctorDO.setDegreeHeat(c);
return Result.OK(conDoctorDO);
}
@Override
public Result<Map<String, Object>> selectDoctorInfoAndJudgement(String doctorId) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ConDoctorDO conDoctor = conDoctorMapper.selectDoctorInfoById(doctorId);
if (conDoctor == null) {
return Result.error("查询失败");
}
Double tfFollow = conDoctorFollowReidsTunnel.tfFollowDoctor(sysUser.getId(), doctorId);
conDoctor.setTfFollow("0");
if (tfFollow != null) {
conDoctor.setTfFollow("1");
}
String doctorTitle = dictUtil.queryDictItemListByCodeAndType("z_doct_lev", conDoctor.getDoctorTitle());
conDoctor.setDoctorTitle(doctorTitle);
ConDepartment conDepartment = conDepartmentMapper.selectDepartmentNameById(conDoctor.getDepartmentId());
if (conDepartment != null) {
conDoctor.setDepartmentName(conDepartment.getDepartmentName());
}
ConResource conResource = conResourceMapper.selectById(conDoctor.getResourceId());
if (conResource != null) {
String level = dictUtil.queryDictItemListByCodeAndType("hospital_level", conResource.getLevel());
conDoctor.setHospitalLevel(level);
conDoctor.setResourceName(conResource.getResourceName());
}
if (!StringUtils.isEmpty(conDoctor.getGoodAtSickness())) {
conDoctor.setGoodAtSicknessName(conDoctorMapper.selectSickName(conDoctor.getGoodAtSickness()));
}
List<ConEvaluateDO> list = conEvaluateMapper.selectDoctorJudgmentById(doctorId);
Map<String, Object> map = new HashMap<>();
map.put("conDoctor", conDoctor);
map.put("conEvaluateList", list);
return Result.OK(map);
}
@Override
public Result<Map<String, String>> selectDoctorAverageScore(String doctorId) {
Map<String, String> map = new HashMap<>();
ConDoctor conDoctor = conDoctorMapper.selectDoctorDetailById(doctorId);
if (conDoctor == null) {
return Result.error("医生不存在,请确认后重新查询");
}
BigDecimal userScore = new BigDecimal(conDoctor.getUserScore());
BigDecimal userScoreNum = new BigDecimal(conDoctor.getUserScoreNum());
map.put("score", "0");
if (userScoreNum.compareTo(new BigDecimal(0)) > 0) {
String score = userScore.divide(userScoreNum, 2, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_HALF_DOWN).toPlainString();
map.put("score", score);
}
map.put("userScoreNum", conEvaluateMapper.selectDoctorEvNum(doctorId));
return Result.ok(map);
}
@Override
public Result<List<ConDoctorDO>> selectDoctorByHospitalId(String hospitalId, int pageNo, int pageSize) {
if (StringUtils.isEmpty(hospitalId)) {
return Result.error("请选择医院");
}
com.baomidou.mybatisplus.extension.plugins.pagination.Page<ConDoctor> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<ConDoctor>(pageNo, pageSize);
List<ConDoctor> list = conDoctorMapper.selectDoctorListByHospitalId(page, hospitalId);
List<ConDoctorDO> res = Lists.newArrayList();
if (CollectionUtil.isNotEmpty(list)) {
for (ConDoctor conDoctor : list) {
String doctorTitle = dictUtil.queryDictItemListByCodeAndType("z_doct_lev", conDoctor.getDoctorTitle());
conDoctor.setDoctorTitle(doctorTitle);
ConDoctorDO aa = BeanUtil.toBean(conDoctor, ConDoctorDO.class);
ConDepartment conDepartment = conDepartmentMapper.selectDepartmentNameById(conDoctor.getDepartmentId());
if (conDepartment != null) {
conDoctor.setDepartmentName(conDepartment.getDepartmentName());
}
ConResource conResource = conResourceMapper.selectById(conDoctor.getResourceId());
if (conResource != null) {
conDoctor.setResourceName(conResource.getResourceName());
}
if (!StringUtils.isEmpty(conDoctor.getGoodAtSickness())) {
aa.setGoodAtSicknessName(conDoctorMapper.selectSickName(conDoctor.getGoodAtSickness()));
}
res.add(aa);
}
}
return Result.ok(res);
}
//综合评价
public String averageJudgment(String doctorId, BigDecimal userScore, BigDecimal userScoreNum) {
// RedisConstants key = RedisConstants.DOCTOR_SCORE;
// if (stringRedisTemplate.hasKey(key.getKey(doctorId))) {
// return stringRedisTemplate.opsForValue().get(key.getKey(doctorId));
// }
String score = "0";
if (userScoreNum.compareTo(new BigDecimal(0)) > 0 && userScore.compareTo(new BigDecimal(0)) > 0) {
score = userScore.divide(userScoreNum, 2, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_HALF_DOWN).toPlainString();
}
// stringRedisTemplate.opsForValue().set(key.getKey(doctorId), score, key.getExpire(), key.getTimeUnit());
return score;
}
//24小时回复率
public String averageReply(String doctorId, BigDecimal replyNum, BigDecimal messageNum) {
// RedisConstants key = RedisConstants.DOCTOR_REPLY;
// if (stringRedisTemplate.hasKey(key.getKey(doctorId))) {
//
// return stringRedisTemplate.opsForValue().get(key.getKey(doctorId));
// }
String score = "0";
if (messageNum.compareTo(new BigDecimal(0)) > 0 && replyNum.compareTo(new BigDecimal(0)) > 0) {
score = replyNum.divide(messageNum, 2, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_HALF_DOWN).toPlainString();
}
// stringRedisTemplate.opsForValue().set(key.getKey(doctorId), score, key.getExpire(), key.getTimeUnit());
return score;
}
public String averageHeat(String doctorId, BigDecimal userScoreNum, BigDecimal replyNum, BigDecimal messageNum) {
// RedisConstants key = RedisConstants.DOCTOR_HEAT;
// if (stringRedisTemplate.hasKey(key.getKey(doctorId))) {
// return stringRedisTemplate.opsForValue().get(key.getKey(doctorId));
// }
//好评率
BigDecimal goodPointRate = BigDecimal.ZERO;
String goodPoint = conEvaluateMapper.selectDoctorSumScore(doctorId);
if (new BigDecimal(goodPoint).compareTo(new BigDecimal(0)) > 0 &&
userScoreNum.compareTo(new BigDecimal(0)) > 0) {
goodPointRate = new BigDecimal(goodPoint).divide(userScoreNum, 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(0.3)).setScale(2, BigDecimal.ROUND_HALF_DOWN);
}
//回复率
BigDecimal replayRate = new BigDecimal(averageReply(doctorId, replyNum, messageNum)).multiply(new BigDecimal(0.7)).setScale(2, BigDecimal.ROUND_HALF_DOWN);
String heat = goodPointRate.add(replayRate).setScale(2, BigDecimal.ROUND_HALF_DOWN).toPlainString();
// stringRedisTemplate.opsForValue().set(key.getKey(doctorId), heat, key.getExpire(), key.getTimeUnit());
return heat;
}
@Override
public Result<Map<String, Object>> selectDoctorRecommend() {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> all = Lists.newArrayList();
Map<String, Object> map = new HashMap<>();
List<String> history = new ArrayList<>();
List<String> follow = new ArrayList<>();
map.put("haveSessioning", "0");
if (sysUser != null) {
//咨询历史两个
history = conSessionMapper.selectSessionByUserId(sysUser.getId());
//关注两个
follow = conDoctorFollowMapper.selectFollowDoctorId(sysUser.getId());
String haveSessioning = conSessionMapper.selectSessioningExist(sysUser.getId());
if (!"0".equals(haveSessioning)) {
map.put("haveSessioning", "1");
}
}
all.addAll(history);
all.addAll(follow);
int aa = 6 - all.size();
//剩下的用推荐
List<String> recommend = conDoctorMapper.selectRecommendDoctor(aa);
all.addAll(recommend);
List<ConDoctorDO> list = new ArrayList<>(6);
for (String s : all) {
ConDoctorDO conDoctorDO = conDoctorMapper.selectDoctorInfoByIdNew(s);
if (conDoctorDO == null) {
continue;
}
String doctorTitle = dictUtil.queryDictItemListByCodeAndType("z_doct_lev", conDoctorDO.getDoctorTitle());
conDoctorDO.setDoctorTitle(doctorTitle);
ConDepartment conDepartment = conDepartmentMapper.selectDepartmentNameById(conDoctorDO.getDepartmentId());
if (conDepartment != null) {
conDoctorDO.setDepartmentName(conDepartment.getDepartmentName());
}
ConResource conResource = conResourceMapper.selectById(conDoctorDO.getResourceId());
if (conResource != null) {
String level = dictUtil.queryDictItemListByCodeAndType("hospital_level", conResource.getLevel());
conDoctorDO.setHospitalLevel(level);
conDoctorDO.setResourceName(conResource.getResourceName());
}
conDoctorDO.setType("");
if (history.indexOf(s) > 0) {
conDoctorDO.setType("历史咨询");
}
if (follow.indexOf(s) > 0) {
conDoctorDO.setType("我的关注");
}
if (!StringUtils.isEmpty(conDoctorDO.getGoodAtSickness())) {
conDoctorDO.setGoodAtSicknessName(conDoctorMapper.selectSickName(conDoctorDO.getGoodAtSickness()));
}
if (conDoctorDO != null) {
list.add(conDoctorDO);
}
}
map.put("list", list);
return Result.ok(map);
}
@Override
public Result<List<DictModel>> selectDictList(String dictKey) {
if (StringUtils.isEmpty(dictKey)) {
return Result.error("请填写主键");
}
return Result.ok(dictUtil.queryDictItemListByCode(dictKey));
}
@Override
public Result<List<ConDoctorDO>> selectDictListByNHDS(String doctorName, String hispitalId, String departmentId, String sickId, String tfSort, int pageNo, int pageSize) {
if (!StringUtils.isEmpty(departmentId)) {
ConDepartment conDepartment = conDepartmentMapper.selectDepartmentNameById(departmentId);
if (conDepartment != null && StringUtil.equals(conDepartment.getOfficeLevel(), "1")) {
String levelTwoDepartment = conDepartmentMapper.selectDepartmentIdByLevelOneId(departmentId);
if (!StringUtils.isEmpty(levelTwoDepartment)) {
departmentId = departmentId + "," + levelTwoDepartment;
}
}
}
List<String> goodAtSickness = null;
if (!StringUtils.isEmpty(sickId)) {
ConDepartment conDepartment = conDepartmentMapper.selectDepartmentNameById(sickId);
if (conDepartment != null && StringUtil.equals(conDepartment.getOfficeLevel(), "1")) {
sickId = "";
String departmentIdOnly = conDepartment.getId();
String levelTwoDepartment = conDepartmentMapper.selectDepartmentIdByLevelOneId(conDepartment.getId());
if (!com.aliyuncs.utils.StringUtils.isEmpty(levelTwoDepartment)) {
departmentIdOnly = departmentIdOnly + "," + levelTwoDepartment;
}
List<ConSicksDO> sickIdList = conSicksMapper.selectSickListByDepartment(departmentIdOnly);
if(!CollectionUtils.isEmpty(sickIdList)){
List<String> sickIds = sickIdList.stream().map(ConSicksDO::getId).collect(Collectors.toList());
goodAtSickness = sickIds;
}
}
}
com.baomidou.mybatisplus.extension.plugins.pagination.Page<ConDoctor> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<ConDoctor>(pageNo, pageSize);
List<ConDoctor> list = conDoctorMapper.selectDictListByNHDS(page, hispitalId, departmentId, sickId, doctorName, tfSort, goodAtSickness);
List<ConDoctorDO> doctorList = new ArrayList<>(pageSize);
for (ConDoctor conDoctor : list) {
ConDoctorDO conDoctorDO = BeanUtil.copyProperties(conDoctor, ConDoctorDO.class);
String doctorTitle = dictUtil.queryDictItemListByCodeAndType("z_doct_lev", conDoctorDO.getDoctorTitle());
conDoctorDO.setDoctorTitle(doctorTitle);
ConDepartment conDepartment = conDepartmentMapper.selectDepartmentNameById(conDoctorDO.getDepartmentId());
if (conDepartment != null) {
conDoctorDO.setDepartmentName(conDepartment.getDepartmentName());
}
ConResource conResource = conResourceMapper.selectById(conDoctorDO.getResourceId());
if (conResource != null) {
String level = dictUtil.queryDictItemListByCodeAndType("hospital_level", conResource.getLevel());
conDoctorDO.setHospitalLevel(level);
conDoctorDO.setResourceName(conResource.getResourceName());
}
if (!StringUtils.isEmpty(conDoctorDO.getGoodAtSickness())) {
conDoctorDO.setGoodAtSicknessName(conDoctorMapper.selectSickName(conDoctorDO.getGoodAtSickness()));
}
String a = averageJudgment(conDoctor.getId(), new BigDecimal(conDoctor.getUserScore()), new BigDecimal(conDoctor.getUserScoreNum()));
String b = new BigDecimal(averageReply(conDoctor.getId(), new BigDecimal(conDoctor.getReplyNum()), new BigDecimal(conDoctor.getMessageNum()))).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_DOWN).toPlainString();
String c = averageHeat(conDoctor.getId(), new BigDecimal(conDoctor.getUserScoreNum()), new BigDecimal(conDoctor.getReplyNum()), new BigDecimal(conDoctor.getMessageNum()));
conDoctorDO.setOverallMerit(a);
conDoctorDO.setResponseRate(b);
conDoctorDO.setDegreeHeat(c);
doctorList.add(conDoctorDO);
}
return Result.ok(doctorList);
}
@Override
public List<Map<String, String>> selectSickName(String sickIds) {
return conDoctorMapper.selectSickName(sickIds);
}
@Override
public Result<List<ConDoctorDO>> selectDictListBySickAndDepartment(ConDoctorSearchDTO conDoctorSearchDTO) {
String departmentId = null;
if(CollectionUtil.isNotEmpty(conDoctorSearchDTO.getDepartmentIds())){
departmentId = String.join(",", conDoctorSearchDTO.getDepartmentIds());
}
com.baomidou.mybatisplus.extension.plugins.pagination.Page<ConDoctor> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<ConDoctor>(conDoctorSearchDTO.getPageNo(), conDoctorSearchDTO.getPageSize());
List<ConDoctor> list = conDoctorMapper.selectDictListBySickAndDepartment(page, conDoctorSearchDTO.getSickIds(),departmentId);
List<ConDoctorDO> doctorList = new ArrayList<>(conDoctorSearchDTO.getPageSize());
for (ConDoctor conDoctor : list) {
ConDoctorDO conDoctorDO = BeanUtil.copyProperties(conDoctor, ConDoctorDO.class);
String doctorTitle = dictUtil.queryDictItemListByCodeAndType("z_doct_lev", conDoctorDO.getDoctorTitle());
conDoctorDO.setDoctorTitle(doctorTitle);
ConDepartment conDepartment = conDepartmentMapper.selectDepartmentNameById(conDoctorDO.getDepartmentId());
if (conDepartment != null) {
conDoctorDO.setDepartmentName(conDepartment.getDepartmentName());
}
ConResource conResource = conResourceMapper.selectById(conDoctorDO.getResourceId());
if (conResource != null) {
String level = dictUtil.queryDictItemListByCodeAndType("hospital_level", conResource.getLevel());
conDoctorDO.setHospitalLevel(level);
conDoctorDO.setResourceName(conResource.getResourceName());
}
if (!StringUtils.isEmpty(conDoctorDO.getGoodAtSickness())) {
conDoctorDO.setGoodAtSicknessName(conDoctorMapper.selectSickName(conDoctorDO.getGoodAtSickness()));
}
String a = averageJudgment(conDoctor.getId(), new BigDecimal(conDoctor.getUserScore()), new BigDecimal(conDoctor.getUserScoreNum()));
String b = new BigDecimal(averageReply(conDoctor.getId(), new BigDecimal(conDoctor.getReplyNum()), new BigDecimal(conDoctor.getMessageNum()))).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_DOWN).toPlainString();
String c = averageHeat(conDoctor.getId(), new BigDecimal(conDoctor.getUserScoreNum()), new BigDecimal(conDoctor.getReplyNum()), new BigDecimal(conDoctor.getMessageNum()));
conDoctorDO.setOverallMerit(a);
conDoctorDO.setResponseRate(b);
conDoctorDO.setDegreeHeat(c);
doctorList.add(conDoctorDO);
}
return Result.ok(doctorList);
}
@Override
public Result<Map<String, Object>> selectDoctorRecommendNew(int pageNo,int pageSize) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Map<String, Object> map = new HashMap<>();
map.put("haveSessioning", "0");
if (sysUser != null) {
String haveSessioning = conSessionMapper.selectSessioningExist(sysUser.getId());
if (!"0".equals(haveSessioning)) {
map.put("haveSessioning", "1");
}
}
List<ConDoctorDO> list = new ArrayList<>(6);
List<ConDoctor> doctorList = conDoctorMapper.selectRecommendDoctorNewAnother(new Page<>(pageNo, pageSize));
if (CollUtil.isEmpty(doctorList)) {
return Result.ok();
}
for (ConDoctor conDoctor : doctorList) {
ConDoctorDO conDoctorDO = new ConDoctorDO();
BeanUtils.copyProperties(conDoctor,conDoctorDO);
String doctorTitle = dictUtil.queryDictItemListByCodeAndType("z_doct_lev", conDoctorDO.getDoctorTitle());
conDoctorDO.setDoctorTitle(doctorTitle);
ConDepartment conDepartment = conDepartmentMapper.selectDepartmentNameById(conDoctorDO.getDepartmentId());
if (conDepartment != null) {
conDoctorDO.setDepartmentName(conDepartment.getDepartmentName());
}
ConResource conResource = conResourceMapper.selectById(conDoctorDO.getResourceId());
if (conResource != null) {
String level = dictUtil.queryDictItemListByCodeAndType("hospital_level", conResource.getLevel());
conDoctorDO.setHospitalLevel(level);
conDoctorDO.setResourceName(conResource.getResourceName());
}
conDoctorDO.setType("");
if (!StringUtils.isEmpty(conDoctorDO.getGoodAtSickness())) {
conDoctorDO.setGoodAtSicknessName(conDoctorMapper.selectSickName(conDoctorDO.getGoodAtSickness()));
}
//历史原因,反转字段,以后看情况改 TODO
TempUtil.reversalDocInfo(conDoctorDO);
list.add(conDoctorDO);
}
map.put("list", list);
return Result.ok(map);
}
@Override
public Result<Map<String, Object>> listDoctorInterveneHomeV2(int pageNo, int pageSize) {
return selectDoctorRecommendNew(pageNo, pageSize);
}
@Override
public List<SimpleDoctorVo> listDoctorInterveneHome(int pageNo, int pageSize) {
LambdaQueryWrapper<ConDoctor> queryWrapper = Wrappers.<ConDoctor>lambdaQuery()
.select(ConDoctor::getId,
ConDoctor::getDoctorNo,
ConDoctor::getDoctorTitle,
ConDoctor::getPhoto,
ConDoctor::getDoctorName,
ConDoctor::getResourceName,
ConDoctor::getDepartmentName)
.eq(ConDoctor::getDoctorStatus, 1)
.eq(ConDoctor::getDelFlag, CommonConstant.DEL_FLAG_0)
.orderByDesc(ConDoctor::getTfRecommend)
.orderByAsc(ConDoctor::getSort);
Page<ConDoctor> pageParam = new Page<>(pageNo, pageSize);
Page<ConDoctor> page = conDoctorMapper.selectPage(pageParam, queryWrapper);
if (CollUtil.isEmpty(page.getRecords())) {
return Collections.emptyList();
}
return page.getRecords().stream()
.map(f -> {
SimpleDoctorVo vo = new SimpleDoctorVo();
BeanUtil.copyProperties(f, vo);
return vo;
})
.collect(Collectors.toList());
}
public void initDoctorJudgment(String id){
ConDoctorSatisfy conDoctorSatisfy = new ConDoctorSatisfy();
conDoctorSatisfy.setId(id);
conDoctorSatisfy.setUserScore("0");
conDoctorSatisfy.setUserScoreNum("0");
conDoctorSatisfy.setReplyNum("0");
conDoctorSatisfy.setMessageNum("0");
conDoctorSatisfy.setShowScore("0");
conDoctorMapper.insertConDoctorSatisfyQhByDoctorNew(conDoctorSatisfy);
}
}
@@ -0,0 +1,73 @@
package com.renkang.consultation.api.service.impl;
import com.renkang.consultation.api.service.ConDoctorFollowApiService;
import com.renkang.consultation.api.storge.redis.ConDoctorFollowReidsTunnel;
import com.renkang.consultation.entity.ConDoctorFollow;
import com.renkang.consultation.mapper.ConDoctorFollowMapper;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@Service("conDoctorFollowApiService")
public class ConDoctorFollowApiServiceImpl implements ConDoctorFollowApiService {
@Autowired
private ConDoctorFollowMapper conDoctorFollowMapper;
@Autowired
private ConDoctorFollowReidsTunnel conDoctorFollowReidsTunnel;
@Transactional
@Override
public Result<String> followOrCancelDoctor(String doctorId) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (doctorId.equals(sysUser.getId())) {
return Result.error("不能自己关注自己");
}
int i = conDoctorFollowMapper.selectFollowDoctorExist(sysUser.getId(), doctorId);
if (i > 0) {
return Result.error("此医生已关注");
}
ConDoctorFollow conDoctorFollow = new ConDoctorFollow();
conDoctorFollow.setUserId(sysUser.getId());
conDoctorFollow.setDoctorId(doctorId);
conDoctorFollow.setCreateTime(new Date());
conDoctorFollowMapper.insert(conDoctorFollow);
conDoctorFollowReidsTunnel.setFollowDoctor(conDoctorFollow);
return Result.ok("关注成功");
}
@Transactional
@Override
public Result<String> cancelDoctor(String doctorId) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (doctorId.equals(sysUser.getId())) {
return Result.error("取消失败");
}
int i = conDoctorFollowMapper.selectFollowDoctorExist(sysUser.getId(), doctorId);
if (i == 0) {
return Result.error("未关注该医生");
}
conDoctorFollowMapper.cancelDoctorFollow(sysUser.getId(), doctorId);
conDoctorFollowReidsTunnel.cancelFollowUser(sysUser.getId(), doctorId);
return Result.ok("取消成功");
}
}
@@ -0,0 +1,304 @@
package com.renkang.consultation.api.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.aliyuncs.utils.StringUtils;
import com.renkang.consultation.api.RedisConstants;
import com.renkang.consultation.api.service.ConDoctorSchedulingApiService;
import com.renkang.consultation.entity.*;
import com.renkang.consultation.mapper.ConDoctorMapper;
import com.renkang.consultation.mapper.ConDoctorSchedulingDateMapper;
import com.renkang.consultation.mapper.ConDoctorSchedulingMapper;
import com.renkang.consultation.service.impl.ConDoctorSchedulingDateServiceImpl;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.oConvertUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("conDoctorSchedulingApiService")
public class ConDoctorSchedulingApiServiceImpl implements ConDoctorSchedulingApiService {
@Autowired
private ConDoctorSchedulingMapper conDoctorSchedulingMapper;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private ISysBaseAPI sysBaseAPI;
@Autowired
private ConDoctorSchedulingDateMapper conDoctorSchedulingDateMapper;
@Autowired
private ConDoctorMapper conDoctorMapper;
@Autowired
private ConDoctorSchedulingDateServiceImpl conDoctorSchedulingDateServiceImpl;
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> insertDoctorScheduling(ConDoctorSchedulingListDO conDoctorSchedulingListDO) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ConDoctorSchedulingDO> list = conDoctorSchedulingListDO.getList();
for (ConDoctorSchedulingDO conDoctorSchedulingDO : list) {
ConDoctorScheduling conDoctorScheduling = BeanUtil.copyProperties(conDoctorSchedulingDO, ConDoctorScheduling.class);
if (StringUtils.isEmpty(conDoctorSchedulingDO.getId())) {
String type = "0";
if (!StringUtil.equals(conDoctorScheduling.getPmNum(), "0")) {
type = "1";
}
if (!StringUtil.equals(conDoctorScheduling.getPmNum(), "0") && !StringUtil.equals(conDoctorScheduling.getAmNum(), "0")) {
type = "2";
}
conDoctorScheduling.setType(type);
conDoctorScheduling.setUserId(sysUser.getId());
conDoctorScheduling.setCreateTime(new Date());
conDoctorSchedulingMapper.insert(conDoctorScheduling);
} else {
String type = "0";
if (!StringUtil.equals(conDoctorScheduling.getPmNum(), "0")) {
type = "1";
}
if (!StringUtil.equals(conDoctorScheduling.getPmNum(), "0") && !StringUtil.equals(conDoctorScheduling.getAmNum(), "0")) {
type = "2";
}
conDoctorScheduling.setType(type);
conDoctorScheduling.setUserId(sysUser.getId());
conDoctorScheduling.setUpdateTime(new Date());
conDoctorSchedulingMapper.updateById(conDoctorScheduling);
}
List<ConDoctorSchedulingDateListDO> schList = conDoctorSchedulingDateMapper.selectDoctorSchedulingByWeekAndUserId(sysUser.getId(), conDoctorSchedulingDO.getWeek());
if (!CollectionUtils.isEmpty(schList)) {
for (ConDoctorSchedulingDateListDO doctorSchedulingDO : schList) {
if (StringUtil.equals(doctorSchedulingDO.getType(), "0")) {
conDoctorSchedulingDateMapper.updateScheduleNum(conDoctorSchedulingDO.getAmNum(), doctorSchedulingDO.getId());
}
if (StringUtil.equals(doctorSchedulingDO.getType(), "1")) {
conDoctorSchedulingDateMapper.updateScheduleNum(conDoctorSchedulingDO.getPmNum(), doctorSchedulingDO.getId());
}
}
}
}
redisTemplate.opsForValue().set(RedisConstants.TF_DATE_DEFAULT.getKey(sysUser.getId()), conDoctorSchedulingListDO.getTfDefault());
redisTemplate.opsForValue().set(RedisConstants.TF_JUMP_HOLIDAY.getKey(sysUser.getId()), conDoctorSchedulingListDO.getTfJumpHoliday());
conDoctorMapper.updateAudioStatus(sysUser.getId(), conDoctorSchedulingListDO.getAudioStatus(), conDoctorSchedulingListDO.getTfJumpHoliday());
if (StringUtil.equals(conDoctorSchedulingListDO.getAudioStatus(), "1")) {
this.generalDoctorSchedulingTime(sysUser.getId());
}
return Result.ok("添加成功");
}
@Override
public Result<Map<String, Object>> selectDoctorScheduling() {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Map<String, Object> map = new HashMap<>();
List<ConDoctorSchedulingDO> list = conDoctorSchedulingMapper.selectDoctorScheduling(sysUser.getId());
map.put("list", list);
map.put("tfJumpHoliday", "0");
map.put("tfDefault", "0");
map.put("audioStatus", "0");
ConDoctor conDoctor = conDoctorMapper.selectById(sysUser.getId());
if (conDoctor != null) {
map.put("tfJumpHoliday", StringUtil.isNotBlank(conDoctor.getTfJumpHoliday()) ? conDoctor.getTfJumpHoliday() : "0");
map.put("audioStatus", StringUtil.isNotBlank(conDoctor.getAudioStatus()) ? conDoctor.getAudioStatus() : "0");
}
if (redisTemplate.hasKey(RedisConstants.TF_DATE_DEFAULT.getKey(sysUser.getId()))) {
String aa = oConvertUtils.getString(redisTemplate.opsForValue().get(RedisConstants.TF_DATE_DEFAULT.getKey(sysUser.getId())));
map.put("tfDefault", aa);
}
return Result.ok(map);
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> insertDoctorSchedulingSingle(ConDoctorSchedulingDO conDoctorSchedulingDO) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ConDoctorSchedulingDO conDoctorSchedulingOnly = conDoctorSchedulingMapper.selectDoctorSchedulingByWeek(sysUser.getId(), conDoctorSchedulingDO.getWeek());
ConDoctorScheduling conDoctorScheduling = BeanUtil.copyProperties(conDoctorSchedulingDO, ConDoctorScheduling.class);
if (conDoctorSchedulingOnly == null) {
conDoctorScheduling.setUserId(sysUser.getId());
conDoctorScheduling.setCreateTime(new Date());
conDoctorSchedulingMapper.insert(conDoctorScheduling);
} else {
conDoctorScheduling.setUpdateTime(new Date());
conDoctorScheduling.setId(conDoctorSchedulingOnly.getId());
conDoctorSchedulingMapper.updateById(conDoctorScheduling);
}
return Result.ok("添加成功");
}
@Transactional(rollbackFor = Exception.class)
public Result<String> generalDoctorSchedulingTime(String doctorId) {
Date date = DateUtils.dateAddDay(new Date(), 1);
for (int i = 0; i < 7; i++) {
int week = DateUtils.dateToWeek(date);
ConDoctorScheduling conDoctorScheduling = conDoctorSchedulingMapper.selectDoctorSchedulingByWeekListByDoctorId(week, doctorId);
boolean tfHoliday = conDoctorSchedulingDateServiceImpl.isHoliday(date);
ConDoctor conDoctor = conDoctorMapper.selectDoctorDetailById(conDoctorScheduling.getUserId());
if (conDoctor == null) {
continue;
}
String aa = conDoctor.getTfJumpHoliday();
if (!"1".equals(conDoctorScheduling.getType()) && !StringUtils.isEmpty(conDoctorScheduling.getType())) {
List<ConDoctorSchedulingDateListDO> existList = conDoctorSchedulingDateMapper.selectDoctorScheduleDate(conDoctorScheduling.getUserId(), date, "0");
if (CollectionUtils.isEmpty(existList)) {
ConDoctorSchedulingDate conDoctorSchedulingDate = new ConDoctorSchedulingDate();
conDoctorSchedulingDate.setUserId(conDoctorScheduling.getUserId());
conDoctorSchedulingDate.setSchedulingDate(date);
conDoctorSchedulingDate.setCreateTime(new Date());
conDoctorSchedulingDate.setWeek(conDoctorScheduling.getWeek());
conDoctorSchedulingDate.setId(null);
conDoctorSchedulingDate.setType("0");
conDoctorSchedulingDate.setSchedulingNum(tfHoliday && "1".equals(aa) ? "0" : conDoctorScheduling.getAmNum());
conDoctorSchedulingDateMapper.insert(conDoctorSchedulingDate);
}
}
if (!"0".equals(conDoctorScheduling.getType()) && !StringUtils.isEmpty(conDoctorScheduling.getType())) {
List<ConDoctorSchedulingDateListDO> existList = conDoctorSchedulingDateMapper.selectDoctorScheduleDate(conDoctorScheduling.getUserId(), date, "1");
if (CollectionUtils.isEmpty(existList)) {
ConDoctorSchedulingDate conDoctorSchedulingDate = new ConDoctorSchedulingDate();
conDoctorSchedulingDate.setUserId(conDoctorScheduling.getUserId());
conDoctorSchedulingDate.setSchedulingDate(date);
conDoctorSchedulingDate.setCreateTime(new Date());
conDoctorSchedulingDate.setWeek(conDoctorScheduling.getWeek());
conDoctorSchedulingDate.setId(null);
conDoctorSchedulingDate.setType("1");
conDoctorSchedulingDate.setSchedulingNum(tfHoliday && "1".equals(aa) ? "0" : conDoctorScheduling.getPmNum());
conDoctorSchedulingDateMapper.insert(conDoctorSchedulingDate);
}
}
date = DateUtils.dateAddDay(date, 1);
}
return Result.ok("生成完成");
}
public Result<Map<String, Object>> selectDoctorSchedulingTime() {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Map<String, Object> map = new HashMap<>();
List<ConDoctorSchedulingDO> list = conDoctorSchedulingMapper.selectDoctorScheduling(sysUser.getId());
if (CollectionUtils.isEmpty(list)) {
return Result.ok();
}
Date date = new Date();
int week = DateUtils.dateToWeek(date);
return Result.ok(map);
}
@Override
public Result<String> insertDoctorSchedulingRunData() {
List<ConDoctor> list = conDoctorMapper.selectListAll();
for (ConDoctor conDoctor : list) {
int exisSchedule = conDoctorSchedulingMapper.selectExistSchedule(conDoctor.getId());
if(exisSchedule > 0){
continue;
}
for (int i = 0; i < 7; i++) {
ConDoctorScheduling conDoctorScheduling = new ConDoctorScheduling();
conDoctorScheduling.setWeek(String.valueOf(i+1));
conDoctorScheduling.setType("2");
conDoctorScheduling.setAmNum("5");
conDoctorScheduling.setPmNum("5");
conDoctorScheduling.setTfJumpHoliday("0");
conDoctorScheduling.setUserId(conDoctor.getId());
conDoctorScheduling.setStatus("1");
conDoctorScheduling.setDelFlag("0");
conDoctorScheduling.setCreateTime(new Date());
conDoctorScheduling.setTfDefault("1");
conDoctorScheduling.setAudioStatus("1");
conDoctorSchedulingMapper.insert(conDoctorScheduling);
}
conDoctorMapper.updateDoctorStatusDouble(conDoctor.getId());
this.generalDoctorSchedulingTime(conDoctor.getId());
}
return Result.ok();
}
@Override
public Result<String> initDoctorSchedulingData() {
conDoctorSchedulingDateMapper.deleteDoctorSchedulingDateAll();
conDoctorSchedulingMapper.deleteDoctorScheduleAll();
List<ConDoctor> list = conDoctorMapper.selectListAll();
for (ConDoctor conDoctor : list) {
int exisSchedule = conDoctorSchedulingMapper.selectExistSchedule(conDoctor.getId());
if(exisSchedule > 0){
continue;
}
for (int i = 0; i < 7; i++) {
ConDoctorScheduling conDoctorScheduling = new ConDoctorScheduling();
conDoctorScheduling.setWeek(String.valueOf(i+1));
conDoctorScheduling.setType("2");
conDoctorScheduling.setAmNum("5");
conDoctorScheduling.setPmNum("5");
conDoctorScheduling.setTfJumpHoliday("0");
conDoctorScheduling.setUserId(conDoctor.getId());
conDoctorScheduling.setStatus("1");
conDoctorScheduling.setDelFlag("0");
conDoctorScheduling.setCreateTime(new Date());
conDoctorScheduling.setTfDefault("1");
conDoctorScheduling.setAudioStatus("1");
conDoctorSchedulingMapper.insert(conDoctorScheduling);
}
conDoctorMapper.updateDoctorStatusDouble(conDoctor.getId());
this.generalDoctorSchedulingTime(conDoctor.getId());
}
return Result.ok();
}
}
@@ -0,0 +1,95 @@
package com.renkang.consultation.api.service.impl;
import com.alibaba.druid.util.StringUtils;
import com.renkang.consultation.api.service.ConDoctorSchedulingDateApiService;
import com.renkang.consultation.entity.ConDoctor;
import com.renkang.consultation.entity.ConDoctorSchedulingDateListDO;
import com.renkang.consultation.mapper.ConDoctorMapper;
import com.renkang.consultation.mapper.ConDoctorSchedulingDateMapper;
import com.renkang.consultation.mapper.ConServiceMapper;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@Service("conDoctorSchedulingDateApiService")
public class ConDoctorSchedulingDateApiServiceImpl implements ConDoctorSchedulingDateApiService {
@Autowired
private ConDoctorSchedulingDateMapper conDoctorSchedulingDateMapper;
@Autowired
private ConDoctorMapper conDoctorMapper;
@Autowired
private ConServiceMapper conServiceMapper;
@Override
public Result<List<ConDoctorSchedulingDateListDO>> selectSchedulingDateListByDoctorId(String doctorId) {
List<ConDoctorSchedulingDateListDO> list = conDoctorSchedulingDateMapper.selectDoctorById(doctorId);
ConDoctor conDoctor = conDoctorMapper.selectById(doctorId);
if (conDoctor == null) {
return Result.error("医生不存在");
}
if (CollectionUtils.isEmpty(list) || StringUtils.equals(conDoctor.getDoctorStatus(), "3")) {
Date date = new Date();
for (int i = 0; i < 7; i++) {
int week = DateUtils.dateToWeek(date);
ConDoctorSchedulingDateListDO conDoctorSchedulingDateListDO = new ConDoctorSchedulingDateListDO();
conDoctorSchedulingDateListDO.setType("1");
conDoctorSchedulingDateListDO.setSchedulingNum("0");
conDoctorSchedulingDateListDO.setReadySchedulingNum("0");
conDoctorSchedulingDateListDO.setSchedulingDate(date);
conDoctorSchedulingDateListDO.setWeek(String.valueOf(week));
list.add(conDoctorSchedulingDateListDO);
date = DateUtils.dateAddDay(date, 1);
}
return Result.ok(list);
}
Iterator<ConDoctorSchedulingDateListDO> iterator = list.iterator();
Date date = DateUtils.formatDateToAnother(new Date(), "yyyy-MM-dd");
while (iterator.hasNext()) {
ConDoctorSchedulingDateListDO conDoctorSchedulingDateListDO = iterator.next();
if (date.getTime() == conDoctorSchedulingDateListDO.getSchedulingDate().getTime()) {
int nowHour = DateUtils.nowHour(new Date());
if ("0".equals(conDoctorSchedulingDateListDO.getType())) {
if (nowHour >= 5) {
iterator.remove();
}
}
if ("1".equals(conDoctorSchedulingDateListDO.getType())) {
if (nowHour >= 9) {
iterator.remove();
}
}
}
Date scheduleDate = conDoctorSchedulingDateListDO.getSchedulingDate();
int existStop = conServiceMapper.selectConServiceByDoctrIdExist(doctorId,scheduleDate);
if(existStop > 0){
conDoctorSchedulingDateListDO.setSchedulingNum("0");
}
}
return Result.ok(list);
}
}
@@ -0,0 +1,132 @@
package com.renkang.consultation.api.service.impl;
import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.api.service.ConEvaluateApiService;
import com.renkang.consultation.entity.*;
import com.renkang.consultation.mapper.*;
import com.renkang.im.api.IMHelloApi;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Service("conEvaluateApiService")
public class ConEvaluateApiServiceImpl implements ConEvaluateApiService {
@Autowired
private ConEvaluateMapper conEvaluateMapper;
@Autowired
private ConSessionMapper conSessionMapper;
@Autowired
private ConDoctorMapper conDoctorMapper;
@Autowired
private ConDepartmentMapper conDepartmentMapper;
@Autowired
private ConsultResidentHospitalMapper consultResidentHospitalMapper;
@Autowired
private ConResourceMapper conResourceMapper;
@Autowired
private IMHelloApi iMHelloApi;
@Autowired
private ConDoctorApiServiceImpl conDoctorApiServiceImpl;
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> insertConEvaluate(ConEvaluate conEvaluate) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ConSession conSession = conSessionMapper.selectConSessionByIdView(conEvaluate.getSessionId());
if (conSession == null) {
return Result.error("无法评分");
}
if (!"4".equals(conSession.getContentStatus())) {
return Result.error("无法评分");
}
ConDoctor conDoctor = conDoctorMapper.selectDoctorDetailById(conSession.getToAccount());
if (conDoctor == null) {
return Result.error("医生不存在,无法评分");
}
conEvaluate.setUserId(sysUser.getId());
conEvaluate.setUserName(StringUtils.equals("1", conEvaluate.getTfUnknow()) ? "匿名用户" : sysUser.getRealname());
conEvaluate.setTime(new Date());
conEvaluate.setSessionType(conSession.getContentType());
conEvaluate.setHospitalId(conDoctor.getResourceId());
conEvaluate.setOfficeId(conDoctor.getDepartmentId());
conEvaluate.setExpert(conSession.getToAccount());
conEvaluate.setSessionType(conSession.getSessionType());
conEvaluate.setOrgCode(sysUser.getOrgCode());
ConDepartment conDepartment = conDepartmentMapper.selectDepartmentNameById(conDoctor.getDepartmentId());
if (conDepartment != null) {
conEvaluate.setOfficeName(conDepartment.getDepartmentName());
}
conEvaluateMapper.insert(conEvaluate);
conSessionMapper.updateContentStatus(conEvaluate.getSessionId(), "5", null);
conDoctorMapper.updateDoctorScoreAnfNum(conEvaluate.getScore(), conEvaluate.getExpert());
ConDoctorSatisfy conDoctorSatisfy = conDoctorMapper.selectConDoctorSatisfyQhByDoctorIdNew(conEvaluate.getExpert());
if (conDoctorSatisfy == null) {
conDoctorApiServiceImpl.initDoctorJudgment(conEvaluate.getExpert());
}
conDoctorMapper.updateDoctorScoreAnfNumQh(conEvaluate.getScore(), conEvaluate.getExpert());
conResourceMapper.updateHospitalScoreAnfNum(conEvaluate.getScore(), conDoctor.getResourceId());
if (new BigDecimal(conEvaluate.getScore()).compareTo(new BigDecimal(3)) >= 0) {
conDoctorMapper.updateDoctorShowScoreAnfNum(conEvaluate.getScore(), conEvaluate.getExpert());
if(StringUtils.equals(conSession.getTfQh(),"1")){
conDoctorMapper.updateDoctorShowScoreAnfNumQh(conEvaluate.getScore(), conEvaluate.getExpert());
}
}
iMHelloApi.sendGroupNotifyToUser(conSession.getImId(), Collections.singletonList(sysUser.getId()), "感谢您对此次服务的评价");
return Result.ok("感谢您对此次服务的评价");
}
@Override
public Result<List<ConEvaluateDO>> selectConEvaluateList(String doctorId, int pageNo, int pageSize) {
Page<ConEvaluateDO> page = new Page<ConEvaluateDO>(pageNo, pageSize);
List<ConEvaluateDO> list = conEvaluateMapper.selectDoctorJudgmentList(page, doctorId, null);
return Result.ok(list);
}
@Override
public Result<List<ConEvaluateDO>> selectConEvaluateListByHospitalId(String hospitalId, int pageNo, int pageSize) {
if (StringUtils.isEmpty(hospitalId)) {
return Result.error("请选择医院");
}
Page<ConEvaluateDO> page = new Page<ConEvaluateDO>(pageNo, pageSize);
List<ConEvaluateDO> list = conEvaluateMapper.selectDoctorJudgmentList(page, null, hospitalId);
return Result.ok(list);
}
}
@@ -0,0 +1,181 @@
package com.renkang.consultation.api.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.api.service.ConFamilyMembersApiService;
import com.renkang.consultation.entity.ConFamilyMembers;
import com.renkang.consultation.entity.ConFamilyMembersAndMedicalRecordsDO;
import com.renkang.consultation.entity.ConFamilyMembersDO;
import com.renkang.consultation.entity.ConMedicalRecordsListDO;
import com.renkang.consultation.mapper.ConFamilyMembersMapper;
import com.renkang.consultation.mapper.ConMedicalRecordsMapper;
import com.renkang.emergency.bean.request.SingleParam;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.util.DictUtil;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.AgeCalculateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
@Service("conFamilyMembersApiService")
public class ConFamilyMembersApiServiceImpl implements ConFamilyMembersApiService {
@Autowired
private ConFamilyMembersMapper conFamilyMembersMapper;
@Autowired
private ConMedicalRecordsMapper conMedicalRecordsMapper;
@Autowired
private DictUtil dictUtil;
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> insertFamilyMembers(ConFamilyMembersDO conFamilyMembersDO) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String familyRelation = conFamilyMembersDO.getFamilyRelation();
if (StringUtil.equals(familyRelation, "1")) {
int existNum = conFamilyMembersMapper.selectOwnFanilyExist(sysUser.getId());
if (existNum > 0) {
return Result.error("已存在本人,请勿重复添加");
}
}
String userId = sysUser.getId();
ConFamilyMembers conFamilyMembers = new ConFamilyMembers();
BeanUtil.copyProperties(conFamilyMembersDO, conFamilyMembers);
conFamilyMembers.setGroupId(userId);
if (conFamilyMembersDO.getBirthdayLong() != null) {
conFamilyMembers.setBirthday(new Date(conFamilyMembersDO.getBirthdayLong()));
}
conFamilyMembers.setCreateTime(new Date());
conFamilyMembersMapper.insert(conFamilyMembers);
return Result.OK("添加成功", conFamilyMembers.getId());
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> updateFamilyMembers(ConFamilyMembersDO conFamilyMembersDO) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ConFamilyMembers conFamilyMembersOnly = conFamilyMembersMapper.selectConFamilyMembersById(conFamilyMembersDO.getId());
if (conFamilyMembersOnly == null) {
return Result.error("成员已不存在,无法进行修改");
}
if (!StringUtil.equals(conFamilyMembersOnly.getFamilyRelation(), "1")) {
String familyRelation = conFamilyMembersDO.getFamilyRelation();
if (StringUtil.equals(familyRelation, "1")) {
int existNum = conFamilyMembersMapper.selectOwnFanilyExist(sysUser.getId());
if (existNum > 0) {
return Result.error("已存在本人,请勿重复添加");
}
}
}
ConFamilyMembers conFamilyMembers = new ConFamilyMembers();
BeanUtil.copyProperties(conFamilyMembersDO, conFamilyMembers);
conFamilyMembers.setUpdateTime(new Date());
if (conFamilyMembersDO.getBirthdayLong() != null) {
conFamilyMembers.setBirthday(new Date(conFamilyMembersDO.getBirthdayLong()));
}
conFamilyMembersMapper.updateById(conFamilyMembers);
return Result.OK("修改成功", conFamilyMembers.getId());
}
@Override
public Result<List<ConFamilyMembersAndMedicalRecordsDO>> selectMenberList(int pageNo, int pageSize) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Page<ConFamilyMembersAndMedicalRecordsDO> page = new Page<ConFamilyMembersAndMedicalRecordsDO>(pageNo, pageSize);
List<ConFamilyMembersAndMedicalRecordsDO> list = conFamilyMembersMapper.selectMenberList(page, sysUser.getId());
if (CollectionUtils.isEmpty(list)) {
return Result.ok(list);
}
for (ConFamilyMembersAndMedicalRecordsDO conFamilyMembersAndMedicalRecordsDO : list) {
List<ConMedicalRecordsListDO> medicalList = conMedicalRecordsMapper.selectConMedicalRecordsListByMemberId(conFamilyMembersAndMedicalRecordsDO.getId());
// String doctorTitle = dictUtil.queryDictItemListByCodeAndType("family_member_relation",conFamilyMembersAndMedicalRecordsDO.getFamilyRelation());
// conFamilyMembersAndMedicalRecordsDO.setFamilyRelation(doctorTitle);
if (!CollectionUtils.isEmpty(medicalList)) {
conFamilyMembersAndMedicalRecordsDO.setList(medicalList);
}
if (conFamilyMembersAndMedicalRecordsDO.getBirthday() != null) {
conFamilyMembersAndMedicalRecordsDO.setAge(String.valueOf(AgeCalculateUtil.getAge(conFamilyMembersAndMedicalRecordsDO.getBirthday())));
}
}
return Result.ok(list);
}
@Override
public Result<ConFamilyMembersDO> selectMenberById(String id) {
ConFamilyMembersDO conFamilyMembersDO = conFamilyMembersMapper.selectConFamilyMembersDOById(id);
return Result.ok(conFamilyMembersDO);
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> removeMemberById(SingleParam<List<String>> ids) {
if (ids != null && CollectionUtils.isEmpty(ids.getParam())) {
return Result.error("请选择成员");
}
for (String s : ids.getParam()) {
conFamilyMembersMapper.removeMenberById(s);
}
return Result.ok("删除成功");
}
@Override
public Result<List<ConFamilyMembersAndMedicalRecordsDO>> selectMenberOnlyList(int pageNo, int pageSize) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Page<ConFamilyMembersAndMedicalRecordsDO> page = new Page<ConFamilyMembersAndMedicalRecordsDO>(pageNo, pageSize);
List<ConFamilyMembersAndMedicalRecordsDO> list = conFamilyMembersMapper.selectMenberList(page, sysUser.getId());
if (CollectionUtils.isEmpty(list)) {
return Result.ok(list);
}
for (ConFamilyMembersAndMedicalRecordsDO conFamilyMembersAndMedicalRecordsDO : list) {
String doctorTitle = dictUtil.queryDictItemListByCodeAndType("family_member_relation", conFamilyMembersAndMedicalRecordsDO.getFamilyRelation());
conFamilyMembersAndMedicalRecordsDO.setFamilyRelation(doctorTitle);
if (conFamilyMembersAndMedicalRecordsDO.getBirthday() != null) {
conFamilyMembersAndMedicalRecordsDO.setAge(String.valueOf(AgeCalculateUtil.getAge(conFamilyMembersAndMedicalRecordsDO.getBirthday())));
}
}
return Result.ok(list);
}
}
@@ -0,0 +1,194 @@
package com.renkang.consultation.api.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.Feature;
import com.renkang.consultation.api.service.ConHealthInfoApiService;
import com.renkang.consultation.api.storge.ComposeConHealthInfo;
import com.renkang.consultation.entity.*;
import com.renkang.consultation.mapper.ConHealthInfoAnswerMapper;
import com.renkang.consultation.mapper.ConHealthInfoMapper;
import org.apache.commons.compress.utils.Lists;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.system.vo.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Service("conHealthInfoApiService")
public class ConHealthInfoApiServiceImpl implements ConHealthInfoApiService {
@Autowired
private ComposeConHealthInfo composeConHealthInfo;
@Autowired
private ISysBaseAPI sysBaseAPI;
@Autowired
private ConHealthInfoAnswerMapper conHealthInfoAnswerMapper;
@Autowired
private ConHealthInfoMapper conHealthInfoMapper;
@Override
public Result<List<Object>> selectHealthInfo(String memberId) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<DictModel> dictList = sysBaseAPI.queryDictItemsByCode("con_health_type");
if (CollectionUtils.isEmpty(dictList)) {
return Result.error("查询失败");
}
List<Object> list = Lists.newArrayList();
for (DictModel dictModel : dictList) {
String value = dictModel.getValue();
List<ConHealthInfo> questionList = composeConHealthInfo.selectHealthInfoListByItemArea(value);
if (!CollectionUtils.isEmpty(questionList)) {
Map<String, Object> map = new LinkedHashMap<>();
List<ConHealthInfoDO> res = Lists.newArrayList();
for (ConHealthInfo conHealthInfo : questionList) {
ConHealthInfoDO conHealthInfoDO = BeanUtil.toBean(conHealthInfo, ConHealthInfoDO.class);
ConHealthInfoAnswer conHealthInfoAnswer = conHealthInfoAnswerMapper.selectHealthAnswerByUserIdAndQuestionId(conHealthInfo.getId(), memberId);
if (conHealthInfoAnswer != null) {
JSONObject askOption = JSONObject.parseObject(conHealthInfo.getItemOptions(), Feature.OrderedField);
JSONObject answerOption = JSONObject.parseObject(conHealthInfoAnswer.getItemOptions(), Feature.OrderedField);
conHealthInfoDO.setAnswerContent(conHealthInfoAnswer.getAnswerContent());
conHealthInfoDO.setItemOptions(this.changeItemOptionUtil(askOption, answerOption));
}
res.add(conHealthInfoDO);
}
map.put("childList", res);
map.put("text", dictModel.getText());
map.put("value", dictModel.getValue());
list.add(map);
}
}
return Result.ok(list);
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> inserOrUpdatetHealthInfoAnswer(ConHealthInfoAnswerListDO conHealthInfoListDO) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ConHealthInfoAnswerDO> list = conHealthInfoListDO.getList();
for (ConHealthInfoAnswerDO conHealthInfoAnswerDO : list) {
ConHealthInfoAnswer i = conHealthInfoAnswerMapper.selectHealthAnswerByUserIdAndQuestionId(conHealthInfoAnswerDO.getId(), conHealthInfoAnswerDO.getMemberId());
ConHealthInfoAnswer conHealthInfoAnswer = BeanUtil.toBean(conHealthInfoAnswerDO, ConHealthInfoAnswer.class);
conHealthInfoAnswer.setBaseHealthId(conHealthInfoAnswerDO.getId());
ConHealthInfo conHealthInfo = conHealthInfoMapper.selectById(conHealthInfoAnswerDO.getId());
if (conHealthInfo != null) {
conHealthInfoAnswer.setItemProblem(conHealthInfo.getItemProblem());
conHealthInfoAnswer.setBaseHealthId(conHealthInfo.getId());
}
if (i != null) {
conHealthInfoAnswer.setId(i.getId());
this.updateHealthInfoAnswer(conHealthInfoAnswer);
} else {
insertHealthInfoAnswer(conHealthInfoAnswer, sysUser.getId());
}
}
return Result.ok("操作成功");
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> removeHealthInfo(String memberId) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
conHealthInfoAnswerMapper.deleteHealthAnswerByUserId(sysUser.getId(), memberId);
return Result.ok("删除成功");
}
@Override
public Result<List<ConHealthInfoAnswerSingleDO>> selectHealthInfoDoctor(String memberId) {
List<ConHealthInfoAnswer> list = conHealthInfoAnswerMapper.selectHealthAnswerByMemberId(memberId);
if (CollectionUtils.isEmpty(list)) {
return Result.error("该员工暂无健康信息");
}
List<ConHealthInfoAnswerSingleDO> answerList = com.google.common.collect.Lists.newArrayList();
for (ConHealthInfoAnswer conHealthInfoAnswer : list) {
String itemOption = conHealthInfoAnswer.getItemOptions();
String answerString = "";
if (StringUtils.hasLength(itemOption)) {
JSONObject aa = JSONObject.parseObject(itemOption);
for (Map.Entry<String, Object> entry : aa.entrySet()) {
if ("1".equals(entry.getValue())) {
answerString = answerString + entry.getKey() + " ";
}
}
}
if (!StringUtils.hasLength(answerString)) {
answerString = "";
}
ConHealthInfoAnswerSingleDO conHealthInfoAnswerSingleDO = new ConHealthInfoAnswerSingleDO();
conHealthInfoAnswerSingleDO.setAnswerKey(conHealthInfoAnswer.getItemProblem());
conHealthInfoAnswerSingleDO.setAnswerValue(answerString.toString());
answerList.add(conHealthInfoAnswerSingleDO);
}
return Result.ok(answerList);
}
@Transactional(rollbackFor = Exception.class)
public void insertHealthInfoAnswer(ConHealthInfoAnswer conHealthInfoAnswer, String userId) {
ConHealthInfoAnswer conHealthInfoAnswerNew = new ConHealthInfoAnswer();
conHealthInfoAnswerNew.setCreateTime(new Date());
conHealthInfoAnswerNew.setUserId(userId);
conHealthInfoAnswerNew.setBaseHealthId(conHealthInfoAnswer.getBaseHealthId());
conHealthInfoAnswerNew.setItemType(conHealthInfoAnswer.getItemType());
conHealthInfoAnswerNew.setItemOptions(conHealthInfoAnswer.getItemOptions());
conHealthInfoAnswerNew.setAnswerContent(conHealthInfoAnswer.getAnswerContent());
conHealthInfoAnswerNew.setMemberId(conHealthInfoAnswer.getMemberId());
conHealthInfoAnswerNew.setItemProblem(conHealthInfoAnswer.getItemProblem());
conHealthInfoAnswerMapper.insert(conHealthInfoAnswerNew);
}
@Transactional(rollbackFor = Exception.class)
public void updateHealthInfoAnswer(ConHealthInfoAnswer conHealthInfoAnswer) {
conHealthInfoAnswer.setUpdateTime(new Date());
conHealthInfoAnswerMapper.updateById(conHealthInfoAnswer);
}
public String changeItemOptionUtil(JSONObject askOption, JSONObject answerOption) {
for (Map.Entry<String, Object> entry : askOption.entrySet()) {
String aa = answerOption.getString(entry.getKey());
if (StringUtils.hasLength(aa) && "1".equals(aa)) {
entry.setValue("1");
}
}
return askOption.toJSONString();
}
}
@@ -0,0 +1,119 @@
package com.renkang.consultation.api.service.impl;
import com.aliyuncs.utils.StringUtils;
import com.renkang.consultation.api.service.ConHelperApiService;
import com.renkang.consultation.entity.ConHelper;
import com.renkang.consultation.mapper.ConHelperMapper;
import com.renkang.consultation.mapper.ConHelperSchedulingMapper;
import com.renkang.consultation.service.impl.ConSessionServiceImpl;
import com.renkang.consultation.util.DateUtils;
import com.renkang.consultation.vo.ConHelperCustomUserVO;
import com.renkang.im.api.IMHelloApi;
import com.renkang.im.entity.ConSessionRequestDO;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUserNew;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Service("conHelperApiService")
public class ConHelperApiServiceImpl implements ConHelperApiService {
@Autowired
private ConHelperSchedulingMapper conHelperSchedulingMapper;
@Autowired
private IMHelloApi iMHelloApi;
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired
private ConSessionServiceImpl conSessionServiceImpl;
@Autowired
private ConHelperMapper conHelperMapper;
@Override
public Result<String> selectHelperInfo() {
String helperUser = this.selectHelperUser();
if (StringUtils.isEmpty(helperUser)) {
return Result.error("暂无小助手在线");
}
return Result.ok(helperUser);
}
@Override
public Result<ConHelperCustomUserVO> selectHelperInfoDesc(String helpId) {
ConHelper conHelper = conHelperMapper.selectConHelperbyId(helpId);
if(conHelper == null){
return Result.error("小助手不存在");
}
conHelper.setUserName("全科医生");
ConHelperCustomUserVO conHelperCustomUserVO = new ConHelperCustomUserVO();
BeanUtils.copyProperties(conHelper,conHelperCustomUserVO);
return Result.OK(conHelperCustomUserVO);
}
@Override
public Result<Boolean> selectTfHelper(String helpId) {
ConHelper conHelper = conHelperMapper.selectConHelperbyId(helpId);
if(conHelper == null){
return Result.ok(false);
}
return Result.ok(true);
}
public String selectHelperUser() {
Date date = new Date();
int amOrPm = DateUtils.amOrPm(date);
int weekDay = DateUtils.weekDay(date);
List<String> list = conHelperSchedulingMapper.selectHelperInfo(weekDay, amOrPm);
if (CollectionUtils.isEmpty(list)) {
return "";
}
int aa = 0;
if (list.size() > 1) {
if (!stringRedisTemplate.hasKey("helperchooseNum")) {
stringRedisTemplate.opsForValue().set("helperchooseNum", "0");
}
aa = Integer.valueOf(stringRedisTemplate.opsForValue().get("helperchooseNum"));
if (list.size() - 1 == aa) {
stringRedisTemplate.opsForValue().set("helperchooseNum", "0");
} else {
stringRedisTemplate.opsForValue().increment("helperchooseNum");
}
}
LoginUserNew loginUserNew = conSessionServiceImpl.selectUserByAccount(list.get(aa));
if(loginUserNew == null){
return "";
}
ConSessionRequestDO conSessionRequestDO = new ConSessionRequestDO();
conSessionRequestDO.setAccountList(Collections.singletonList(loginUserNew));
iMHelloApi.accountReg(conSessionRequestDO);
return list.get(aa);
}
}
@@ -0,0 +1,64 @@
package com.renkang.consultation.api.service.impl;
import com.renkang.consultation.api.service.ConHospitalFollowApiService;
import com.renkang.consultation.api.storge.redis.ConHospitalFollowReidsTunnel;
import com.renkang.consultation.entity.ConHospitalFollow;
import com.renkang.consultation.mapper.ConHospitalFollowMapper;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@Service("conHospitalFollowApiService")
public class ConHospitalFollowApiServiceImpl implements ConHospitalFollowApiService {
@Autowired
private ConHospitalFollowMapper conHospitalFollowMapper;
@Autowired
private ConHospitalFollowReidsTunnel conHospitalFollowReidsTunnel;
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> followOrCancelHospital(String hospitalId) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
int i = conHospitalFollowMapper.selectFollowHospitalExist(sysUser.getId(), hospitalId);
if (i > 0) {
return Result.error("此医生已关注");
}
ConHospitalFollow conHospitalFollow = new ConHospitalFollow();
conHospitalFollow.setUserId(sysUser.getId());
conHospitalFollow.setHospitalId(hospitalId);
conHospitalFollow.setCreateTime(new Date());
conHospitalFollowMapper.insert(conHospitalFollow);
conHospitalFollowReidsTunnel.setFollowHospital(conHospitalFollow);
return Result.ok("关注成功");
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> cancelHospital(String hospitalId) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
int i = conHospitalFollowMapper.selectFollowHospitalExist(sysUser.getId(), hospitalId);
if (i == 0) {
return Result.error("未关注该医院");
}
conHospitalFollowMapper.cancelHospitalFollow(sysUser.getId(), hospitalId);
conHospitalFollowReidsTunnel.cancelFollowHospital(sysUser.getId(), hospitalId);
return Result.ok("取消成功");
}
}
@@ -0,0 +1,35 @@
package com.renkang.consultation.api.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.renkang.consultation.api.service.ConKnowledgeCategoryApiService;
import com.renkang.consultation.api.storge.ComposeConKnowledgeCategory;
import com.renkang.consultation.entity.ConKnowledgeCategory;
import com.renkang.consultation.entity.ConKnowledgeCategoryDO;
import org.apache.commons.compress.utils.Lists;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("conKnowledgeCategoryApiService")
public class ConKnowledgeCategoryServiceApiImpl implements ConKnowledgeCategoryApiService {
@Autowired
private ComposeConKnowledgeCategory composeConKnowledgeCategory;
@Override
public Result<List<ConKnowledgeCategoryDO>> selectKnowledgeCategory() {
List<ConKnowledgeCategoryDO> res = Lists.newArrayList();
List<ConKnowledgeCategory> list = composeConKnowledgeCategory.selectKnowledgeCategory();
if (CollectionUtil.isNotEmpty(list)) {
list.forEach(x -> res.add(BeanUtil.toBean(x, ConKnowledgeCategoryDO.class)));
}
return Result.ok(res);
}
}
@@ -0,0 +1,103 @@
package com.renkang.consultation.api.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.api.service.ConKnowledgeApiService;
import com.renkang.consultation.api.storge.ComposeConKnowledge;
import com.renkang.consultation.entity.ConKnowledge;
import com.renkang.consultation.entity.ConKnowledgeDO;
import com.renkang.consultation.entity.ConKnowledgeListDO;
import com.renkang.consultation.mapper.ConKnowledgeMapper;
import org.apache.commons.compress.utils.Lists;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("conKnowledgeApiService")
public class ConKnowledgeServiceApiImpl implements ConKnowledgeApiService {
@Autowired
private ConKnowledgeMapper conKnowledgeMapper;
@Autowired
private ComposeConKnowledge composeConKnowledge;
@Override
public Result<List<ConKnowledgeListDO>> selectKnowledgeRecommendList(int pageNo, int pageSize) {
Page<ConKnowledge> page = new Page<ConKnowledge>(pageNo, pageSize);
IPage<String> pageList = conKnowledgeMapper.selectKnowledgeList(page, null, "1", null);
List<String> list = pageList.getRecords();
List<ConKnowledgeListDO> result = Lists.newArrayList();
for (String s : list) {
ConKnowledge conKnowledge = composeConKnowledge.selectConKnowledgeById(s);
if (conKnowledge == null) {
continue;
}
result.add(BeanUtil.toBean(conKnowledge, ConKnowledgeListDO.class));
}
return Result.OK(result);
}
@Override
public Result<List<ConKnowledgeListDO>> selectKnowledgeListByClass(int pageNo, int pageSize, String classId) {
Page<ConKnowledge> page = new Page<ConKnowledge>(pageNo, pageSize);
IPage<String> pageList = conKnowledgeMapper.selectKnowledgeList(page, classId, null, null);
List<String> list = pageList.getRecords();
List<ConKnowledgeListDO> result = Lists.newArrayList();
for (String s : list) {
ConKnowledge conKnowledge = composeConKnowledge.selectConKnowledgeById(s);
if (conKnowledge == null) {
continue;
}
result.add(BeanUtil.toBean(conKnowledge, ConKnowledgeListDO.class));
}
return Result.OK(result);
}
@Override
public Result<ConKnowledgeDO> selectKnowledgeById(String id) {
ConKnowledge conKnowledge = composeConKnowledge.selectConKnowledgeById(id);
if (conKnowledge == null) {
return Result.error("数据不存在");
}
conKnowledge.setKnowLookNumber(conKnowledge.getKnowLookNumber() + 1);
conKnowledgeMapper.updateById(conKnowledge);
composeConKnowledge.insertConKnowledge(conKnowledge);
return Result.OK(BeanUtil.toBean(conKnowledge, ConKnowledgeDO.class));
}
@Override
public Result<List<ConKnowledgeListDO>> searchKnowledgeList(String title, int pageNo, int pageSize) {
Page<ConKnowledge> page = new Page<ConKnowledge>(pageNo, pageSize);
IPage<String> pageList = conKnowledgeMapper.selectKnowledgeList(page, null, null, title);
List<String> list = pageList.getRecords();
List<ConKnowledgeListDO> result = Lists.newArrayList();
for (String s : list) {
ConKnowledge conKnowledge = composeConKnowledge.selectConKnowledgeById(s);
if (conKnowledge == null) {
continue;
}
result.add(BeanUtil.toBean(conKnowledge, ConKnowledgeListDO.class));
}
return Result.OK(result);
}
}
@@ -0,0 +1,201 @@
package com.renkang.consultation.api.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.fastjson.JSONObject;
import com.renkang.consultation.api.service.ConMedicalRecordsApiService;
import com.renkang.consultation.entity.*;
import com.renkang.consultation.mapper.ConFamilyMembersMapper;
import com.renkang.consultation.mapper.ConHealthInfoAnswerMapper;
import com.renkang.consultation.mapper.ConMedicalRecordsMapper;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.util.DictUtil;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.AgeCalculateUtil;
import org.jeecg.config.shiro.ClientSignThreadLocal;
import org.parboiled.common.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
@Service("conMedicalRecordsApiService")
public class ConMedicalRecordsApiServiceImpl implements ConMedicalRecordsApiService {
@Autowired
private ConMedicalRecordsMapper conMedicalRecordsMapper;
@Autowired
private ConFamilyMembersMapper conFamilyMembersMapper;
@Autowired
private ConHealthInfoAnswerMapper conHealthInfoAnswerMapper;
@Autowired
private DictUtil dictUtil;
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> insertConMedicalRecords(ConMedicalRecordsDO conMedicalRecordsDO) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String memberId = conMedicalRecordsDO.getMemberId();
ConFamilyMembers conFamilyMembers = conFamilyMembersMapper.selectConFamilyMembersById(memberId);
if (conFamilyMembers == null) {
return Result.error("咨询人不存在,请确认后重新添加");
}
conMedicalRecordsDO.setState(null);
ConMedicalRecords conMedicalRecords = BeanUtil.toBean(conMedicalRecordsDO, ConMedicalRecords.class);
conMedicalRecords.setUserId(sysUser.getId());
conMedicalRecords.setUpdateTime(new Date());
if (StringUtils.isEmpty(conMedicalRecordsDO.getId())) {
conMedicalRecordsMapper.insert(conMedicalRecords);
} else {
conMedicalRecordsMapper.updateById(conMedicalRecords);
}
return Result.ok("添加成功");
}
@Override
public Result<ConMedicalRecordsDO> selectConMedicalRecordsById(String id) {
ConMedicalRecordsDO conMedicalRecordsDO = conMedicalRecordsMapper.selectConMedicalRecordsInfoById(id);
if (conMedicalRecordsDO != null) {
String haveTime = conMedicalRecordsDO.getHaveTime();
if (!StringUtils.isEmpty(haveTime)) {
String haveTimeValue = dictUtil.queryDictItemListByCodeAndType("medical_have_time", conMedicalRecordsDO.getHaveTime());
conMedicalRecordsDO.setHaveTimeValue(haveTimeValue);
}
//咨询模块发版
String tfllook = conMedicalRecordsDO.getTfLook();
if (!StringUtils.isEmpty(tfllook)) {
String tfLookValue = dictUtil.queryDictItemListByCodeAndType("tf_look_medical", tfllook);
conMedicalRecordsDO.setTfLookValue(tfLookValue);
}
}
return Result.ok(conMedicalRecordsDO);
}
@Override
public Result<Map<String, Object>> selectConMedicalRecordsByIdDoctor(String id) {
if (StringUtils.isEmpty(id)) {
return Result.error("请先选择档案");
}
Map<String, Object> map = new HashMap<>();
ConMedicalRecordsDO conMedicalRecordsDO = conMedicalRecordsMapper.selectConMedicalRecordsViewInfoById(id);
if (conMedicalRecordsDO == null) {
return Result.error("档案不存在");
}
if( StringUtil.equals(conMedicalRecordsDO.getTfQh(),"1")){
ClientSignThreadLocal.setClientSign(CommonConstant.QUARRY);
}
//咨询模块发版
String tfllook = conMedicalRecordsDO.getTfLook();
if (!StringUtils.isEmpty(tfllook)) {
String tfLookValue = dictUtil.queryDictItemListByCodeAndType("tf_look_medical", tfllook);
conMedicalRecordsDO.setTfLookValue(tfLookValue);
}
String haveTime = conMedicalRecordsDO.getHaveTime();
if (!StringUtils.isEmpty(haveTime)) {
String haveTimeValue = dictUtil.queryDictItemListByCodeAndType("medical_have_time", conMedicalRecordsDO.getHaveTime());
conMedicalRecordsDO.setHaveTimeValue(haveTimeValue);
}
ConFamilyMembersDO conFamilyMembersDO = conFamilyMembersMapper.selectConFamilyMembersDOById(conMedicalRecordsDO.getMemberId());
if (conFamilyMembersDO != null && conFamilyMembersDO.getBirthday() != null) {
conFamilyMembersDO.setAge(AgeCalculateUtil.getAge(conFamilyMembersDO.getBirthday()));
}
List<ConHealthInfoAnswer> list = conHealthInfoAnswerMapper.selectHealthAnswerByUserId(conMedicalRecordsDO.getUserId(), conMedicalRecordsDO.getMemberId());
List<ConHealthInfoAnswerSingleDO> answerList = new ArrayList<>();
for (ConHealthInfoAnswer conHealthInfoAnswer : list) {
String itemOption = conHealthInfoAnswer.getItemOptions();
String answerString = "";
if (StringUtils.isNotEmpty(itemOption)) {
JSONObject aa = JSONObject.parseObject(itemOption);
for (Map.Entry<String, Object> entry : aa.entrySet()) {
if ("1".equals(entry.getValue())) {
answerString = answerString + entry.getKey() + " ";
}
}
}
if (StringUtil.equals(conHealthInfoAnswer.getItemType(), "4") && StringUtil.isNotEmpty(conHealthInfoAnswer.getAnswerContent())) {
answerString = conHealthInfoAnswer.getAnswerContent();
}
if (StringUtils.isEmpty(answerString)) {
answerString = "";
}
ConHealthInfoAnswerSingleDO conHealthInfoAnswerSingleDO = new ConHealthInfoAnswerSingleDO();
conHealthInfoAnswerSingleDO.setAnswerKey(conHealthInfoAnswer.getItemProblem());
conHealthInfoAnswerSingleDO.setAnswerValue(answerString.toString());
answerList.add(conHealthInfoAnswerSingleDO);
}
map.put("conFamilyMembersDO", conFamilyMembersDO);
map.put("conMedicalRecordsDO", conMedicalRecordsDO);
map.put("answer", answerList);
return Result.ok(map);
}
@Override
public Result<List<ConMedicalRecordsListDO>> selectConMedicalRecordsByMemberId(String memberId) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ConMedicalRecordsListDO> conMedicalRecordsListDO = new ArrayList<>();
if (StringUtils.isEmpty(memberId)) {
conMedicalRecordsListDO = conMedicalRecordsMapper.selectConMedicalRecordsByMemberId(sysUser.getId());
ConFamilyMembersDO conFamilyMembersDO = conFamilyMembersMapper.selectConFamilyMembersDOById(sysUser.getId());
if (conFamilyMembersDO != null) {
conMedicalRecordsListDO.forEach(x -> {
x.setAge("0");
if (conFamilyMembersDO.getBirthday() != null) {
x.setAge(String.valueOf(AgeCalculateUtil.getAge(conFamilyMembersDO.getBirthday())));
}
x.setName(conFamilyMembersDO.getName());
x.setGender(conFamilyMembersDO.getGender());
});
}
} else {
conMedicalRecordsListDO = conMedicalRecordsMapper.selectConMedicalRecordsByMemberId(memberId);
ConFamilyMembersDO conFamilyMembersDO = conFamilyMembersMapper.selectConFamilyMembersDOById(memberId);
if (conFamilyMembersDO != null) {
conMedicalRecordsListDO.forEach(x -> {
x.setAge("0");
if (conFamilyMembersDO.getBirthday() != null) {
x.setAge(String.valueOf(AgeCalculateUtil.getAge(conFamilyMembersDO.getBirthday())));
}
x.setName(conFamilyMembersDO.getName());
x.setGender(conFamilyMembersDO.getGender());
});
}
}
return Result.ok(conMedicalRecordsListDO);
}
}
@@ -0,0 +1,101 @@
package com.renkang.consultation.api.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.renkang.consultation.api.RedisConstants;
import com.renkang.consultation.api.service.ConNoticeApiService;
import com.renkang.consultation.dto.NoticeOnOrOff;
import com.renkang.consultation.entity.ConNotice;
import com.renkang.consultation.entity.ConNoticeDO;
import com.renkang.consultation.mapper.ConNoticeMapper;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("conNoticeApiService")
public class ConNoticeServiceApiImpl implements ConNoticeApiService {
@Autowired
private ConNoticeMapper conNoticeMapper;
@Autowired
private RedisTemplate redisTemplate;
@Override
public Result<ConNoticeDO> selectUserNotice(String type) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userId = sysUser.getId();
if (redisTemplate.hasKey(RedisConstants.NOTICE_USER_TF.getKey(userId, type))) {
return Result.ok();
}
ConNotice conNotice = conNoticeMapper.selectNoticeByType(type);
if (conNotice != null) {
return Result.ok(BeanUtil.copyProperties(conNotice, ConNoticeDO.class));
}
return Result.ok();
}
@Override
public Result<String> chooseToDontShowUp(String id, String notShow) {
RedisConstants redisKey = RedisConstants.NOTICE_USER_TF;
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userId = sysUser.getId();
ConNotice conNotice = conNoticeMapper.selectById(id);
if (conNotice == null) {
return Result.error("信息不存在");
}
redisTemplate.opsForValue().set(redisKey.getKey(userId, conNotice.getType()), "1");
if ("0".equals(notShow)) {
redisTemplate.expire(redisKey.getKey(userId, conNotice.getType()), 7, redisKey.getTimeUnit());
}
if ("1".equals(notShow)) {
redisTemplate.expire(redisKey.getKey(userId, conNotice.getType()), 30, redisKey.getTimeUnit());
}
if ("2".equals(notShow)) {
redisTemplate.expire(redisKey.getKey(userId, conNotice.getType()), 180, redisKey.getTimeUnit());
}
return Result.ok();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void on(NoticeOnOrOff notice) {
ConNotice conNotice = conNoticeMapper.selectById(notice.getId());
if (conNotice == null) {
throw new RuntimeException("非法参数请求");
}
if (conNotice.getNoticeType() == null) {
throw new RuntimeException("数据错乱,请联系管理员");
}
// 修改自己为启用
LambdaUpdateWrapper<ConNotice> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(ConNotice::getId, notice.getId())
.set(ConNotice::getStatus, CommonConstant.STATUS_1);
conNoticeMapper.update(null, updateWrapper);
// 修改其他为禁用
LambdaUpdateWrapper<ConNotice> updateWrapperOther = new LambdaUpdateWrapper<>();
updateWrapperOther.eq(ConNotice::getNoticeType, conNotice.getNoticeType())
.ne(ConNotice::getId, notice.getId())
.set(ConNotice::getStatus, CommonConstant.STATUS_2);
conNoticeMapper.update(null, updateWrapperOther);
}
}
@@ -0,0 +1,177 @@
package com.renkang.consultation.api.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.aliyuncs.utils.StringUtils;
import com.renkang.consultation.api.service.ConResourceApiService;
import com.renkang.consultation.entity.*;
import com.renkang.consultation.mapper.*;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.util.DictUtil;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.config.vo.HttpResult;
import org.jeecg.util.HttpClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
@Service("conResourceApiService")
public class ConResourceApiServiceImpl implements ConResourceApiService {
@Autowired
private ConResourceMapper conResourceMapper;
@Autowired
private DictUtil dictUtil;
@Autowired
private ConDepartmentMapper conDepartmentMapper;
@Autowired
private ConSicksMapper conSicksMapper;
@Autowired
private ConDoctorMapper conDoctorMapper;
@Autowired
private ConHospitalFollowMapper conHospitalFollowMapper;
@Autowired
private HospitalDepartmentMapper hospitalDepartmentMapper;
@Autowired
private ConEvaluateMapper conEvaluateMapper;
@Autowired
private HttpClientUtil httpClientUtil;
@Override
public Result<ConResourceDO> hospitalDetail(String id) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (StringUtils.isEmpty(id)) {
return Result.error("请选择医院");
}
ConResource consultResidentHospital = conResourceMapper.selectConResourceById(id);
if (consultResidentHospital == null) {
return Result.error("医院不存在");
}
String level = dictUtil.queryDictItemListByCodeAndType("hospital_level", consultResidentHospital.getLevel());
consultResidentHospital.setLevel(level);
ConResourceDO conResourceDO = BeanUtil.copyProperties(consultResidentHospital, ConResourceDO.class);
conResourceDO.setDepartmentNum(conDepartmentMapper.selectDepartmentNum());
conResourceDO.setDoctorNum(conDoctorMapper.selectDoctorNum(id));
conResourceDO.setTfFollow("0");
if (sysUser != null) {
String userId = sysUser.getId();
int existHostital = conHospitalFollowMapper.selectFollowHospitalExist(userId, id);
if (existHostital > 0) {
conResourceDO.setTfFollow("1");
}
}
return Result.ok(conResourceDO);
}
@Override
public Result<Map<String, String>> selectHostitalAverageScore(String hospitalId) {
Map<String, String> map = new HashMap<>();
if (StringUtils.isEmpty(hospitalId)) {
return Result.error("请选择医院");
}
ConResource consultResidentHospital = conResourceMapper.selectConResourceById(hospitalId);
if (consultResidentHospital == null) {
return Result.error("医院不存在");
}
BigDecimal userScore = new BigDecimal(consultResidentHospital.getUserScore());
BigDecimal userScoreNum = new BigDecimal(consultResidentHospital.getUserScoreNum());
map.put("score", "0");
if (userScoreNum.compareTo(new BigDecimal(0)) > 0) {
String score = userScore.divide(userScoreNum, 2, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_HALF_DOWN).toPlainString();
map.put("score", score);
}
map.put("userScoreNum", conEvaluateMapper.selectHospitalEvNum(hospitalId));
return Result.ok(map);
}
@Override
public Result<Map<String, Object>> selectHospitalList() {
Map<String, Object> map = new HashMap<>();
List<ConResourceDO> list = conResourceMapper.selectHospitalList();
List<ConDepartmentDO> depart = conDepartmentMapper.selectDepartmentNameByParentId("0", null);
List<ConSicksDO> sickList = conSicksMapper.selectSickListByDepartmentId(null);
map.put("hostitalList", list);
map.put("departList", depart);
map.put("sickList", sickList);
return Result.ok(map);
}
@Override
public Result<Map<String, Object>> testData() {
// List<ConResource> list = conResourceMapper.selectResourceList();
// List<ConDepartment> departList = conDepartmentMapper.selectListLeval();
// for (ConResource conResource : list) {
//
// for (ConDepartment conDepartment : departList) {
// HospitalDepartment hospitalDepartment = new HospitalDepartment();
// hospitalDepartment.setDepartmentId(conDepartment.getId());
// hospitalDepartment.setHospitalId(conResource.getId());
// hospitalDepartment.setSort("0");
// hospitalDepartment.setCreateTime(new Date());
// hospitalDepartmentMapper.insert(hospitalDepartment);
// }
//
// }
List<String> sslist = new ArrayList<>();
List<ConDepartmentDO> list =conDepartmentMapper.selectDepartmentNameByParentId("0",null);
for (ConDepartmentDO conDepartmentDO : list) {
String departmentId = conDepartmentDO.getId();
String child = conDepartmentMapper.selectDepartmentIdByLevelOneId(departmentId);
if(!StringUtils.isEmpty(child)){
departmentId = departmentId+","+child;
}
int abc = conDoctorMapper.selectDoctorNumByDepartmentId(departmentId);
if(abc > 0){
sslist.add(conDepartmentDO.getDepartmentName()+":"+abc);
}
}
for (String s : sslist) {
System.out.println(s);
}
return Result.ok();
}
@Override
public Result<Map<String, Object>> selectHospitalListVersionTwo() {
Map<String, Object> map = new HashMap<>();
List<ConResourceDO> list = conResourceMapper.selectHospitalListVersionTwo();
map.put("hostitalList", list);
return Result.ok(map);
}
}
@@ -0,0 +1,77 @@
package com.renkang.consultation.api.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.renkang.consultation.api.service.ConServiceApiService;
import com.renkang.consultation.entity.ConService;
import com.renkang.consultation.mapper.ConDoctorMapper;
import com.renkang.consultation.mapper.ConServiceMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.DateUtils;
import org.jeecg.global.GlobalUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @author Junqiang Zhu
* @date 2023-06-06 10:22
*/
@Service("conServiceApiService")
public class ConServiceApiServiceImpl implements ConServiceApiService {
@Autowired
private ConServiceMapper conServiceMapper;
@Autowired
private ConDoctorMapper conDoctorMapper;
@Autowired
private ConSessionApiServiceImpl conSessionApiServiceImpl;
@Override
public void add(ConService data) {
if (ObjectUtil.isNull(data.getStartDay())
|| ObjectUtil.isNull(data.getEndDay())) {
throw new RuntimeException("请确认事件后重新提交");
}
LoginUser loginUser = GlobalUtils.getLoginUser();
List<ConService> list = getConService(loginUser);
// if (CollectionUtils.isEmpty(list)) {
// conServiceMapper.insert(data);
// return;
// }
for (ConService service : list) {
boolean startContain = DateUtils.contain(service.getStartDay(), service.getEndDay(), data.getStartDay());
boolean endContain = DateUtils.contain(service.getStartDay(), service.getEndDay(), data.getEndDay());
if (startContain || endContain) {
throw new RuntimeException("时间有重叠,请检查已有停诊时间");
}
}
data.setDoctorId(loginUser.getId());
// 新增
conServiceMapper.insert(data);
Date startDate = data.getStartDay();
Date endDate = data.getEndDay();
Date date = com.renkang.consultation.util.DateUtils.changeDate(new Date());
if (date.getTime() >= startDate.getTime() && date.getTime() <= endDate.getTime()) {
conDoctorMapper.changeDoctorStatus(loginUser.getId());
conSessionApiServiceImpl.doctorStopSessionByDoctorId(loginUser.getId(),startDate, endDate);
}
}
private List<ConService> getConService(LoginUser loginUser) {
LambdaQueryWrapper<ConService> lambdaQueryWrapper = GlobalUtils.getLambdaQueryWrapper();
lambdaQueryWrapper.eq(ConService::getDoctorId, loginUser.getId())
// 服务状态 0停诊中 1结束停诊
.eq(ConService::getServiceStatus, "0");
return conServiceMapper.selectList(lambdaQueryWrapper);
}
}
@@ -0,0 +1,109 @@
package com.renkang.consultation.api.service.impl;
import com.alibaba.druid.util.StringUtils;
import com.renkang.consultation.api.service.ConSessionApiService;
import com.renkang.consultation.api.service.ConSessionReservationApiService;
import com.renkang.consultation.entity.ConCostLog;
import com.renkang.consultation.entity.ConSession;
import com.renkang.consultation.entity.ConSessionReservationDate;
import com.renkang.consultation.entity.ConSessionReservationDateDO;
import com.renkang.consultation.mapper.ConSessionMapper;
import com.renkang.consultation.mapper.ConSessionReservationDateMapper;
import com.renkang.consultation.service.impl.ConCostLogServiceImpl;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
import java.util.List;
@Service("conSessionReservationApiService")
public class ConSessionReservationApiServiceImpl implements ConSessionReservationApiService {
@Autowired
private ConSessionReservationDateMapper conSessionReservationDateMapper;
@Autowired
private ConSessionMapper conSessionMapper;
@Autowired
private ConSessionApiServiceImpl conSessionApiServiceImpl;
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> sessionReservationDate(String id, String type, String startTime, String endTime) {
ConSession conSession = conSessionMapper.selectConSessionByIdView(id);
if (conSession == null) {
return Result.error("预约不存在");
}
ConSessionReservationDate conSessionReservationDate = new ConSessionReservationDate();
conSessionReservationDate.setStartTime(new Date());
if (StringUtils.equals(type, "1")) {
if (StringUtils.isEmpty(startTime) || StringUtils.isEmpty(endTime)) {
return Result.error("开始时间结束时间不能为空");
}
conSessionReservationDate.setStartTime(new Date(Long.valueOf(startTime)));
conSessionReservationDate.setEndTime(new Date(Long.valueOf(endTime)));
}
conSessionReservationDate.setType(type);
conSessionReservationDate.setSessionId(id);
conSessionReservationDateMapper.insert(conSessionReservationDate);
return Result.ok(conSessionReservationDate.getId());
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> endPhone(String id) {
ConSessionReservationDate conSessionReservationDate = conSessionReservationDateMapper.selectById(id);
if (conSessionReservationDate == null) {
return Result.error("通话不存在");
}
Date nowTime = getNowTime();
conSessionReservationDate.setEndTime(nowTime);
conSessionReservationDateMapper.updateById(conSessionReservationDate);
String sessionId = conSessionReservationDate.getSessionId();
ConSession conSession = conSessionMapper.selectConSessionById(sessionId);
conSessionApiServiceImpl.changeSessionMoney(conSession,nowTime);
return Result.ok();
}
public Date getNowTime(){
// 获取当前时间的Instant对象
Instant now = Instant.now();
// 将Instant对象转换为东八区的ZonedDateTime对象
ZonedDateTime zonedDateTime = now.atZone(ZoneId.of("Asia/Shanghai"));
// 将LocalDateTime对象转换为Date对象
Date date = Date.from(zonedDateTime.toInstant());
return date;
}
public List<ConSessionReservationDateDO> selectReservationDateAndVideoList(String sessionId) {
List<ConSessionReservationDateDO> list = conSessionReservationDateMapper.selectConSessionVideoBySessionId(sessionId);
return list;
}
}
@@ -0,0 +1,155 @@
package com.renkang.consultation.api.service.impl;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.druid.util.StringUtils;
import com.renkang.consultation.api.service.ConSessionVideoInfoApiService;
import com.renkang.consultation.entity.ConDoctorSatisfy;
import com.renkang.consultation.entity.ConSession;
import com.renkang.consultation.entity.ConSessionVideoInfo;
import com.renkang.consultation.entity.ConSessionVideoInfoDO;
import com.renkang.consultation.mapper.ConDoctorMapper;
import com.renkang.consultation.mapper.ConSessionMapper;
import com.renkang.consultation.mapper.ConSessionVideoInfoMapper;
import com.renkang.im.api.IMHelloApi;
import com.renkang.im.entity.ConSessionRequestDO;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.system.vo.LoginUserNew;
import org.jeecg.config.shiro.ClientSignThreadLocal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.concurrent.CompletableFuture;
@Service("conSessionVideoInfoApiService")
public class ConSessionVideoInfoApiServiceImpl implements ConSessionVideoInfoApiService {
@Autowired
private ConSessionVideoInfoMapper conSessionVideoInfoMapper;
@Autowired
private ConSessionMapper conSessionMapper;
@Autowired
private IMHelloApi iMHelloApi;
@Autowired
private ConDoctorMapper conDoctorMapper;
@Autowired
private ConDoctorApiServiceImpl conDoctorApiServiceImpl;
@Autowired
private ConSessionApiServiceImpl conSessionApiServiceImpl;
@Transactional(rollbackFor = Exception.class)
@Override
public Result<Map<String, Object>> startVideoSession(String sessionId) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String groupId = "";
ConSession conSession = conSessionMapper.selectConSessionByIdView(sessionId);
if (conSession == null) {
return Result.error("预约不存在");
}
groupId = conSession.getImId();
if (StringUtils.equals(conSession.getSessionStatus(), "1") && StringUtils.equals(conSession.getSessionStatus(), "5")) {
return Result.error("专家不能接受预约");
}
String toAccount = conSession.getToAccount();
if (!sysUser.getId().equals(toAccount)) {
return Result.error("只能由专家发起视频通话");
}
if( StringUtil.equals(conSession.getTfQh(),"1")){
ClientSignThreadLocal.setClientSign(CommonConstant.QUARRY);
}
List<ConSessionVideoInfoDO> list = conSessionVideoInfoMapper.selectConSessionVideoById(sessionId);
List<String> userList = new ArrayList<>(2);
if (CollectionUtils.isEmpty(list)) {
List<String> yesIds = new ArrayList<>();
yesIds.add(conSession.getFromAccount());
if (!StringUtils.isEmpty(conSession.getThirdAccount())) {
yesIds.add(conSession.getThirdAccount());
}
ConSessionRequestDO conSessionRequestDO = conSessionApiServiceImpl.selectConSessionRequestDO(yesIds,conSession.getToAccount(),"咨询");
conSessionRequestDO.setUserId(conSession.getToAccount());
Result<Map<String, Object>> imrs = iMHelloApi.creatGroupMagNew(conSessionRequestDO);
groupId = (String) imrs.getResult().get("groupId");
conSessionMapper.updateSessionStatusByIdOnly(sessionId, "3", groupId);
ConDoctorSatisfy conDoctorSatisfy = conDoctorMapper.selectConDoctorSatisfyQhByDoctorIdNew(conSession.getToAccount());
if (conDoctorSatisfy == null) {
conDoctorApiServiceImpl.initDoctorJudgment(conSession.getToAccount());
}
conDoctorMapper.addDoctorReplyNumBackUp(conSession.getToAccount());
conDoctorMapper.addDoctorReplyNum(conSession.getToAccount());
}
ConSessionVideoInfo conSessionVideoInfo = new ConSessionVideoInfo();
conSessionVideoInfo.setSessionId(sessionId);
conSessionVideoInfo.setCreateTime(new Date());
conSessionVideoInfo.setImId(groupId);
conSessionVideoInfoMapper.insert(conSessionVideoInfo);
Map res = new HashMap<>();
res.put("userId", sysUser.getId());
res.put("groupId", groupId);
userList.add(conSession.getFromAccount());
if (!StringUtils.isEmpty(conSession.getThirdAccount())) {
userList.add(conSession.getThirdAccount());
}
res.put("member", userList);
res.put("videoSessionId", conSessionVideoInfo.getId());
return Result.OK(res);
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> endVideoSession(String sessionId) {
ConSession conSession = conSessionMapper.selectConSessionByIdView(sessionId);
if (conSession == null) {
return Result.error("预约不存在");
}
if(StringUtil.equals(conSession.getTfQh(),"1")){
ClientSignThreadLocal.setClientSign(CommonConstant.QUARRY);
}
ConSessionVideoInfo conSessionVideoInfo = conSessionVideoInfoMapper.selectConSessionVideoOnlyById(sessionId);
if (conSessionVideoInfo == null) {
return Result.error("聊天不存在");
}
conSessionVideoInfo.setEndTime(new Date());
conSessionVideoInfoMapper.updateById(conSessionVideoInfo);
conSessionMapper.updateSessionStatusById(sessionId, "5", conSession.getGroupId());
return Result.ok();
}
}
@@ -0,0 +1,124 @@
package com.renkang.consultation.api.service.impl;
import com.renkang.consultation.api.service.ConSicksApiService;
import com.renkang.consultation.entity.ConSicks;
import com.renkang.consultation.entity.ConSicksDO;
import com.renkang.consultation.mapper.ConDepartmentMapper;
import com.renkang.consultation.mapper.ConDoctorMapper;
import com.renkang.consultation.mapper.ConSicksMapper;
import com.xkcoding.http.util.StringUtil;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
@Service("conSicksApiService")
public class ConSicksApiServiceImpl implements ConSicksApiService {
@Autowired
private ConSicksMapper conSicksMapper;
@Autowired
private ConDoctorMapper conDoctorMapper;
@Autowired
private ConDepartmentMapper conDepartmentMapper;
@Autowired
private RedisUtil redisUtil;
/**
* 根据科室list查询疾病
*
* @param departmentId 科室id
* @return
*/
@Override
public Result<List<ConSicksDO>> selectSickListByDepartmentId(String departmentId) {
String key = "";
if (StringUtils.pathEquals(departmentId,"0")) {
key = "consulation:sickHaveDoctor:all";
}else{
key = "consulation:sickHaveDoctor:department:"+departmentId;
}
List<Object> redisList = redisUtil.lGet(key,0,-1);
if(CollectionUtils.isEmpty(redisList)){
return Result.ok(Collections.emptyList());
}
List<ConSicksDO> departmentList = redisList.stream().filter(obj -> obj instanceof ConSicksDO).map(obj -> (ConSicksDO) obj).collect(Collectors.toList());
return Result.ok(departmentList);
}
@Override
public List<ConSicks> selectSickByTopAndHaveDoctor() {
List<ConSicks> list = conSicksMapper.selectSickByTopAndHaveDoctor();
for (ConSicks conSicks : list) {
int aa = conDoctorMapper.selectDoctorNumBySickId(conSicks.getId());
conSicks.setDoctorNum(aa);
}
return list;
}
@Override
public Result<Map<String, Object>> selectSickListByDepartmentIdNew(String departmentId) {
if (StringUtil.isEmpty(departmentId)) {
return Result.ok();
}
Map<String,Object> map = new HashMap<>();
List<ConSicksDO> newList = new ArrayList<>();
int allDoctorNum = 0;
if (!"0".equals(departmentId)){
String levelTwoDepartment = conDepartmentMapper.selectDepartmentIdByLevelOneId(departmentId);
if (!com.aliyuncs.utils.StringUtils.isEmpty(levelTwoDepartment)) {
departmentId = departmentId + "," + levelTwoDepartment;
}
}
List<ConSicksDO> list = conSicksMapper.selectSickListByDepartmentId(departmentId);
for (ConSicksDO conSicksDO : list) {
int doctorNum = conDoctorMapper.selectDoctorNumBySickId(conSicksDO.getId());
conSicksDO.setDoctorNum(doctorNum);
if(doctorNum > 0){
newList.add(conSicksDO);
allDoctorNum = allDoctorNum + Integer.valueOf(doctorNum);
}
}
map.put("list",newList);
map.put("allDoctorNum",allDoctorNum);
return Result.ok(map);
}
@Override
public Result<List<ConSicksDO>> selectSickListByDepartmentIdDoctorSearch(String departmentId) {
if (StringUtil.isEmpty(departmentId)) {
return Result.ok();
}
if (!"0".equals(departmentId)){
String levelTwoDepartment = conDepartmentMapper.selectDepartmentIdByLevelOneId(departmentId);
if (!com.aliyuncs.utils.StringUtils.isEmpty(levelTwoDepartment)) {
departmentId = departmentId + "," + levelTwoDepartment;
}
}
List<ConSicksDO> list = conSicksMapper.selectSickListByDepartmentId(departmentId);
return Result.ok(list);
}
}
@@ -0,0 +1,69 @@
package com.renkang.consultation.api.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.aliyuncs.utils.StringUtils;
import com.renkang.consultation.api.service.ConsultResidentHospitalApiService;
import com.renkang.consultation.entity.ConsultResidentHospital;
import com.renkang.consultation.entity.ConsultResidentHospitalDO;
import com.renkang.consultation.mapper.ConsultResidentHospitalMapper;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.util.DictUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
@Service("consultResidentHospitalApiService")
public class ConsultResidentHospitalApiServiceImpl implements ConsultResidentHospitalApiService {
@Autowired
private ConsultResidentHospitalMapper consultResidentHospitalMapper;
@Autowired
private DictUtil dictUtil;
@Override
public Result<ConsultResidentHospitalDO> hospitalDetail(String id) {
if (StringUtils.isEmpty(id)) {
return Result.error("请选择医院");
}
ConsultResidentHospital consultResidentHospital = consultResidentHospitalMapper.selectById(id);
if (consultResidentHospital == null) {
return Result.error("医院不存在");
}
String level = dictUtil.queryDictItemListByCodeAndType("hospital_level", consultResidentHospital.getLevel());
consultResidentHospital.setLevel(level);
return Result.ok(BeanUtil.copyProperties(consultResidentHospital, ConsultResidentHospitalDO.class));
}
@Override
public Result<Map<String, String>> selectHostitalAverageScore(String hospitalId) {
Map<String, String> map = new HashMap<>();
if (StringUtils.isEmpty(hospitalId)) {
return Result.error("请选择医院");
}
ConsultResidentHospital consultResidentHospital = consultResidentHospitalMapper.selectById(hospitalId);
if (consultResidentHospital == null) {
return Result.error("医院不存在");
}
BigDecimal userScore = new BigDecimal(consultResidentHospital.getUserScore());
BigDecimal userScoreNum = new BigDecimal(consultResidentHospital.getUserScoreNum());
String score = userScore.divide(userScoreNum, 2, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_HALF_DOWN).toPlainString();
map.put("score", score);
map.put("userScoreNum", consultResidentHospital.getUserScoreNum());
return Result.ok(map);
}
}
@@ -0,0 +1,37 @@
package com.renkang.consultation.api.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.api.service.MsgRecordApiService;
import com.renkang.consultation.entity.ConKnowledge;
import com.renkang.consultation.entity.MsgRecord;
import com.renkang.consultation.mapper.MsgRecordMapper;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class MsgRecordApiServiceImpl implements MsgRecordApiService {
@Autowired
private MsgRecordMapper msgRecordMapper;
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Override
public Result<List<MsgRecord>> selectMsgRecordList(String usetId, int pageNo, int pageSize) {
Page<ConKnowledge> page = new Page<ConKnowledge>(pageNo, pageSize);
List<MsgRecord> list = msgRecordMapper.selectMsgRecordList(page, usetId);
return Result.ok(list);
}
@Override
public Result<Boolean> selectTokenExpire(String token) {
String key = "prefix_user_token:" + token;
return Result.ok(stringRedisTemplate.hasKey(key));
}
}
@@ -0,0 +1,37 @@
package com.renkang.consultation.api.storge;
import com.renkang.consultation.api.storge.redis.ConHealthInfoRedisTunnel;
import com.renkang.consultation.entity.ConHealthInfo;
import com.renkang.consultation.mapper.ConHealthInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class ComposeConHealthInfo {
@Autowired
private ConHealthInfoRedisTunnel conHealthInfoRedisTunnel;
@Autowired
private ConHealthInfoMapper conHealthInfoMapper;
public List<ConHealthInfo> selectHealthInfoListByItemArea(String type) {
// List<ConHealthInfo> list = conHealthInfoRedisTunnel.selectConHealthInfoByType(type);
// if(CollectionUtils.isEmpty(list)){
List<ConHealthInfo> list = conHealthInfoMapper.selectHealthInfoListByItemArea(type);
// if(!CollectionUtils.isEmpty(list)){
// conHealthInfoRedisTunnel.insertConHealthInfoByType(list,type);
// }
// }
return list;
}
}
@@ -0,0 +1,34 @@
package com.renkang.consultation.api.storge;
import com.renkang.consultation.api.RedisConstants;
import com.renkang.consultation.entity.ConKnowledge;
import com.renkang.consultation.mapper.ConKnowledgeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Repository;
@Repository
public class ComposeConKnowledge {
@Autowired
private ConKnowledgeMapper conKnowledgeMapper;
@Autowired
private RedisTemplate redisTemplate;
public ConKnowledge selectConKnowledgeById(String id) {
ConKnowledge conKnowledge = conKnowledgeMapper.selectConKnowledgeById(id);
return conKnowledge;
}
public void insertConKnowledge(ConKnowledge conKnowledge) {
RedisConstants redisKey = RedisConstants.KNOWLEDGE_INFO;
redisTemplate.opsForValue().set(redisKey.getKey(conKnowledge.getId()), conKnowledge, redisKey.getExpire(), redisKey.getTimeUnit());
}
}
@@ -0,0 +1,29 @@
package com.renkang.consultation.api.storge;
import com.renkang.consultation.api.storge.db.ConKnowledgeCategoryDbTunnel;
import com.renkang.consultation.api.storge.redis.ConKnowledgeCategoryRedisTunnel;
import com.renkang.consultation.entity.ConKnowledgeCategory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class ComposeConKnowledgeCategory {
@Autowired
private ConKnowledgeCategoryRedisTunnel conKnowledgeCategoryRedisTunnel;
@Autowired
private ConKnowledgeCategoryDbTunnel conKnowledgeCategoryDbTunnel;
public List<ConKnowledgeCategory> selectKnowledgeCategory() {
List<ConKnowledgeCategory> list = conKnowledgeCategoryDbTunnel.selectKnowledgeCategory();
return list;
}
}
@@ -0,0 +1,30 @@
package com.renkang.consultation.api.storge.db;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.renkang.consultation.entity.ConKnowledgeCategory;
import com.renkang.consultation.mapper.ConKnowledgeCategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class ConKnowledgeCategoryDbTunnel {
@Autowired
private ConKnowledgeCategoryMapper conKnowledgeCategoryMapper;
public List<ConKnowledgeCategory> selectKnowledgeCategory() {
LambdaQueryWrapper<ConKnowledgeCategory> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ConKnowledgeCategory::getDelFlag, "0");
queryWrapper.eq(ConKnowledgeCategory::getStatus, "1");
queryWrapper.orderByDesc(ConKnowledgeCategory::getSort);
List<ConKnowledgeCategory> list = conKnowledgeCategoryMapper.selectList(queryWrapper);
return list;
}
}
@@ -0,0 +1,49 @@
package com.renkang.consultation.api.storge.redis;
import com.renkang.consultation.api.RedisConstants;
import com.renkang.consultation.entity.ConDoctorFollow;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.stereotype.Repository;
@Repository
public class ConDoctorFollowReidsTunnel {
@Autowired
private RedisTemplate redisTemplate;
//关注医生
public void setFollowDoctor(ConDoctorFollow conDoctorFollow) {
ZSetOperations<String, String> reds = redisTemplate.opsForZSet();
String myFollowUserKey = RedisConstants.MY_FOLLOW_DOCTOR_ZSET.getKey(conDoctorFollow.getUserId());
reds.add(myFollowUserKey, conDoctorFollow.getDoctorId(), conDoctorFollow.getCreateTime().getTime());
// String followMyUserKey = RedisConstants.FOLLOW_MY_ZSET.getKey(conDoctorFollow.getDoctorId());
// reds.add(followMyUserKey, conDoctorFollow.getUserId(), conDoctorFollow.getCreateTime().getTime());
}
public void cancelFollowUser(String userId, String doctorId) {
ZSetOperations<String, String> reds = redisTemplate.opsForZSet();
//我关注的用户
String myFollowUserKey = RedisConstants.MY_FOLLOW_DOCTOR_ZSET.getKey(userId);
reds.remove(myFollowUserKey, doctorId);
//被关注的用户
// String followMyUserKey = RedisConstants.FOLLOW_MY_ZSET.getKey(doctorId);
// reds.remove(followMyUserKey, userId);
}
public Double tfFollowDoctor(String userId, String doctorId) {
ZSetOperations<String, String> reds = redisTemplate.opsForZSet();
String myFollowUserKey = RedisConstants.MY_FOLLOW_DOCTOR_ZSET.getKey(userId);
return reds.score(myFollowUserKey, doctorId);
}
}
@@ -0,0 +1,36 @@
package com.renkang.consultation.api.storge.redis;
import com.renkang.consultation.api.RedisConstants;
import com.renkang.consultation.entity.ConHealthInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class ConHealthInfoRedisTunnel {
@Autowired
private RedisTemplate redisTemplate;
public List<ConHealthInfo> selectConHealthInfoByType(String type) {
String key = RedisConstants.HEALTH_INFO.getKey(type);
if (redisTemplate.hasKey(key)) {
return redisTemplate.opsForList().range(key, 0, -1);
}
return null;
}
public void insertConHealthInfoByType(List<ConHealthInfo> list, String type) {
RedisConstants aa = RedisConstants.HEALTH_INFO;
redisTemplate.opsForList().rightPushAll(aa.getKey(type), list);
redisTemplate.expire(aa.getKey(type), aa.getExpire(), aa.getTimeUnit());
}
}
@@ -0,0 +1,44 @@
package com.renkang.consultation.api.storge.redis;
import com.renkang.consultation.api.RedisConstants;
import com.renkang.consultation.entity.ConHospitalFollow;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.stereotype.Repository;
@Repository
public class ConHospitalFollowReidsTunnel {
@Autowired
private RedisTemplate redisTemplate;
//关注医生
public void setFollowHospital(ConHospitalFollow conHospitalFollow) {
ZSetOperations<String, String> reds = redisTemplate.opsForZSet();
String myFollowUserKey = RedisConstants.MY_FOLLOW_HOSPITAL_ZSET.getKey(conHospitalFollow.getUserId());
reds.add(myFollowUserKey, conHospitalFollow.getHospitalId(), conHospitalFollow.getCreateTime().getTime());
}
public void cancelFollowHospital(String userId, String hospitalId) {
ZSetOperations<String, String> reds = redisTemplate.opsForZSet();
//我关注的用户
String myFollowUserKey = RedisConstants.MY_FOLLOW_HOSPITAL_ZSET.getKey(userId);
reds.remove(myFollowUserKey, hospitalId);
}
public Double tfFollowHospital(String userId, String hospitalId) {
ZSetOperations<String, String> reds = redisTemplate.opsForZSet();
String myFollowUserKey = RedisConstants.MY_FOLLOW_HOSPITAL_ZSET.getKey(userId);
return reds.score(myFollowUserKey, hospitalId);
}
}
@@ -0,0 +1,41 @@
package com.renkang.consultation.api.storge.redis;
import com.renkang.consultation.api.RedisConstants;
import com.renkang.consultation.entity.ConKnowledgeCategory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class ConKnowledgeCategoryRedisTunnel {
@Autowired
private RedisTemplate redisTemplate;
public List<ConKnowledgeCategory> selectKnowledgeCategory() {
String redisKey = RedisConstants.KNOWLEDGE_CATEGORY_LIST.getKey();
if (redisTemplate.hasKey(redisKey)) {
List<ConKnowledgeCategory> list = redisTemplate.opsForList().range(redisKey, 0, -1);
return list;
}
return null;
}
public void insertStrategyClass(List<ConKnowledgeCategory> list) {
RedisConstants redisKey = RedisConstants.KNOWLEDGE_CATEGORY_LIST;
redisTemplate.opsForList().rightPushAll(redisKey.getKey(), list);
redisTemplate.expire(redisKey.getKey(), redisKey.getExpire(), redisKey.getTimeUnit());
}
}
@@ -0,0 +1,88 @@
package com.renkang.consultation.archives.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.renkang.consultation.archives.model.dto.SpecialistAndHospitalArchivesParam;
import com.renkang.consultation.archives.model.vo.*;
import com.renkang.consultation.archives.service.SpecialistAndHospitalService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.jeecg.common.api.vo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Description: 档案模块-机构信息-专家医院控制器
* @Author: feng
* @Date: 2024-11-22
* @Version: V1.0
*/
@Tag(name = "档案模块")
@RestController
@RequestMapping("/archives")
@RequiredArgsConstructor
public class SpecialistAndHospitalController {
private final SpecialistAndHospitalService specialistAndHospitalService;
@GetMapping("/hospital/page")
@Operation(summary = "机构信息-专家医院-医院列表数据", description = "机构信息-专家医院-医院列表数据")
public Result<IPage<HospitalArchivesInfo>> hospitalArchivesPage(SpecialistAndHospitalArchivesParam pageParam) {
return Result.OK(specialistAndHospitalService.hospitalArchivesPage(pageParam));
}
/**
* 机构信息-专家医院-医院地图数据接口
*
* PS: 实时服务-咨询服务公用此接口
*/
@GetMapping("/hospital/geo")
@Operation(summary = "机构信息-专家医院-医院地图数据", description = "机构信息-专家医院-医院地图数据(实时服务-咨询服务公用)")
public Result<List<HospitalArchivesInfo>> hospitalArchivesMap(SpecialistAndHospitalArchivesParam param) {
return Result.OK(specialistAndHospitalService.hospitalArchivesMap(param));
}
@GetMapping("/hospital/years-statistic")
@Operation(summary = "机构信息-专家医院-医院历年服务人次变化", description = "机构信息-专家医院-医院历年服务人次变化")
public Result<List<SessionYearsStatistic>> hospitalSessionYearsStatistic(@RequestParam(name = "hospitalId") @Parameter(description = "医院ID") String hospitalId) {
return Result.OK(specialistAndHospitalService.hospitalSessionYearsStatistic(hospitalId));
}
/**
* 机构信息-专家医院-查询医院下的专家列表
*
* PS: 实时服务-咨询服务公用此接口
*/
@GetMapping("/specialist/page")
@Operation(summary = "机构信息-专家医院-查询医院下的专家列表", description = "机构信息-专家医院-查询医院下的专家列表(实时服务-咨询服务公用)")
public Result<IPage<SpecialistArchivesInfo>> querySpecialistByHospital(@RequestParam(name = "hospitalId") @Parameter(description = "医院ID") String hospitalId,
@RequestParam(name = "year",required = false) @Parameter(description = "年份") Integer year,
@RequestParam(name = "pageNo",defaultValue = "0") Integer pageNo,
@RequestParam(name = "pageSize",defaultValue = "10") Integer pageSize) {
return Result.OK(specialistAndHospitalService.querySpecialistByHospital(hospitalId,pageNo,pageSize,year));
}
@GetMapping("/specialist/years-statistic")
@Operation(summary = "机构信息-专家医院-专家历年服务人次变化", description = "机构信息-专家医院-专家历年服务人次变化")
public Result<List<SessionYearsStatistic>> specialistSessionYearsStatistic(@RequestParam(name = "specialistId") @Parameter(description = "专家ID") String specialistId) {
return Result.OK(specialistAndHospitalService.specialistSessionYearsStatistic(specialistId));
}
@GetMapping("/consultation/statistics")
@Operation(summary = "实时服务-咨询服务-数据统计", description = "实时服务-咨询服务-数据统计")
public Result<SessionServerStatistic> consultationStatistics() {
return Result.OK(specialistAndHospitalService.consultationStatistics());
}
@GetMapping("/consultation/user-page")
@Operation(summary = "实时服务-咨询服务-员工咨询数据列表", description = "实时服务-咨询服务-员工咨询数据列表")
public Result<IPage<UserSessionPageVO>> userSessionPage(@RequestParam(name = "hospitalId") @Parameter(description = "医院ID") String hospitalId,
@RequestParam(name = "pageNo",defaultValue = "0") Integer pageNo,
@RequestParam(name = "pageSize",defaultValue = "10") Integer pageSize) {
return Result.OK(specialistAndHospitalService.userSessionPage(hospitalId,pageNo,pageSize));
}
}
@@ -0,0 +1,23 @@
package com.renkang.consultation.archives.model.dto;
import com.renkang.consultation.entity.ConResource;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jeecg.base.Criteria;
import org.jeecg.base.PageInfo;
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(title = "档案专家医院列表参数", description = "档案专家医院列表参数")
public class SpecialistAndHospitalArchivesParam extends PageInfo<ConResource> {
@Schema(description = "医院名称")
@Criteria(value = Criteria.Mode.LIKE)
private String resourceName;
@Schema(description = "医院等级")
private String level;
@Schema(description = "查询年份(默认当年)")
private Integer year;
}
@@ -0,0 +1,101 @@
package com.renkang.consultation.archives.model.vo;
import com.renkang.consultation.entity.ConResource;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jeecg.common.aspect.annotation.Dict;
import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Schema(title = "档案专家医院列表数据模型", description = "档案专家医院列表数据模型")
public class HospitalArchivesInfo {
/**
* 主键
*/
@Schema(title = "主键")
private String id;
/**
* 名称
*/
@Schema(title = "名称")
private String resourceName;
/**
* 经度
*/
@Schema(title = "经度")
private BigDecimal longitude;
/**
* 纬度
*/
@Schema(title = "纬度")
private BigDecimal latitude;
/**
* 资源类型(1:油田职工医院 2:医院 3:卫生所 4: )
*/
@Schema(title = "资源类型(1:油田职工医院 2:医院 3:卫生所 4: )")
@Dict(dicCode = "h_type")
private String type;
/**
* 二级分类(0-1: 合作医院 0-2:)
*/
@Schema(title = "二级分类(0-1: 合作医院 0-2:)")
private String secondType;
/**
* 详细地址
*/
@Schema(title = "详细地址")
private String address;
/**
* 医院等级
*/
@Schema(title = "医院等级")
@Dict(dicCode = "hospital_level")
private String level;
/**
* 图片
*/
@Schema(title = "图片")
private String img;
/**
*专家数量
*/
@Schema(title = "专家数量")
private Integer specialistSum;
/**
*今年服务人次
*/
@Schema(title = "今年服务人次")
private Integer thisYearSessionSum;
/**
*年份
*/
@Schema(title = "年份")
private Integer year;
/**
*累计服务人次
*/
@Schema(title = "累计服务人次")
private Integer allSessionSum;
public HospitalArchivesInfo(ConResource conResource) {
this.id = conResource.getId();
this.resourceName = conResource.getResourceName();
this.longitude = conResource.getLongitude();
this.latitude = conResource.getLatitude();
this.type = conResource.getType();
this.secondType = conResource.getSecondType();
this.address = conResource.getAddress();
this.level = conResource.getLevel();
this.img = conResource.getImg();
}
}
@@ -0,0 +1,43 @@
package com.renkang.consultation.archives.model.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Schema(title = "档案实时服务-咨询服务统计数据", description = "档案实时服务-咨询服务统计数据")
public class SessionServerStatistic {
/**
*医院数量
*/
@Schema(title = "医院数量")
private int hospitalSum;
/**
*专家数量
*/
@Schema(title = "专家数量")
private int specialistSum;
/**
*今年服务人次
*/
@Schema(title = "今年服务人次")
private int thisYearSessionSum;
/**
*累计服务人次
*/
@Schema(title = "累计服务人次")
private int allSessionSum;
public SessionServerStatistic(long hospitalSum, long specialistSum, long thisYearSessionSum, long allSessionSum) {
this.hospitalSum = (int) hospitalSum;
this.specialistSum = (int) specialistSum;
this.thisYearSessionSum = (int) thisYearSessionSum;
this.allSessionSum = (int) allSessionSum;
}
}
@@ -0,0 +1,14 @@
package com.renkang.consultation.archives.model.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(title = "档案专家医院历年服务人次趋势", description = "档案专家医院历年服务人次趋势")
public class SessionYearsStatistic {
@Schema(title = "当年服务人次")
private Integer sums;
@Schema(title = "年份")
private Integer years;
}
@@ -0,0 +1,99 @@
package com.renkang.consultation.archives.model.vo;
import com.renkang.consultation.entity.ConDoctor;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jeecg.common.aspect.annotation.Dict;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Schema(title = "档案专家列表列表数据模型", description = "档案专家列表列表数据模型")
public class SpecialistArchivesInfo {
/**
* 医生id
*/
@Schema(title = "医生id")
private String id;
/**
* 医生姓名
*/
@Schema(title = "医生姓名")
private String doctorName;
/**
* 职务
*/
@Schema(title = "职称")
@Dict(dicCode = "z_doct_job")
private String doctorJob;
/**
* 职称
*/
@Schema(title = "职务")
@Dict(dicCode = "z_doct_lev")
private String doctorTitle;
/**
* 所属科室id
*/
@Schema(title = "所属科室id")
private String departmentId;
/**
* 科室名称
*/
@Schema(title = "科室名称")
private String departmentName;
/**
* 医生头像
*/
@Schema(title = "医生头像")
private String photo;
/**
* 性别
*/
@Schema(title = "性别")
@Dict(dicCode = "sex2")
private Integer sex;
/**
* 年龄
*/
@Schema(title = "年龄")
private Integer age;
/**
*今年服务人次
*/
@Schema(title = "今年服务人次")
private Integer thisYearSessionSum;
/**
*年份
*/
@Schema(title = "年份")
private Integer year;
/**
*累计服务人次
*/
@Schema(title = "累计服务人次")
private Integer allSessionSum;
public SpecialistArchivesInfo(ConDoctor doctor) {
this.id = doctor.getId();
this.doctorName = doctor.getDoctorName();
this.doctorJob = doctor.getDoctorJob();
this.doctorTitle = doctor.getDoctorTitle();
this.departmentId = doctor.getDepartmentId();
this.departmentName = doctor.getDepartmentName();
this.photo = doctor.getPhoto();
this.sex = doctor.getSex();
}
}
@@ -0,0 +1,13 @@
package com.renkang.consultation.archives.model.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SpecialistSessionStatisticVo {
private String id;
private Integer sums;
}
@@ -0,0 +1,60 @@
package com.renkang.consultation.archives.model.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.jeecg.bean.response.BaseEmployeeInfo;
import org.jeecg.common.aspect.annotation.Dict;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@Schema(title = "档案实时服务-咨询服务员工咨询数据", description = "档案实时服务-咨询服务员工咨询数据")
public class UserSessionPageVO {
@Schema(title = "员工ID")
private String userId;
@Schema(title = "员工姓名")
private String realName;
@Schema(title = "员工编号")
private String workNo;
@Schema(title = "年龄")
private Integer age;
@Schema(title = "性别")
@Dict(dicCode = "sex2")
private Integer sex;
@Schema(title = "单位名称")
private String secondDeptName;
@Schema(title = "部门名称")
private String thirdDeptName;
@Schema(title = "orgCode")
private String orgCode;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(title = "最新咨询时间")
private Date lastSessionDate;
@Schema(title = "累积咨询次数")
private Integer sessionCount = 0;
public void complementUserInfo(BaseEmployeeInfo employeeInfo){
if(null != employeeInfo){
this.setAge(employeeInfo.getAge());
this.setRealName(employeeInfo.getRealName());
this.setOrgCode(employeeInfo.getThisDeptCode());
this.setSex(employeeInfo.getSex());
this.setSecondDeptName(employeeInfo.getSecondDeptName());
this.setThirdDeptName(employeeInfo.getThirdDeptName());
this.setWorkNo(employeeInfo.getWorkNo());
}
}
}
@@ -0,0 +1,66 @@
package com.renkang.consultation.archives.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.renkang.consultation.archives.model.dto.SpecialistAndHospitalArchivesParam;
import com.renkang.consultation.archives.model.vo.*;
import java.util.List;
/**
* @Description: 档案模块-机构信息-专家医院service
* @Author: feng
* @Date: 2024-11-20
* @Version: V1.0
*/
public interface SpecialistAndHospitalService {
/**
* 机构信息-专家医院-医院列表数据
* @param pageParam
* @return
*/
IPage<HospitalArchivesInfo> hospitalArchivesPage(SpecialistAndHospitalArchivesParam pageParam);
/**
* 机构信息-专家医院-医院地图数据(实时服务-咨询服务公用)
* @param param
* @return
*/
List<HospitalArchivesInfo> hospitalArchivesMap(SpecialistAndHospitalArchivesParam param);
/**
* 机构信息-专家医院-医院历年服务人次变化
* @param hospitalId
* @return
*/
List<SessionYearsStatistic> hospitalSessionYearsStatistic(String hospitalId);
/**
* 机构信息-专家医院-查询医院下的专家列表(实时服务-咨询服务公用)
* @param hospitalId
* @return
*/
IPage<SpecialistArchivesInfo> querySpecialistByHospital(String hospitalId,Integer pageNo,Integer pageSize,Integer year);
/**
* 机构信息-专家医院-专家历年服务人次变化
* @param specialistId
* @return
*/
List<SessionYearsStatistic> specialistSessionYearsStatistic(String specialistId);
/**
* 实时服务-咨询服务-数据统计
* @return
*/
SessionServerStatistic consultationStatistics();
/**
* 实时服务-咨询服务-员工咨询数据列表
* @param hospitalId
* @param pageNo
* @param pageSize
* @return
*/
IPage<UserSessionPageVO> userSessionPage(String hospitalId, Integer pageNo, Integer pageSize);
}
@@ -0,0 +1,275 @@
package com.renkang.consultation.archives.service.impl;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.renkang.consultation.archives.model.dto.SpecialistAndHospitalArchivesParam;
import com.renkang.consultation.archives.model.vo.*;
import com.renkang.consultation.archives.service.SpecialistAndHospitalService;
import com.renkang.consultation.entity.ConDoctor;
import com.renkang.consultation.entity.ConResource;
import com.renkang.consultation.entity.ConSession;
import com.renkang.consultation.mapper.ConDoctorMapper;
import com.renkang.consultation.mapper.ConResourceMapper;
import com.renkang.consultation.mapper.ConSessionMapper;
import com.renkang.consultation.util.SessionWrapperUtils;
import lombok.RequiredArgsConstructor;
import org.jeecg.bean.response.BaseEmployeeInfo;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.util.WrapperUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
/**
* @Description: 档案模块-机构信息-专家医院service impl
* @Author: feng
* @Date: 2024-11-20
* @Version: V1.0
*/
@Service
@RequiredArgsConstructor
public class SpecialistAndHospitalServiceImpl implements SpecialistAndHospitalService {
private static final Logger log = LoggerFactory.getLogger(SpecialistAndHospitalServiceImpl.class);
private final ConDoctorMapper doctorMapper;
private final ConResourceMapper hospitalMapper;
private final ConSessionMapper sessionMapper;
private final ISysBaseAPI sysBaseAPI;
@Override
public IPage<HospitalArchivesInfo> hospitalArchivesPage(SpecialistAndHospitalArchivesParam pageParam) {
IPage<HospitalArchivesInfo> resultPage = new Page<>();
LambdaQueryWrapper<ConResource> wrapper = buildHospitalArchivesWrapper(pageParam);
IPage<ConResource> resourceIPage = hospitalMapper.selectPage(new Page<>(pageParam.getPageNo(),pageParam.getPageSize()),wrapper);
BeanUtils.copyProperties(resourceIPage, resultPage, "records");
if(ObjectUtil.isNotEmpty(resourceIPage.getRecords())){
//处理列表中需要展示的统计数据
List<HospitalArchivesInfo> hospitalArchivesInfos = resourceIPage.getRecords().stream().map(HospitalArchivesInfo::new).collect(Collectors.toList());
Integer year = ObjectUtil.isNull(pageParam.getYear())? DateUtil.thisYear() : pageParam.getYear();
disposeHospitalStaticData(hospitalArchivesInfos,year);
resultPage.setRecords(hospitalArchivesInfos);
}
return resultPage;
}
@Override
public List<HospitalArchivesInfo> hospitalArchivesMap(SpecialistAndHospitalArchivesParam param) {
LambdaQueryWrapper<ConResource> wrapper = buildHospitalArchivesWrapper(param);
List<ConResource> resourceList = hospitalMapper.selectList(wrapper);
List<HospitalArchivesInfo> hospitalArchivesInfos = resourceList.stream().map(HospitalArchivesInfo::new).collect(Collectors.toList());
if(ObjectUtil.isNotEmpty(hospitalArchivesInfos)){
Integer year = ObjectUtil.isNull(param.getYear())? DateUtil.thisYear() : param.getYear();
disposeHospitalStaticData(hospitalArchivesInfos,year);
}
return hospitalArchivesInfos;
}
private LambdaQueryWrapper<ConResource> buildHospitalArchivesWrapper(SpecialistAndHospitalArchivesParam pageParam){
LambdaQueryWrapper<ConResource> queryWrapper = WrapperUtils.initLambdaWrapper(pageParam);
queryWrapper.orderByDesc(ConResource::getTfTop);
queryWrapper.orderByAsc(ConResource::getSort);
return queryWrapper;
}
private void disposeHospitalStaticData(List<HospitalArchivesInfo> hospitalArchivesInfos,Integer year){
Set<String> hospitalIds = hospitalArchivesInfos.stream().map(HospitalArchivesInfo::getId).collect(Collectors.toSet());
//统计医院专家数量
CompletableFuture<Map<String,Integer>> specialistSumFuture = CompletableFuture.supplyAsync(() -> selectSpecialistSum(hospitalIds));
//统计当年服务人数
CompletableFuture<Map<String,Integer>> thisYearSessionSumFuture = CompletableFuture.supplyAsync(() -> selectSessionSum(hospitalIds,year));
//统计历年服务人数
CompletableFuture<Map<String,Integer>> allSessionSumFuture = CompletableFuture.supplyAsync(() -> selectSessionSum(hospitalIds,null));
CompletableFuture.allOf(specialistSumFuture, thisYearSessionSumFuture, allSessionSumFuture).join();
try {
Map<String,Integer> specialistSumMap = specialistSumFuture.get();
Map<String,Integer> thisYearSessionSumMap = thisYearSessionSumFuture.get();
Map<String,Integer> allSessionSumMap = allSessionSumFuture.get();
Iterator<HospitalArchivesInfo> iterator = hospitalArchivesInfos.iterator();
while (iterator.hasNext()) {
HospitalArchivesInfo info = iterator.next();
info.setYear(year);
info.setSpecialistSum(Optional.ofNullable(specialistSumMap.get(info.getId())).orElse(0));
if (info.getSpecialistSum() == 0) {
iterator.remove();
}
info.setThisYearSessionSum(Optional.ofNullable(thisYearSessionSumMap.get(info.getId())).orElse(0));
info.setAllSessionSum(Optional.ofNullable(allSessionSumMap.get(info.getId())).orElse(0));
}
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
private Map<String,Integer> selectSessionSum(Set<String> hospitalIds, Integer year) {
MPJLambdaWrapper<ConSession> queryWrapper = buildSessionWrapper();
queryWrapper.selectAs(ConDoctor::getResourceId, SpecialistSessionStatisticVo::getId);
queryWrapper.selectCount(ConSession::getId, SpecialistSessionStatisticVo::getSums);
queryWrapper.innerJoin(ConDoctor.class,ConDoctor::getId,ConSession::getToAccount);
queryWrapper.in(ConDoctor::getResourceId,hospitalIds);
queryWrapper.groupBy(ConDoctor::getResourceId);
if(null != year){
Date yearDate =new DateTime(year.toString(), DatePattern.NORM_YEAR_PATTERN);
queryWrapper.between(ConSession::getUserFirstReplyTime,DateUtil.beginOfYear(yearDate),DateUtil.endOfYear(yearDate));
}
List<SpecialistSessionStatisticVo> list = sessionMapper.selectJoinList(SpecialistSessionStatisticVo.class,queryWrapper);
return list.stream().collect(Collectors.toMap(SpecialistSessionStatisticVo::getId, SpecialistSessionStatisticVo::getSums,(k1, k2) -> k1));
}
/**
* 统计医院下专家数量
* @param hospitalIds 医院ID
* @return
*/
private Map<String,Integer> selectSpecialistSum(Set<String> hospitalIds) {
MPJLambdaWrapper<ConDoctor> queryWrapper = new MPJLambdaWrapper<>();
queryWrapper.selectAs(ConDoctor::getResourceId, SpecialistSessionStatisticVo::getId);
queryWrapper.selectCount(ConDoctor::getId, SpecialistSessionStatisticVo::getSums);
queryWrapper.in(ConDoctor::getResourceId,hospitalIds);
queryWrapper.groupBy(ConDoctor::getResourceId);
List<SpecialistSessionStatisticVo> list = doctorMapper.selectJoinList(SpecialistSessionStatisticVo.class,queryWrapper);
return list.stream().collect(Collectors.toMap(SpecialistSessionStatisticVo::getId, SpecialistSessionStatisticVo::getSums,(k1, k2) -> k1));
}
private MPJLambdaWrapper<ConSession> buildSessionWrapper(){
MPJLambdaWrapper<ConSession> queryWrapper = new MPJLambdaWrapper<>();
queryWrapper.eq(ConSession::getSessionType, SessionWrapperUtils.SESSION_DOCTOR);
//只要用户发消息就认为是一次咨询服务(这里限制了状态和验证发消息时间, 如果数量和之前的咨询业务接口对不上 , 考虑是数据质量问题[历史数据未修正])
queryWrapper.eq(ConSession::getUserTfReply, SessionWrapperUtils.TF_USER_REPLY_TRUE);
queryWrapper.isNotNull(ConSession::getUserFirstReplyTime);
return queryWrapper;
}
@Override
public List<SessionYearsStatistic> hospitalSessionYearsStatistic(String hospitalId) {
MPJLambdaWrapper<ConSession> queryWrapper = sessionYearsStatisticWrapper();
queryWrapper.innerJoin(ConDoctor.class,ConDoctor::getId,ConSession::getToAccount);
queryWrapper.eq(ConDoctor::getResourceId,hospitalId);
return sessionMapper.selectJoinList(SessionYearsStatistic.class,queryWrapper);
}
@Override
public IPage<SpecialistArchivesInfo> querySpecialistByHospital(String hospitalId,Integer pageNo,Integer pageSize,Integer year) {
IPage<SpecialistArchivesInfo> resultPage = new Page<>();
//查询医院下的医生列表
MPJLambdaWrapper<ConDoctor> queryWrapper = new MPJLambdaWrapper<>();
queryWrapper.eq(ConDoctor::getResourceId,hospitalId);
IPage<ConDoctor> resourceIPage = doctorMapper.selectPage(new Page<>(pageNo,pageSize),queryWrapper);
BeanUtils.copyProperties(resourceIPage, resultPage, "records");
if(ObjectUtil.isNotEmpty(resourceIPage.getRecords())){
List<SpecialistArchivesInfo> archivesInfos = resourceIPage.getRecords().stream().map(SpecialistArchivesInfo::new).collect(Collectors.toList());
// 处理医生信息
setDoctorMsg(archivesInfos);
//统计医生服务人次
disposeSpecialistData(archivesInfos,year);
resultPage.setRecords(archivesInfos);
}
return resultPage;
}
private void disposeSpecialistData(List<SpecialistArchivesInfo> archivesInfos,Integer year){
year = null != year? year : DateUtil.thisYear(); //默认查当年
MPJLambdaWrapper<ConSession> queryWrapper = buildSessionWrapper();
queryWrapper.selectAs(ConSession::getToAccount, SpecialistSessionStatisticVo::getId);
queryWrapper.selectCount(ConSession::getId, SpecialistSessionStatisticVo::getSums);
queryWrapper.in(ConSession::getToAccount,archivesInfos.stream().map(SpecialistArchivesInfo::getId).collect(Collectors.toSet()));
queryWrapper.groupBy(ConSession::getToAccount);
//批量查询医生历年服务人次
Map<String,Integer> allSessionSumMap = sessionMapper.selectJoinList(SpecialistSessionStatisticVo.class,queryWrapper)
.stream().collect(Collectors.toMap(SpecialistSessionStatisticVo::getId, SpecialistSessionStatisticVo::getSums,(k1, k2) -> k1));
Date yearDate =new DateTime(year.toString(), DatePattern.NORM_YEAR_PATTERN);
queryWrapper.between(ConSession::getUserFirstReplyTime,DateUtil.beginOfYear(yearDate),DateUtil.endOfYear(yearDate));
//批量查询医生当年服务人次(PS: 因为PM的带条件函数查询不好写 这里发起两次查询,若后期单次查询速度较慢可将两次查询合并使用原生语法实现)
Map<String,Integer> thisYearSessionSumMap = sessionMapper.selectJoinList(SpecialistSessionStatisticVo.class,queryWrapper)
.stream().collect(Collectors.toMap(SpecialistSessionStatisticVo::getId, SpecialistSessionStatisticVo::getSums,(k1, k2) -> k1));
for (SpecialistArchivesInfo archivesInfo : archivesInfos){
archivesInfo.setYear(year);
archivesInfo.setAllSessionSum(Optional.ofNullable(allSessionSumMap.get(archivesInfo.getId())).orElse(0));
archivesInfo.setThisYearSessionSum(Optional.ofNullable(thisYearSessionSumMap.get(archivesInfo.getId())).orElse(0));
}
}
private MPJLambdaWrapper<ConSession> sessionYearsStatisticWrapper(){
MPJLambdaWrapper<ConSession> queryWrapper = buildSessionWrapper();
queryWrapper.selectFunc(() -> "YEAR(%s)",ConSession::getUserFirstReplyTime, SessionYearsStatistic::getYears);
queryWrapper.selectCount(ConSession::getId, SessionYearsStatistic::getSums);
queryWrapper.groupBy("YEAR(user_first_reply_time)");
return queryWrapper;
}
@Override
public List<SessionYearsStatistic> specialistSessionYearsStatistic(String specialistId) {
MPJLambdaWrapper<ConSession> queryWrapper = sessionYearsStatisticWrapper();
queryWrapper.eq(ConSession::getToAccount,specialistId);
return sessionMapper.selectJoinList(SessionYearsStatistic.class,queryWrapper);
}
@Override
public SessionServerStatistic consultationStatistics() {
//1.查询医院总数
long hospitalSum = hospitalMapper.selectCount(null);
//2.查询专家总数
long specialistSum = doctorMapper.selectCount(null);
MPJLambdaWrapper<ConSession> queryWrapper = buildSessionWrapper();
//3.查询当年服务人次
long allSessionSum = sessionMapper.selectCount(queryWrapper);
//4.查询历年服务人次(如果线上响应速度过慢,将四次查询做异步处理)
queryWrapper.between(ConSession::getUserFirstReplyTime,DateUtil.beginOfYear(new Date()),DateUtil.endOfYear(new Date()));
long thisYearSessionSum = sessionMapper.selectCount(queryWrapper);
return new SessionServerStatistic(hospitalSum,specialistSum,thisYearSessionSum,allSessionSum);
}
@Override
public IPage<UserSessionPageVO> userSessionPage(String hospitalId, Integer pageNo, Integer pageSize) {
IPage<UserSessionPageVO> resultPage = new Page<>(pageNo,pageSize);
MPJLambdaWrapper<ConSession> queryWrapper = buildSessionWrapper();
queryWrapper.selectAs(ConSession::getFromAccount, UserSessionPageVO::getUserId);
queryWrapper.selectCount(ConSession::getId, UserSessionPageVO::getSessionCount);
queryWrapper.selectMax(ConSession::getUserFirstReplyTime, UserSessionPageVO::getLastSessionDate);
queryWrapper.innerJoin(ConDoctor.class,ConDoctor::getId,ConSession::getToAccount);
queryWrapper.eq(ConDoctor::getResourceId,hospitalId);
queryWrapper.groupBy(ConSession::getFromAccount);
queryWrapper.orderByDesc("MAX( user_first_reply_time )");
resultPage = sessionMapper.selectJoinPage(resultPage,UserSessionPageVO.class,queryWrapper);
if(ObjectUtil.isNotEmpty(resultPage.getRecords())){
//补全咨询用户信息
List<BaseEmployeeInfo> employeeInfos = sysBaseAPI.queryBaseEmployeeInfo(
resultPage.getRecords().stream().map(UserSessionPageVO::getUserId).collect(Collectors.toSet()));
resultPage.getRecords().forEach(vo -> vo.complementUserInfo(
employeeInfos.stream().filter(user -> vo.getUserId().equals(user.getUserId())).findFirst().orElse(null)));
}
return resultPage;
}
private void setDoctorMsg(List<SpecialistArchivesInfo> list){
List<String> doctorIds = list.stream().map(SpecialistArchivesInfo::getId).collect(Collectors.toList());
List<BaseEmployeeInfo> userList = sysBaseAPI.queryBaseEmployeeInfo(new HashSet<>(doctorIds));
Map<String, BaseEmployeeInfo> userMap = userList.stream().collect(Collectors.toMap(BaseEmployeeInfo::getUserId, user -> user));
list.forEach(doctor -> {
BaseEmployeeInfo user = userMap.get(doctor.getId());
if (user != null) {
doctor.setSex(user.getSex());
// 根据身份证号获取年龄及性别
try {
doctor.setAge(IdcardUtil.getAgeByIdCard(user.getIdCard()));
} catch (Exception e) {
log.error("根据身份证号获取年龄异常", e);
}
}
});
}
}
@@ -0,0 +1,644 @@
package com.renkang.consultation.async;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.renkang.consultation.bean.SessionExt;
import com.renkang.consultation.bean.SessionFilter;
import com.renkang.consultation.bean.UserToDoctorExport;
import com.renkang.consultation.dto.ConSessionDTO;
import com.renkang.consultation.entity.*;
import com.renkang.consultation.mapper.ConDoctorMapper;
import com.renkang.consultation.mapper.ConHelperMapper;
import com.renkang.consultation.mapper.ConSessionMapper;
import com.renkang.consultation.service.IConDoctorService;
import com.renkang.consultation.service.IConSessionService;
import com.renkang.consultation.vo.ConDoctorExportVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.SecurityUtils;
import org.jeecg.bean.request.ListUser;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.export.PoiExportHandler;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.system.vo.LoginUserNew;
import org.jeecg.common.system.vo.SysUserModel;
import org.jeecg.common.util.MyUploadUtil;
import org.jeecg.common.util.PasswordUtil;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.global.GlobalUtils;
import org.jeecg.modules.exports.entity.CommonExportsInfo;
import org.jeecg.modules.manager.SysCacheImpl;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.export.styler.ExcelExportStylerBorderImpl;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.slf4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.renkang.consultation.util.SessionWrapperUtils.TF_REPLY_TRUE;
import static com.renkang.consultation.util.SessionWrapperUtils.TF_USER_REPLY_TRUE;
@Service
@Slf4j
public class AsyncExportService {
private final UserToDoctorExportHandler userToDoctorExportHandler = new UserToDoctorExportHandler();
@Autowired
private ConDoctorMapper conDoctorMapper;
@Autowired
private IConDoctorService conDoctorService;
@Autowired
private IConSessionService conSessionService;
@Autowired
private ConSessionMapper conSessionMapper;
@Resource
private ISysBaseAPI sysBaseAPI;
@Resource
private RedisUtil redisUtil;
@Autowired
private SysCacheImpl sysCache;
@Value("${jeecg.path.upload}")
private String upLoadPath;
@Autowired
private ConHelperMapper conHelperMapper;
@Autowired
private AsyncTaskExecutor taskExecutor;
@Transactional(rollbackFor = Exception.class)
public void userToDoctorExportXls(ConSessionDTO dto, CommonExportsInfo info, String empFinish, String errCode, String sheetName, String fileName) {
ConSession conSession = new ConSession();
BeanUtils.copyProperties(dto, conSession);
LambdaQueryWrapper<ConSession> sessionWrapper = new LambdaQueryWrapper<>();
// 只查询员工咨询专家的数据
sessionWrapper.eq(ConSession::getSessionType, "1");
sessionWrapper.and(
p -> p.eq(ConSession::getTfReply, TF_REPLY_TRUE)
.or()
.eq(ConSession::getUserTfReply, TF_USER_REPLY_TRUE)
);
List<String> orgCodeList = new ArrayList<>();
// 只获取本单位及以下的咨询数据 admin用户不遵循此逻辑
if (!StringUtil.equals("3", dto.getSessionType()) && StrUtil.isEmpty(dto.getSysOrgSecondId()) && StrUtil.isEmpty(dto.getSysOrgThirdId())) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> orgCodes = GlobalUtils.getManagedCodesBack(sysUser.getOrgCode());
if (!sysUser.getRoleCodes().contains("helper")) {
orgCodeList.addAll(orgCodes);
}
}
//从redis中获取部门数据
String orgCode = "";
if (StringUtils.hasLength(dto.getSysOrgThirdId())) {
SysDepart depart = sysCache.getDepartById(dto.getSysOrgThirdId());
if (depart != null) {
orgCode = StrUtil.isNotBlank(depart.getOrgCode()) ? depart.getOrgCode() : "";
}
} else if (StringUtils.hasLength(dto.getSysOrgSecondId())) {
SysDepart depart = sysCache.getDepartById(dto.getSysOrgSecondId());
if (depart != null) {
orgCode = StrUtil.isNotBlank(depart.getOrgCode()) ? depart.getOrgCode() : "";
}
}
if (StrUtil.isNotBlank(orgCode)) {
orgCodeList.add(orgCode);
}
if (CollUtil.isNotEmpty(orgCodeList)) {
sessionWrapper.and(wrapper -> {
for (String code : orgCodeList) {
wrapper.or().likeRight(ConSession::getOrgCode, code);
}
});
}
if (StrUtil.isNotEmpty(dto.getFromName())) {
sessionWrapper.like(ConSession::getFromName, dto.getFromName());
}
if (StrUtil.isNotEmpty(dto.getDoctorName())) {
sessionWrapper.like(ConSession::getToName, dto.getDoctorName());
}
if (StrUtil.isNotEmpty(dto.getContentStatus())) {
sessionWrapper.eq(ConSession::getContentStatus, dto.getContentStatus());
}
if (StrUtil.isNotEmpty(dto.getContentType())) {
sessionWrapper.eq(ConSession::getContentType, dto.getContentType());
}
if (ObjectUtils.isNotEmpty(dto.getStartDate()) && ObjectUtils.isNotEmpty(dto.getEndDate())) {
sessionWrapper.between(ConSession::getCreateTime, dto.getStartDate(), dto.getEndDate());
}
//医院筛选
if (StringUtils.hasLength(dto.getHospitalName())) {
List<ConDoctor> doctorList = conDoctorMapper.selectDoctorInfoByHospitalName(dto.getHospitalName());
List<String> doctorIdList = new ArrayList<>();
if (CollectionUtils.isEmpty(doctorList)) {
doctorIdList.add("0");
} else {
doctorIdList = doctorList.stream().map(ConDoctor::getId).collect(Collectors.toList());
}
// 根据 conType 添加额外的查询条件
if (conSession.getConType() == null) {
sessionWrapper.in(ConSession::getToAccount, doctorIdList);
} else {
sessionWrapper.in(ConSession::getFromAccount, doctorIdList);
}
}
// 人员筛选
if (StrUtil.isNotBlank(dto.getIdNo()) || StrUtil.isNotBlank(dto.getUserNo())) {
List<String> userIdList = sysBaseAPI.getUserIdsByDepartAndUsername(null, null, dto.getIdNo(), dto.getUserNo());
if (CollectionUtils.isEmpty(userIdList)) {
userIdList.add("0");
}
sessionWrapper.in(ConSession::getFromAccount, userIdList);
}
sessionWrapper.orderByDesc(ConSession::getCreateTime);
List<ConSession> conSessionList = conSessionMapper.selectList(sessionWrapper);
info.setHandleMsg("0/" + conSessionList.size());
GlobalUtils.setFeignToken();
sysBaseAPI.updateExportsInfo(info);
List<UserToDoctorExportVO> exportVOList = new ArrayList<>();
if (CollUtil.isNotEmpty(conSessionList)) {
// 取出用户的id
List<String> userIdList = conSessionList.stream().map(ConSession::getFromAccount).distinct().collect(Collectors.toList());
// 取出专家的id
List<String> doctorIdList = conSessionList.stream().map(ConSession::getToAccount).distinct().collect(Collectors.toList());
// 查询用户信息
List<LoginUserNew> userNewList = sysBaseAPI.listUserByIds(new ListUser(userIdList));
// 查询专家信息
List<ConDoctor> conDoctorList = conDoctorMapper.selectDoctorByIds(doctorIdList);
Map<String, ConDoctor> conDoctorMap = conDoctorList.stream().collect(Collectors.toMap(ConDoctor::getId, Function.identity()));
//一次性查询部门信息
String orgCodeString = String.join(",", GlobalUtils.getDistinctOrgCodeList(userNewList.stream()
.map(LoginUserNew::getOrgCode)
.collect(Collectors.toList())));
List<JSONObject> jsonObjects = sysBaseAPI.queryDepartsByOrgcodes(orgCodeString);
Map<String, SysDepart> orgCodeMap = jsonObjects.stream()
.map(jsonObject -> jsonObject.toJavaObject(SysDepart.class))
.collect(Collectors.toMap(SysDepart::getOrgCode, Function.identity()));
Map<String, LoginUserNew> userNewMap = userNewList.stream().collect(Collectors.toMap(LoginUserNew::getId, a -> a));
for (int i = 0; i < conSessionList.size(); i++) {
UserToDoctorExportVO exportVO = new UserToDoctorExportVO();
ConSession session = conSessionList.get(i);
exportVO.setIndex(i + 1);
exportVO.setId(session.getId());
LoginUserNew loginUserNew = userNewMap.get(session.getFromAccount());
if (ObjectUtils.isNotEmpty(loginUserNew)) {
exportVO.setRealName(loginUserNew.getRealname());
if (StrUtil.isNotEmpty(loginUserNew.getOrgCode())) {
SysDepart secondDepart = orgCodeMap.get(GlobalUtils.getSecondDepartOrgCode(loginUserNew.getOrgCode()));
if (secondDepart != null) {
exportVO.setUserOrgName(secondDepart.getDepartName());
}
SysDepart thirdDepart = orgCodeMap.get(GlobalUtils.getThirdDepartOrgCode(loginUserNew.getOrgCode()));
if (thirdDepart != null) {
exportVO.setUserDeptName(thirdDepart.getDepartName());
}
}
} else {
// 没查询到用户信息
exportVO.setRealName(session.getFromName());
if (StrUtil.isNotEmpty(session.getOrgCode())) {
SysDepart secondDepart = orgCodeMap.get(GlobalUtils.getSecondDepartOrgCode(session.getOrgCode()));
if (secondDepart != null) {
exportVO.setUserOrgName(secondDepart.getDepartName());
}
SysDepart thirdDepart = orgCodeMap.get(GlobalUtils.getThirdDepartOrgCode(session.getOrgCode()));
if (thirdDepart != null) {
exportVO.setUserDeptName(thirdDepart.getDepartName());
}
}
}
ConDoctor conDoctor = conDoctorMap.get(session.getToAccount());
if (ObjectUtils.isNotEmpty(conDoctor)) {
exportVO.setDoctorName(conDoctor.getDoctorName());
exportVO.setDoctorTitle(conDoctor.getDoctorTitle());
exportVO.setResourceName(conDoctor.getResourceName());
}
exportVO.setCreateTime(session.getCreateTime());
exportVO.setContentType(session.getContentType());
exportVO.setContentStatus(session.getContentStatus());
exportVOList.add(exportVO);
}
}
// 导出设置
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
// 此处设置的filename无效 ,前端会重新更新设置一下
String encode = null;
try {
encode = URLEncoder.encode(sheetName, "UTF-8");
} catch (UnsupportedEncodingException e) {
log.error("导出文件名编码异常", e);
}
// 配置导出参数
ExportParams exportParams = new ExportParams(sheetName + "报表", "导出人:" + sysUser.getRealname(), sheetName);
exportParams.setStyle(ExcelExportStylerBorderImpl.class);
exportParams.setImageBasePath(upLoadPath);
// 设置导出的数据
mv.addObject(NormalExcelConstants.FILE_NAME, encode);
mv.addObject(NormalExcelConstants.CLASS, UserToDoctorExportVO.class);
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportVOList);
// 记录条数
info.setHandleMsg(exportVOList.size() + "/" + exportVOList.size());
// 生成 Workbook 对象并修改
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, UserToDoctorExportVO.class, exportVOList);
Sheet sheet = workbook.getSheetAt(0);
try {
// 将 Workbook 写入 ByteArrayOutputStream
ByteArrayOutputStream out = new ByteArrayOutputStream();
workbook.write(out);
byte[] workbookBytes = out.toByteArray();
ByteArrayInputStream in = new ByteArrayInputStream(workbookBytes);
// 上传 FTP
String suffixName = ".xlsx";
in.reset();
String url = MyUploadUtil.upload(in, MyUploadUtil.IMPORT_BIZ, fileName + suffixName);
info.setExportUrl(url);
// 关闭流
in.close();
out.close();
} catch (Exception e) {
log.error("导出异常", e);
} finally {
// 数据导入完成
info.setExportStatus(empFinish);
info.setExportMsg(sheetName + "完成");
info.setHandleEndTime(new Date());
GlobalUtils.setFeignToken();
sysBaseAPI.updateExportsInfo(info);
}
}
public Future<?> userToDoctorExportXlsV2(SessionFilter filter) {
return userToDoctorExportHandler.exportAsync(filter);
}
@Transactional(rollbackFor = Exception.class)
public void userToHelpExportXls(ConSessionDTO dto, CommonExportsInfo info, String empFinish, String errCode, String sheetName, String fileName) {
ConSession conSession = new ConSession();
BeanUtils.copyProperties(dto, conSession);
LambdaQueryWrapper<ConSession> sessionWrapper = new LambdaQueryWrapper<>();
// 只查询员工咨询小助手的数据
sessionWrapper.eq(ConSession::getSessionType, "2");
sessionWrapper.and(
p -> p.eq(ConSession::getTfReply, TF_REPLY_TRUE)
.or()
.eq(ConSession::getUserTfReply, TF_USER_REPLY_TRUE)
);
List<String> orgCodeList = new ArrayList<>();
// 只获取本单位及以下的咨询数据 admin用户不遵循此逻辑
if (!StringUtil.equals("3", dto.getSessionType()) && StrUtil.isEmpty(dto.getSysOrgSecondId()) && StrUtil.isEmpty(dto.getSysOrgThirdId())) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> orgCodes = GlobalUtils.getManagedCodesBack(sysUser.getOrgCode());
if (!sysUser.getRoleCodes().contains("helper")) {
orgCodeList.addAll(orgCodes);
}
}
//从redis中获取部门数据
String orgCode = "";
if (StringUtils.hasLength(dto.getSysOrgThirdId())) {
SysDepart depart = sysCache.getDepartById(dto.getSysOrgThirdId());
if (depart != null) {
orgCode = StrUtil.isNotBlank(depart.getOrgCode()) ? depart.getOrgCode() : "";
}
} else if (StringUtils.hasLength(dto.getSysOrgSecondId())) {
SysDepart depart = sysCache.getDepartById(dto.getSysOrgSecondId());
if (depart != null) {
orgCode = StrUtil.isNotBlank(depart.getOrgCode()) ? depart.getOrgCode() : "";
}
}
if (StrUtil.isNotBlank(orgCode)) {
orgCodeList.add(orgCode);
}
if (CollUtil.isNotEmpty(orgCodeList)) {
sessionWrapper.and(wrapper -> {
for (String code : orgCodeList) {
wrapper.or().likeRight(ConSession::getOrgCode, code);
}
});
}
if (StrUtil.isNotEmpty(dto.getFromName())) {
sessionWrapper.like(ConSession::getFromName, dto.getFromName());
}
if (StrUtil.isNotEmpty(dto.getDoctorName())) {
sessionWrapper.like(ConSession::getToName, dto.getDoctorName());
}
if (StrUtil.isNotEmpty(dto.getContentStatus())) {
sessionWrapper.eq(ConSession::getContentStatus, dto.getContentStatus());
}
if (StrUtil.isNotEmpty(dto.getContentType())) {
sessionWrapper.eq(ConSession::getContentType, dto.getContentType());
}
if (ObjectUtils.isNotEmpty(dto.getStartDate()) && ObjectUtils.isNotEmpty(dto.getEndDate())) {
sessionWrapper.between(ConSession::getCreateTime, dto.getStartDate(), dto.getEndDate());
}
// 人员筛选
if (StrUtil.isNotBlank(dto.getIdNo()) || StrUtil.isNotBlank(dto.getUserNo())) {
List<String> userIdList = sysBaseAPI.getUserIdsByDepartAndUsername(null, null, dto.getIdNo(), dto.getUserNo());
if (CollectionUtils.isEmpty(userIdList)) {
userIdList.add("0");
}
sessionWrapper.in(ConSession::getFromAccount, userIdList);
}
sessionWrapper.orderByDesc(ConSession::getCreateTime);
List<ConSession> conSessionList = conSessionMapper.selectList(sessionWrapper);
info.setHandleMsg("0/" + conSessionList.size());
GlobalUtils.setFeignToken();
sysBaseAPI.updateExportsInfo(info);
List<UserToHelpExportVO> exportVOList = new ArrayList<>();
if (CollUtil.isNotEmpty(conSessionList)) {
// 取出用户的id
List<String> userIdList = conSessionList.stream().map(ConSession::getFromAccount).distinct().collect(Collectors.toList());
// 取出小助手的id
List<String> helpIdList = conSessionList.stream().map(ConSession::getToAccount).distinct().collect(Collectors.toList());
// 查询用户信息
List<LoginUserNew> userNewList = sysBaseAPI.listUserByIds(new ListUser(userIdList));
// 查询专家信息
List<ConHelper> conHelperList = conHelperMapper.selectList(new LambdaQueryWrapper<ConHelper>().in(ConHelper::getId, helpIdList));
Map<String, ConHelper> conHelperMap = conHelperList.stream().collect(Collectors.toMap(ConHelper::getId, Function.identity()));
//一次性查询部门信息
String orgCodeString = String.join(",", GlobalUtils.getDistinctOrgCodeList(userNewList.stream()
.map(LoginUserNew::getOrgCode)
.collect(Collectors.toList())));
List<JSONObject> jsonObjects = sysBaseAPI.queryDepartsByOrgcodes(orgCodeString);
Map<String, SysDepart> orgCodeMap = jsonObjects.stream()
.map(jsonObject -> jsonObject.toJavaObject(SysDepart.class))
.collect(Collectors.toMap(SysDepart::getOrgCode, Function.identity()));
Map<String, LoginUserNew> userNewMap = userNewList.stream().collect(Collectors.toMap(LoginUserNew::getId, a -> a));
for (int i = 0; i < conSessionList.size(); i++) {
UserToHelpExportVO exportVO = new UserToHelpExportVO();
ConSession session = conSessionList.get(i);
exportVO.setIndex(i + 1);
LoginUserNew loginUserNew = userNewMap.get(session.getFromAccount());
if (ObjectUtils.isNotEmpty(loginUserNew)) {
exportVO.setRealName(loginUserNew.getRealname());
if (StrUtil.isNotEmpty(loginUserNew.getOrgCode())) {
SysDepart secondDepart = orgCodeMap.get(GlobalUtils.getSecondDepartOrgCode(loginUserNew.getOrgCode()));
if (secondDepart != null) {
exportVO.setUserOrgName(secondDepart.getDepartName());
}
SysDepart thirdDepart = orgCodeMap.get(GlobalUtils.getThirdDepartOrgCode(loginUserNew.getOrgCode()));
if (thirdDepart != null) {
exportVO.setUserDeptName(thirdDepart.getDepartName());
}
}
} else {
// 没查询到用户信息
exportVO.setRealName(session.getFromName());
if (StrUtil.isNotEmpty(session.getOrgCode())) {
SysDepart secondDepart = orgCodeMap.get(GlobalUtils.getSecondDepartOrgCode(session.getOrgCode()));
if (secondDepart != null) {
exportVO.setUserOrgName(secondDepart.getDepartName());
}
SysDepart thirdDepart = orgCodeMap.get(GlobalUtils.getThirdDepartOrgCode(session.getOrgCode()));
if (thirdDepart != null) {
exportVO.setUserDeptName(thirdDepart.getDepartName());
}
}
}
ConHelper conHelper = conHelperMap.get(session.getToAccount());
if (ObjectUtils.isNotEmpty(conHelper)) {
exportVO.setDoctorName(conHelper.getUserName());
}
exportVO.setCreateTime(session.getCreateTime());
exportVO.setContentType(session.getContentType());
exportVO.setContentStatus(session.getContentStatus());
exportVOList.add(exportVO);
}
}
// 导出设置
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
// 此处设置的filename无效 ,前端会重新更新设置一下
String encode = null;
try {
encode = URLEncoder.encode(sheetName, "UTF-8");
} catch (UnsupportedEncodingException e) {
log.error("导出文件名编码异常", e);
}
// 配置导出参数
ExportParams exportParams = new ExportParams(sheetName + "报表", "导出人:" + sysUser.getRealname(), sheetName);
exportParams.setStyle(ExcelExportStylerBorderImpl.class);
exportParams.setImageBasePath(upLoadPath);
// 设置导出的数据
mv.addObject(NormalExcelConstants.FILE_NAME, encode);
mv.addObject(NormalExcelConstants.CLASS, UserToHelpExportVO.class);
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportVOList);
// 记录条数
info.setHandleMsg(exportVOList.size() + "/" + exportVOList.size());
// 生成 Workbook 对象并修改
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, UserToHelpExportVO.class, exportVOList);
Sheet sheet = workbook.getSheetAt(0);
try {
// 将 Workbook 写入 ByteArrayOutputStream
ByteArrayOutputStream out = new ByteArrayOutputStream();
workbook.write(out);
byte[] workbookBytes = out.toByteArray();
ByteArrayInputStream in = new ByteArrayInputStream(workbookBytes);
// 上传 FTP
String suffixName = ".xlsx";
in.reset();
String url = MyUploadUtil.upload(in, MyUploadUtil.IMPORT_BIZ, fileName + suffixName);
info.setExportUrl(url);
// 关闭流
in.close();
out.close();
} catch (Exception e) {
log.error("导出异常", e);
} finally {
// 数据导入完成
info.setExportStatus(empFinish);
info.setExportMsg(sheetName + "完成");
info.setHandleEndTime(new Date());
GlobalUtils.setFeignToken();
sysBaseAPI.updateExportsInfo(info);
}
}
@Async
@Transactional(rollbackFor = Exception.class)
public void importDoctor(ByteArrayInputStream inputStream, String empDocCode, String empDocDoing, String empDocFinish) throws Exception {
ImportParams params = new ImportParams();
params.setTitleRows(1);
params.setHeadRows(1);
params.setNeedSave(true);
List<ConDoctorExportVO> empExcelList = ExcelImportUtil.importExcel(inputStream, ConDoctorExportVO.class, params);
String password = (String) redisUtil.get(CommonConstant.SYS_CACHE_CONFIG_KEY + ":default_password");
//保存主信息
CommonExportsInfo info = new CommonExportsInfo();
info.setBatchNo(String.valueOf(System.currentTimeMillis()));
info.setHandleMsg("0/" + empExcelList.size());
info.setCreateBy(GlobalUtils.getLoginUser().getId());
info.setCreateDate(new Date());
info.setExportMsg("专家信息导入中");
info.setTaskCode(empDocCode);
info.setExportStatus(empDocDoing);//数据导入中
info.setHandleStartTime(new Date());
info.setCreateDate(new Date());
GlobalUtils.setFeignToken();
CommonExportsInfo commonExportsInfo = sysBaseAPI.updateExportsInfo(info);
// 去除无效数据
List<ConDoctorExportVO> userList = empExcelList.
stream().filter(item -> item.getDoctorName() != null).distinct().collect(Collectors.toList());
int index = 1;
for (ConDoctorExportVO excelVo : userList) {
SysUserModel user = new SysUserModel();
BeanUtils.copyProperties(excelVo, user);
if (StrUtil.isNotEmpty(excelVo.getIdCard())) {
user.setSex(IdcardUtil.getGenderByIdCard(excelVo.getIdCard()) == 1 ? 2 : 1);
user.setBirthday(IdcardUtil.getBirthDate(excelVo.getIdCard()));
}
user.setUsername(excelVo.getUserName());
user.setRealname(excelVo.getDoctorName());
user.setPersonType("3"); // 专家
user.setPassword(password);
user.setSalt(RandomUtil.randomString(8));
user.setPassword(PasswordUtil.encrypt(user.getUsername(), password, user.getSalt()));
String userId = sysBaseAPI.addUserToEx(user);
// 同步向con_doctor表插入数据
ConDoctor conDoctor = new ConDoctor();
BeanUtils.copyProperties(excelVo, conDoctor);
conDoctor.setId(userId);
conDoctorService.saveDoctor(conDoctor);
info.setHandleMsg(index++ + "/" + userList.size());
info.setExportStatus("0");
info.setId(commonExportsInfo.getId());
sysBaseAPI.updateExportsInfo(info);
}
//上传ftp
String newFileName = "专家信息导入" + System.currentTimeMillis() + ".xlsx";
String importDoc = MyUploadUtil.upload(inputStream, "import", newFileName);
if (StrUtil.isNotEmpty(importDoc)) {
info.setExportUrl(importDoc);
}
info.setExportStatus(empDocFinish);//数据导入完成
info.setHandleMsg(userList.size() + "/" + userList.size());
info.setHandleEndTime(new Date());
info.setExportMsg("专家信息导入完成");
sysBaseAPI.updateExportsInfo(info);
}
private class UserToDoctorExportHandler implements PoiExportHandler<UserToDoctorExport, SessionFilter> {
@Override
public Class<UserToDoctorExport> getExportClass() {
return UserToDoctorExport.class;
}
@Override
public String getCode() {
return "UserToDoctorExportCodeV2";
}
@Override
public String getTitle() {
return "员工咨询专家导出";
}
@Override
public AsyncTaskExecutor getAsyncTaskExecutor() {
return taskExecutor;
}
@Override
public List<UserToDoctorExport> getData(SessionFilter filter) {
filter.setPageSize(-1);
IPage<SessionExt> pageList = conSessionService.queryPagelist(filter);
return pageList.getRecords()
.stream()
.map(UserToDoctorExport::convert)
.collect(Collectors.toList());
}
@Override
public Logger getLogger() {
return log;
}
@Override
public String getBizPath() {
return "/consult/userToDoctor";
}
}
}
@@ -0,0 +1,124 @@
package com.renkang.consultation.controller;
import com.aliyuncs.utils.StringUtils;
import com.renkang.consultation.api.service.impl.ConSessionApiServiceImpl;
import com.renkang.consultation.entity.ConSession;
import com.renkang.consultation.service.IConHelperSchedulingService;
import com.renkang.consultation.service.IConSessionService;
import com.renkang.consultation.util.UniqId;
import com.renkang.emergency.api.EmergencyCloudApi;
import com.renkang.emergency.bean.request.CallBack;
import com.renkang.emergency.bean.request.EmergencyCall;
import com.renkang.emergency.bean.response.Call;
import com.renkang.im.api.IMHelloApi;
import com.renkang.im.entity.ConSessionRequestDO;
import com.renkang.im.entity.ImMsgRecordAll;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
/**
* 应急咨询相关接口
*
* @program: cqyt-platform
* @ClassName com.renkang.consultation.controller.ConConsultationController
* @description: TODO
* @User jinbo
* @create: 2023-05-16 10:01
* @Version 1.0
**/
@Tag(name = "应急咨询")
@RestController
@RequestMapping("/ConConsultation")
@Slf4j
public class ConConsultationController {
@Autowired
private IConSessionService conSessionService;
@Autowired
private EmergencyCloudApi emergencyCloudApi;
@Autowired
private IMHelloApi imHelloApi;
@Autowired
private IConHelperSchedulingService conHelperSchedulingService;
@Autowired
private ConSessionApiServiceImpl conSessionApiServiceImpl;
@Operation(summary = "创建群聊-应急")
@GetMapping(value = "/createGroupMag")
public Result<Map<String, Object>> createGroupMag(@RequestParam("name") String name, @RequestParam("longitude") String longitude,
@RequestParam("latitude") String latitude) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Result<String> aa = emergencyCloudApi.sessionNow(sysUser.getId());
String groupId = aa.getResult();
if (!StringUtils.isEmpty(groupId)) {
Map res = new HashMap<>();
res.put("userId", sysUser.getId());
res.put("groupId", groupId);
return Result.OK(res);
}
Result<Call> rs = emergencyCloudApi.officerOnDuty();
if (rs.getResult() != null) {
String majorsId = rs.getResult().getMajors().get(0).getUserId();
String operatorsId = rs.getResult().getOperators().get(0).getUserId();
List<String> yesIds = new ArrayList<>();
yesIds.add(sysUser.getId());
yesIds.add(majorsId);
yesIds.add(operatorsId);
ConSessionRequestDO conSessionRequestDO = conSessionApiServiceImpl.selectConSessionRequestDO(yesIds,"",name);
conSessionRequestDO.setUserId(sysUser.getId());
Result<Map<String, Object>> imrs = imHelloApi.creatGroupMagNew(conSessionRequestDO);
EmergencyCall emergencyCall = new EmergencyCall();
emergencyCall.setCallType("1");
emergencyCall.setLongitude(Double.valueOf(longitude));
emergencyCall.setLatitude(Double.valueOf(latitude));
Result<String> bb = emergencyCloudApi.call(emergencyCall);
CallBack callBack = new CallBack();
callBack.setOrderId(bb.getResult());
callBack.setMajorUserId(majorsId);
callBack.setOperationUserId(operatorsId);
callBack.setSessionId((String) imrs.getResult().get("groupId"));
emergencyCloudApi.callBack(callBack);
return imrs;
}
return Result.error("没有接受方人员!");
}
@Operation(summary = "获取Android需要的封装数据")
@GetMapping(value = "/getMessageAndroid")
public Result<List> getMessageAndroid(String userId) {
ConSession session = conSessionService.getGroupByType(userId);
return imHelloApi.getMessageAndroid(session.getImId());
}
/**
* 查询im消息列表
* @param groupId
* @return
*/
@GetMapping(value = "/selectImMessageList")
public Result<List<ImMsgRecordAll>> selectImMessageList(String groupId) {
return conSessionService.selectImMessageList(groupId);
}
}
@@ -0,0 +1,204 @@
package com.renkang.consultation.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.dto.ConCostStatisticsDTO;
import com.renkang.consultation.entity.ConCostStatistics;
import com.renkang.consultation.entity.ConDoctor;
import com.renkang.consultation.service.IConCostStatisticsService;
import com.renkang.consultation.service.IConDoctorService;
import com.renkang.consultation.vo.ConCostStatisticsVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.vo.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @Description: con_cost_statistics
* @Author: jeecg-boot
* @Date: 2023-05-30
* @Version: V1.0
*/
@Tag(name = "consult/健康咨询/专家账户")
@RestController
@RequestMapping("/conCostStatistics")
@Slf4j
public class ConCostStatisticsController extends JeecgController<ConCostStatistics, IConCostStatisticsService> {
@Autowired
private IConCostStatisticsService conCostStatisticsService;
@Autowired
private IConDoctorService conDoctorService;
@Autowired
private ISysBaseAPI sysBaseAPI;
/**
* 分页列表查询
*
* @param dto 查询条件
* @return
*/
@Operation(summary = "全部分页列表查询", description = "全部分页列表查询")
@GetMapping(value = "/list")
public Result<ConCostStatisticsVO> queryPageList(ConCostStatisticsDTO dto) {
Page<ConCostStatistics> page = new Page<>(dto.getPageNo(), dto.getPageSize());
IPage<ConCostStatistics> pageList = conCostStatisticsService.queryPageList(page, dto);
ConCostStatisticsVO statisticsDO = new ConCostStatisticsVO();
statisticsDO.setRecords(pageList.getRecords());
if (dto.getUserId() != null && dto.getUserId() != "") {
statisticsDO.setAccountMoney(
conCostStatisticsService.getAccountMoney(dto.getUserId()) == null ? BigDecimal.valueOf(0) : conCostStatisticsService.getAccountMoney(dto.getUserId()));
statisticsDO.setAccountMoneyToString(
conCostStatisticsService.getAccountMoney(dto.getUserId()) == null ? "0" : conCostStatisticsService.getAccountMoney(dto.getUserId()).toString());
statisticsDO.setAccumulatedIncome(
conCostStatisticsService.getAccumulatedIncome(dto.getUserId()) == null ? BigDecimal.valueOf(0) : conCostStatisticsService.getAccumulatedIncome(dto.getUserId()));
statisticsDO.setWithdrawalAmount(
conCostStatisticsService.getWithdrawalAmount(dto.getUserId()) == null ? BigDecimal.valueOf(0) : conCostStatisticsService.getWithdrawalAmount(dto.getUserId()));
}
statisticsDO.setTotal(pageList.getTotal());
return Result.OK(statisticsDO);
}
/**
* 添加
*
* @param conCostStatistics
* @return
*/
@AutoLog(value = "con_cost_statistics-添加")
@Operation(summary = "con_cost_statistics-添加", description = "con_cost_statistics-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ConCostStatistics conCostStatistics) {
conCostStatisticsService.save(conCostStatistics);
return Result.OK("添加成功!");
}
/**
* 添加
*
* @param conCostStatistics
* @return
*/
@AutoLog(value = "提现")
@Operation(summary = "提现", description = "提现")
@PostMapping(value = "/payment")
public Result<String> payment(@RequestBody ConCostStatistics conCostStatistics) {
return conCostStatisticsService.payment(conCostStatistics);
}
/**
* 编辑
*
* @param conCostStatistics
* @return
*/
@AutoLog(value = "con_cost_statistics-编辑")
@Operation(summary = "con_cost_statistics-编辑", description = "con_cost_statistics-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody ConCostStatistics conCostStatistics) {
conCostStatisticsService.updateById(conCostStatistics);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "con_cost_statistics-通过id删除")
@Operation(summary = "con_cost_statistics-通过id删除", description = "con_cost_statistics-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
conCostStatisticsService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "con_cost_statistics-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.conCostStatisticsService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@Operation(summary = "记录详情 提现详情", description = "记录详情 提现详情")
@GetMapping(value = "/queryById")
public Result<ConCostStatistics> queryById(@RequestParam(name = "id", required = true) String id) {
ConCostStatistics conCostStatistics = conCostStatisticsService.getById(id);
if (conCostStatistics == null) {
return Result.error("未找到对应数据");
}
ConDoctor conDoctor = conDoctorService.getById(conCostStatistics.getUserId());
LoginUser userById = sysBaseAPI.getUserById(conCostStatistics.getUserId());
if (userById != null) {
conDoctor.setIdCard(userById.getIdCard());
}
conCostStatistics.setConDoctor(conDoctor);
return Result.OK(conCostStatistics);
}
/**
* 导出excel
*
* @param request
* @param conCostStatistics
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ConCostStatistics conCostStatistics) {
return super.exportXls(request, conCostStatistics, ConCostStatistics.class, "con_cost_statistics");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ConCostStatistics.class);
}
@Operation(summary = "月度统计")
@GetMapping(value = "/groupByMonthList")
public Result<?> groupByMonthList(@RequestParam(name = "date") String date) {
List<Map<String, Object>> groupByMonthList = conCostStatisticsService.groupByMonthList(date);
for (int i = 0; i < groupByMonthList.size(); i++) {
Map<String, Object> map = groupByMonthList.get(i);
if ("1".equals(map.get("content_type"))) {
groupByMonthList.get(i).put("content_type", "图文咨询");
}
if ("2".equals(map.get("content_type"))) {
groupByMonthList.get(i).put("content_type", "视频咨询");
}
}
return Result.OK(groupByMonthList);
}
}
@@ -0,0 +1,270 @@
package com.renkang.consultation.controller;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.renkang.consultation.dto.ConDepartmentDTO;
import com.renkang.consultation.entity.ConDepartment;
import com.renkang.consultation.entity.ConDoctor;
import com.renkang.consultation.mapper.ESConDepartmentMapper;
import com.renkang.consultation.service.IConDepartmentService;
import com.renkang.consultation.service.IConDoctorService;
import com.renkang.consultation.vo.ConDepartDoctorVO;
import com.renkang.consultation.vo.ConDepartRelevancyVO;
import com.renkang.consultation.vo.ConDepartmentVO;
import io.micrometer.core.instrument.util.StringUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.checkerframework.checker.units.qual.A;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.vo.SelectTreeModel;
import org.jeecg.common.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description: con_department
* @Author: jeecg-boot
* @Date: 2023-05-09
* @Version: V1.0
*/
@Tag(name = "科室管理")
@RestController
@RequestMapping("/conDepartment")
@Slf4j
public class ConDepartmentController extends JeecgController<ConDepartment, IConDepartmentService> {
@Autowired
ESConDepartmentMapper esConDepartmentMapper;
@Autowired
private IConDepartmentService conDepartmentService;
@Autowired
private IConDoctorService conDoctorService;
@Autowired
private RedisUtil redisUtil;
/**
* 列表查询
*
* @param dto
* @return
*/
//@AutoLog(value = "con_department-分页列表查询")
@Operation(summary = "con_department-列表查询", description = "con_department-列表查询")
@GetMapping(value = "/list")
public Result<List<ConDepartmentVO>> queryPageList(ConDepartmentDTO dto) {
List<ConDepartmentVO> voList = conDepartmentService.queryPageList(dto);
return Result.OK(voList);
}
/**
* 列表查询 一级
*
* @return
*/
@Operation(summary = "列表查询 一级", description = "con_department-列表查询")
@GetMapping(value = "/listLevelOne")
public Result<List<ConDepartmentVO>> listLevelOne() {
List<ConDepartmentVO> voList = conDepartmentService.listLevelOne();
return Result.OK(voList);
}
/**
* 添加
*
* @param conDepartment
* @return
*/
@AutoLog(value = "con_department-添加")
@Operation(summary = "con_department-添加", description = "con_department-添加")
// @RequiresPermissions("consultation:con_department:add")
@PostMapping(value = "/add")
public Result add(@RequestBody ConDepartment conDepartment) {
return conDepartmentService.addDepartment(conDepartment);
}
/**
* 编辑
*
* @param conDepartment
* @return
*/
@AutoLog(value = "con_department-编辑")
@Operation(summary = "con_department-编辑", description = "con_department-编辑")
@RequiresPermissions("consultation:con_department:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody ConDepartment conDepartment) {
conDepartment.setOfficeLevel("1");
if (StringUtils.isNotBlank(conDepartment.getOfficeparid())) {
conDepartment.setOfficeLevel("2");
}
conDepartmentService.updateById(conDepartment);
esConDepartmentMapper.save(conDepartment);
LambdaUpdateWrapper<ConDoctor> doctorLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
doctorLambdaUpdateWrapper.eq(ConDoctor::getDepartmentId, conDepartment.getId());
doctorLambdaUpdateWrapper.set(ConDoctor::getDepartmentName, conDepartment.getDepartmentName());
conDoctorService.update(doctorLambdaUpdateWrapper);
redisUtil.hdel(CommonConstant.CONSULT_DEPARTMENT + CommonConstant.OFFICE, conDepartment.getId());
ConDepartDoctorVO vo = new ConDepartDoctorVO();
vo.setId(conDepartment.getId());
vo.setName(conDepartment.getDepartmentName());
Map<String, Object> resultMap = new HashMap<>();
resultMap.put(conDepartment.getId(), vo);
redisUtil.hmset(CommonConstant.CONSULT_DEPARTMENT + CommonConstant.OFFICE, resultMap);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "con_department-通过id删除")
@Operation(summary = "con_department-通过id删除", description = "con_department-通过id删除")
@RequiresPermissions("consultation:con_department:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
conDepartmentService.removeById(id);
esConDepartmentMapper.deleteById(id);
redisUtil.hdel(CommonConstant.CONSULT_DEPARTMENT + CommonConstant.OFFICE, id);
return Result.OK("删除成功!");
}
/**
* 通过id查询该科室下关联数据条数
*
* @param id
* @return
*/
@Operation(summary = "通过id查询该科室下关联数据条数", description = "通过id查询该科室下关联数据条数")
@GetMapping(value = "/selectRelevancyById")
public Result<ConDepartRelevancyVO> selectRelevancyById(@RequestParam(name = "id", required = true) String id) {
return Result.OK(conDepartmentService.selectRelevancyById(id));
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "con_department-批量删除")
@Operation(summary = "con_department-批量删除", description = "con_department-批量删除")
@RequiresPermissions("consultation:con_department:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.conDepartmentService.removeByIds(Arrays.asList(ids.split(",")));
List<String> strings = Arrays.asList(ids.split(","));
strings.forEach(item -> {
esConDepartmentMapper.deleteById(item);
});
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "con_department-通过id查询")
@Operation(summary = "con_department-通过id查询", description = "con_department-通过id查询")
@GetMapping(value = "/queryById")
public Result<ConDepartment> queryById(@RequestParam(name = "id", required = true) String id) {
ConDepartment conDepartment = conDepartmentService.getById(id);
if (conDepartment == null) {
return Result.error("未找到对应数据");
}
return Result.OK(conDepartment);
}
/**
* 导出excel
*
* @param request
* @param conDepartment
*/
@RequiresPermissions("consultation:con_department:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ConDepartment conDepartment) {
return super.exportXls(request, conDepartment, ConDepartment.class, "con_department");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("consultation:con_department:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ConDepartment.class);
}
/**
* 获取所有科室
* 2023.09.22 update by wanghao content:只返回二级科室
* @param dto
* @return
*/
@Operation(summary = "获取所有科室")
@GetMapping(value = "/getConDepartmentAll")
public Result<?> getConDepartmentAll(ConDepartmentDTO dto) {
return Result.OK(conDepartmentService.getConDepartmentAll(dto));
}
@Operation(summary = "置顶(type=false取消置顶,type=true置顶)", description = "置顶(type=false取消置顶,type=true置顶)")
@GetMapping(value = "/updateTop")
public Result updateTop(String id, Boolean type) {
return conDepartmentService.updateTop(id, type);
}
@Operation(summary = "查询科室树")
@RequestMapping(value = "/loadTreeRoot", method = RequestMethod.GET)
public Result<List<SelectTreeModel>> loadTreeRoot(
@RequestParam(required = false,name = "pcode") String pcode) {
Result<List<SelectTreeModel>> result = new Result<>();
try {
List<SelectTreeModel> ls = conDepartmentService.queryListByPid(pcode);
loadAllChildren(ls);
result.setResult(ls);
result.setSuccess(true);
} catch (Exception e) {
e.printStackTrace();
result.setMessage(e.getMessage());
result.setSuccess(false);
}
return result;
}
/**
* 【vue3专用】递归求子节点 同步加载用到
*
* @param ls
*/
private void loadAllChildren(List<SelectTreeModel> ls) {
for (SelectTreeModel tsm : ls) {
List<SelectTreeModel> temp = conDepartmentService.queryListByPid(tsm.getKey());
if (temp != null && temp.size() > 0) {
tsm.setChildren(temp);
loadAllChildren(temp);
}
}
}
}
@@ -0,0 +1,188 @@
package com.renkang.consultation.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.entity.ConDoctorCard;
import com.renkang.consultation.service.IConDoctorCardService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @Description: con_doctor_card
* @Author: jeecg-boot
* @Date: 2023-06-06
* @Version: V1.0
*/
@Tag(name = "健康咨询/专家管理/专家账户")
@RestController
@RequestMapping("/consultation/conDoctorCard")
@Slf4j
public class ConDoctorCardController extends JeecgController<ConDoctorCard, IConDoctorCardService> {
@Autowired
private IConDoctorCardService conDoctorCardService;
/**
* 分页列表查询
*
* @param dto
* @return
*/
//@AutoLog(value = "con_doctor_card-列表查询")
@Operation(summary = "获取所有银行卡", description = "获取所有银行卡")
@GetMapping(value = "/list")
public Result<IPage<ConDoctorCard>> queryPageList(ConDoctorCard dto) {
Page<ConDoctorCard> page = new Page<>(dto.getPageNo(), dto.getPageSize());
IPage<ConDoctorCard> pageList = conDoctorCardService.queryPageList(page, dto);
return Result.ok(pageList);
}
/**
* 添加银行卡
*
* @param conDoctorCard
* @return
*/
@AutoLog(value = "con_doctor_card-添加")
@Operation(summary = "添加银行卡", description = "添加银行卡")
// @RequiresPermissions("consultation:con_doctor_card:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ConDoctorCard conDoctorCard) {
conDoctorCard.setCreateTime(new Date());
conDoctorCardService.save(conDoctorCard);
return Result.OK("添加成功!");
}
/**
* 批量添加
*
* @param conDoctorCardList
* @return
*/
@AutoLog(value = "批量添加银行卡")
@Operation(summary = "批量添加银行卡", description = "批量添加银行卡")
// @RequiresPermissions("consultation:con_doctor_card:add")
@PostMapping(value = "/addList")
public Result<String> add(@RequestBody List<ConDoctorCard> conDoctorCardList) {
List<ConDoctorCard> addList = new ArrayList<>();
List<ConDoctorCard> updateList = new ArrayList<>();
conDoctorCardList.forEach(conDoctorCard -> {
if (conDoctorCard.getId() == null) {
addList.add(conDoctorCard);
} else {
updateList.add(conDoctorCard);
}
});
if (CollectionUtils.isNotEmpty(addList)) {
conDoctorCardService.saveBatch(addList);
}
if (CollectionUtils.isNotEmpty(updateList)) {
conDoctorCardService.updateBatchById(updateList);
}
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param conDoctorCard
* @return
*/
@AutoLog(value = "编辑")
@Operation(summary = "编辑", description = "编辑")
// @RequiresPermissions("consultation:con_doctor_card:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody ConDoctorCard conDoctorCard) {
conDoctorCardService.updateById(conDoctorCard);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "通过id删除")
@Operation(summary = "通过id删除", description = "通过id删除")
// @RequiresPermissions("consultation:con_doctor_card:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
conDoctorCardService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "批量删除")
@Operation(summary = "批量删除", description = "批量删除")
// @RequiresPermissions("consultation:con_doctor_card:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.conDoctorCardService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "con_doctor_card-通过id查询")
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping(value = "/queryById")
public Result<ConDoctorCard> queryById(@RequestParam(name = "id", required = true) String id) {
ConDoctorCard conDoctorCard = conDoctorCardService.getById(id);
if (conDoctorCard == null) {
return Result.error("未找到对应数据");
}
return Result.OK(conDoctorCard);
}
/**
* 导出excel
*
* @param request
* @param conDoctorCard
*/
// @RequiresPermissions("consultation:con_doctor_card:exportXls")
@RequestMapping(value = "/exportXls")
@Operation(summary = "导出", description = "导出")
public ModelAndView exportXls(HttpServletRequest request, ConDoctorCard conDoctorCard) {
return super.exportXls(request, conDoctorCard, ConDoctorCard.class, "con_doctor_card");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
// @RequiresPermissions("consultation:con_doctor_card:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
@Operation(summary = "导入", description = "导入")
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ConDoctorCard.class);
}
}
@@ -0,0 +1,220 @@
package com.renkang.consultation.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.entity.ConDoctorChangeLog;
import com.renkang.consultation.service.IConDoctorChangeLogService;
import com.renkang.consultation.service.IConDoctorService;
import com.renkang.consultation.vo.ConDoctorChangeLogVO;
import com.renkang.consultation.vo.ConDoctorMainVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
/**
* @Description: 专家信息修改日志
* @Author: jeecg-boot
* @Date: 2024-07-23
* @Version: V1.0
*/
@Tag(name="专家信息修改日志")
@RestController
@RequestMapping("/consultation/conDoctorChangeLog")
@Slf4j
public class ConDoctorChangeLogController extends JeecgController<ConDoctorChangeLog, IConDoctorChangeLogService> {
@Autowired
private IConDoctorChangeLogService conDoctorChangeLogService;
@Autowired
private IConDoctorService conDoctorService;
/**
* 分页列表查询
*
* @param conDoctorChangeLog
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "专家信息修改日志-分页列表查询")
// @Operation(summary="专家信息修改日志-分页列表查询",description="专家信息修改日志-分页列表查询")
// @GetMapping(value = "/list")
// public Result<IPage<ConDoctorChangeLog>> queryPageList(ConDoctorChangeLog conDoctorChangeLog,
// @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
// @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
// HttpServletRequest req) {
// QueryWrapper<ConDoctorChangeLog> queryWrapper = QueryGenerator.initQueryWrapper(conDoctorChangeLog, req.getParameterMap());
// Page<ConDoctorChangeLog> page = new Page<ConDoctorChangeLog>(pageNo, pageSize);
// IPage<ConDoctorChangeLog> pageList = conDoctorChangeLogService.page(page, queryWrapper);
// return Result.OK(pageList);
// }
@Operation(summary="专家信息修改日志-分页列表查询",description="专家信息修改日志-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<ConDoctorChangeLogVO>> queryPageList(ConDoctorChangeLogVO doctorVO,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
Page<ConDoctorChangeLogVO> page = new Page<>(pageNo, pageSize);
IPage<ConDoctorChangeLogVO> pageList = conDoctorChangeLogService.queryPageList(page, doctorVO);
return Result.OK(pageList);
}
/**
* 添加
*
* @param conDoctorChangeLog
* @return
*/
@AutoLog(value = "专家信息修改日志-添加")
@Operation(summary="专家信息修改日志-添加",description="专家信息修改日志-添加")
@RequiresPermissions("consultation:con_doctor_change_log:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ConDoctorChangeLog conDoctorChangeLog) {
//添加前判断,如果啥都没改,就返回错误
if(conDoctorChangeLog.getDoctorJob().equals(conDoctorChangeLog.getDoctorOldJob())
&& conDoctorChangeLog.getDoctorType().equals(conDoctorChangeLog.getDoctorOldType())
&& conDoctorChangeLog.getDoctorStatus().equals(conDoctorChangeLog.getDoctorOldStatus())
){
return Result.error("未修改信息,不能保存");
}
conDoctorChangeLogService.save(conDoctorChangeLog);
//根据日志信息反向更新专家信息
conDoctorService.updateDoctorByLog(conDoctorChangeLog);
//根据日志修改专家咨询消费的金额
conDoctorChangeLog.getChangeDate();
conDoctorChangeLog.getDoctorId();
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param conDoctorChangeLog
* @return
*/
@AutoLog(value = "专家信息修改日志-编辑")
@Operation(summary="专家信息修改日志-编辑",description="专家信息修改日志-编辑")
@RequiresPermissions("consultation:con_doctor_change_log:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ConDoctorChangeLog conDoctorChangeLog) {
conDoctorChangeLogService.updateById(conDoctorChangeLog);
//根据日志信息反向更新专家信息
conDoctorService.updateDoctorByLog(conDoctorChangeLog);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "专家信息修改日志-通过id删除")
@Operation(summary="专家信息修改日志-通过id删除",description="专家信息修改日志-通过id删除")
@RequiresPermissions("consultation:con_doctor_change_log:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
conDoctorChangeLogService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "专家信息修改日志-批量删除")
@Operation(summary="专家信息修改日志-批量删除",description="专家信息修改日志-批量删除")
@RequiresPermissions("consultation:con_doctor_change_log:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.conDoctorChangeLogService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "专家信息修改日志-通过id查询")
@Operation(summary="专家信息修改日志-通过id查询",description="专家信息修改日志-通过id查询")
@GetMapping(value = "/queryById")
public Result<ConDoctorChangeLog> queryById(@RequestParam(name="id",required=true) String id) {
ConDoctorChangeLog conDoctorChangeLog = conDoctorChangeLogService.getById(id);
if(conDoctorChangeLog==null) {
return Result.error("未找到对应数据");
}
return Result.OK(conDoctorChangeLog);
}
/**
* 导出excel
*
* @param request
* @param conDoctorChangeLog
*/
@RequiresPermissions("consultation:con_doctor_change_log:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ConDoctorChangeLog conDoctorChangeLog) {
return super.exportXls(request, conDoctorChangeLog, ConDoctorChangeLog.class, "专家信息修改日志");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("consultation:con_doctor_change_log:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ConDoctorChangeLog.class);
}
@Operation(summary="根据日志表更新咨询历史表【更新】",description="根据日志表更新咨询历史表【更新】")
@RequiresPermissions("consultation:con_doctor_change_log:update_session")
@PostMapping(value = "/updateSessionByLog")
public Result<ConDoctorChangeLog> updateSessionByLog(@RequestParam(name = "id", required = true) String id) {
ConDoctorChangeLog conDoctorChangeLog = conDoctorChangeLogService.getById(id);
if (conDoctorChangeLog == null) {
return Result.error("未找到对应数据");
}
ConDoctorMainVO mainVO = new ConDoctorMainVO();
BeanUtils.copyProperties(conDoctorChangeLog, mainVO);
conDoctorChangeLogService.updateSessionDoctorMainInfo(mainVO);
return Result.OK("更新成功");
}
@Operation(summary="根据日志表更新咨询历史表【回滚】",description="根据日志表更新咨询历史表【更新】")
@RequiresPermissions("consultation:con_doctor_change_log:update_session")
@PostMapping(value = "/undoUpdateSessionByLog")
public Result<ConDoctorChangeLog> undoUpdateSessionByLog(@RequestParam(name="id",required=true) String id) {
ConDoctorChangeLog conDoctorChangeLog = conDoctorChangeLogService.getById(id);
if (conDoctorChangeLog == null) {
return Result.error("未找到对应数据");
}
ConDoctorMainVO mainVO = new ConDoctorMainVO();
BeanUtils.copyProperties(conDoctorChangeLog, mainVO);
conDoctorChangeLogService.undoUpdateSessionDoctorMainInfo(mainVO);
return Result.OK("撤销成功");
}
}
@@ -0,0 +1,449 @@
package com.renkang.consultation.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.async.AsyncExportService;
import com.renkang.consultation.constant.ConsultationConstants;
import com.renkang.consultation.dto.AccountDTO;
import com.renkang.consultation.dto.ConDoctorDTO;
import com.renkang.consultation.dto.DoctorAudioStatusDTO;
import com.renkang.consultation.dto.DoctorJumpHolidayDTO;
import com.renkang.consultation.entity.ConCostLog;
import com.renkang.consultation.entity.ConDoctor;
import com.renkang.consultation.entity.ConDoctorExAndUser;
import com.renkang.consultation.entity.CondepartmentId;
import com.renkang.consultation.mapper.ESConDoctorMapper;
import com.renkang.consultation.service.IConDepartmentService;
import com.renkang.consultation.service.IConDoctorService;
import com.renkang.consultation.service.IConResourceService;
import com.renkang.consultation.vo.AccountVO;
import com.renkang.consultation.vo.ConDoctorExportVO;
import com.renkang.consultation.vo.ConDoctorVO;
import com.renkang.consultation.vo.ConServiceVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.util.CheckPasswordUtil;
import org.jeecg.util.RSAEncryptUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @Description: con_doctor
* @Author: jeecg-boot
* @Date: 2023-05-09
* @Version: V1.0
*/
@Tag(name = "consult/健康咨询/专家管理")
@RestController
@RequestMapping("/conDoctor")
@Slf4j
public class ConDoctorController extends JeecgController<ConDoctor, IConDoctorService> {
@Autowired
private IConDoctorService conDoctorService;
@Resource
private ISysBaseAPI sysBaseAPI;
@Autowired
private ESConDoctorMapper esConDoctorMapper;
@Resource
private AsyncExportService asyncExportService;
/**
* 分页列表查询
*
* @param dto 查询条件
* @return
*/
@Operation(summary = "分页列表查询", description = "分页列表查询")
@GetMapping(value = "/list")
// @RequiresPermissions("consultation:con_doctor:list")
public Result<IPage<ConDoctorVO>> queryPageList(ConDoctorDTO dto) {
Page<ConDoctor> page = new Page<>(dto.getPageNo(), dto.getPageSize());
IPage<ConDoctorVO> pageList = conDoctorService.queryPageList(page, dto);
return Result.OK(pageList);
}
/**
* 专家账户分页列表查询
*
* @param dto 查询条件
* @return
*/
@Operation(summary = "专家账户分页列表查询", description = "专家账户分页列表查询")
@GetMapping(value = "/accountList")
// @RequiresPermissions("consultation:con_doctor:list")
public Result<IPage<AccountVO>> accountList(AccountDTO dto) {
Page<ConDoctor> page = new Page<>(dto.getPageNo(), dto.getPageSize());
IPage<AccountVO> pageList = conDoctorService.accountList(page, dto);
return Result.OK(pageList);
}
/**
* 咨询统计
*
* @param dto 查询条件
* @return
*/
@Operation(summary = "咨询统计查询", description = "咨询统计查询")
@GetMapping(value = "/statisticalList")
public Result<IPage<ConDoctor>> statisticalList(ConDoctorDTO dto) {
Page<ConDoctor> page = new Page<ConDoctor>(dto.getPageNo(), dto.getPageSize());
IPage<ConDoctor> pageList = conDoctorService.statisticalList(page, dto);
List<ConDoctor> conDoctors = pageList.getRecords();
conDoctors.forEach(item -> {
if (item.getResponseRate() == null || "".equals(item.getResponseRate())) {
item.setResponseRate("0");
}
if (item.getDegreeHeat() == null || "".equals(item.getDegreeHeat())) {
item.setDegreeHeat("0");
}
});
return Result.OK(pageList);
}
/**
* 添加
*
* @param conDoctorExAndUser 医生信息及用户基础信息
* @return
*/
@Operation(summary = "添加", description = "添加")
@PostMapping(value = "/add")
@AutoLog(value = "添加医生信息及用户基础信息")
@RequiresPermissions("consultation:con_doctor:add")
public Result<String> add(@RequestBody @Validated ConDoctorExAndUser conDoctorExAndUser) {
String key = RSAEncryptUtils.decrypt1(conDoctorExAndUser.getSysUserModel().getPassword(), CommonConstant.PRIVATE_KEY);
String s = CheckPasswordUtil.checkPasswordRule(key);
if (StrUtil.isNotBlank(s)) {
return Result.error(s);
}
conDoctorExAndUser.getSysUserModel().setPassword(key);
return conDoctorService.saveDoctorUser(conDoctorExAndUser);
}
/**
* 编辑
*
* @param conDoctorExAndUser
* @return
*/
@Operation(summary = "编辑", description = "编辑")
@AutoLog(value = "编辑医生信息及用户基础信息")
@RequiresPermissions("consultation:con_doctor:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody @Validated ConDoctorExAndUser conDoctorExAndUser) {
return conDoctorService.updateByDoctorUser(conDoctorExAndUser);
}
/**
* 通过id删除
*
* @param id
* @return
*/
@Operation(summary = "通过id删除", description = "通过id删除")
@DeleteMapping(value = "/delete")
@AutoLog(value = "通过id删除医生信息")
@RequiresPermissions("consultation:con_doctor:delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
conDoctorService.removeById(id);
esConDoctorMapper.deleteById(id);
sysBaseAPI.deleteUserById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@Operation(summary = "批量删除", description = "批量删除")
@DeleteMapping(value = "/deleteBatch")
@AutoLog(value = "通过id批量删除医生信息")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.conDoctorService.removeByIds(Arrays.asList(ids.split(",")));
List<String> strings = Arrays.asList(ids.split(","));
strings.forEach(item -> {
esConDoctorMapper.deleteById(item);
sysBaseAPI.deleteUserById(item);
esConDoctorMapper.deleteById(item);
});
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id 医生id
* @return
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping(value = "/queryById")
public Result<ConDoctorExAndUser> queryById(@RequestParam(name = "id", required = true) String id) {
ConDoctorExAndUser doctorUser = conDoctorService.getByDoctorUser(id);
if (doctorUser == null) {
return Result.error("未找到对应数据");
}
return Result.OK(doctorUser);
}
@PostMapping("/exportXls")
@Operation(summary = "导出专家信息")
public Result<?> exportXls(@RequestBody ConDoctor conDoctor) {
Boolean flag = sysBaseAPI.getFinishFlagByCode(ConsultationConstants.CON_DOCTOR_MSG_CODE, ConsultationConstants.CON_DOCTOR_MSG_DOING);
if (!flag) {
return Result.error("已存在执行中的导出任务,请稍后导出或点击【查看导出任务】查看任务导出进度!");
}
return conDoctorService.exportXls(conDoctor, ConsultationConstants.CON_DOCTOR_MSG_CODE, ConsultationConstants.CON_DOCTOR_MSG_DOING, ConsultationConstants.CON_DOCTOR_MSG_FINISH);
}
/**
* 通过excel导入数据
*
* @return
*/
@RequestMapping(value = "/importDoctor", consumes = "multipart/*", method = RequestMethod.POST, headers = "content-type=multipart/form-data")
@ResponseBody
@Operation(summary = "导入专家信息")
public Result<?> importDoctor(@Parameter(description = "文件", required = true) MultipartFile file) throws Exception {
Boolean flag = sysBaseAPI.getFinishFlagByCode(ConsultationConstants.CON_DOCTOR_IMPORT_CODE, ConsultationConstants.CON_DOCTOR_IMPORT_DOING);
if (!flag) {
return Result.error("已存在执行中的导入任务,请稍后导出或点击【查看导入任务】查看任务导入进度!");
}
byte[] fileBytes = file.getBytes();
ByteArrayInputStream inputStream = new ByteArrayInputStream(fileBytes);
asyncExportService.importDoctor(inputStream, ConsultationConstants.CON_DOCTOR_IMPORT_CODE, ConsultationConstants.CON_DOCTOR_IMPORT_DOING, ConsultationConstants.CON_DOCTOR_IMPORT_FINISH);
return Result.ok("导入任务启动成功,请点击【导入记录】查看导入详情!");
}
@PostMapping("/exportXlsAccount")
@Operation(summary = "导出专家账户")
public Result<?> exportXlsAccount(@RequestBody ConDoctor vo) {
Boolean flag = sysBaseAPI.getFinishFlagByCode(ConsultationConstants.CON_DOCTOR_ACCOUNT_CODE, ConsultationConstants.CON_DOCTOR_ACCOUNT_DOING);
if (!flag) {
return Result.error("已存在执行中的导出任务,请稍后导出或点击【查看导出任务】查看任务导出进度!");
}
return conDoctorService.exportXlsAccount(vo, ConsultationConstants.CON_DOCTOR_ACCOUNT_CODE, ConsultationConstants.CON_DOCTOR_ACCOUNT_DOING, ConsultationConstants.CON_DOCTOR_ACCOUNT_FINISH);
}
/**
* 通过职称批量修改图文及音视频费用
*
* @param titleId 职称id
* @param graphicCost 图文费用
* @param videoCost 音视频费用
* @return
*/
@Operation(summary = "通过职称批量修改图文及音视频费用")
@GetMapping(value = "/updateCostByTitle")
@AutoLog(value = "通过职称批量修改图文及音视频费用")
public Result<Boolean> updateCostByTitle(@RequestParam(name = "titleId", required = true) String titleId,
@RequestParam(name = "graphicCost", required = true) BigDecimal graphicCost,
@RequestParam(name = "videoCost", required = true) BigDecimal videoCost) {
conDoctorService.updateCostByTitle(titleId, graphicCost, videoCost);
return Result.OK("修改成功!");
}
/**
* 通过用户id修改图文及音视频费用
*
* @param userId 用户id
* @param graphicCost 图文费用
* @param videoCost 音视频费用
* @return
*/
@Operation(summary = "通过用户id修改图文及音视频费用")
@GetMapping(value = "/updateCostByUserId")
@AutoLog(value = "通过用户id修改图文及音视频费用")
public Result<Boolean> updateCostByUserId(@RequestParam(name = "userId", required = true) String userId,
@RequestParam(name = "graphicCost", required = true) BigDecimal graphicCost,
@RequestParam(name = "videoCost", required = true) BigDecimal videoCost) {
conDoctorService.updateCostByUserId(userId, graphicCost, videoCost);
return Result.OK("修改成功!");
}
/**
* 根据type获取历史费用(0:单体历史费用 1:群体历史费用)
*
* @param type 0:单体历史费用 1:群体历史费用
* @param userId 用户id
* @param titleId 职称id
* @return
*/
@Operation(summary = "根据type获取历史费用(0:单体历史费用 1:群体历史费用")
@GetMapping(value = "/getCostLogByType")
public Result<List<ConCostLog>> getCostLogByType(@RequestParam(name = "type", required = true) String type,
@RequestParam(name = "userId") String userId,
@RequestParam(name = "titleId") String titleId) {
return Result.OK(conDoctorService.getCostLogByType(type, userId, titleId));
}
/**
* 根据科室获取所有闲置专家
*
* @param departmentId 科室id
* @return
*/
@Operation(summary = "根据科室获取所有闲置专家")
@PostMapping(value = "/getFreeDoctorByDept")
public Result<List<ConDoctor>> getFreeDoctor(@RequestBody CondepartmentId departmentId) {
List<ConDoctor> list = new ArrayList<>();
if (departmentId != null) {
list = conDoctorService.getFreeDoctor(departmentId);
}
return Result.OK(list);
}
/**
* 根据专家id查询专家暂停服务的记录
*
* @param doctorId
* @return
*/
@Operation(summary = "根据专家id查询专家暂停服务的记录")
@GetMapping(value = "/getServiceByDoctorId")
public Result<List<ConServiceVO>> getPauseServiceByDoctorId(@RequestParam(name = "doctorId", required = true) String doctorId) {
List<ConServiceVO> list = conDoctorService.getServiceByDoctorId(doctorId);
return Result.OK(list);
}
/**
* 隐私协议
*
* @return
*/
@Operation(summary = "隐私协议")
@GetMapping("/privacyPolicy")
public String privacyPolicyHtml() {
return "privacyPolicy";
}
/**
* 用户协议
*
* @return
*/
@Operation(summary = "用户协议")
@GetMapping("/userAgreement")
public String userAgreementHtml() {
return "userAgreement";
}
@Operation(summary = "专家端专家登录接口")
@RequestMapping(value = "/loginDoctor", method = RequestMethod.POST)
public Result<JSONObject> loginDoctor(@RequestBody JSONObject json) {
if (json == null || json.isEmpty()) {
Result.error("数据为空!");
}
if (json.containsKey("password") && json.containsKey("username")) {
Result.error("参数不合法!");
}
String password = json.get("password").toString();
String key = RSAEncryptUtils.decrypt1(password, CommonConstant.PRIVATE_KEY);
json.put("password",key);
return sysBaseAPI.loginDoctor(json);
}
/**
* 修改专家音频状态
*
* @param dto
* @return
*/
@PostMapping("/updateAudioStatus")
@Operation(summary = "修改专家音频状态")
public Result<?> updateAudioStatus(@RequestBody DoctorAudioStatusDTO dto) {
conDoctorService.updateAudioStatus(dto);
return Result.OK("修改成功!");
}
/**
* 修改跳过节假日
*
* @param dto
* @return
*/
@PostMapping("/updateJumpHoliday")
@Operation(summary = "修改跳过节假日")
public Result<?> updateAudioStatus(@RequestBody DoctorJumpHolidayDTO dto) {
conDoctorService.updateJumpHoliday(dto);
return Result.OK("修改成功!");
}
/**
* 设置推荐专家(目前用于移动端专家列表显示)
*
* @param type
*/
@GetMapping("/recommend")
@Operation(summary = "设置推荐专家")
public Result<String> recommendDoctor(@RequestParam(name = "type", defaultValue = "1") @Parameter(name = "type", description = "1-推荐,0-取消")Integer type,
@RequestParam(name = "id") @Parameter(name = "id", description = "专家ID")String id) {
conDoctorService.recommendDoctor(id,type);
return Result.OK("操作成功!");
}
/**
*
* @param id
* @return
*/
//貌似没啥用,先屏蔽,专家出库在修改专家信息时,录入出库日期就按出库处理,也就是置为无效就行
// @DeleteMapping(value = "/outOrInDoctor")
// @AutoLog(value = "医生出库 入库")
// public Result<String> outOrInDoctor(@RequestParam(name = "id", required = true) String id) {
//
// ConDoctor conDoctor = conDoctorService.getById(id);
// if(conDoctor == null){
// return Result.ok("医生不存在");
// }
// String doctorStatus = "1";
// if(StrUtil.equals(conDoctor.getDoctorStatus(),"1")){
// doctorStatus = "2";
// }
//
// LambdaUpdateWrapper<ConDoctor> updateWrapper = new LambdaUpdateWrapper<>();
// updateWrapper.eq(ConDoctor::getId, id);
// if(StrUtil.equals(doctorStatus,"2")){
// updateWrapper.set(ConDoctor::getOffDate, new Date());
// }
// updateWrapper.set(ConDoctor::getDoctorStatus, doctorStatus);
//
// conDoctorService.update(null, updateWrapper);
//
// if(StrUtil.equals(doctorStatus,"1")){
// esConDoctorMapper.save(conDoctor);
// return Result.OK("入库成功!");
// }
// esConDoctorMapper.deleteById(id);
// return Result.OK("出库成功!");
// }
}
@@ -0,0 +1,162 @@
package com.renkang.consultation.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.entity.ConDoctorFollow;
import com.renkang.consultation.service.IConDoctorFollowService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
/**
* @Description: 医生关注
* @Author: jeecg-boot
* @Date: 2023-05-10
* @Version: V1.0
*/
@Tag(name = "医生关注")
@RestController
@RequestMapping("/consultation/conDoctorFollow")
@Slf4j
public class ConDoctorFollowController extends JeecgController<ConDoctorFollow, IConDoctorFollowService> {
@Autowired
private IConDoctorFollowService conDoctorFollowService;
/**
* 分页列表查询
*
* @param conDoctorFollow
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "医生关注-分页列表查询")
@Operation(summary = "医生关注-分页列表查询", description = "医生关注-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<ConDoctorFollow>> queryPageList(ConDoctorFollow conDoctorFollow,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<ConDoctorFollow> queryWrapper = QueryGenerator.initQueryWrapper(conDoctorFollow, req.getParameterMap());
Page<ConDoctorFollow> page = new Page<ConDoctorFollow>(pageNo, pageSize);
IPage<ConDoctorFollow> pageList = conDoctorFollowService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param conDoctorFollow
* @return
*/
@AutoLog(value = "医生关注-添加")
@Operation(summary = "医生关注-添加", description = "医生关注-添加")
@RequiresPermissions("consultation:con_doctor_follow:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ConDoctorFollow conDoctorFollow) {
conDoctorFollowService.save(conDoctorFollow);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param conDoctorFollow
* @return
*/
@AutoLog(value = "医生关注-编辑")
@Operation(summary = "医生关注-编辑", description = "医生关注-编辑")
@RequiresPermissions("consultation:con_doctor_follow:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody ConDoctorFollow conDoctorFollow) {
conDoctorFollowService.updateById(conDoctorFollow);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "医生关注-通过id删除")
@Operation(summary = "医生关注-通过id删除", description = "医生关注-通过id删除")
@RequiresPermissions("consultation:con_doctor_follow:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
conDoctorFollowService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "医生关注-批量删除")
@Operation(summary = "医生关注-批量删除", description = "医生关注-批量删除")
@RequiresPermissions("consultation:con_doctor_follow:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.conDoctorFollowService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "医生关注-通过id查询")
@Operation(summary = "医生关注-通过id查询", description = "医生关注-通过id查询")
@GetMapping(value = "/queryById")
public Result<ConDoctorFollow> queryById(@RequestParam(name = "id", required = true) String id) {
ConDoctorFollow conDoctorFollow = conDoctorFollowService.getById(id);
if (conDoctorFollow == null) {
return Result.error("未找到对应数据");
}
return Result.OK(conDoctorFollow);
}
/**
* 导出excel
*
* @param request
* @param conDoctorFollow
*/
@RequiresPermissions("consultation:con_doctor_follow:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ConDoctorFollow conDoctorFollow) {
return super.exportXls(request, conDoctorFollow, ConDoctorFollow.class, "医生关注");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("consultation:con_doctor_follow:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ConDoctorFollow.class);
}
}
@@ -0,0 +1,197 @@
package com.renkang.consultation.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.entity.ConDoctorScheduling;
import com.renkang.consultation.service.IConDoctorSchedulingDateService;
import com.renkang.consultation.service.IConDoctorSchedulingService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
/**
* @Description: 专家排班
* @Author: jeecg-boot
* @Date: 2023-05-09
* @Version: V1.0
*/
@Tag(name = "专家排班")
@RestController
@RequestMapping("/consultation/conDoctorScheduling")
@Slf4j
public class ConDoctorSchedulingController extends JeecgController<ConDoctorScheduling, IConDoctorSchedulingService> {
@Autowired
private IConDoctorSchedulingService conDoctorSchedulingService;
@Autowired
private IConDoctorSchedulingDateService conDoctorSchedulingDateService;
/**
* 分页列表查询
*
* @param conDoctorScheduling
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@Operation(summary = "专家排班-分页列表查询", description = "专家排班-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<ConDoctorScheduling>> queryPageList(ConDoctorScheduling conDoctorScheduling,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<ConDoctorScheduling> queryWrapper = QueryGenerator.initQueryWrapper(conDoctorScheduling, req.getParameterMap());
Page<ConDoctorScheduling> page = new Page<ConDoctorScheduling>(pageNo, pageSize);
IPage<ConDoctorScheduling> pageList = conDoctorSchedulingService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 根据专家id获取专家排班
*
* @param doctorId 专家id
* @return
*/
@Operation(summary = "根据专家id获取专家排班", description = "根据专家id获取专家排班")
@GetMapping(value = "/getDoctorScheduling")
public Result<List<ConDoctorScheduling>> getDoctorScheduling(@RequestParam("doctorId") String doctorId) {
List<ConDoctorScheduling> doctorSchedulingList = conDoctorSchedulingService.getDoctorScheduling(doctorId);
return Result.OK(doctorSchedulingList);
}
/**
* 修改专家排班
*
* @param schedulingList 修改专家排班
* @return
*/
@Operation(summary = "修改专家排班", description = "修改专家排班")
@PostMapping(value = "/updateDoctorScheduling")
public Result<Boolean> updateDoctorScheduling(@RequestBody List<ConDoctorScheduling> schedulingList) {
Boolean aBoolean = conDoctorSchedulingService.updateDoctorScheduling(schedulingList);
if (aBoolean) {
String userId = schedulingList.get(0).getUserId();
conDoctorSchedulingDateService.generateDoctorSchedulingDate(userId);
return Result.OK("修改成功");
}
return Result.error("修改失败");
}
/**
* 添加
*
* @param conDoctorScheduling
* @return
*/
@AutoLog(value = "专家排班-添加")
@Operation(summary = "专家排班-添加", description = "专家排班-添加")
@RequiresPermissions("consultation:con_doctor_scheduling:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ConDoctorScheduling conDoctorScheduling) {
conDoctorSchedulingService.save(conDoctorScheduling);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param conDoctorScheduling
* @return
*/
@AutoLog(value = "专家排班-编辑")
@Operation(summary = "专家排班-编辑", description = "专家排班-编辑")
@RequiresPermissions("consultation:con_doctor_scheduling:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody ConDoctorScheduling conDoctorScheduling) {
conDoctorSchedulingService.updateById(conDoctorScheduling);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "专家排班-通过id删除")
@Operation(summary = "专家排班-通过id删除", description = "专家排班-通过id删除")
@RequiresPermissions("consultation:con_doctor_scheduling:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
conDoctorSchedulingService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "专家排班-批量删除")
@Operation(summary = "专家排班-批量删除", description = "专家排班-批量删除")
@RequiresPermissions("consultation:con_doctor_scheduling:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.conDoctorSchedulingService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "专家排班-通过id查询")
@Operation(summary = "专家排班-通过id查询", description = "专家排班-通过id查询")
@GetMapping(value = "/queryById")
public Result<ConDoctorScheduling> queryById(@RequestParam(name = "id", required = true) String id) {
ConDoctorScheduling conDoctorScheduling = conDoctorSchedulingService.getById(id);
if (conDoctorScheduling == null) {
return Result.error("未找到对应数据");
}
return Result.OK(conDoctorScheduling);
}
/**
* 导出excel
*
* @param request
* @param conDoctorScheduling
*/
@RequiresPermissions("consultation:con_doctor_scheduling:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ConDoctorScheduling conDoctorScheduling) {
return super.exportXls(request, conDoctorScheduling, ConDoctorScheduling.class, "专家排班");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("consultation:con_doctor_scheduling:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ConDoctorScheduling.class);
}
}
@@ -0,0 +1,190 @@
package com.renkang.consultation.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.renkang.consultation.entity.ConDoctorSchedulingDate;
import com.renkang.consultation.service.IConDoctorSchedulingDateService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
/**
* @Description: 排班时间
* @Author: jeecg-boot
* @Date: 2023-05-09
* @Version: V1.0
*/
@Tag(name = "consult/健康咨询/排班时间")
@RestController
@RequestMapping("/consultation/conDoctorSchedulingDate")
@Slf4j
public class ConDoctorSchedulingDateController extends JeecgController<ConDoctorSchedulingDate, IConDoctorSchedulingDateService> {
@Autowired
private IConDoctorSchedulingDateService conDoctorSchedulingDateService;
/**
* 分页列表查询
*
* @param conDoctorSchedulingDate
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "排班时间-分页列表查询")
@Operation(summary = "排班时间-分页列表查询", description = "排班时间-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<ConDoctorSchedulingDate>> queryPageList(ConDoctorSchedulingDate conDoctorSchedulingDate,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
// QueryWrapper<ConDoctorSchedulingDate> queryWrapper = QueryGenerator.initQueryWrapper(conDoctorSchedulingDate, req.getParameterMap());
Page<ConDoctorSchedulingDate> page = new Page<ConDoctorSchedulingDate>(pageNo, pageSize);
IPage<ConDoctorSchedulingDate> pageList = conDoctorSchedulingDateService.queryPageList(page, conDoctorSchedulingDate);
return Result.OK(pageList);
}
/**
* 添加
*
* @param conDoctorSchedulingDate
* @return
*/
@AutoLog(value = "排班时间-添加")
@Operation(summary = "排班时间-添加", description = "排班时间-添加")
@RequiresPermissions("consultation:con_doctor_scheduling_date:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ConDoctorSchedulingDate conDoctorSchedulingDate) {
conDoctorSchedulingDateService.save(conDoctorSchedulingDate);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param conDoctorSchedulingDate
* @return
*/
@AutoLog(value = "排班时间-编辑")
@Operation(summary = "排班时间-编辑", description = "排班时间-编辑")
@RequiresPermissions("consultation:con_doctor_scheduling_date:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody ConDoctorSchedulingDate conDoctorSchedulingDate) {
conDoctorSchedulingDateService.updateById(conDoctorSchedulingDate);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "排班时间-通过id删除")
@Operation(summary = "排班时间-通过id删除", description = "排班时间-通过id删除")
@RequiresPermissions("consultation:con_doctor_scheduling_date:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
conDoctorSchedulingDateService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "排班时间-批量删除")
@Operation(summary = "排班时间-批量删除", description = "排班时间-批量删除")
@RequiresPermissions("consultation:con_doctor_scheduling_date:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.conDoctorSchedulingDateService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "排班时间-通过id查询")
@Operation(summary = "排班时间-通过id查询", description = "排班时间-通过id查询")
@GetMapping(value = "/queryById")
public Result<List<ConDoctorSchedulingDate>> queryById(@RequestParam(name = "id", required = true) String id) {
List<ConDoctorSchedulingDate> list = conDoctorSchedulingDateService.getByUserId(id);
if (list == null) {
return Result.error("未找到对应数据");
}
return Result.OK(list);
}
/**
* 导出excel
*
* @param request
* @param conDoctorSchedulingDate
*/
@RequiresPermissions("consultation:con_doctor_scheduling_date:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ConDoctorSchedulingDate conDoctorSchedulingDate) {
return super.exportXls(request, conDoctorSchedulingDate, ConDoctorSchedulingDate.class, "排班时间");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("consultation:con_doctor_scheduling_date:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ConDoctorSchedulingDate.class);
}
/**
* 生成专家排班
*
* @param id
*/
@Operation(summary = "生成专家排班", description = "生成专家排班")
@GetMapping("/generateDoctorSchedulingDate")
public Result<?> generateDoctorSchedulingDate(@Param("id") String id) {
return conDoctorSchedulingDateService.generateDoctorSchedulingDate(id);
}
@Operation(summary = "定时器生成排班", description = "定时器生成排班")
@GetMapping("/generalDoctorSchedulingTime")
public Result<String> generalDoctorSchedulingTime() {
return conDoctorSchedulingDateService.generalDoctorSchedulingTime();
}
@Operation(summary = "定时器生成排班 当天", description = "定时器生成排班 当天")
@GetMapping("/generalDoctorSchedulingTimeToday")
public Result<String> generalDoctorSchedulingTimeToday() {
return conDoctorSchedulingDateService.generalDoctorSchedulingTimeToday();
}
}

Some files were not shown because too many files have changed in this diff Show More