Commit 0527fbeb819a26d9ba6517f9814c495679a4f132

Authored by changpengfei
1 parent 9ecae5ba23
Exists in master

修改科室对应疾病

Showing 7 changed files with 181 additions and 18 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DepartController.java View file @ 0527fbe
... ... @@ -2,10 +2,12 @@
2 2  
3 3 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
4 4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5 +import com.lyms.talkonlineweb.domain.LymsDepartill;
5 6 import com.lyms.talkonlineweb.domain.LymsDict;
6 7 import com.lyms.talkonlineweb.domain.LymsHdepart;
7 8 import com.lyms.talkonlineweb.domain.LymsHospital;
8 9 import com.lyms.talkonlineweb.result.BaseResponse;
  10 +import com.lyms.talkonlineweb.service.LymsDepartillService;
9 11 import com.lyms.talkonlineweb.service.LymsHdepartService;
10 12 import com.lyms.talkonlineweb.util.Constant;
11 13 import com.lyms.talkonlineweb.util.JwtUtils;
12 14  
... ... @@ -32,7 +34,10 @@
32 34 @Autowired
33 35 private LymsHdepartService lymsHdepartService;
34 36  
  37 + @Autowired //科室所拥有的疾病
  38 + private LymsDepartillService lymsDepartillService;
35 39  
  40 +
36 41 /**
37 42 * 获取科室列表
38 43 * @param depart
39 44  
... ... @@ -59,19 +64,13 @@
59 64 * @return
60 65 */
61 66 @PostMapping("saveDepart")
62   - public BaseResponse saveDepart(@Validated LymsHdepart depart, BindingResult result){
  67 + public BaseResponse saveDepart(@Validated LymsHdepart depart, BindingResult result,String ills){
63 68 BaseResponse baseResponse=new BaseResponse();
64 69 baseResponse.setErrormsg("");
65 70 if(depart.getDid()==null){
66 71 depart.setCreatedtime(new Date());
67 72 LymsHdepart depart2=new LymsHdepart();
68   - depart2.setDusername(depart.getDusername());
69   - List<LymsHdepart> dLst=lymsHdepartService.list(Wrappers.query(depart2));
70   - if (dLst.size()>0) {
71   - baseResponse.setErrormsg("不能创建重复账号");
72   - baseResponse.setErrorcode(1);
73   - return baseResponse;
74   - }
  73 +
75 74 }else{
76 75 depart.setUpdatedTime(new Date());
77 76 }
78 77  
79 78  
... ... @@ -83,9 +82,21 @@
83 82  
84 83 return baseResponse;
85 84 }
  85 + boolean f=lymsHdepartService.saveOrUpdate(depart);
86 86  
  87 + Map param=new HashMap();
  88 + param.put("did",depart.getDid());
  89 + lymsDepartillService.removeByMap(param);
87 90  
88   - boolean f=lymsHdepartService.saveOrUpdate(depart);
  91 + String[] iArr=ills.split(",");
  92 +
  93 + for (int i = 0; i < iArr.length; i++) {
  94 + LymsDepartill departill=new LymsDepartill();
  95 + departill.setDid(depart.getDid());
  96 + departill.setIid(Integer.parseInt(iArr[i]));
  97 + lymsDepartillService.save(departill);
  98 + }
  99 +
89 100 baseResponse.setErrorcode(f==true?0:1);
90 101 return baseResponse;
91 102 }
... ... @@ -114,15 +125,15 @@
114 125 BaseResponse baseResponse=new BaseResponse();
115 126 List<LymsHdepart> dLst=lymsHdepartService.list(Wrappers.query(depart));
116 127  
117   - if (dLst.size()>0) {
118   - depart=dLst.get(0);
119   - depart.setDpasswd(null);
120   - String jwt = JwtUtils.createJWT("1", depart.getDusername(), Constant.JWT_TTL);
121   - Map<String,Object> map=new HashMap<>();
122   - map.put("depart",depart);
123   - map.put("token",jwt);
124   - baseResponse.setObject(map);
125   - }
  128 +// if (dLst.size()>0) {
  129 +// depart=dLst.get(0);
  130 +// depart.setDpasswd(null);
  131 +// String jwt = JwtUtils.createJWT("1", depart.getDusername(), Constant.JWT_TTL);
  132 +// Map<String,Object> map=new HashMap<>();
  133 +// map.put("depart",depart);
  134 +// map.put("token",jwt);
  135 +// baseResponse.setObject(map);
  136 +// }
126 137  
127 138 return baseResponse;
128 139 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDepartill.java View file @ 0527fbe
  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 lombok.Data;
  9 +
  10 +/**
  11 + *
  12 + * @TableName lyms_departill
  13 + */
  14 +@TableName(value ="lyms_departill")
  15 +@Data
  16 +public class LymsDepartill implements Serializable {
  17 + /**
  18 + *
  19 + */
  20 + @TableId(value = "id", type = IdType.AUTO)
  21 + private Integer id;
  22 +
  23 + /**
  24 + * 所属科室
  25 + */
  26 + @TableField(value = "did")
  27 + private Integer did;
  28 +
  29 + /**
  30 + * 疾病ID
  31 + */
  32 + @TableField(value = "iid")
  33 + private Integer iid;
  34 +
  35 + /**
  36 + * 疾病名称
  37 + */
  38 + @TableField(value = "iname")
  39 + private String iname;
  40 +
  41 + @TableField(exist = false)
  42 + private static final long serialVersionUID = 1L;
  43 +
  44 + @Override
  45 + public boolean equals(Object that) {
  46 + if (this == that) {
  47 + return true;
  48 + }
  49 + if (that == null) {
  50 + return false;
  51 + }
  52 + if (getClass() != that.getClass()) {
  53 + return false;
  54 + }
  55 + LymsDepartill other = (LymsDepartill) that;
  56 + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
  57 + && (this.getDid() == null ? other.getDid() == null : this.getDid().equals(other.getDid()))
  58 + && (this.getIid() == null ? other.getIid() == null : this.getIid().equals(other.getIid()))
  59 + && (this.getIname() == null ? other.getIname() == null : this.getIname().equals(other.getIname()));
  60 + }
  61 +
  62 + @Override
  63 + public int hashCode() {
  64 + final int prime = 31;
  65 + int result = 1;
  66 + result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
  67 + result = prime * result + ((getDid() == null) ? 0 : getDid().hashCode());
  68 + result = prime * result + ((getIid() == null) ? 0 : getIid().hashCode());
  69 + result = prime * result + ((getIname() == null) ? 0 : getIname().hashCode());
  70 + return result;
  71 + }
  72 +
  73 + @Override
  74 + public String toString() {
  75 + StringBuilder sb = new StringBuilder();
  76 + sb.append(getClass().getSimpleName());
  77 + sb.append(" [");
  78 + sb.append("Hash = ").append(hashCode());
  79 + sb.append(", id=").append(id);
  80 + sb.append(", did=").append(did);
  81 + sb.append(", iid=").append(iid);
  82 + sb.append(", iname=").append(iname);
  83 + sb.append(", serialVersionUID=").append(serialVersionUID);
  84 + sb.append("]");
  85 + return sb.toString();
  86 + }
  87 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsHdepart.java View file @ 0527fbe
... ... @@ -84,6 +84,7 @@
84 84 @TableField(value = "updated_time")
85 85 private Date updatedTime;
86 86  
  87 +
87 88 @TableField(exist = false)
88 89 private static final long serialVersionUID = 1L;
89 90  
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDepartillMapper.java View file @ 0527fbe
  1 +package com.lyms.talkonlineweb.mapper;
  2 +
  3 +import com.lyms.talkonlineweb.domain.LymsDepartill;
  4 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  5 +
  6 +/**
  7 + * @Entity com.lyms.talkonlineweb.domain.LymsDepartill
  8 + */
  9 +public interface LymsDepartillMapper extends BaseMapper<LymsDepartill> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDepartillService.java View file @ 0527fbe
  1 +package com.lyms.talkonlineweb.service;
  2 +
  3 +import com.lyms.talkonlineweb.domain.LymsDepartill;
  4 +import com.baomidou.mybatisplus.extension.service.IService;
  5 +
  6 +/**
  7 + *
  8 + */
  9 +public interface LymsDepartillService extends IService<LymsDepartill> {
  10 +
  11 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDepartillServiceImpl.java View file @ 0527fbe
  1 +package com.lyms.talkonlineweb.service.impl;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4 +import com.lyms.talkonlineweb.domain.LymsDepartill;
  5 +import com.lyms.talkonlineweb.service.LymsDepartillService;
  6 +import com.lyms.talkonlineweb.mapper.LymsDepartillMapper;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +/**
  10 + *
  11 + */
  12 +@Service
  13 +public class LymsDepartillServiceImpl extends ServiceImpl<LymsDepartillMapper, LymsDepartill>
  14 + implements LymsDepartillService{
  15 +
  16 +}
talkonlineweb/src/main/resources/mapper/LymsDepartillMapper.xml View file @ 0527fbe
  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.LymsDepartillMapper">
  6 +
  7 + <resultMap id="BaseResultMap" type="com.lyms.talkonlineweb.domain.LymsDepartill">
  8 + <id property="id" column="id" jdbcType="INTEGER"/>
  9 + <result property="did" column="did" jdbcType="INTEGER"/>
  10 + <result property="iid" column="iid" jdbcType="INTEGER"/>
  11 + <result property="iname" column="iname" jdbcType="VARCHAR"/>
  12 + </resultMap>
  13 +
  14 + <sql id="Base_Column_List">
  15 + id,did,iid,
  16 + iname
  17 + </sql>
  18 +</mapper>