diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DepartController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DepartController.java index d213316..376302c 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DepartController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DepartController.java @@ -2,10 +2,12 @@ package com.lyms.talkonlineweb.controller; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.lyms.talkonlineweb.domain.LymsDepartill; import com.lyms.talkonlineweb.domain.LymsDict; import com.lyms.talkonlineweb.domain.LymsHdepart; import com.lyms.talkonlineweb.domain.LymsHospital; import com.lyms.talkonlineweb.result.BaseResponse; +import com.lyms.talkonlineweb.service.LymsDepartillService; import com.lyms.talkonlineweb.service.LymsHdepartService; import com.lyms.talkonlineweb.util.Constant; import com.lyms.talkonlineweb.util.JwtUtils; @@ -32,6 +34,9 @@ public class DepartController { @Autowired private LymsHdepartService lymsHdepartService; + @Autowired //科室所拥有的疾病 + private LymsDepartillService lymsDepartillService; + /** * 获取科室列表 @@ -59,19 +64,13 @@ public class DepartController { * @return */ @PostMapping("saveDepart") - public BaseResponse saveDepart(@Validated LymsHdepart depart, BindingResult result){ + public BaseResponse saveDepart(@Validated LymsHdepart depart, BindingResult result,String ills){ BaseResponse baseResponse=new BaseResponse(); baseResponse.setErrormsg(""); if(depart.getDid()==null){ depart.setCreatedtime(new Date()); LymsHdepart depart2=new LymsHdepart(); - depart2.setDusername(depart.getDusername()); - List dLst=lymsHdepartService.list(Wrappers.query(depart2)); - if (dLst.size()>0) { - baseResponse.setErrormsg("不能创建重复账号"); - baseResponse.setErrorcode(1); - return baseResponse; - } + }else{ depart.setUpdatedTime(new Date()); } @@ -83,9 +82,21 @@ public class DepartController { return baseResponse; } + boolean f=lymsHdepartService.saveOrUpdate(depart); + Map param=new HashMap(); + param.put("did",depart.getDid()); + lymsDepartillService.removeByMap(param); + + String[] iArr=ills.split(","); + + for (int i = 0; i < iArr.length; i++) { + LymsDepartill departill=new LymsDepartill(); + departill.setDid(depart.getDid()); + departill.setIid(Integer.parseInt(iArr[i])); + lymsDepartillService.save(departill); + } - boolean f=lymsHdepartService.saveOrUpdate(depart); baseResponse.setErrorcode(f==true?0:1); return baseResponse; } @@ -114,15 +125,15 @@ public class DepartController { BaseResponse baseResponse=new BaseResponse(); List dLst=lymsHdepartService.list(Wrappers.query(depart)); - if (dLst.size()>0) { - depart=dLst.get(0); - depart.setDpasswd(null); - String jwt = JwtUtils.createJWT("1", depart.getDusername(), Constant.JWT_TTL); - Map map=new HashMap<>(); - map.put("depart",depart); - map.put("token",jwt); - baseResponse.setObject(map); - } +// if (dLst.size()>0) { +// depart=dLst.get(0); +// depart.setDpasswd(null); +// String jwt = JwtUtils.createJWT("1", depart.getDusername(), Constant.JWT_TTL); +// Map map=new HashMap<>(); +// map.put("depart",depart); +// map.put("token",jwt); +// baseResponse.setObject(map); +// } return baseResponse; } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDepartill.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDepartill.java new file mode 100644 index 0000000..d6f5011 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDepartill.java @@ -0,0 +1,87 @@ +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 lombok.Data; + +/** + * + * @TableName lyms_departill + */ +@TableName(value ="lyms_departill") +@Data +public class LymsDepartill implements Serializable { + /** + * + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 所属科室 + */ + @TableField(value = "did") + private Integer did; + + /** + * 疾病ID + */ + @TableField(value = "iid") + private Integer iid; + + /** + * 疾病名称 + */ + @TableField(value = "iname") + private String iname; + + @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; + } + LymsDepartill other = (LymsDepartill) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getDid() == null ? other.getDid() == null : this.getDid().equals(other.getDid())) + && (this.getIid() == null ? other.getIid() == null : this.getIid().equals(other.getIid())) + && (this.getIname() == null ? other.getIname() == null : this.getIname().equals(other.getIname())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getDid() == null) ? 0 : getDid().hashCode()); + result = prime * result + ((getIid() == null) ? 0 : getIid().hashCode()); + result = prime * result + ((getIname() == null) ? 0 : getIname().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(", did=").append(did); + sb.append(", iid=").append(iid); + sb.append(", iname=").append(iname); + 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/domain/LymsHdepart.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsHdepart.java index 3a28b63..c5bfd2d 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsHdepart.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsHdepart.java @@ -84,6 +84,7 @@ public class LymsHdepart implements Serializable { @TableField(value = "updated_time") private Date updatedTime; + @TableField(exist = false) private static final long serialVersionUID = 1L; diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDepartillMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDepartillMapper.java new file mode 100644 index 0000000..a5b834f --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDepartillMapper.java @@ -0,0 +1,15 @@ +package com.lyms.talkonlineweb.mapper; + +import com.lyms.talkonlineweb.domain.LymsDepartill; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Entity com.lyms.talkonlineweb.domain.LymsDepartill + */ +public interface LymsDepartillMapper extends BaseMapper { + +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDepartillService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDepartillService.java new file mode 100644 index 0000000..96d33cf --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDepartillService.java @@ -0,0 +1,11 @@ +package com.lyms.talkonlineweb.service; + +import com.lyms.talkonlineweb.domain.LymsDepartill; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * + */ +public interface LymsDepartillService extends IService { + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDepartillServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDepartillServiceImpl.java new file mode 100644 index 0000000..5eaa1f2 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDepartillServiceImpl.java @@ -0,0 +1,20 @@ +package com.lyms.talkonlineweb.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lyms.talkonlineweb.domain.LymsDepartill; +import com.lyms.talkonlineweb.service.LymsDepartillService; +import com.lyms.talkonlineweb.mapper.LymsDepartillMapper; +import org.springframework.stereotype.Service; + +/** + * + */ +@Service +public class LymsDepartillServiceImpl extends ServiceImpl + implements LymsDepartillService{ + +} + + + + diff --git a/talkonlineweb/src/main/resources/mapper/LymsDepartillMapper.xml b/talkonlineweb/src/main/resources/mapper/LymsDepartillMapper.xml new file mode 100644 index 0000000..d30326c --- /dev/null +++ b/talkonlineweb/src/main/resources/mapper/LymsDepartillMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + id,did,iid, + iname + +