Commit 4d23963a231da7f563b5a5e5524c9ad654547053
1 parent
6e3b4f1564
Exists in
master
and in
1 other branch
配置中心 化验项 参考项配置
Showing 6 changed files with 177 additions and 28 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ReferConfigDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/ReferConfigDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/ReferConfigService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/ReferValue.java
- platform-dal/src/main/java/com/lyms/platform/query/ReferConfigQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReferConfigController.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ReferConfigDao.java
View file @
4d23963
| 1 | 1 | package com.lyms.platform.biz.dal; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 3 | 4 | import com.lyms.platform.common.result.BaseListResponse; |
| 4 | 5 | import com.lyms.platform.pojo.ReferValue; |
| 5 | 6 | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 6 | 9 | /** |
| 7 | 10 | * Created by Zhang.Rui on 2016/3/17. |
| 8 | 11 | */ |
| 9 | 12 | public interface ReferConfigDao { |
| 10 | 13 | void addRefer(ReferValue referValue); |
| 14 | + | |
| 15 | + void updateRefer(MongoQuery query, ReferValue referValue); | |
| 16 | + | |
| 17 | + void deleteRefer(MongoQuery query, ReferValue referValue); | |
| 18 | + | |
| 19 | + List<ReferValue> queryRefer(MongoQuery query); | |
| 11 | 20 | |
| 12 | 21 | |
| 13 | 22 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/ReferConfigDaoImpl.java
View file @
4d23963
| ... | ... | @@ -23,5 +23,22 @@ |
| 23 | 23 | public void addRefer(ReferValue referValue) { |
| 24 | 24 | this.save(referValue); |
| 25 | 25 | } |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public void updateRefer(MongoQuery query, ReferValue referValue) { | |
| 29 | + List<ReferValue> list = find(query.convertToMongoQuery()); | |
| 30 | + update(query.convertToMongoQuery(), referValue); | |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public void deleteRefer(MongoQuery query, ReferValue referValue) { | |
| 35 | + delete(query.convertToMongoQuery()); | |
| 36 | + } | |
| 37 | + | |
| 38 | + | |
| 39 | + @Override | |
| 40 | + public List<ReferValue> queryRefer(MongoQuery query) { | |
| 41 | + return find(query.convertToMongoQuery()); | |
| 42 | + } | |
| 26 | 43 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/ReferConfigService.java
View file @
4d23963
| 1 | 1 | package com.lyms.platform.biz.service; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.dal.ReferConfigDao; |
| 4 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | 7 | import com.lyms.platform.common.result.BaseListResponse; |
| 5 | 8 | import com.lyms.platform.pojo.ReferValue; |
| 9 | +import com.lyms.platform.query.ReferConfigQuery; | |
| 6 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 11 | import org.springframework.stereotype.Service; |
| 8 | 12 | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 9 | 15 | /** |
| 10 | 16 | * Created by Zhang.Rui on 2016/3/17. |
| 11 | 17 | * 参考值服务 |
| 12 | 18 | |
| 13 | 19 | |
| ... | ... | @@ -15,20 +21,24 @@ |
| 15 | 21 | @Autowired |
| 16 | 22 | private ReferConfigDao referConfigDao; |
| 17 | 23 | |
| 18 | - public BaseListResponse queryRefer() { | |
| 19 | - return null; | |
| 24 | + public List<ReferValue> queryRefer(ReferConfigQuery referConfigQuery) { | |
| 25 | + return referConfigDao.queryRefer(referConfigQuery.convertToQuery()); | |
| 20 | 26 | } |
| 21 | 27 | |
| 22 | 28 | public void addRefer(ReferValue referValue) { |
| 23 | 29 | referConfigDao.addRefer(referValue); |
| 24 | 30 | } |
| 25 | 31 | |
| 26 | - public BaseListResponse updateRefer() { | |
| 27 | - return null; | |
| 32 | + public void updateRefer(ReferValue referValue) { | |
| 33 | + MongoCondition mongoCondition = MongoCondition.newInstance("id",referValue.getId(), MongoOper.IS); | |
| 34 | + referConfigDao.updateRefer(mongoCondition.toMongoQuery(), referValue); | |
| 28 | 35 | } |
| 29 | 36 | |
| 30 | - public BaseListResponse delRefer() { | |
| 31 | - return null; | |
| 37 | + public void delRefer(ReferValue referValue) { | |
| 38 | + MongoCondition mongoCondition = MongoCondition.newInstance(); | |
| 39 | + mongoCondition.and("id", referValue.getId(), MongoOper.IS); | |
| 40 | + referValue.setYn(2); //软删除 | |
| 41 | + referConfigDao.updateRefer(mongoCondition.toMongoQuery(), referValue); | |
| 32 | 42 | } |
| 33 | 43 | } |
platform-dal/src/main/java/com/lyms/platform/pojo/ReferValue.java
View file @
4d23963
| ... | ... | @@ -3,6 +3,8 @@ |
| 3 | 3 | import com.lyms.platform.common.core.annotation.form.Form; |
| 4 | 4 | import com.lyms.platform.common.result.BaseModel; |
| 5 | 5 | import org.hibernate.validator.constraints.NotEmpty; |
| 6 | +import org.springframework.data.annotation.Id; | |
| 7 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 6 | 8 | |
| 7 | 9 | import javax.validation.constraints.NotNull; |
| 8 | 10 | |
| 9 | 11 | |
| ... | ... | @@ -11,7 +13,12 @@ |
| 11 | 13 | * 参考值模型 |
| 12 | 14 | */ |
| 13 | 15 | @Form |
| 16 | +@Document | |
| 14 | 17 | public class ReferValue extends BaseModel{ |
| 18 | + @Id | |
| 19 | + private String id; | |
| 20 | + @NotNull(message = "医院ID不能为空") | |
| 21 | + private Integer hospitalId; | |
| 15 | 22 | @NotNull(message = "项目名称不能为空") |
| 16 | 23 | @NotEmpty(message = "项目名称不能为空") |
| 17 | 24 | private String name; |
| 18 | 25 | |
| 19 | 26 | |
| ... | ... | @@ -37,8 +44,50 @@ |
| 37 | 44 | private String deal; //处理 |
| 38 | 45 | private String serviceContent;//服务内容 |
| 39 | 46 | private int department; //科室 |
| 47 | + private int assayConfigId; //化验项ID | |
| 48 | + private String standardCode;//标准代码 | |
| 40 | 49 | |
| 50 | + private Integer yn; | |
| 41 | 51 | |
| 52 | + public Integer getYn() { | |
| 53 | + return yn; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setYn(Integer yn) { | |
| 57 | + this.yn = yn; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public String getId() { | |
| 61 | + return id; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public void setId(String id) { | |
| 65 | + this.id = id; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public String getStandardCode() { | |
| 69 | + return standardCode; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public void setStandardCode(String standardCode) { | |
| 73 | + this.standardCode = standardCode; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public int getAssayConfigId() { | |
| 77 | + return assayConfigId; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public void setAssayConfigId(int assayConfigId) { | |
| 81 | + this.assayConfigId = assayConfigId; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public Integer getHospitalId() { | |
| 85 | + return hospitalId; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public void setHospitalId(Integer hospitalId) { | |
| 89 | + this.hospitalId = hospitalId; | |
| 90 | + } | |
| 42 | 91 | |
| 43 | 92 | public String getName() { |
| 44 | 93 | return name; |
platform-dal/src/main/java/com/lyms/platform/query/ReferConfigQuery.java
View file @
4d23963
| 1 | 1 | package com.lyms.platform.query; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.dao.BaseQuery; |
| 4 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 7 | +import org.hibernate.validator.constraints.NotEmpty; | |
| 4 | 8 | |
| 9 | +import javax.validation.constraints.NotNull; | |
| 10 | + | |
| 5 | 11 | /** |
| 6 | 12 | * Created by Zhang.Rui on 2016/3/17. |
| 7 | 13 | * 参考值查询对象 |
| 8 | 14 | */ |
| 9 | 15 | public class ReferConfigQuery extends BaseQuery { |
| 10 | - private int hospitalId; | |
| 11 | - private int codeType; | |
| 16 | + @NotNull(message = "医院ID不能为空") | |
| 17 | + private Integer hospitalId; | |
| 18 | + private Integer codeType;//1:项目代码2:标准代码 3:项目名称 | |
| 12 | 19 | private String keyword; |
| 13 | - private int referVal; | |
| 14 | - private int emergencyVal; | |
| 20 | + private Integer referVal;//1已设置2未设置3全部 | |
| 21 | + private Integer emergencyVal;//1已设置2未设置3全部 | |
| 15 | 22 | |
| 16 | - public int getHospitalId() { | |
| 23 | + public MongoQuery convertToQuery() { | |
| 24 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 25 | + if (null != hospitalId) { | |
| 26 | + condition.and("hospitalId", hospitalId, MongoOper.IS); | |
| 27 | + } | |
| 28 | + if (null != codeType && null != keyword) { | |
| 29 | + if(1 == codeType) { | |
| 30 | + condition.and("code", keyword, MongoOper.LIKE); | |
| 31 | + } else if(2 == codeType) { | |
| 32 | + condition.and("standardCode", keyword, MongoOper.LIKE); | |
| 33 | + } else if(3 == codeType) { | |
| 34 | + condition.and("name", keyword, MongoOper.LIKE); | |
| 35 | + } | |
| 36 | + } | |
| 37 | + if (null != referVal) { | |
| 38 | + if(1 == referVal) { | |
| 39 | + condition.and("charRefer", null, MongoOper.NE); | |
| 40 | + } else if(2 == referVal) { | |
| 41 | + condition.and("charRefer", null, MongoOper.IS); | |
| 42 | + } | |
| 43 | + } | |
| 44 | + if (null != emergencyVal) { | |
| 45 | + if(1 == emergencyVal) { | |
| 46 | + condition.and("emergencyChar", null, MongoOper.NE); | |
| 47 | + } else if(2 == emergencyVal) { | |
| 48 | + condition.and("emergencyChar", null, MongoOper.IS); | |
| 49 | + } | |
| 50 | + } | |
| 51 | + return condition.toMongoQuery(); | |
| 52 | + } | |
| 53 | + | |
| 54 | + public Integer getHospitalId() { | |
| 17 | 55 | return hospitalId; |
| 18 | 56 | } |
| 19 | 57 | |
| 20 | - public void setHospitalId(int hospitalId) { | |
| 58 | + public void setHospitalId(Integer hospitalId) { | |
| 21 | 59 | this.hospitalId = hospitalId; |
| 22 | 60 | } |
| 23 | 61 | |
| 24 | - public int getCodeType() { | |
| 62 | + public Integer getCodeType() { | |
| 25 | 63 | return codeType; |
| 26 | 64 | } |
| 27 | 65 | |
| 28 | - public void setCodeType(int codeType) { | |
| 66 | + public void setCodeType(Integer codeType) { | |
| 29 | 67 | this.codeType = codeType; |
| 30 | 68 | } |
| 31 | 69 | |
| 32 | 70 | |
| 33 | 71 | |
| 34 | 72 | |
| ... | ... | @@ -37,19 +75,19 @@ |
| 37 | 75 | this.keyword = keyword; |
| 38 | 76 | } |
| 39 | 77 | |
| 40 | - public int getReferVal() { | |
| 78 | + public Integer getReferVal() { | |
| 41 | 79 | return referVal; |
| 42 | 80 | } |
| 43 | 81 | |
| 44 | - public void setReferVal(int referVal) { | |
| 82 | + public void setReferVal(Integer referVal) { | |
| 45 | 83 | this.referVal = referVal; |
| 46 | 84 | } |
| 47 | 85 | |
| 48 | - public int getEmergencyVal() { | |
| 86 | + public Integer getEmergencyVal() { | |
| 49 | 87 | return emergencyVal; |
| 50 | 88 | } |
| 51 | 89 | |
| 52 | - public void setEmergencyVal(int emergencyVal) { | |
| 90 | + public void setEmergencyVal(Integer emergencyVal) { | |
| 53 | 91 | this.emergencyVal = emergencyVal; |
| 54 | 92 | } |
| 55 | 93 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReferConfigController.java
View file @
4d23963
| 1 | 1 | package com.lyms.platform.operate.web.controller; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.service.AssayConfigService; | |
| 3 | 4 | import com.lyms.platform.biz.service.ReferConfigService; |
| 4 | 5 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | 6 | import com.lyms.platform.common.result.BaseListResponse; |
| 6 | 7 | import com.lyms.platform.common.result.BaseResponse; |
| 8 | +import com.lyms.platform.params.AssayConfigParam; | |
| 9 | +import com.lyms.platform.pojo.AssayConfig; | |
| 7 | 10 | import com.lyms.platform.pojo.ReferValue; |
| 11 | +import com.lyms.platform.query.ReferConfigQuery; | |
| 8 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 13 | import org.springframework.stereotype.Controller; |
| 10 | -import org.springframework.web.bind.annotation.RequestBody; | |
| 11 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 12 | -import org.springframework.web.bind.annotation.ResponseBody; | |
| 14 | +import org.springframework.web.bind.annotation.*; | |
| 13 | 15 | |
| 14 | 16 | import javax.validation.Valid; |
| 17 | +import java.util.List; | |
| 15 | 18 | |
| 16 | 19 | /** |
| 17 | 20 | * Created by Zhang.Rui on 2016/3/17. |
| 18 | 21 | |
| 19 | 22 | |
| 20 | 23 | |
| 21 | 24 | |
| 22 | 25 | |
| 23 | 26 | |
| ... | ... | @@ -21,27 +24,50 @@ |
| 21 | 24 | public class ReferConfigController extends RestController{ |
| 22 | 25 | @Autowired |
| 23 | 26 | ReferConfigService referConfigService; |
| 27 | + @Autowired | |
| 28 | + AssayConfigService assayConfigService; | |
| 24 | 29 | |
| 25 | - public BaseListResponse queryRefer() { | |
| 26 | - return null; | |
| 30 | + @ResponseBody | |
| 31 | + @RequestMapping(value = "referConfig",method = RequestMethod.GET) | |
| 32 | + public BaseListResponse queryRefer(@RequestBody @Valid ReferConfigQuery referConfigQuery) { | |
| 33 | + List<ReferValue> referValueList = referConfigService.queryRefer(referConfigQuery); | |
| 34 | + BaseListResponse baseListResponse = new BaseListResponse(); | |
| 35 | + baseListResponse.setData(referValueList).setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 36 | + return baseListResponse; | |
| 27 | 37 | } |
| 28 | 38 | |
| 29 | - @RequestMapping("referConfig") | |
| 39 | + @RequestMapping(value = "referConfig",method = RequestMethod.POST) | |
| 30 | 40 | @ResponseBody |
| 31 | 41 | public BaseResponse addRefer(@RequestBody @Valid ReferValue referValue) { |
| 42 | + //添加前先设置项目代码, 标准代码 | |
| 32 | 43 | referConfigService.addRefer(referValue); |
| 33 | 44 | return new BaseResponse() |
| 34 | 45 | .setErrorcode(ErrorCodeConstants.SUCCESS) |
| 35 | 46 | .setErrormsg("添加成功!"); |
| 36 | 47 | } |
| 37 | 48 | |
| 38 | - public BaseListResponse updateRefer() { | |
| 39 | - return null; | |
| 49 | + @RequestMapping(value = "referConfig/{id}",method = RequestMethod.DELETE) | |
| 50 | + @ResponseBody | |
| 51 | + public BaseResponse delRefer(@PathVariable String id) { | |
| 52 | + ReferValue referValue = new ReferValue(); | |
| 53 | + referValue.setId(id); | |
| 54 | + referConfigService.delRefer(referValue); | |
| 55 | + return new BaseResponse() | |
| 56 | + .setErrorcode(ErrorCodeConstants.SUCCESS) | |
| 57 | + .setErrormsg("删除成功!"); | |
| 40 | 58 | } |
| 41 | 59 | |
| 42 | - public BaseListResponse delRefer() { | |
| 43 | - return null; | |
| 60 | + @RequestMapping(value = "referConfig/{id}",method = RequestMethod.PUT) | |
| 61 | + @ResponseBody | |
| 62 | + public BaseResponse updateRefer(@RequestBody @Valid ReferValue referValue, @PathVariable String id) { | |
| 63 | + //更新前先设置项目代码, 标准代码 | |
| 64 | + referValue.setId(id); | |
| 65 | + referConfigService.updateRefer(referValue); | |
| 66 | + return new BaseResponse() | |
| 67 | + .setErrorcode(ErrorCodeConstants.SUCCESS) | |
| 68 | + .setErrormsg("更新成功!"); | |
| 44 | 69 | } |
| 70 | + | |
| 45 | 71 | |
| 46 | 72 | } |