Commit 9f2baf4673fcba14af27e5ccc9af9e2a8081540b
1 parent
aa8d5d4333
Exists in
master
and in
6 other branches
眼保健
Showing 7 changed files with 439 additions and 35 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IHosptialOpinionsDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/HosptialOpinionsDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/HosptialOpinionsService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/HosptialOpinions.java
- platform-dal/src/main/java/com/lyms/platform/query/HosptialOpinionsQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HosptialHighRiskController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HosptialHighRiskFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IHosptialOpinionsDao.java
View file @
9f2baf4
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | +import com.lyms.platform.pojo.HosptialHighRisk; | |
| 5 | +import com.lyms.platform.pojo.HosptialOpinions; | |
| 6 | + | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +public interface IHosptialOpinionsDao { | |
| 10 | + | |
| 11 | + public List<HosptialOpinions> queryHosptialOpinions(MongoQuery query); | |
| 12 | + | |
| 13 | + public int queryHosptialOpinionsCount(MongoQuery query); | |
| 14 | + | |
| 15 | + public HosptialOpinions addHosptialOpinions(HosptialOpinions obj); | |
| 16 | + | |
| 17 | + HosptialOpinions getOneHosptialOpinionsById(String id); | |
| 18 | + | |
| 19 | + void updateHosptialOpinions(HosptialOpinions obj, String id); | |
| 20 | + | |
| 21 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/HosptialOpinionsDaoImpl.java
View file @
9f2baf4
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IHosptialHightRiskDao; | |
| 4 | +import com.lyms.platform.biz.dal.IHosptialOpinionsDao; | |
| 5 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 8 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 9 | +import com.lyms.platform.common.dao.operator.Page; | |
| 10 | +import com.lyms.platform.pojo.HosptialHighRisk; | |
| 11 | +import com.lyms.platform.pojo.HosptialOpinions; | |
| 12 | +import org.springframework.stereotype.Repository; | |
| 13 | + | |
| 14 | +import java.util.Collection; | |
| 15 | +import java.util.List; | |
| 16 | + | |
| 17 | +@Repository("hosptialOpinionsDao") | |
| 18 | +public class HosptialOpinionsDaoImpl extends BaseMongoDAOImpl<HosptialOpinions> implements IHosptialOpinionsDao { | |
| 19 | + | |
| 20 | + @Override | |
| 21 | + public List<HosptialOpinions> queryHosptialOpinions(MongoQuery query) { | |
| 22 | + return find(query.convertToMongoQuery()); | |
| 23 | + } | |
| 24 | + | |
| 25 | + @Override | |
| 26 | + public int queryHosptialOpinionsCount(MongoQuery query) { | |
| 27 | + return (int) count(query.convertToMongoQuery()); | |
| 28 | + } | |
| 29 | + | |
| 30 | + @Override | |
| 31 | + public HosptialOpinions addHosptialOpinions(HosptialOpinions obj) { | |
| 32 | + return save(obj); | |
| 33 | + } | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public HosptialOpinions getOneHosptialOpinionsById(String id) { | |
| 37 | + return findById(id); | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + public void updateHosptialOpinions(HosptialOpinions obj, String id) { | |
| 42 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj); | |
| 43 | + } | |
| 44 | + | |
| 45 | + | |
| 46 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/HosptialOpinionsService.java
View file @
9f2baf4
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | +import com.google.common.cache.CacheLoader; | |
| 4 | +import com.google.common.cache.LoadingCache; | |
| 5 | +import com.lyms.platform.biz.dal.IHosptialOpinionsDao; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 7 | +import com.lyms.platform.common.utils.CacheHelper; | |
| 8 | +import com.lyms.platform.pojo.HosptialHighRisk; | |
| 9 | +import com.lyms.platform.pojo.HosptialOpinions; | |
| 10 | +import com.lyms.platform.query.HosptialHighRiskQuery; | |
| 11 | +import com.lyms.platform.query.HosptialOpinionsQuery; | |
| 12 | +import org.apache.commons.lang.StringUtils; | |
| 13 | +import org.springframework.beans.factory.InitializingBean; | |
| 14 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 15 | +import org.springframework.data.domain.Sort; | |
| 16 | +import org.springframework.stereotype.Service; | |
| 17 | + | |
| 18 | +import java.util.List; | |
| 19 | + | |
| 20 | +@Service | |
| 21 | +public class HosptialOpinionsService implements InitializingBean { | |
| 22 | + | |
| 23 | + @Autowired | |
| 24 | + private IHosptialOpinionsDao hosptialOpinionsDao; | |
| 25 | + private LoadingCache<String, HosptialOpinions> cached=null; | |
| 26 | + @Override | |
| 27 | + public void afterPropertiesSet() throws Exception { | |
| 28 | + //cache size 为400 缓存3分钟 | |
| 29 | + cached = CacheHelper.cached(new CacheLoader<String, HosptialOpinions>() { | |
| 30 | + @Override | |
| 31 | + public HosptialOpinions load(String key) throws Exception { | |
| 32 | + return hosptialOpinionsDao.getOneHosptialOpinionsById(key); | |
| 33 | + } | |
| 34 | + },400,3); | |
| 35 | + } | |
| 36 | + | |
| 37 | + public List<HosptialOpinions> queryHosptialHighRisk(HosptialOpinionsQuery hosptialOpinionsQuery) { | |
| 38 | + MongoQuery query = hosptialOpinionsQuery.convertToQuery(); | |
| 39 | + if (StringUtils.isNotEmpty(hosptialOpinionsQuery.getNeed())) { | |
| 40 | + hosptialOpinionsQuery.mysqlBuild(hosptialOpinionsDao.queryHosptialOpinionsCount(hosptialOpinionsQuery.convertToQuery())); | |
| 41 | + query.start(hosptialOpinionsQuery.getOffset()).end(hosptialOpinionsQuery.getLimit()); | |
| 42 | + } | |
| 43 | + return hosptialOpinionsDao.queryHosptialOpinions(query.addOrder(Sort.Direction.DESC, "createDate").addOrder(Sort.Direction.DESC, "weight")); | |
| 44 | + } | |
| 45 | + | |
| 46 | + public void addHosptialOpinions(HosptialOpinions obj) { | |
| 47 | + hosptialOpinionsDao.addHosptialOpinions(obj); | |
| 48 | + } | |
| 49 | + | |
| 50 | + public HosptialOpinions getOneHosptialOpinionsById(String id) { | |
| 51 | + try{ | |
| 52 | + return cached.get(id); | |
| 53 | + }catch (Exception e){ | |
| 54 | + } | |
| 55 | + return hosptialOpinionsDao.getOneHosptialOpinionsById(id); | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void updateHosptialOpinions(HosptialOpinions obj) { | |
| 59 | + obj.setModifiedDate(System.currentTimeMillis()); | |
| 60 | + hosptialOpinionsDao.updateHosptialOpinions(obj, obj.getId()); | |
| 61 | + } | |
| 62 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/HosptialOpinions.java
View file @
9f2baf4
| ... | ... | @@ -16,27 +16,36 @@ |
| 16 | 16 | private String id; |
| 17 | 17 | //医院id |
| 18 | 18 | private String hospitalId; |
| 19 | - //医生姓名 | |
| 20 | - private String doctorName; | |
| 19 | + //医生id | |
| 20 | + private Integer doctorId; | |
| 21 | 21 | //创建时间 |
| 22 | 22 | private Long createDate; |
| 23 | 23 | //修改时间 |
| 24 | 24 | private Long modifiedDate; |
| 25 | 25 | //是否有效0-无效,1-有效 |
| 26 | 26 | private Integer yn; |
| 27 | - //是否使用、true-使用,false-未使用,false在下拉框不显示,在数据中显示 | |
| 28 | - private boolean isUse; | |
| 27 | + //1 下拉框显示,2下拉框不显示 | |
| 28 | + private String isUse; | |
| 29 | 29 | //权重 |
| 30 | 30 | private Integer weight; |
| 31 | 31 | //1 处理意见内容 2 指导意见内容 |
| 32 | 32 | private Integer type; |
| 33 | - //处理意见内容 | |
| 34 | - private String handleContent; | |
| 35 | - //指导意见内容 | |
| 36 | - private String guideContent; | |
| 33 | + //内容 | |
| 34 | + private String content; | |
| 35 | + ; | |
| 37 | 36 | |
| 37 | + public Integer getDoctorId() { | |
| 38 | + return doctorId; | |
| 39 | + } | |
| 38 | 40 | |
| 41 | + public void setDoctorId(Integer doctorId) { | |
| 42 | + this.doctorId = doctorId; | |
| 43 | + } | |
| 39 | 44 | |
| 45 | + public static long getSerialVersionUID() { | |
| 46 | + return serialVersionUID; | |
| 47 | + } | |
| 48 | + | |
| 40 | 49 | public String getId() { |
| 41 | 50 | return id; |
| 42 | 51 | } |
| ... | ... | @@ -53,14 +62,6 @@ |
| 53 | 62 | this.hospitalId = hospitalId; |
| 54 | 63 | } |
| 55 | 64 | |
| 56 | - public String getDoctorName() { | |
| 57 | - return doctorName; | |
| 58 | - } | |
| 59 | - | |
| 60 | - public void setDoctorName(String doctorName) { | |
| 61 | - this.doctorName = doctorName; | |
| 62 | - } | |
| 63 | - | |
| 64 | 65 | public Long getCreateDate() { |
| 65 | 66 | return createDate; |
| 66 | 67 | } |
| 67 | 68 | |
| ... | ... | @@ -85,12 +86,12 @@ |
| 85 | 86 | this.yn = yn; |
| 86 | 87 | } |
| 87 | 88 | |
| 88 | - public boolean isUse() { | |
| 89 | + public String getIsUse() { | |
| 89 | 90 | return isUse; |
| 90 | 91 | } |
| 91 | 92 | |
| 92 | - public void setUse(boolean use) { | |
| 93 | - isUse = use; | |
| 93 | + public void setIsUse(String isUse) { | |
| 94 | + this.isUse = isUse; | |
| 94 | 95 | } |
| 95 | 96 | |
| 96 | 97 | public Integer getWeight() { |
| 97 | 98 | |
| ... | ... | @@ -109,20 +110,12 @@ |
| 109 | 110 | this.type = type; |
| 110 | 111 | } |
| 111 | 112 | |
| 112 | - public String getHandleContent() { | |
| 113 | - return handleContent; | |
| 113 | + public String getContent() { | |
| 114 | + return content; | |
| 114 | 115 | } |
| 115 | 116 | |
| 116 | - public void setHandleContent(String handleContent) { | |
| 117 | - this.handleContent = handleContent; | |
| 118 | - } | |
| 119 | - | |
| 120 | - public String getGuideContent() { | |
| 121 | - return guideContent; | |
| 122 | - } | |
| 123 | - | |
| 124 | - public void setGuideContent(String guideContent) { | |
| 125 | - this.guideContent = guideContent; | |
| 117 | + public void setContent(String content) { | |
| 118 | + this.content = content; | |
| 126 | 119 | } |
| 127 | 120 | } |
platform-dal/src/main/java/com/lyms/platform/query/HosptialOpinionsQuery.java
View file @
9f2baf4
| 1 | +package com.lyms.platform.query; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.base.IConvertToNativeQuery; | |
| 4 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import com.lyms.platform.common.enums.YnEnums; | |
| 9 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 医院自定义处理意见 和 指导意见内容 | |
| 15 | + */ | |
| 16 | +public class HosptialOpinionsQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 17 | + | |
| 18 | + private String id; | |
| 19 | + //医院id | |
| 20 | + private String hospitalId; | |
| 21 | + //医生姓名 | |
| 22 | + private String doctorName; | |
| 23 | + //创建时间 | |
| 24 | + private Long createDate; | |
| 25 | + //是否有效0-无效,1-有效 | |
| 26 | + private Integer yn; | |
| 27 | + //是否使用、1 使用,2未使用,false在下拉框不显示,在数据中显示 | |
| 28 | + private String isUse; | |
| 29 | + //1 处理意见内容 2 指导意见内容 | |
| 30 | + private Integer type; | |
| 31 | + //内容 | |
| 32 | + private String content; | |
| 33 | + //权重 | |
| 34 | + private Integer weight; | |
| 35 | + | |
| 36 | + public String getHospitalId() { | |
| 37 | + return hospitalId; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setHospitalId(String hospitalId) { | |
| 41 | + this.hospitalId = hospitalId; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public String getDoctorName() { | |
| 45 | + return doctorName; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setDoctorName(String doctorName) { | |
| 49 | + this.doctorName = doctorName; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public Long getCreateDate() { | |
| 53 | + return createDate; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setCreateDate(Long createDate) { | |
| 57 | + this.createDate = createDate; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public void setYn(Integer yn) { | |
| 61 | + this.yn = yn; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public String getIsUse() { | |
| 65 | + return isUse; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public void setIsUse(String isUse) { | |
| 69 | + this.isUse = isUse; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public Integer getType() { | |
| 73 | + return type; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public void setType(Integer type) { | |
| 77 | + this.type = type; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public String getContent() { | |
| 81 | + return content; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public void setContent(String content) { | |
| 85 | + this.content = content; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public Integer getWeight() { | |
| 89 | + return weight; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public void setWeight(Integer weight) { | |
| 93 | + this.weight = weight; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public String getId() { | |
| 97 | + return id; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public void setId(String id) { | |
| 101 | + this.id = id; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public Integer getYn() { | |
| 105 | + return yn; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public MongoQuery convertToQuery() { | |
| 109 | +// MongoCondition condition = MongoCondition.newInstance("1","1",MongoOper.IS); | |
| 110 | + MongoCondition condition = MongoCondition.newInstance("yn", YnEnums.YES.getId(),MongoOper.IS); | |
| 111 | + if (null != id) { | |
| 112 | + condition = condition.and("id", id, MongoOper.IS); | |
| 113 | + } | |
| 114 | + | |
| 115 | + if (null != hospitalId) { | |
| 116 | + condition = condition.and("hospitalId", hospitalId, MongoOper.IS); | |
| 117 | + } | |
| 118 | + | |
| 119 | + if (null != doctorName) { | |
| 120 | + condition = condition.and("doctorName", doctorName, MongoOper.IS); | |
| 121 | + } | |
| 122 | + | |
| 123 | + if (null != isUse) { | |
| 124 | + condition = condition.and("isUse", isUse, MongoOper.IS); | |
| 125 | + } | |
| 126 | + | |
| 127 | + if (null != type) { | |
| 128 | + condition = condition.and("type", type, MongoOper.IS); | |
| 129 | + } | |
| 130 | + | |
| 131 | + if (null != content) { | |
| 132 | + condition = condition.and("content", content, MongoOper.IN); | |
| 133 | + } | |
| 134 | + | |
| 135 | + if(null!=weight){ | |
| 136 | + condition = condition.and("weight", weight, MongoOper.EXISTS); | |
| 137 | + } | |
| 138 | + | |
| 139 | + return condition.toMongoQuery(); | |
| 140 | + } | |
| 141 | + | |
| 142 | + | |
| 143 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HosptialHighRiskController.java
View file @
9f2baf4
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | import com.lyms.platform.common.utils.StringUtils; |
| 9 | 9 | import com.lyms.platform.operate.web.facade.HosptialHighRiskFacade; |
| 10 | 10 | import com.lyms.platform.pojo.HosptialHighRisk; |
| 11 | +import com.lyms.platform.pojo.HosptialOpinions; | |
| 11 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | 13 | import org.springframework.stereotype.Controller; |
| 13 | 14 | import org.springframework.web.bind.annotation.*; |
| ... | ... | @@ -85,5 +86,56 @@ |
| 85 | 86 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 86 | 87 | return hosptialHighRiskFacade.getHosptialHighRisk(loginState.getId()); |
| 87 | 88 | } |
| 89 | + | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 添加 医院自定义处理意见 和 指导意见内容 | |
| 93 | + * | |
| 94 | + * @param request | |
| 95 | + * @param httpServletRequest | |
| 96 | + * @Author: 武涛涛 | |
| 97 | + * @Date: 2020/7/18 13:41 | |
| 98 | + */ | |
| 99 | + @RequestMapping(method = RequestMethod.POST, value = "/addHosptialOpinions") | |
| 100 | + @ResponseBody | |
| 101 | + @TokenRequired | |
| 102 | + public BaseResponse addHosptialOpinions(@Valid @RequestBody HosptialOpinions request, HttpServletRequest httpServletRequest) { | |
| 103 | + LoginContext loginState = (LoginContext) httpServletRequest.getAttribute("loginContext"); | |
| 104 | + return hosptialHighRiskFacade.addHosptialOpinions(request, loginState.getId()); | |
| 105 | + } | |
| 106 | + | |
| 107 | + /** | |
| 108 | + * 根据医院自定义处理意见 和 指导意见内容 | |
| 109 | + * | |
| 110 | + * @param request | |
| 111 | + * @param type 1 处理意见内容 2 指导意见内容 | |
| 112 | + * @Author: 武涛涛 | |
| 113 | + * @Date: 2020/7/18 14:56 | |
| 114 | + */ | |
| 115 | + @RequestMapping(value = "/getHosptialOpinions", method = RequestMethod.GET) | |
| 116 | + @TokenRequired | |
| 117 | + @ResponseBody | |
| 118 | + public BaseResponse getHosptialOpinions(HttpServletRequest request,@RequestParam(required = true) Integer type) { | |
| 119 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 120 | + return hosptialHighRiskFacade.getHosptialOpinions(loginState.getId(),type); | |
| 121 | + } | |
| 122 | + | |
| 123 | + /** | |
| 124 | + * 删除自定义处理意见 和 指导意见内容,这里是逻辑删除 | |
| 125 | + * | |
| 126 | + * @param id | |
| 127 | + * @param request | |
| 128 | + * @Author: 武涛涛 | |
| 129 | + * @Date: 2020/7/18 15:05 | |
| 130 | + */ | |
| 131 | + @RequestMapping(value = "/deleteHosptialOpinionsById/{id}", method = RequestMethod.DELETE) | |
| 132 | + @TokenRequired | |
| 133 | + @ResponseBody | |
| 134 | + public BaseResponse deleteHosptialOpinionsById(@PathVariable("id") String id, HttpServletRequest request) { | |
| 135 | + return hosptialHighRiskFacade.deleteHosptialOpinionsById(id); | |
| 136 | + | |
| 137 | + } | |
| 138 | + | |
| 139 | + | |
| 88 | 140 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HosptialHighRiskFacade.java
View file @
9f2baf4
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.service.HosptialHighRiskService; |
| 4 | +import com.lyms.platform.biz.service.HosptialOpinionsService; | |
| 4 | 5 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | 6 | import com.lyms.platform.common.enums.HisptialRiskTypeEnum; |
| 6 | 7 | import com.lyms.platform.common.enums.RiskDefaultTypeEnum; |
| 8 | +import com.lyms.platform.common.enums.YnEnums; | |
| 7 | 9 | import com.lyms.platform.common.result.BaseResponse; |
| 8 | 10 | import com.lyms.platform.common.utils.JsonUtil; |
| 9 | 11 | import com.lyms.platform.common.utils.SystemConfig; |
| 10 | 12 | import com.lyms.platform.pojo.HosptialHighRisk; |
| 13 | +import com.lyms.platform.pojo.HosptialOpinions; | |
| 11 | 14 | import com.lyms.platform.query.HosptialHighRiskQuery; |
| 15 | +import com.lyms.platform.query.HosptialOpinionsQuery; | |
| 12 | 16 | import org.apache.commons.collections.CollectionUtils; |
| 13 | 17 | import org.apache.commons.lang.StringUtils; |
| 14 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -16,10 +20,7 @@ |
| 16 | 20 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 17 | 21 | import org.springframework.stereotype.Component; |
| 18 | 22 | |
| 19 | -import java.util.ArrayList; | |
| 20 | -import java.util.HashMap; | |
| 21 | -import java.util.List; | |
| 22 | -import java.util.Map; | |
| 23 | +import java.util.*; | |
| 23 | 24 | |
| 24 | 25 | /** |
| 25 | 26 | * @auther yangfei |
| ... | ... | @@ -31,6 +32,8 @@ |
| 31 | 32 | @Autowired |
| 32 | 33 | private HosptialHighRiskService hosptialHighRiskService; |
| 33 | 34 | @Autowired |
| 35 | + private HosptialOpinionsService hosptialOpinionsService; | |
| 36 | + @Autowired | |
| 34 | 37 | private AutoMatchFacade autoMatchFacade; |
| 35 | 38 | @Autowired |
| 36 | 39 | private BasicConfigFacade basicConfigFacade; |
| 37 | 40 | |
| ... | ... | @@ -148,7 +151,41 @@ |
| 148 | 151 | } |
| 149 | 152 | return baseResponse; |
| 150 | 153 | } |
| 154 | + /** | |
| 155 | + * 添加 医院自定义处理意见 和 指导意见内容 | |
| 156 | + * | |
| 157 | + * @param hosptialOpinions | |
| 158 | + * @param userId | |
| 159 | + * @Author: 武涛涛 | |
| 160 | + * @Date: 2020/7/18 13:41 | |
| 161 | + */ | |
| 162 | + public BaseResponse addHosptialOpinions(HosptialOpinions hosptialOpinions, int userId) { | |
| 151 | 163 | |
| 164 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 165 | + HosptialOpinionsQuery hosptialOpinionsQuery = new HosptialOpinionsQuery(); | |
| 166 | + hosptialOpinionsQuery.setHospitalId(hospitalId); | |
| 167 | + hosptialOpinionsQuery.setContent(hosptialOpinions.getContent());//内容 | |
| 168 | + hosptialOpinionsQuery.setIsUse("1");//1 下拉框显示,2下拉框不显示 | |
| 169 | + hosptialOpinionsQuery.setType(hosptialOpinions.getType());//1 处理意见内容 2 指导意见内容 | |
| 170 | + List<HosptialOpinions> hosptialOpinionsList = hosptialOpinionsService.queryHosptialHighRisk(hosptialOpinionsQuery); | |
| 171 | + | |
| 172 | + BaseResponse baseResponse = new BaseResponse(); | |
| 173 | + if (CollectionUtils.isEmpty(hosptialOpinionsList)) { | |
| 174 | + hosptialOpinions.setCreateDate(System.currentTimeMillis()); | |
| 175 | + hosptialOpinions.setModifiedDate(System.currentTimeMillis()); | |
| 176 | + hosptialOpinions.setYn(1); | |
| 177 | + hosptialOpinions.setHospitalId(hospitalId); | |
| 178 | + hosptialOpinions.setDoctorId(userId); | |
| 179 | + hosptialOpinions.setIsUse("1");//1 下拉框显示,2下拉框不显示 | |
| 180 | + hosptialOpinionsService.addHosptialOpinions(hosptialOpinions); | |
| 181 | + baseResponse.setErrormsg("保存成功"); | |
| 182 | + } else { | |
| 183 | + baseResponse.setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
| 184 | + baseResponse.setErrormsg("添加的内容名称已经存在,请勿重复添加"); | |
| 185 | + } | |
| 186 | + return baseResponse; | |
| 187 | + } | |
| 188 | + | |
| 152 | 189 | /** |
| 153 | 190 | * 根据用户id查询自定义高危 |
| 154 | 191 | * |
| 155 | 192 | |
| ... | ... | @@ -176,7 +213,54 @@ |
| 176 | 213 | return baseResponse; |
| 177 | 214 | } |
| 178 | 215 | |
| 216 | + | |
| 179 | 217 | /** |
| 218 | + *根据用户id查询 自定义处理意见 和 指导意见内容 | |
| 219 | + * | |
| 220 | + * @param userId 当前登录用户id | |
| 221 | + * @param type //1 处理意见内容 2 指导意见内容 | |
| 222 | + * @Author: 武涛涛 | |
| 223 | + * @Date: 2020/7/18 14:51 | |
| 224 | + */ | |
| 225 | + public BaseResponse getHosptialOpinions(int userId,Integer type) { | |
| 226 | + BaseResponse baseResponse = new BaseResponse(); | |
| 227 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 228 | + HosptialOpinionsQuery hosptialOpinionsQuery = new HosptialOpinionsQuery(); | |
| 229 | + hosptialOpinionsQuery.setHospitalId(hospitalId); | |
| 230 | + hosptialOpinionsQuery.setYn(YnEnums.YES.getId()); | |
| 231 | + hosptialOpinionsQuery.setIsUse("1"); //1 下拉框显示,2下拉框不显示 | |
| 232 | + hosptialOpinionsQuery.setType(type); | |
| 233 | + List<HosptialOpinions> hosptialOpinionsList = hosptialOpinionsService.queryHosptialHighRisk(hosptialOpinionsQuery); | |
| 234 | + | |
| 235 | + if (CollectionUtils.isNotEmpty(hosptialOpinionsList)) { | |
| 236 | + baseResponse.setObject(hosptialOpinionsList); | |
| 237 | + } | |
| 238 | + | |
| 239 | + return baseResponse; | |
| 240 | + } | |
| 241 | + /** | |
| 242 | + * 根据Id,删除自定义高危,这里是逻辑删除 | |
| 243 | + * | |
| 244 | + * @param id | |
| 245 | + * @return | |
| 246 | + */ | |
| 247 | + public BaseResponse deleteHosptialOpinionsById(String id) { | |
| 248 | + BaseResponse baseResponse = new BaseResponse(); | |
| 249 | + if(StringUtils.isNotEmpty(id)){ | |
| 250 | + HosptialOpinions hosptialOpinions = hosptialOpinionsService.getOneHosptialOpinionsById(id); | |
| 251 | + if( hosptialOpinions != null ){ | |
| 252 | + hosptialOpinions.setIsUse("2"); //1 下拉框显示,2下拉框不显示 | |
| 253 | + hosptialOpinionsService.updateHosptialOpinions(hosptialOpinions); | |
| 254 | + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 255 | + baseResponse.setErrormsg("删除成功"); | |
| 256 | + }else{ | |
| 257 | + baseResponse.setErrorcode(ErrorCodeConstants.DONT_DELETE); | |
| 258 | + baseResponse.setErrormsg("删除失败,缺少ID"); | |
| 259 | + } | |
| 260 | + } | |
| 261 | + return baseResponse; | |
| 262 | + } | |
| 263 | + /** | |
| 180 | 264 | * 根据Id,删除自定义高危 |
| 181 | 265 | * |
| 182 | 266 | * @param id |
| ... | ... | @@ -197,5 +281,8 @@ |
| 197 | 281 | } |
| 198 | 282 | return baseResponse; |
| 199 | 283 | } |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 200 | 287 | } |