From 5e270c9aad5e07c6db354844bd0ef56921409736 Mon Sep 17 00:00:00 2001 From: shiyang <316555390@qq.com> Date: Mon, 25 Apr 2022 15:31:17 +0800 Subject: [PATCH] =?UTF-8?q?his=E7=96=BE=E7=97=85=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=92=8C=E7=96=BE=E7=97=85=E5=BA=93=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/LymsDictCodeORMController.java | 176 +++++++++++++++++++++ .../lyms/talkonlineweb/domain/LymsDictCodeOrm.java | 111 +++++++++++++ .../mapper/LymsDictCodeOrmMapper.java | 15 ++ .../service/LymsDictCodeOrmService.java | 11 ++ .../service/impl/LymsDictCodeOrmServiceImpl.java | 20 +++ .../service/impl/LymsHisInfoServiceImpl.java | 27 +++- .../resources/mapper/LymsDictCodeOrmMapper.xml | 20 +++ 7 files changed, 376 insertions(+), 4 deletions(-) create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsDictCodeORMController.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDictCodeOrm.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDictCodeOrmMapper.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDictCodeOrmService.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDictCodeOrmServiceImpl.java create mode 100644 talkonlineweb/src/main/resources/mapper/LymsDictCodeOrmMapper.xml diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsDictCodeORMController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsDictCodeORMController.java new file mode 100644 index 0000000..dfba81e --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsDictCodeORMController.java @@ -0,0 +1,176 @@ +package com.lyms.talkonlineweb.controller; + +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 com.lyms.talkonlineweb.domain.LymsDictCodeOrm; +import com.lyms.talkonlineweb.domain.RegisterPatientInfo; +import com.lyms.talkonlineweb.result.BaseResponse; +import com.lyms.talkonlineweb.service.LymsDictCodeOrmService; +import com.lyms.talkonlineweb.util.StringUtil; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.validation.ObjectError; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 疾病名称映射 + */ +@RestController +@Log4j2 +@RequestMapping("orm") +public class LymsDictCodeORMController { + + @Autowired + private LymsDictCodeOrmService lymsDictCodeOrmService; + + /** + * 新增 疾病名称映射 + * @param lymsDictCodeOrm + * @param bindingResult + * @return + */ + @PostMapping("addOrm") + public BaseResponse addOrm(@RequestBody @Validated LymsDictCodeOrm lymsDictCodeOrm + , BindingResult bindingResult){ + BaseResponse baseResponse = new BaseResponse(); + baseResponse.setErrorcode(1); + baseResponse.setErrormsg("失败"); + //@Validated对象验证的错误信息 + if(bindingResult.hasErrors()){ + baseResponse.setErrorcode(1); + for (ObjectError allError : bindingResult.getAllErrors()) { + baseResponse.setErrormsg((StringUtil.isNotEmpty(baseResponse.getErrormsg())?baseResponse.getErrormsg():"")+allError.getDefaultMessage()+";"); + } + return baseResponse; + } + try { + //新增 + boolean result = lymsDictCodeOrmService.save(lymsDictCodeOrm); + if(result){ + baseResponse.setErrorcode(0); + baseResponse.setErrormsg("成功"); + } + } catch (Exception e) { + e.printStackTrace(); + } + return baseResponse; + } + /** + * 修改 疾病名称映射 + * @param lymsDictCodeOrm + * @param bindingResult + * @return + */ + @PostMapping("updateOrm") + public BaseResponse updateOrm(@RequestBody @Validated LymsDictCodeOrm lymsDictCodeOrm + , BindingResult bindingResult){ + BaseResponse baseResponse = new BaseResponse(); + baseResponse.setErrorcode(1); + baseResponse.setErrormsg("失败"); + //@Validated对象验证的错误信息 + if(bindingResult.hasErrors()){ + baseResponse.setErrorcode(1); + for (ObjectError allError : bindingResult.getAllErrors()) { + baseResponse.setErrormsg((StringUtil.isNotEmpty(baseResponse.getErrormsg())?baseResponse.getErrormsg():"")+allError.getDefaultMessage()+";"); + } + return baseResponse; + } + try { + //修改 + if(null==lymsDictCodeOrm.getId()){ + baseResponse.setErrormsg("修改 id 不能为空"); + return baseResponse; + } + boolean result = lymsDictCodeOrmService.updateById(lymsDictCodeOrm); + if(result){ + baseResponse.setErrorcode(0); + baseResponse.setErrormsg("成功"); + } + } catch (Exception e) { + e.printStackTrace(); + } + return baseResponse; + } + /** + * 删除 疾病名称映射 + * @param id + * @return + */ + @DeleteMapping("delOrm") + public BaseResponse delOrm(Integer id){ + BaseResponse baseResponse = new BaseResponse(); + baseResponse.setErrorcode(1); + baseResponse.setErrormsg("失败"); + try { + //修改 + if(null==id){ + baseResponse.setErrormsg("删除 id 不能为空"); + return baseResponse; + } + boolean result = lymsDictCodeOrmService.removeById(id); + if(result){ + baseResponse.setErrorcode(0); + baseResponse.setErrormsg("成功"); + } + } catch (Exception e) { + e.printStackTrace(); + } + return baseResponse; + } + + /** + * 查询列表 疾病名称映射 + * @param lymsDictCodeOrm + * @param current + * @param size + * @return + */ + @GetMapping("getListPageOrm") + public BaseResponse getListPageOrm(@RequestBody LymsDictCodeOrm lymsDictCodeOrm,Integer current,Integer size ){ + BaseResponse baseResponse = new BaseResponse(); + try { + LambdaQueryWrapper query=new QueryWrapper().lambda(); + query.setEntity(lymsDictCodeOrm); + query.orderByDesc(LymsDictCodeOrm::getCreatedTime); + + Page page= new Page<>(current,size); + Page lymsDictCodeOrmPage = lymsDictCodeOrmService.page(page,query); + baseResponse.setObject(lymsDictCodeOrmPage); + } catch (Exception e) { + e.printStackTrace(); + } + return baseResponse; + } + + /** + * 查询关联疾病名称 查重 + * @param lymsDictCodeOrm + * @return + */ + @GetMapping("getIllnessRepetition") + public BaseResponse getIllnessRepetition(LymsDictCodeOrm lymsDictCodeOrm){ + BaseResponse baseResponse = new BaseResponse(); + try { + //疾病名称查重 + List list = lymsDictCodeOrmService.list(Wrappers.query(lymsDictCodeOrm)); + if (list.size()>0) { + baseResponse.setErrorcode(1); + baseResponse.setErrormsg("疾病名称已存在!"); + return baseResponse; + } + baseResponse.setErrorcode(0); + baseResponse.setErrormsg("疾病名称可以使用"); + } catch (Exception e) { + e.printStackTrace(); + } + return baseResponse; + } +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDictCodeOrm.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDictCodeOrm.java new file mode 100644 index 0000000..7773286 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDictCodeOrm.java @@ -0,0 +1,111 @@ +package com.lyms.talkonlineweb.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * his对接疾病名称统一匹配 + * @TableName lyms_dict_code_ORM + */ +@TableName(value ="lyms_dict_code_ORM") +@Data +public class LymsDictCodeOrm implements Serializable { + /** + * 主键id,自增 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 字典表疾病id + */ + @NotNull(message = "illId 不能为空") + @TableField(value = "ill_id") + private Integer illId; + + /** + * his疾病名称 + */ + @NotNull(message = "hisIllness 不能为空") + @TableField(value = "his_illness") + private String hisIllness; + + /** + * 备注 + */ + @TableField(value = "remark") + private String remark; + + /** + * 创建时间 + */ + @TableField(value = "created_time") + private Date createdTime; + + /** + * 修改时间 + */ + @TableField(value = "update_time") + private Date updateTime; + + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + LymsDictCodeOrm other = (LymsDictCodeOrm) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getIllId() == null ? other.getIllId() == null : this.getIllId().equals(other.getIllId())) + && (this.getHisIllness() == null ? other.getHisIllness() == null : this.getHisIllness().equals(other.getHisIllness())) + && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark())) + && (this.getCreatedTime() == null ? other.getCreatedTime() == null : this.getCreatedTime().equals(other.getCreatedTime())) + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getIllId() == null) ? 0 : getIllId().hashCode()); + result = prime * result + ((getHisIllness() == null) ? 0 : getHisIllness().hashCode()); + result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode()); + result = prime * result + ((getCreatedTime() == null) ? 0 : getCreatedTime().hashCode()); + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", illId=").append(illId); + sb.append(", hisIllness=").append(hisIllness); + sb.append(", remark=").append(remark); + sb.append(", createdTime=").append(createdTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDictCodeOrmMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDictCodeOrmMapper.java new file mode 100644 index 0000000..b895081 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDictCodeOrmMapper.java @@ -0,0 +1,15 @@ +package com.lyms.talkonlineweb.mapper; + +import com.lyms.talkonlineweb.domain.LymsDictCodeOrm; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Entity com.lyms.talkonlineweb.domain.LymsDictCodeOrm + */ +public interface LymsDictCodeOrmMapper extends BaseMapper { + +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDictCodeOrmService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDictCodeOrmService.java new file mode 100644 index 0000000..7b0e844 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDictCodeOrmService.java @@ -0,0 +1,11 @@ +package com.lyms.talkonlineweb.service; + +import com.lyms.talkonlineweb.domain.LymsDictCodeOrm; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * + */ +public interface LymsDictCodeOrmService extends IService { + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDictCodeOrmServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDictCodeOrmServiceImpl.java new file mode 100644 index 0000000..f1e310b --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDictCodeOrmServiceImpl.java @@ -0,0 +1,20 @@ +package com.lyms.talkonlineweb.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lyms.talkonlineweb.domain.LymsDictCodeOrm; +import com.lyms.talkonlineweb.service.LymsDictCodeOrmService; +import com.lyms.talkonlineweb.mapper.LymsDictCodeOrmMapper; +import org.springframework.stereotype.Service; + +/** + * + */ +@Service +public class LymsDictCodeOrmServiceImpl extends ServiceImpl + implements LymsDictCodeOrmService{ + +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java index 2ac6594..778c374 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java @@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.DigestUtils; import java.util.*; +import java.util.stream.Collectors; /** * @@ -45,6 +46,8 @@ public class LymsHisInfoServiceImpl extends ServiceImpl diagnoses = Arrays.asList(lymsHisInfo.getDiagnose().split(",")); List diagnoseIds = new ArrayList<>();//疾病ids + List diagnoseOrmIds = new ArrayList<>();//疾病映射ids if (null != diagnoses) { for (String diagnose : diagnoses) { LymsDict dict = new LymsDict(); @@ -122,11 +126,26 @@ public class LymsHisInfoServiceImpl extends ServiceImpl dictCodeOrms = lymsDictCodeOrmService.list(Wrappers.query(dictCodeOrm)); + for (LymsDictCodeOrm codeOrm : dictCodeOrms) { + if(null != codeOrm.getIllId()){ + diagnoseOrmIds.add(codeOrm.getIllId().toString()); + } + } + } } - //如果有疾病在数据库中不存在,则都不予上传 - if(diagnoses.length!=diagnoseIds.size()){ - return "疾病不存在,请在设置-字典管理中添加疾病:"+lymsHisInfo.getDiagnose(); + //如果有疾病在疾病库中不存在,则都不予上传,如果在映射库中存在可以上传 + if(diagnoses.size()!=diagnoseIds.size()){ + if(diagnoses.size()==diagnoseOrmIds.size()){ + //去重赋值 + diagnoseIds=diagnoseOrmIds.stream().distinct().collect(Collectors.toList()); + }else { + return "疾病不存在,请在设置-字典管理中添加疾病或在疾病映射中添加映射关系。"; + } } //患者(身份证) String idCard = lymsHisInfo.getIdcard(); diff --git a/talkonlineweb/src/main/resources/mapper/LymsDictCodeOrmMapper.xml b/talkonlineweb/src/main/resources/mapper/LymsDictCodeOrmMapper.xml new file mode 100644 index 0000000..cdc8628 --- /dev/null +++ b/talkonlineweb/src/main/resources/mapper/LymsDictCodeOrmMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + id,ill_id,his_illness, + remark,created_time,update_time + + -- 1.8.3.1