Commit 5e270c9aad5e07c6db354844bd0ef56921409736
1 parent
d1d3fac434
Exists in
master
his疾病名称和疾病库关联
Showing 7 changed files with 376 additions and 4 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsDictCodeORMController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDictCodeOrm.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDictCodeOrmMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDictCodeOrmService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDictCodeOrmServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java
- talkonlineweb/src/main/resources/mapper/LymsDictCodeOrmMapper.xml
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsDictCodeORMController.java
View file @
5e270c9
| 1 | +package com.lyms.talkonlineweb.controller; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 4 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
| 6 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 7 | +import com.lyms.talkonlineweb.domain.LymsDictCodeOrm; | |
| 8 | +import com.lyms.talkonlineweb.domain.RegisterPatientInfo; | |
| 9 | +import com.lyms.talkonlineweb.result.BaseResponse; | |
| 10 | +import com.lyms.talkonlineweb.service.LymsDictCodeOrmService; | |
| 11 | +import com.lyms.talkonlineweb.util.StringUtil; | |
| 12 | +import lombok.extern.log4j.Log4j2; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | +import org.springframework.validation.BindingResult; | |
| 15 | +import org.springframework.validation.ObjectError; | |
| 16 | +import org.springframework.validation.annotation.Validated; | |
| 17 | +import org.springframework.web.bind.annotation.*; | |
| 18 | + | |
| 19 | +import javax.servlet.http.HttpServletRequest; | |
| 20 | +import javax.servlet.http.HttpServletResponse; | |
| 21 | +import java.util.List; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * 疾病名称映射 | |
| 25 | + */ | |
| 26 | +@RestController | |
| 27 | +@Log4j2 | |
| 28 | +@RequestMapping("orm") | |
| 29 | +public class LymsDictCodeORMController { | |
| 30 | + | |
| 31 | + @Autowired | |
| 32 | + private LymsDictCodeOrmService lymsDictCodeOrmService; | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 新增 疾病名称映射 | |
| 36 | + * @param lymsDictCodeOrm | |
| 37 | + * @param bindingResult | |
| 38 | + * @return | |
| 39 | + */ | |
| 40 | + @PostMapping("addOrm") | |
| 41 | + public BaseResponse addOrm(@RequestBody @Validated LymsDictCodeOrm lymsDictCodeOrm | |
| 42 | + , BindingResult bindingResult){ | |
| 43 | + BaseResponse baseResponse = new BaseResponse(); | |
| 44 | + baseResponse.setErrorcode(1); | |
| 45 | + baseResponse.setErrormsg("失败"); | |
| 46 | + //@Validated对象验证的错误信息 | |
| 47 | + if(bindingResult.hasErrors()){ | |
| 48 | + baseResponse.setErrorcode(1); | |
| 49 | + for (ObjectError allError : bindingResult.getAllErrors()) { | |
| 50 | + baseResponse.setErrormsg((StringUtil.isNotEmpty(baseResponse.getErrormsg())?baseResponse.getErrormsg():"")+allError.getDefaultMessage()+";"); | |
| 51 | + } | |
| 52 | + return baseResponse; | |
| 53 | + } | |
| 54 | + try { | |
| 55 | + //新增 | |
| 56 | + boolean result = lymsDictCodeOrmService.save(lymsDictCodeOrm); | |
| 57 | + if(result){ | |
| 58 | + baseResponse.setErrorcode(0); | |
| 59 | + baseResponse.setErrormsg("成功"); | |
| 60 | + } | |
| 61 | + } catch (Exception e) { | |
| 62 | + e.printStackTrace(); | |
| 63 | + } | |
| 64 | + return baseResponse; | |
| 65 | + } | |
| 66 | + /** | |
| 67 | + * 修改 疾病名称映射 | |
| 68 | + * @param lymsDictCodeOrm | |
| 69 | + * @param bindingResult | |
| 70 | + * @return | |
| 71 | + */ | |
| 72 | + @PostMapping("updateOrm") | |
| 73 | + public BaseResponse updateOrm(@RequestBody @Validated LymsDictCodeOrm lymsDictCodeOrm | |
| 74 | + , BindingResult bindingResult){ | |
| 75 | + BaseResponse baseResponse = new BaseResponse(); | |
| 76 | + baseResponse.setErrorcode(1); | |
| 77 | + baseResponse.setErrormsg("失败"); | |
| 78 | + //@Validated对象验证的错误信息 | |
| 79 | + if(bindingResult.hasErrors()){ | |
| 80 | + baseResponse.setErrorcode(1); | |
| 81 | + for (ObjectError allError : bindingResult.getAllErrors()) { | |
| 82 | + baseResponse.setErrormsg((StringUtil.isNotEmpty(baseResponse.getErrormsg())?baseResponse.getErrormsg():"")+allError.getDefaultMessage()+";"); | |
| 83 | + } | |
| 84 | + return baseResponse; | |
| 85 | + } | |
| 86 | + try { | |
| 87 | + //修改 | |
| 88 | + if(null==lymsDictCodeOrm.getId()){ | |
| 89 | + baseResponse.setErrormsg("修改 id 不能为空"); | |
| 90 | + return baseResponse; | |
| 91 | + } | |
| 92 | + boolean result = lymsDictCodeOrmService.updateById(lymsDictCodeOrm); | |
| 93 | + if(result){ | |
| 94 | + baseResponse.setErrorcode(0); | |
| 95 | + baseResponse.setErrormsg("成功"); | |
| 96 | + } | |
| 97 | + } catch (Exception e) { | |
| 98 | + e.printStackTrace(); | |
| 99 | + } | |
| 100 | + return baseResponse; | |
| 101 | + } | |
| 102 | + /** | |
| 103 | + * 删除 疾病名称映射 | |
| 104 | + * @param id | |
| 105 | + * @return | |
| 106 | + */ | |
| 107 | + @DeleteMapping("delOrm") | |
| 108 | + public BaseResponse delOrm(Integer id){ | |
| 109 | + BaseResponse baseResponse = new BaseResponse(); | |
| 110 | + baseResponse.setErrorcode(1); | |
| 111 | + baseResponse.setErrormsg("失败"); | |
| 112 | + try { | |
| 113 | + //修改 | |
| 114 | + if(null==id){ | |
| 115 | + baseResponse.setErrormsg("删除 id 不能为空"); | |
| 116 | + return baseResponse; | |
| 117 | + } | |
| 118 | + boolean result = lymsDictCodeOrmService.removeById(id); | |
| 119 | + if(result){ | |
| 120 | + baseResponse.setErrorcode(0); | |
| 121 | + baseResponse.setErrormsg("成功"); | |
| 122 | + } | |
| 123 | + } catch (Exception e) { | |
| 124 | + e.printStackTrace(); | |
| 125 | + } | |
| 126 | + return baseResponse; | |
| 127 | + } | |
| 128 | + | |
| 129 | + /** | |
| 130 | + * 查询列表 疾病名称映射 | |
| 131 | + * @param lymsDictCodeOrm | |
| 132 | + * @param current | |
| 133 | + * @param size | |
| 134 | + * @return | |
| 135 | + */ | |
| 136 | + @GetMapping("getListPageOrm") | |
| 137 | + public BaseResponse getListPageOrm(@RequestBody LymsDictCodeOrm lymsDictCodeOrm,Integer current,Integer size ){ | |
| 138 | + BaseResponse baseResponse = new BaseResponse(); | |
| 139 | + try { | |
| 140 | + LambdaQueryWrapper<LymsDictCodeOrm> query=new QueryWrapper().lambda(); | |
| 141 | + query.setEntity(lymsDictCodeOrm); | |
| 142 | + query.orderByDesc(LymsDictCodeOrm::getCreatedTime); | |
| 143 | + | |
| 144 | + Page<LymsDictCodeOrm> page= new Page<>(current,size); | |
| 145 | + Page<LymsDictCodeOrm> lymsDictCodeOrmPage = lymsDictCodeOrmService.page(page,query); | |
| 146 | + baseResponse.setObject(lymsDictCodeOrmPage); | |
| 147 | + } catch (Exception e) { | |
| 148 | + e.printStackTrace(); | |
| 149 | + } | |
| 150 | + return baseResponse; | |
| 151 | + } | |
| 152 | + | |
| 153 | + /** | |
| 154 | + * 查询关联疾病名称 查重 | |
| 155 | + * @param lymsDictCodeOrm | |
| 156 | + * @return | |
| 157 | + */ | |
| 158 | + @GetMapping("getIllnessRepetition") | |
| 159 | + public BaseResponse getIllnessRepetition(LymsDictCodeOrm lymsDictCodeOrm){ | |
| 160 | + BaseResponse baseResponse = new BaseResponse(); | |
| 161 | + try { | |
| 162 | + //疾病名称查重 | |
| 163 | + List<LymsDictCodeOrm> list = lymsDictCodeOrmService.list(Wrappers.query(lymsDictCodeOrm)); | |
| 164 | + if (list.size()>0) { | |
| 165 | + baseResponse.setErrorcode(1); | |
| 166 | + baseResponse.setErrormsg("疾病名称已存在!"); | |
| 167 | + return baseResponse; | |
| 168 | + } | |
| 169 | + baseResponse.setErrorcode(0); | |
| 170 | + baseResponse.setErrormsg("疾病名称可以使用"); | |
| 171 | + } catch (Exception e) { | |
| 172 | + e.printStackTrace(); | |
| 173 | + } | |
| 174 | + return baseResponse; | |
| 175 | + } | |
| 176 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDictCodeOrm.java
View file @
5e270c9
| 1 | +package com.lyms.talkonlineweb.domain; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | |
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import java.io.Serializable; | |
| 8 | +import java.util.Date; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +import javax.validation.constraints.NotNull; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * his对接疾病名称统一匹配 | |
| 15 | + * @TableName lyms_dict_code_ORM | |
| 16 | + */ | |
| 17 | +@TableName(value ="lyms_dict_code_ORM") | |
| 18 | +@Data | |
| 19 | +public class LymsDictCodeOrm implements Serializable { | |
| 20 | + /** | |
| 21 | + * 主键id,自增 | |
| 22 | + */ | |
| 23 | + @TableId(value = "id", type = IdType.AUTO) | |
| 24 | + private Integer id; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 字典表疾病id | |
| 28 | + */ | |
| 29 | + @NotNull(message = "illId 不能为空") | |
| 30 | + @TableField(value = "ill_id") | |
| 31 | + private Integer illId; | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * his疾病名称 | |
| 35 | + */ | |
| 36 | + @NotNull(message = "hisIllness 不能为空") | |
| 37 | + @TableField(value = "his_illness") | |
| 38 | + private String hisIllness; | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 备注 | |
| 42 | + */ | |
| 43 | + @TableField(value = "remark") | |
| 44 | + private String remark; | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 创建时间 | |
| 48 | + */ | |
| 49 | + @TableField(value = "created_time") | |
| 50 | + private Date createdTime; | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 修改时间 | |
| 54 | + */ | |
| 55 | + @TableField(value = "update_time") | |
| 56 | + private Date updateTime; | |
| 57 | + | |
| 58 | + | |
| 59 | + @TableField(exist = false) | |
| 60 | + private static final long serialVersionUID = 1L; | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + public boolean equals(Object that) { | |
| 64 | + if (this == that) { | |
| 65 | + return true; | |
| 66 | + } | |
| 67 | + if (that == null) { | |
| 68 | + return false; | |
| 69 | + } | |
| 70 | + if (getClass() != that.getClass()) { | |
| 71 | + return false; | |
| 72 | + } | |
| 73 | + LymsDictCodeOrm other = (LymsDictCodeOrm) that; | |
| 74 | + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) | |
| 75 | + && (this.getIllId() == null ? other.getIllId() == null : this.getIllId().equals(other.getIllId())) | |
| 76 | + && (this.getHisIllness() == null ? other.getHisIllness() == null : this.getHisIllness().equals(other.getHisIllness())) | |
| 77 | + && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark())) | |
| 78 | + && (this.getCreatedTime() == null ? other.getCreatedTime() == null : this.getCreatedTime().equals(other.getCreatedTime())) | |
| 79 | + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())); | |
| 80 | + } | |
| 81 | + | |
| 82 | + @Override | |
| 83 | + public int hashCode() { | |
| 84 | + final int prime = 31; | |
| 85 | + int result = 1; | |
| 86 | + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); | |
| 87 | + result = prime * result + ((getIllId() == null) ? 0 : getIllId().hashCode()); | |
| 88 | + result = prime * result + ((getHisIllness() == null) ? 0 : getHisIllness().hashCode()); | |
| 89 | + result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode()); | |
| 90 | + result = prime * result + ((getCreatedTime() == null) ? 0 : getCreatedTime().hashCode()); | |
| 91 | + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); | |
| 92 | + return result; | |
| 93 | + } | |
| 94 | + | |
| 95 | + @Override | |
| 96 | + public String toString() { | |
| 97 | + StringBuilder sb = new StringBuilder(); | |
| 98 | + sb.append(getClass().getSimpleName()); | |
| 99 | + sb.append(" ["); | |
| 100 | + sb.append("Hash = ").append(hashCode()); | |
| 101 | + sb.append(", id=").append(id); | |
| 102 | + sb.append(", illId=").append(illId); | |
| 103 | + sb.append(", hisIllness=").append(hisIllness); | |
| 104 | + sb.append(", remark=").append(remark); | |
| 105 | + sb.append(", createdTime=").append(createdTime); | |
| 106 | + sb.append(", updateTime=").append(updateTime); | |
| 107 | + sb.append(", serialVersionUID=").append(serialVersionUID); | |
| 108 | + sb.append("]"); | |
| 109 | + return sb.toString(); | |
| 110 | + } | |
| 111 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDictCodeOrmMapper.java
View file @
5e270c9
| 1 | +package com.lyms.talkonlineweb.mapper; | |
| 2 | + | |
| 3 | +import com.lyms.talkonlineweb.domain.LymsDictCodeOrm; | |
| 4 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * @Entity com.lyms.talkonlineweb.domain.LymsDictCodeOrm | |
| 8 | + */ | |
| 9 | +public interface LymsDictCodeOrmMapper extends BaseMapper<LymsDictCodeOrm> { | |
| 10 | + | |
| 11 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDictCodeOrmService.java
View file @
5e270c9
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDictCodeOrmServiceImpl.java
View file @
5e270c9
| 1 | +package com.lyms.talkonlineweb.service.impl; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
| 4 | +import com.lyms.talkonlineweb.domain.LymsDictCodeOrm; | |
| 5 | +import com.lyms.talkonlineweb.service.LymsDictCodeOrmService; | |
| 6 | +import com.lyms.talkonlineweb.mapper.LymsDictCodeOrmMapper; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * | |
| 11 | + */ | |
| 12 | +@Service | |
| 13 | +public class LymsDictCodeOrmServiceImpl extends ServiceImpl<LymsDictCodeOrmMapper, LymsDictCodeOrm> | |
| 14 | + implements LymsDictCodeOrmService{ | |
| 15 | + | |
| 16 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java
View file @
5e270c9
| ... | ... | @@ -20,6 +20,7 @@ |
| 20 | 20 | import org.springframework.util.DigestUtils; |
| 21 | 21 | |
| 22 | 22 | import java.util.*; |
| 23 | +import java.util.stream.Collectors; | |
| 23 | 24 | |
| 24 | 25 | /** |
| 25 | 26 | * |
| ... | ... | @@ -45,6 +46,8 @@ |
| 45 | 46 | private LymsTcardService lymsTcardService;//问诊卡信息 |
| 46 | 47 | @Autowired |
| 47 | 48 | private LymsHisInfoService lymsHisInfoService; |
| 49 | + @Autowired | |
| 50 | + private LymsDictCodeOrmService lymsDictCodeOrmService; | |
| 48 | 51 | |
| 49 | 52 | |
| 50 | 53 | @Override |
| 51 | 54 | |
| ... | ... | @@ -109,8 +112,9 @@ |
| 109 | 112 | } |
| 110 | 113 | |
| 111 | 114 | //疾病 |
| 112 | - String[] diagnoses =lymsHisInfo.getDiagnose().split(","); | |
| 115 | + List<String> diagnoses = Arrays.asList(lymsHisInfo.getDiagnose().split(",")); | |
| 113 | 116 | List<String> diagnoseIds = new ArrayList<>();//疾病ids |
| 117 | + List<String> diagnoseOrmIds = new ArrayList<>();//疾病映射ids | |
| 114 | 118 | if (null != diagnoses) { |
| 115 | 119 | for (String diagnose : diagnoses) { |
| 116 | 120 | LymsDict dict = new LymsDict(); |
| 117 | 121 | |
| ... | ... | @@ -122,11 +126,26 @@ |
| 122 | 126 | diagnoseIds.add(lymsDict.getCode().toString()); |
| 123 | 127 | } |
| 124 | 128 | } |
| 129 | + //去疾病映射库做对比 | |
| 130 | + LymsDictCodeOrm dictCodeOrm=new LymsDictCodeOrm(); | |
| 131 | + dictCodeOrm.setHisIllness(diagnose); | |
| 132 | + List<LymsDictCodeOrm> dictCodeOrms = lymsDictCodeOrmService.list(Wrappers.query(dictCodeOrm)); | |
| 133 | + for (LymsDictCodeOrm codeOrm : dictCodeOrms) { | |
| 134 | + if(null != codeOrm.getIllId()){ | |
| 135 | + diagnoseOrmIds.add(codeOrm.getIllId().toString()); | |
| 136 | + } | |
| 137 | + } | |
| 138 | + | |
| 125 | 139 | } |
| 126 | 140 | } |
| 127 | - //如果有疾病在数据库中不存在,则都不予上传 | |
| 128 | - if(diagnoses.length!=diagnoseIds.size()){ | |
| 129 | - return "疾病不存在,请在设置-字典管理中添加疾病:"+lymsHisInfo.getDiagnose(); | |
| 141 | + //如果有疾病在疾病库中不存在,则都不予上传,如果在映射库中存在可以上传 | |
| 142 | + if(diagnoses.size()!=diagnoseIds.size()){ | |
| 143 | + if(diagnoses.size()==diagnoseOrmIds.size()){ | |
| 144 | + //去重赋值 | |
| 145 | + diagnoseIds=diagnoseOrmIds.stream().distinct().collect(Collectors.toList()); | |
| 146 | + }else { | |
| 147 | + return "疾病不存在,请在设置-字典管理中添加疾病或在疾病映射中添加映射关系。"; | |
| 148 | + } | |
| 130 | 149 | } |
| 131 | 150 | //患者(身份证) |
| 132 | 151 | String idCard = lymsHisInfo.getIdcard(); |
talkonlineweb/src/main/resources/mapper/LymsDictCodeOrmMapper.xml
View file @
5e270c9
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper | |
| 3 | + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
| 4 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 5 | +<mapper namespace="com.lyms.talkonlineweb.mapper.LymsDictCodeOrmMapper"> | |
| 6 | + | |
| 7 | + <resultMap id="BaseResultMap" type="com.lyms.talkonlineweb.domain.LymsDictCodeOrm"> | |
| 8 | + <id property="id" column="id" jdbcType="INTEGER"/> | |
| 9 | + <result property="illId" column="ill_id" jdbcType="INTEGER"/> | |
| 10 | + <result property="hisIllness" column="his_illness" jdbcType="VARCHAR"/> | |
| 11 | + <result property="remark" column="remark" jdbcType="VARCHAR"/> | |
| 12 | + <result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/> | |
| 13 | + <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> | |
| 14 | + </resultMap> | |
| 15 | + | |
| 16 | + <sql id="Base_Column_List"> | |
| 17 | + id,ill_id,his_illness, | |
| 18 | + remark,created_time,update_time | |
| 19 | + </sql> | |
| 20 | +</mapper> |