Commit 4e9a8dfb authored by 向怀芳's avatar 向怀芳 🎱

1. 解决CORS跨域问题

2. 导医推荐添加查询条件
3. 预约记录添加查询条件,列表显示字段
4. 新增查询个人历史医生list
5. 新增家庭成员管理接口:列表,新增,删除
parent 26fc5718
...@@ -13,6 +13,9 @@ import org.springframework.web.server.WebFilter; ...@@ -13,6 +13,9 @@ import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain; import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import java.util.HashSet;
import java.util.Set;
/** /**
* @Description * @Description
* @Author * @Author
...@@ -26,7 +29,14 @@ public class GlobalCorsConfig { ...@@ -26,7 +29,14 @@ public class GlobalCorsConfig {
*/ */
private static final String ALLOWED_HEADERS = "x-requested-with, authorization, Content-Type, Authorization, credential, X-XSRF-TOKEN,token,username,client,access-token"; private static final String ALLOWED_HEADERS = "x-requested-with, authorization, Content-Type, Authorization, credential, X-XSRF-TOKEN,token,username,client,access-token";
private static final String ALLOWED_METHODS = "*"; private static final String ALLOWED_METHODS = "*";
private static final String ALLOWED_ORIGIN = "https://inno.sh-sict.com/, https://hy.hpwjsns.org.cn/"; private static final Set<String> ALLOWED_ORIGINS = new HashSet<String>(){{
add("https://inno.sh-sict.com");
add("https://hy.hpwjsns.org.cn");
add("http://localhost:12998");
add("http://127.0.0.1:12998");
add("http://sict-gateway:12998");
add("http://192.168.31.140:12998");
}};
private static final String ALLOWED_Expose = "*"; private static final String ALLOWED_Expose = "*";
private static final String MAX_AGE = "18000L"; private static final String MAX_AGE = "18000L";
...@@ -37,7 +47,11 @@ public class GlobalCorsConfig { ...@@ -37,7 +47,11 @@ public class GlobalCorsConfig {
if (CorsUtils.isCorsRequest(request)) { if (CorsUtils.isCorsRequest(request)) {
ServerHttpResponse response = ctx.getResponse(); ServerHttpResponse response = ctx.getResponse();
HttpHeaders headers = response.getHeaders(); HttpHeaders headers = response.getHeaders();
headers.add("Access-Control-Allow-Origin", ALLOWED_ORIGIN); if(ALLOWED_ORIGINS.contains(request.getHeaders().getOrigin())){
headers.add("Access-Control-Allow-Origin", request.getHeaders().getOrigin());
}else{
headers.add("Access-Control-Allow-Origin", "https://hy.hpwjsns.org.cn");
}
headers.add("Access-Control-Allow-Methods", ALLOWED_METHODS); headers.add("Access-Control-Allow-Methods", ALLOWED_METHODS);
headers.add("Access-Control-Max-Age", MAX_AGE); headers.add("Access-Control-Max-Age", MAX_AGE);
headers.add("Access-Control-Allow-Headers", ALLOWED_HEADERS); headers.add("Access-Control-Allow-Headers", ALLOWED_HEADERS);
......
...@@ -74,6 +74,7 @@ public class HpAppointmentEvaController { ...@@ -74,6 +74,7 @@ public class HpAppointmentEvaController {
} }
CurrentUser current = SecurityUtils.getCurrentUser(); CurrentUser current = SecurityUtils.getCurrentUser();
eva.setUserId(current.getId()); eva.setUserId(current.getId());
eva.setPatientName(app.getPatientName());
eva.setHospCode(app.getHosOrgCode()); eva.setHospCode(app.getHosOrgCode());
eva.setHospName(app.getHosOrgName()); eva.setHospName(app.getHosOrgName());
eva.setDeptCode(app.getDeptCode()); eva.setDeptCode(app.getDeptCode());
......
package cn.sh.stc.sict.theme.hpgp.controller.mobile; package cn.sh.stc.sict.theme.hpgp.controller.mobile;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import cn.sh.stc.sict.cloud.common.security.util.SecurityUtils; import cn.sh.stc.sict.cloud.common.security.util.SecurityUtils;
import cn.sh.stc.sict.cloud.upms.dto.CurrentUser; import cn.sh.stc.sict.cloud.upms.dto.CurrentUser;
import cn.sh.stc.sict.theme.hpgp.model.HpgpBusyIdlePrediction; import cn.sh.stc.sict.theme.hpgp.model.HpgpBusyIdlePrediction;
import cn.sh.stc.sict.theme.hphy.model.HpDocInfo;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase; import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase;
import cn.sh.stc.sict.theme.hphy.service.HphyPatientBaseService; import cn.sh.stc.sict.theme.hphy.service.HphyPatientBaseService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -34,7 +34,7 @@ import java.util.List; ...@@ -34,7 +34,7 @@ import java.util.List;
@Slf4j @Slf4j
@RestController @RestController
@AllArgsConstructor @AllArgsConstructor
@Api(tags = "患者就诊记录") @Api(tags = "[C]患者就诊记录")
@RequestMapping("/hpHzjl") @RequestMapping("/hpHzjl")
public class HpHzjlController { public class HpHzjlController {
/** /**
...@@ -43,20 +43,39 @@ public class HpHzjlController { ...@@ -43,20 +43,39 @@ public class HpHzjlController {
private final HpHzjlService hpHzjlService; private final HpHzjlService hpHzjlService;
private final HphyPatientBaseService hphyPatientBaseService; private final HphyPatientBaseService hphyPatientBaseService;
@ApiOperation("历史科室 list")
@GetMapping("/history/dept/list") @GetMapping("/history/dept/list")
public R historyDeptList(){ public R historyDeptList() {
CurrentUser current = SecurityUtils.getCurrentUser();
if (ObjectUtil.isEmpty(current) || StrUtil.isBlank(current.getOpenId())) {
log.error("current = {}", JSONUtil.toJsonStr(current));
return new R().error("当前的登录人信息异常");
}
HphyPatientBase patient = hphyPatientBaseService.getByOpenId(current.getOpenId());
if (ObjectUtil.isEmpty(patient) || StrUtil.isBlank(patient.getCertId())) {
log.error("patient = {}", JSONUtil.toJsonStr(patient));
return new R().error("患者信息异常!");
}
List<HpgpBusyIdlePrediction> result = hpHzjlService.listByCertId(patient.getCertId());
return new R(result);
}
@ApiOperation("历史医生 list")
@GetMapping("/history/doctor/list")
public R historyDoctorList() {
CurrentUser current = SecurityUtils.getCurrentUser(); CurrentUser current = SecurityUtils.getCurrentUser();
if(ObjectUtil.isEmpty(current)|| StrUtil.isBlank(current.getOpenId())){ if (ObjectUtil.isEmpty(current) || StrUtil.isBlank(current.getOpenId())) {
log.error("current = {}", JSONUtil.toJsonStr(current)); log.error("current = {}", JSONUtil.toJsonStr(current));
return new R().error("当前的登录人信息异常"); return new R().error("当前的登录人信息异常");
} }
HphyPatientBase patient = hphyPatientBaseService.getByOpenId(current.getOpenId()); HphyPatientBase patient = hphyPatientBaseService.getByOpenId(current.getOpenId());
if(ObjectUtil.isEmpty(patient)||StrUtil.isBlank(patient.getCertId())){ if (ObjectUtil.isEmpty(patient) || StrUtil.isBlank(patient.getCertId())) {
log.error("patient = {}", JSONUtil.toJsonStr(patient)); log.error("patient = {}", JSONUtil.toJsonStr(patient));
return new R().error("患者信息异常!"); return new R().error("患者信息异常!");
} }
List<HpgpBusyIdlePrediction> result = hpHzjlService.listByCertId(patient.getCertId());
List<HpDocInfo> result = hpHzjlService.listDoctorByCertId(patient.getCertId());
return new R(result); return new R(result);
} }
} }
...@@ -23,6 +23,7 @@ public class HpAppointmentEva extends Model<HpAppointmentEva> { ...@@ -23,6 +23,7 @@ public class HpAppointmentEva extends Model<HpAppointmentEva> {
private Long id; private Long id;
private Long userId; private Long userId;
private Long patientId; private Long patientId;
private String patientName;
private Long appId; private Long appId;
private String hospCode; private String hospCode;
private String hospName; private String hospName;
......
package cn.sh.stc.sict.theme.hpgp.service; package cn.sh.stc.sict.theme.hpgp.service;
import cn.sh.stc.sict.theme.hpgp.model.HpgpBusyIdlePrediction; import cn.sh.stc.sict.theme.hpgp.model.HpgpBusyIdlePrediction;
import cn.sh.stc.sict.theme.hphy.model.HpDocInfo;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import cn.sh.stc.sict.theme.hpgp.model.HpHzjl; import cn.sh.stc.sict.theme.hpgp.model.HpHzjl;
...@@ -15,4 +16,6 @@ import java.util.List; ...@@ -15,4 +16,6 @@ import java.util.List;
public interface HpHzjlService extends IService<HpHzjl> { public interface HpHzjlService extends IService<HpHzjl> {
List<HpgpBusyIdlePrediction> listByCertId(String certId); List<HpgpBusyIdlePrediction> listByCertId(String certId);
List<HpDocInfo> listDoctorByCertId(String certId);
} }
...@@ -8,6 +8,9 @@ import cn.sh.stc.sict.theme.hpgp.model.HpgpBusyIdlePrediction; ...@@ -8,6 +8,9 @@ import cn.sh.stc.sict.theme.hpgp.model.HpgpBusyIdlePrediction;
import cn.sh.stc.sict.theme.hpgp.model.HpgpDepartmentRank; import cn.sh.stc.sict.theme.hpgp.model.HpgpDepartmentRank;
import cn.sh.stc.sict.theme.hpgp.service.HpgpBusyIdlePredictionService; import cn.sh.stc.sict.theme.hpgp.service.HpgpBusyIdlePredictionService;
import cn.sh.stc.sict.theme.hpgp.service.HpgpDepartmentRankService; import cn.sh.stc.sict.theme.hpgp.service.HpgpDepartmentRankService;
import cn.sh.stc.sict.theme.hphy.model.HpDocInfo;
import cn.sh.stc.sict.theme.hphy.model.HphyDoctor;
import cn.sh.stc.sict.theme.hphy.service.HpDocInfoService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -32,6 +35,7 @@ public class HpHzjlServiceImpl extends ServiceImpl<HpHzjlMapper, HpHzjl> impleme ...@@ -32,6 +35,7 @@ public class HpHzjlServiceImpl extends ServiceImpl<HpHzjlMapper, HpHzjl> impleme
private final HpgpDepartmentRankService hpgpDepartmentRankService; private final HpgpDepartmentRankService hpgpDepartmentRankService;
private final HpgpBusyIdlePredictionService hpgpBusyIdlePredictionService; private final HpgpBusyIdlePredictionService hpgpBusyIdlePredictionService;
private final HpDocInfoService hpDocInfoService;
/** /**
* 根据身份证号查找最后三次不同科室就诊记录,并计算忙闲 * 根据身份证号查找最后三次不同科室就诊记录,并计算忙闲
...@@ -75,4 +79,27 @@ public class HpHzjlServiceImpl extends ServiceImpl<HpHzjlMapper, HpHzjl> impleme ...@@ -75,4 +79,27 @@ public class HpHzjlServiceImpl extends ServiceImpl<HpHzjlMapper, HpHzjl> impleme
return result; return result;
} }
@Override
public List<HpDocInfo> listDoctorByCertId(String certId) {
LambdaQueryWrapper<HpHzjl> wrapper = Wrappers.lambdaQuery();
wrapper.eq(HpHzjl::getZjhm, certId)
.groupBy(HpHzjl::getYljgdm, HpHzjl::getJzksbm, HpHzjl::getZzysgh)
.orderByDesc(HpHzjl::getJzksrq)
.last("limit 10");
List<HpHzjl> recordList = this.list(wrapper);
List<HpDocInfo> doctorList = new ArrayList<>();
if (CollUtil.isNotEmpty(recordList)) {
recordList.forEach(r -> {
LambdaQueryWrapper<HpDocInfo> dw = Wrappers.lambdaQuery();
dw.eq(HpDocInfo::getHosOrgCode, r.getYljgdm())
.eq(HpDocInfo::getResourceCode, r.getZzysgh())
.eq(HpDocInfo::getResourceName, r.getZzysxm())
.last("limit 1");
HpDocInfo one = hpDocInfoService.getOne(dw);
doctorList.add(one);
});
}
return doctorList;
}
} }
...@@ -58,8 +58,12 @@ public class HphyPatientBaseController { ...@@ -58,8 +58,12 @@ public class HphyPatientBaseController {
@PostMapping("/register") @PostMapping("/register")
public R register(@RequestBody HphyPatientBase patient) { public R register(@RequestBody HphyPatientBase patient) {
CurrentUser current = SecurityUtils.getCurrentUser(); CurrentUser current = SecurityUtils.getCurrentUser();
HphyPatientBase base = hphyPatientBaseService.getByOpenId(current.getOpenId()); HphyPatientBase base = hphyPatientBaseService.getCurrentBase();
patient.setOpenId(current.getOpenId()); patient.setOpenId(current.getOpenId());
// 根据手机号去重
if (base == null || NumberUtil.isNullOrZero(base.getId())) {
base = hphyPatientBaseService.getByPhone(current.getPhone(), true);
}
if (base != null && NumberUtil.isNotNullOrZero(base.getId())) { if (base != null && NumberUtil.isNotNullOrZero(base.getId())) {
patient.setId(base.getId()); patient.setId(base.getId());
...@@ -78,7 +82,6 @@ public class HphyPatientBaseController { ...@@ -78,7 +82,6 @@ public class HphyPatientBaseController {
patient.setAge(String.valueOf(IdcardUtil.getAgeByIdCard(patient.getCertId()))); patient.setAge(String.valueOf(IdcardUtil.getAgeByIdCard(patient.getCertId())));
patient.setGender(IdcardUtil.getGenderByIdCard(patient.getCertId()) == 1 ? "男" : "女"); patient.setGender(IdcardUtil.getGenderByIdCard(patient.getCertId()) == 1 ? "男" : "女");
// 手机号redis验证 // 手机号redis验证
// 根据手机号去重
// 获取家庭医生签约信息 // 获取家庭医生签约信息
try { try {
String familyDocHos = WanDaHttpUtil.getContractInfo(patient.getCertId()); String familyDocHos = WanDaHttpUtil.getContractInfo(patient.getCertId());
...@@ -137,7 +140,16 @@ public class HphyPatientBaseController { ...@@ -137,7 +140,16 @@ public class HphyPatientBaseController {
} }
// 获取患者信息 // 获取患者信息
HphyPatientBase base = hphyPatientBaseService.getByOpenId(current.getOpenId()); HphyPatientBase base = hphyPatientBaseService.getByOpenId(current.getOpenId());
log.error("third-party.base1 = {}", JSONUtil.toJsonStr(base)); // 根据手机号去重
if (ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())) {
base = hphyPatientBaseService.getByPhone(current.getPhone(), true);
if(NumberUtil.isNotNullOrZero(base.getId())){
HphyPatientBase update = new HphyPatientBase();
update.setOpenId(current.getOpenId());
update.setId(base.getId());
hphyPatientBaseService.updateById(update);
}
}
if (ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())) { if (ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())) {
if (LoginTypeEnum.SSB.getType().equals(source)) { if (LoginTypeEnum.SSB.getType().equals(source)) {
WDUserInfo userInfo = SsbUtil.getUserInfo(token); WDUserInfo userInfo = SsbUtil.getUserInfo(token);
......
package cn.sh.stc.sict.theme.hphy.controller.mp;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.sh.stc.sict.cloud.common.core.util.NumberUtil;
import cn.sh.stc.sict.cloud.common.core.util.R;
import cn.sh.stc.sict.cloud.common.security.util.SecurityUtils;
import cn.sh.stc.sict.cloud.upms.dto.CurrentUser;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientRelation;
import cn.sh.stc.sict.theme.hphy.service.HphyPatientBaseService;
import cn.sh.stc.sict.theme.hphy.service.HphyPatientRelationService;
import cn.sh.stc.sict.theme.hphy.vo.PatientRelationDTO;
import cn.sh.stc.sict.theme.hphy.vo.PatientRelationVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
/**
* 患者-家庭成员关系表(HphyPatientRelation)表控制层
*
* @author F_xh
* @since 2022-10-10 14:41:04
*/
@Slf4j
@RestController
@AllArgsConstructor
@Api(tags = "[C]患者-家庭成员关系表")
@RequestMapping("/hphyPatientRelation")
public class HphyPatientRelationController {
/**
* 服务对象
*/
private final HphyPatientRelationService hphyPatientRelationService;
private final HphyPatientBaseService hphyPatientBaseService;
@ApiOperation("获取自己的家庭成员")
@GetMapping("/list")
public R list() {
CurrentUser current = SecurityUtils.getCurrentUser();
HphyPatientBase base = hphyPatientBaseService.getByOpenId(current.getOpenId());
if (ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())) {
return new R();
}
List<PatientRelationVO> result = hphyPatientRelationService.listPatientRelation(base.getId());
return new R(result);
}
@ApiOperation("新增家庭成员")
@PostMapping
@Transactional(rollbackFor = Exception.class)
public R insert(@RequestBody PatientRelationDTO dto) {
HphyPatientBase base = hphyPatientBaseService.getCurrentBase();
if (ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())) {
return new R().error("当前登陆人信息异常");
}
if (StrUtil.isBlank(dto.getPatient().getName())) {
return new R().error("姓名不可为空!");
}
if (StrUtil.isBlank(dto.getPatient().getCertId())) {
return new R().error("身份证号不可为空!");
}
if (StrUtil.isBlank(dto.getRelation().getRelationName())) {
return new R().error("关系不可为空!");
}
if (StrUtil.isBlank(dto.getPatient().getPhone())) {
return new R().error("手机号不可为空!");
}
hphyPatientBaseService.savePatient(dto.getPatient());
dto.getRelation().setSourcePatientId(base.getId());
dto.getRelation().setTargetPatientId(dto.getPatient().getId());
LambdaQueryWrapper<HphyPatientRelation> wrapper = Wrappers.lambdaQuery();
wrapper.and(i -> i.eq(HphyPatientRelation::getSourcePatientId, base.getId()).eq(HphyPatientRelation::getTargetPatientId, dto.getPatient().getId()))
.or().and(i -> i.eq(HphyPatientRelation::getSourcePatientId, dto.getPatient().getId()).eq(HphyPatientRelation::getTargetPatientId, base.getId()));
hphyPatientRelationService.saveOrUpdate(dto.getRelation(), wrapper);
return new R();
}
@ApiOperation("删除关系")
@DeleteMapping("/{relationId}")
public R delete(@PathVariable Long relationId) {
HphyPatientRelation relation = hphyPatientRelationService.getById(relationId);
if (ObjectUtil.isNull(relation) || NumberUtil.isNullOrZero(relation.getId())) {
return new R().error("未找到待删除项!");
}
hphyPatientRelationService.removeById(relationId);
return new R();
}
}
\ No newline at end of file
package cn.sh.stc.sict.theme.hphy.controller.web;
import cn.hutool.core.util.StrUtil;
import cn.sh.stc.sict.cloud.common.core.util.R;
import cn.sh.stc.sict.theme.hpgp.model.HpAppointmentEva;
import cn.sh.stc.sict.theme.hpgp.service.HpAppointmentEvaService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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;
@Slf4j
@RestController
@AllArgsConstructor
@Api(tags = "[B]预约评价")
@RequestMapping("/app/eva")
public class AppEvaController {
private final HpAppointmentEvaService hpAppointmentEvaService;
@ApiOperation("分页")
@GetMapping("/page")
public R hasEavedPage(Page page, HpAppointmentEva eva) {
LambdaQueryWrapper<HpAppointmentEva> wrapper = Wrappers.lambdaQuery();
wrapper.like(StrUtil.isNotBlank(eva.getPatientName()), HpAppointmentEva::getPatientName, eva.getPatientName())
.like(StrUtil.isNotBlank(eva.getHospName()), HpAppointmentEva::getHospName, eva.getHospName())
.like(StrUtil.isNotBlank(eva.getDeptName()), HpAppointmentEva::getDeptName, eva.getDeptName())
.like(StrUtil.isNotBlank(eva.getDoctorName()), HpAppointmentEva::getDoctorName, eva.getDoctorName())
.orderByDesc(HpAppointmentEva::getCreateTime);
return new R(hpAppointmentEvaService.page(page, wrapper));
}
}
...@@ -35,10 +35,16 @@ public class GuideRecordController { ...@@ -35,10 +35,16 @@ public class GuideRecordController {
@ApiOperation("分页查询") @ApiOperation("分页查询")
@GetMapping("/page") @GetMapping("/page")
public R<HphyGuideRecord> page(Page page, String patientName, String disease){ public R<HphyGuideRecord> page(Page page,
String patientName,
String disease,
String hospName,
String deptName,
String doctorName){
LambdaQueryWrapper<HphyGuideRecord> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<HphyGuideRecord> wrapper = new LambdaQueryWrapper<>();
wrapper.like(StrUtil.isNotBlank(patientName), HphyGuideRecord::getPatientName, patientName) wrapper.like(StrUtil.isNotBlank(patientName), HphyGuideRecord::getPatientName, patientName)
.like(StrUtil.isNotBlank(disease), HphyGuideRecord::getDisease, disease) .like(StrUtil.isNotBlank(disease), HphyGuideRecord::getDisease, disease)
// .like(StrUtil.isNotBlank(hospName), HphyGuideRecord)
.orderByDesc(HphyGuideRecord::getUpdateTime, HphyGuideRecord::getCreateTime); .orderByDesc(HphyGuideRecord::getUpdateTime, HphyGuideRecord::getCreateTime);
page = hphyGuideRecordService.page(page, wrapper); page = hphyGuideRecordService.page(page, wrapper);
......
...@@ -37,9 +37,15 @@ public class HpAppointmentController extends ApiController { ...@@ -37,9 +37,15 @@ public class HpAppointmentController extends ApiController {
@ApiOperation("分页查询 - 预约记录") @ApiOperation("分页查询 - 预约记录")
@GetMapping("/app/page") @GetMapping("/app/page")
public R appPage(Page page, public R appPage(Page page,
@RequestParam(value = "name", required = false) String name) { @RequestParam(value = "name", required = false) String name,
@RequestParam(value = "hospName", required = false) String hospName,
@RequestParam(value = "deptName", required = false) String deptName,
@RequestParam(value = "doctorName", required = false) String doctorName) {
LambdaQueryWrapper<HpAppointment> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<HpAppointment> wrapper = new LambdaQueryWrapper<>();
wrapper.like(StrUtil.isNotBlank(name), HpAppointment::getPatientName, name) wrapper.like(StrUtil.isNotBlank(name), HpAppointment::getPatientName, name)
.like(StrUtil.isNotBlank(hospName), HpAppointment::getHosOrgName, hospName)
.like(StrUtil.isNotBlank(doctorName), HpAppointment::getDoctorName, doctorName)
.like(StrUtil.isNotBlank(deptName), HpAppointment::getDeptName, deptName)
.orderByDesc(HpAppointment::getCreateTime); .orderByDesc(HpAppointment::getCreateTime);
page = hpAppointmentService.page(page, wrapper); page = hpAppointmentService.page(page, wrapper);
...@@ -49,10 +55,16 @@ public class HpAppointmentController extends ApiController { ...@@ -49,10 +55,16 @@ public class HpAppointmentController extends ApiController {
@ApiOperation("分页查询 - 取消预约记录") @ApiOperation("分页查询 - 取消预约记录")
@GetMapping("/cancel/page") @GetMapping("/cancel/page")
public R cancelPage(Page page, public R cancelPage(Page page,
@RequestParam(value = "name", required = false) String name) { @RequestParam(value = "name", required = false) String name,
@RequestParam(value = "hospName", required = false) String hospName,
@RequestParam(value = "deptName", required = false) String deptName,
@RequestParam(value = "doctorName", required = false) String doctorName) {
LambdaQueryWrapper<HpAppointment> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<HpAppointment> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(HpAppointment::getStatus, Constant.BYTE_YES) wrapper.eq(HpAppointment::getStatus, Constant.BYTE_YES)
.like(StrUtil.isNotBlank(name), HpAppointment::getPatientName, name) .like(StrUtil.isNotBlank(name), HpAppointment::getPatientName, name)
.like(StrUtil.isNotBlank(hospName), HpAppointment::getHosOrgName, hospName)
.like(StrUtil.isNotBlank(doctorName), HpAppointment::getDoctorName, doctorName)
.like(StrUtil.isNotBlank(deptName), HpAppointment::getDeptName, deptName)
.orderByDesc(HpAppointment::getCreateTime); .orderByDesc(HpAppointment::getCreateTime);
page = hpAppointmentService.page(page, wrapper); page = hpAppointmentService.page(page, wrapper);
......
package cn.sh.stc.sict.theme.hphy.controller.web; package cn.sh.stc.sict.theme.hphy.controller.web;
import cn.hutool.core.util.StrUtil;
import cn.sh.stc.sict.cloud.common.core.util.R; import cn.sh.stc.sict.cloud.common.core.util.R;
import cn.sh.stc.sict.theme.hphy.model.HphyGuideMatch; import cn.sh.stc.sict.theme.hphy.model.HphyGuideMatch;
import cn.sh.stc.sict.theme.hphy.service.HphyGuideMatchService; import cn.sh.stc.sict.theme.hphy.service.HphyGuideMatchService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -34,13 +36,19 @@ public class HphyGuideMatchController { ...@@ -34,13 +36,19 @@ public class HphyGuideMatchController {
* 分页查询 * 分页查询
* *
* @param page 分页对象 * @param page 分页对象
* @param hphyGuideMatch 导医推荐记录
* @return * @return
*/ */
@ApiOperation("分页查询 导医推荐记录") @ApiOperation("分页查询 导医推荐记录")
@GetMapping("/page") @GetMapping("/page")
public R<HphyGuideMatch> getHphyGuideMatchPage(Page page, HphyGuideMatch hphyGuideMatch) { public R<HphyGuideMatch> getHphyGuideMatchPage(Page page, HphyGuideMatch guide) {
page = hphyGuideMatchService.page(page, Wrappers.query(hphyGuideMatch)); LambdaQueryWrapper<HphyGuideMatch> wrapper = Wrappers.lambdaQuery();
wrapper.like(StrUtil.isNotBlank(guide.getPatientName()), HphyGuideMatch::getPatientName, guide.getPatientName())
.like(StrUtil.isNotBlank(guide.getHospName()), HphyGuideMatch::getHospName, guide.getHospName())
.like(StrUtil.isNotBlank(guide.getDeptName()), HphyGuideMatch::getDeptName, guide.getDeptName())
.like(StrUtil.isNotBlank(guide.getDoctorName()), HphyGuideMatch::getDoctorName, guide.getDoctorName())
.orderByDesc(HphyGuideMatch::getCreateTime);
page = hphyGuideMatchService.page(page, wrapper);
return new R(page); return new R(page);
} }
} }
package cn.sh.stc.sict.theme.hphy.dao;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientRelation;
import cn.sh.stc.sict.theme.hphy.vo.PatientRelationVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 患者-家庭成员关系表(HphyPatientRelation)表数据库访问层
*
* @author F_xh
* @since 2022-10-10 14:41:03
*/
public interface HphyPatientRelationMapper extends BaseMapper<HphyPatientRelation> {
List<PatientRelationVO> listPatientRelation(@Param("patientId") Long patientId);
}
\ No newline at end of file
...@@ -28,57 +28,57 @@ public class HphyGuideMatch extends Model<HphyGuideMatch> { ...@@ -28,57 +28,57 @@ public class HphyGuideMatch extends Model<HphyGuideMatch> {
* id * id
*/ */
@TableId @TableId
@ApiModelProperty(hidden = false, value = "id") @ApiModelProperty(value = "id")
private Long id; private Long id;
/** /**
* 患者id * 患者id
*/ */
@ApiModelProperty(hidden = false, value = "患者id") @ApiModelProperty(value = "患者id")
private Long patientId; private Long patientId;
/** /**
* 患者name * 患者name
*/ */
@ApiModelProperty(hidden = false, value = "患者name") @ApiModelProperty(value = "患者name")
private String patientName; private String patientName;
/** /**
* 导医id * 导医id
*/ */
@ApiModelProperty(hidden = false, value = "导医id") @ApiModelProperty(value = "导医id")
private Long guideId; private Long guideId;
/** /**
* 医院id * 医院id
*/ */
@ApiModelProperty(hidden = false, value = "医院id") @ApiModelProperty(value = "医院id")
private String hospId; private String hospId;
/** /**
* 医院name * 医院name
*/ */
@ApiModelProperty(hidden = false, value = "医院name") @ApiModelProperty(value = "医院name")
private String hospName; private String hospName;
/** /**
* 科室id * 科室id
*/ */
@ApiModelProperty(hidden = false, value = "科室id") @ApiModelProperty(value = "科室id")
private String deptId; private String deptId;
/** /**
* 科室name * 科室name
*/ */
@ApiModelProperty(hidden = false, value = "科室name") @ApiModelProperty(value = "科室name")
private String deptName; private String deptName;
/** /**
* 医生id * 医生id
*/ */
@ApiModelProperty(hidden = false, value = "医生id") @ApiModelProperty(value = "医生id")
private String doctorId; private String doctorId;
/** /**
* 医生name * 医生name
*/ */
@ApiModelProperty(hidden = false, value = "医生name") @ApiModelProperty(value = "医生name")
private String doctorName; private String doctorName;
/** /**
* 匹配度(%) * 匹配度(%)
*/ */
@ApiModelProperty(hidden = false, value = "匹配度(%)") @ApiModelProperty(value = "匹配度(%)")
private String matchScore; private String matchScore;
/** /**
* 创建时间 * 创建时间
......
package cn.sh.stc.sict.theme.hphy.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* 患者-家庭成员关系表(HphyPatientRelation)表实体类
*
* @author F_xh
* @since 2022-10-10 14:41:03
*/
@Data
@SuppressWarnings("serial")
@EqualsAndHashCode(callSuper = true)
public class HphyPatientRelation extends Model<HphyPatientRelation> {
private Long id;
private Long sourcePatientId;
private Long targetPatientId;
private String relationCode;
private String relationName;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@TableField(fill = FieldFill.INSERT)
private String createUserName;
@TableField(fill = FieldFill.UPDATE)
private Date updateTime;
@TableField(fill = FieldFill.INSERT)
private String updateUserName;
/**
* 获取主键值
*
* @return 主键值
*/
@Override
protected Serializable pkVal() {
return this.id;
}
}
\ No newline at end of file
...@@ -17,6 +17,12 @@ import java.util.List; ...@@ -17,6 +17,12 @@ import java.util.List;
public interface HphyPatientBaseService extends IService<HphyPatientBase> { public interface HphyPatientBaseService extends IService<HphyPatientBase> {
HphyPatientBase getByOpenId(String openId); HphyPatientBase getByOpenId(String openId);
HphyPatientBase getByPhone(String phone, Boolean flag);
HphyPatientBase saveSSbInfo(CurrentUser current, WDUserInfo userInfo, List<WDUserCardInfo> cardList); HphyPatientBase saveSSbInfo(CurrentUser current, WDUserInfo userInfo, List<WDUserCardInfo> cardList);
void savePatient(HphyPatientBase patient);
HphyPatientBase getCurrentBase();
} }
package cn.sh.stc.sict.theme.hphy.service;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientRelation;
import cn.sh.stc.sict.theme.hphy.vo.PatientRelationVO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 患者-家庭成员关系表(HphyPatientRelation)表服务接口
*
* @author F_xh
* @since 2022-10-10 14:41:04
*/
public interface HphyPatientRelationService extends IService<HphyPatientRelation> {
List<PatientRelationVO> listPatientRelation(Long patientId);
}
\ No newline at end of file
...@@ -6,6 +6,8 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -6,6 +6,8 @@ import cn.hutool.core.util.ObjectUtil;
import cn.sh.stc.sict.cloud.common.core.constant.Constant; import cn.sh.stc.sict.cloud.common.core.constant.Constant;
import cn.sh.stc.sict.cloud.common.core.dto.WDUserCardInfo; import cn.sh.stc.sict.cloud.common.core.dto.WDUserCardInfo;
import cn.sh.stc.sict.cloud.common.core.dto.WDUserInfo; import cn.sh.stc.sict.cloud.common.core.dto.WDUserInfo;
import cn.sh.stc.sict.cloud.common.core.util.NumberUtil;
import cn.sh.stc.sict.cloud.common.security.util.SecurityUtils;
import cn.sh.stc.sict.cloud.upms.dto.CurrentUser; import cn.sh.stc.sict.cloud.upms.dto.CurrentUser;
import cn.sh.stc.sict.theme.hphy.dao.HphyPatientBaseMapper; import cn.sh.stc.sict.theme.hphy.dao.HphyPatientBaseMapper;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase; import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase;
...@@ -32,6 +34,17 @@ public class HphyPatientBaseServiceImpl extends ServiceImpl<HphyPatientBaseMappe ...@@ -32,6 +34,17 @@ public class HphyPatientBaseServiceImpl extends ServiceImpl<HphyPatientBaseMappe
return this.getOne(wrapper); return this.getOne(wrapper);
} }
@Override
public HphyPatientBase getByPhone(String phone, Boolean flag) {
LambdaQueryWrapper<HphyPatientBase> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(HphyPatientBase::getPhone, phone)
.isNull(flag, HphyPatientBase::getOpenId)
.orderByDesc(HphyPatientBase::getUpdateTime)
.last("limit 1");
return this.getOne(wrapper);
}
@Override @Override
public HphyPatientBase saveSSbInfo(CurrentUser current, WDUserInfo userInfo, List<WDUserCardInfo> cardList) { public HphyPatientBase saveSSbInfo(CurrentUser current, WDUserInfo userInfo, List<WDUserCardInfo> cardList) {
if (ObjectUtil.isNotNull(userInfo)) { if (ObjectUtil.isNotNull(userInfo)) {
...@@ -44,7 +57,7 @@ public class HphyPatientBaseServiceImpl extends ServiceImpl<HphyPatientBaseMappe ...@@ -44,7 +57,7 @@ public class HphyPatientBaseServiceImpl extends ServiceImpl<HphyPatientBaseMappe
base.setAge(String.valueOf(IdcardUtil.getAgeByIdCard(userInfo.getPersoncard()))); base.setAge(String.valueOf(IdcardUtil.getAgeByIdCard(userInfo.getPersoncard())));
base.setGender(Constant.BYTE_YES.equals(userInfo.getGender()) ? "男" : "女"); base.setGender(Constant.BYTE_YES.equals(userInfo.getGender()) ? "男" : "女");
base.setVerifyStatus(userInfo.getVerifyStatus()); base.setVerifyStatus(userInfo.getVerifyStatus());
if(CollUtil.isNotEmpty(cardList)){ if (CollUtil.isNotEmpty(cardList)) {
WDUserCardInfo card = cardList.get(0); WDUserCardInfo card = cardList.get(0);
base.setMediCardId(card.getCardNo()); base.setMediCardId(card.getCardNo());
base.setMediCardType(card.getCardType()); base.setMediCardType(card.getCardType());
...@@ -55,4 +68,33 @@ public class HphyPatientBaseServiceImpl extends ServiceImpl<HphyPatientBaseMappe ...@@ -55,4 +68,33 @@ public class HphyPatientBaseServiceImpl extends ServiceImpl<HphyPatientBaseMappe
} }
return null; return null;
} }
@Override
public void savePatient(HphyPatientBase patient) {
HphyPatientBase base = this.getByCertId(patient.getCertId());
if (ObjectUtil.isNull(base) || NumberUtil.isNullOrZero(base.getId())) {
base = this.getByPhone(patient.getPhone(), false);
}
if (ObjectUtil.isNotNull(base) && NumberUtil.isNotNullOrZero(base.getId())) {
patient.setId(base.getId());
this.updateById(patient);
} else {
this.save(patient);
}
}
private HphyPatientBase getByCertId(String certId) {
LambdaQueryWrapper<HphyPatientBase> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(HphyPatientBase::getCertId, certId)
.orderByDesc(HphyPatientBase::getUpdateTime)
.last("limit 1");
return this.getOne(wrapper);
}
@Override
public HphyPatientBase getCurrentBase() {
CurrentUser current = SecurityUtils.getCurrentUser();
return this.getByOpenId(current.getOpenId());
}
} }
package cn.sh.stc.sict.theme.hphy.service.impl;
import cn.sh.stc.sict.theme.hphy.dao.HphyPatientRelationMapper;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientRelation;
import cn.sh.stc.sict.theme.hphy.service.HphyPatientRelationService;
import cn.sh.stc.sict.theme.hphy.vo.PatientRelationVO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 患者-家庭成员关系表(HphyPatientRelation)表服务实现类
*
* @author F_xh
* @since 2022-10-10 14:41:04
*/
@AllArgsConstructor
@Service("hphyPatientRelationService")
public class HphyPatientRelationServiceImpl extends ServiceImpl<HphyPatientRelationMapper, HphyPatientRelation> implements HphyPatientRelationService {
private final HphyPatientRelationMapper hphyPatientRelationMapper;
@Override
public List<PatientRelationVO> listPatientRelation(Long patientId) {
return hphyPatientRelationMapper.listPatientRelation(patientId);
}
}
\ No newline at end of file
package cn.sh.stc.sict.theme.hphy.vo;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientRelation;
import lombok.Data;
@Data
public class PatientRelationDTO {
private HphyPatientRelation relation;
private HphyPatientBase patient;
}
package cn.sh.stc.sict.theme.hphy.vo;
import cn.sh.stc.sict.theme.hphy.model.HphyPatientBase;
import lombok.Data;
@Data
public class PatientRelationVO extends HphyPatientBase {
private Long relationId;
private String relationCode;
private String relationName;
}
...@@ -20,3 +20,4 @@ spring: ...@@ -20,3 +20,4 @@ spring:
logging: logging:
level: level:
cn.sh.stc.sict.theme.hpgp.dao: DEBUG cn.sh.stc.sict.theme.hpgp.dao: DEBUG
cn.sh.stc.sict.theme.hphy.dao: DEBUG
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.sh.stc.sict.theme.hphy.dao.HphyPatientRelationMapper">
<resultMap type="cn.sh.stc.sict.theme.hphy.model.HphyPatientRelation" id="HphyPatientRelationMap">
<result property="id" column="id"/>
<result property="sourcePatientId" column="source_patient_id"/>
<result property="targetPatientId" column="target_patient_id"/>
<result property="relationCode" column="relation_code"/>
<result property="relationName" column="relation_name"/>
<result property="createTime" column="create_time"/>
<result property="createUserName" column="create_user_name"/>
<result property="updateTime" column="update_time"/>
<result property="updateUserName" column="update_user_name"/>
</resultMap>
<select id="listPatientRelation" resultType="cn.sh.stc.sict.theme.hphy.vo.PatientRelationVO">
select r.id relationId,
r.relation_code relationCode,
r.relation_name relationName,
p.id,
p.user_id userId,
p.open_id openId,
p.patient_id patientId,
p.name,
p.gender,
p.age,
p.education,
p.current_address currentAddress,
p.marriage_status marriageStatus
, p.`avg_hospitalized_days` avgHospitalizedDays
, p.`insurance_type` insuranceType
, p.`nation`
, p.`blood_type` bloodType
, p.`resident_address` residentAddress
, p.`occupation`
, p.`cert_id` certId
, p.`update_time` updateTime
, p.`disease`
, p.`tag`
, p.`condition`
, p.`phone`
, p.`medi_card_id` mediCardId
, p.`medi_card_type` mediCardType
, p.`enterprise_name` enterpriseName
, p.`family_doc_hos` familyDocHos
, p.`verify_status` verifyStatus
from hphy_patient_relation r
join hphy_patient_base p on r.target_patient_id = p.id or r.source_patient_id = p.id
where (r.source_patient_id = #{patientId} or r.target_patient_id = #{patientId})
and p.id &lt;&gt; #{patientId}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment