Commit 537888f933edc8ea2a5410769de40137a135863c
Exists in
master
and in
3 other branches
Merge branch 'master' of https://git.healthbaby.com.cn/jiangjiazhi/regional-platform
Showing 13 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/CommunityConfigDao.java
- 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/CommunityConfigDaoImpl.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/CommunityConfigService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/ReferConfigService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/CommunityConfig.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/CommunityConfigController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CommunityController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReferConfigController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/CommunityConfigRequest.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/CommunityConfigDao.java
View file @
537888f
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | +import com.lyms.platform.pojo.CommunityConfig; | |
| 5 | +import com.lyms.platform.pojo.ReferValue; | |
| 6 | + | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by Zhang.Rui on 2016/3/17. | |
| 11 | + */ | |
| 12 | +public interface CommunityConfigDao { | |
| 13 | + void addArea(CommunityConfig communityConfig); | |
| 14 | + | |
| 15 | + void updateArea(MongoQuery query, CommunityConfig communityConfig); | |
| 16 | + | |
| 17 | + void deleteArea(MongoQuery query); | |
| 18 | + | |
| 19 | + List<CommunityConfig> queryArea(MongoQuery query); | |
| 20 | + | |
| 21 | + | |
| 22 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ReferConfigDao.java
View file @
537888f
| 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/CommunityConfigDaoImpl.java
View file @
537888f
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.CommunityConfigDao; | |
| 4 | +import com.lyms.platform.biz.dal.ReferConfigDao; | |
| 5 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 7 | +import com.lyms.platform.pojo.CommunityConfig; | |
| 8 | +import com.lyms.platform.pojo.ReferValue; | |
| 9 | +import org.springframework.stereotype.Repository; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Created by Zhang.Rui on 2016/3/17. | |
| 15 | + */ | |
| 16 | +@Repository("communityConfigDao") | |
| 17 | +public class CommunityConfigDaoImpl extends BaseMongoDAOImpl<CommunityConfig> implements CommunityConfigDao { | |
| 18 | + | |
| 19 | + | |
| 20 | + @Override | |
| 21 | + public void addArea(CommunityConfig communityConfig) { | |
| 22 | + save(communityConfig); | |
| 23 | + } | |
| 24 | + | |
| 25 | + @Override | |
| 26 | + public void updateArea(MongoQuery query, CommunityConfig communityConfig) { | |
| 27 | + update(query.convertToMongoQuery(), communityConfig); | |
| 28 | + } | |
| 29 | + | |
| 30 | + @Override | |
| 31 | + public void deleteArea(MongoQuery query ) { | |
| 32 | + delete(query.convertToMongoQuery()); | |
| 33 | + } | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public List<CommunityConfig> queryArea(MongoQuery query) { | |
| 37 | + return find(query.convertToMongoQuery()); | |
| 38 | + } | |
| 39 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/ReferConfigDaoImpl.java
View file @
537888f
| ... | ... | @@ -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/CommunityConfigService.java
View file @
537888f
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.CommunityConfigDao; | |
| 4 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 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 com.lyms.platform.common.result.BaseResponse; | |
| 10 | +import com.lyms.platform.pojo.CommunityConfig; | |
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | +import org.springframework.stereotype.Service; | |
| 13 | +import org.springframework.web.bind.annotation.RequestBody; | |
| 14 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 15 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 16 | +import org.springframework.web.bind.annotation.ResponseBody; | |
| 17 | + | |
| 18 | +import javax.validation.Valid; | |
| 19 | +import java.util.List; | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Created by Zhang.Rui on 2016/3/18. | |
| 23 | + */ | |
| 24 | +@Service("communityConfig") | |
| 25 | +public class CommunityConfigService { | |
| 26 | + @Autowired | |
| 27 | + private CommunityConfigDao communityConfigDao; | |
| 28 | + | |
| 29 | + //添加区域 | |
| 30 | + public void appendArea(CommunityConfig communityConfig) { | |
| 31 | + communityConfigDao.addArea(communityConfig); | |
| 32 | + } | |
| 33 | + | |
| 34 | + //删除区域 | |
| 35 | + public void deleteArea(CommunityConfig communityConfig) { | |
| 36 | + communityConfig.setYn(YnEnums.NO.getId()); | |
| 37 | + communityConfigDao.updateArea(MongoCondition.newInstance("id", communityConfig.getId(), MongoOper.IS).toMongoQuery(), communityConfig); | |
| 38 | + } | |
| 39 | + | |
| 40 | + //更新区域 | |
| 41 | + public void updateArea(CommunityConfig communityConfig) { | |
| 42 | + communityConfigDao.updateArea(MongoCondition.newInstance("id", communityConfig.getId(), MongoOper.IS).toMongoQuery(), communityConfig); | |
| 43 | + } | |
| 44 | + | |
| 45 | + //查询区域 | |
| 46 | + public List<CommunityConfig> queryArea(String keyword) { | |
| 47 | + MongoCondition mongoCondition = MongoCondition.newInstance(); | |
| 48 | + if(null != keyword) { | |
| 49 | + MongoCondition con1= MongoCondition.newInstance("name", keyword, MongoOper.LIKE); | |
| 50 | + MongoCondition con = MongoCondition.newInstance("parentId", keyword, MongoOper.LIKE); | |
| 51 | + mongoCondition = mongoCondition.orCondition(new MongoCondition[]{con1,con}); | |
| 52 | + } | |
| 53 | + | |
| 54 | + return communityConfigDao.queryArea(mongoCondition.toMongoQuery()); | |
| 55 | + } | |
| 56 | + | |
| 57 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/ReferConfigService.java
View file @
537888f
| 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; | |
| 7 | +import com.lyms.platform.common.enums.YnEnums; | |
| 4 | 8 | import com.lyms.platform.common.result.BaseListResponse; |
| 5 | 9 | import com.lyms.platform.pojo.ReferValue; |
| 10 | +import com.lyms.platform.query.ReferConfigQuery; | |
| 6 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 12 | import org.springframework.stereotype.Service; |
| 8 | 13 | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 9 | 16 | /** |
| 10 | 17 | * Created by Zhang.Rui on 2016/3/17. |
| 11 | 18 | * 参考值服务 |
| 12 | 19 | |
| 13 | 20 | |
| 14 | 21 | |
| ... | ... | @@ -15,20 +22,25 @@ |
| 15 | 22 | @Autowired |
| 16 | 23 | private ReferConfigDao referConfigDao; |
| 17 | 24 | |
| 18 | - public BaseListResponse queryRefer() { | |
| 19 | - return null; | |
| 25 | + public List<ReferValue> queryRefer(ReferConfigQuery referConfigQuery) { | |
| 26 | + return referConfigDao.queryRefer(referConfigQuery.convertToQuery()); | |
| 20 | 27 | } |
| 21 | 28 | |
| 22 | 29 | public void addRefer(ReferValue referValue) { |
| 30 | + referValue.setYn(YnEnums.YES.getId()); | |
| 23 | 31 | referConfigDao.addRefer(referValue); |
| 24 | 32 | } |
| 25 | 33 | |
| 26 | - public BaseListResponse updateRefer() { | |
| 27 | - return null; | |
| 34 | + public void updateRefer(ReferValue referValue) { | |
| 35 | + MongoCondition mongoCondition = MongoCondition.newInstance("id",referValue.getId(), MongoOper.IS); | |
| 36 | + referConfigDao.updateRefer(mongoCondition.toMongoQuery(), referValue); | |
| 28 | 37 | } |
| 29 | 38 | |
| 30 | - public BaseListResponse delRefer() { | |
| 31 | - return null; | |
| 39 | + public void delRefer(ReferValue referValue) { | |
| 40 | + MongoCondition mongoCondition = MongoCondition.newInstance(); | |
| 41 | + mongoCondition.and("id", referValue.getId(), MongoOper.IS); | |
| 42 | + referValue.setYn(YnEnums.NO.getId()); //软删除 | |
| 43 | + referConfigDao.updateRefer(mongoCondition.toMongoQuery(), referValue); | |
| 32 | 44 | } |
| 33 | 45 | } |
platform-dal/src/main/java/com/lyms/platform/pojo/CommunityConfig.java
View file @
537888f
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.enums.YnEnums; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by Zhang.Rui on 2016/3/18. | |
| 7 | + */ | |
| 8 | +public class CommunityConfig { | |
| 9 | + private String id; | |
| 10 | + private String name; | |
| 11 | + private String parentId; | |
| 12 | + private Integer yn; | |
| 13 | + | |
| 14 | + public CommunityConfig(String parentId, String tmp) { | |
| 15 | + this.parentId = parentId; | |
| 16 | + this.yn = YnEnums.YES.getId(); | |
| 17 | + this.name = tmp; | |
| 18 | + } | |
| 19 | + public CommunityConfig() {} | |
| 20 | + | |
| 21 | + | |
| 22 | + public String getId() { | |
| 23 | + return id; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public void setId(String id) { | |
| 27 | + this.id = id; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public String getName() { | |
| 31 | + return name; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public void setName(String name) { | |
| 35 | + this.name = name; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public String getParentId() { | |
| 39 | + return parentId; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setParentId(String parentId) { | |
| 43 | + this.parentId = parentId; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public Integer getYn() { | |
| 47 | + return yn; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setYn(Integer yn) { | |
| 51 | + this.yn = yn; | |
| 52 | + } | |
| 53 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/ReferValue.java
View file @
537888f
| ... | ... | @@ -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 @
537888f
| 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/CommunityConfigController.java
View file @
537888f
| 1 | +package com.lyms.platform.operate.web.controller; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.CommunityConfigService; | |
| 4 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 5 | +import com.lyms.platform.common.enums.YnEnums; | |
| 6 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 7 | +import com.lyms.platform.common.result.BaseResponse; | |
| 8 | +import com.lyms.platform.operate.web.request.CommunityConfigRequest; | |
| 9 | +import com.lyms.platform.pojo.CommunityConfig; | |
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | +import org.springframework.stereotype.Controller; | |
| 12 | +import org.springframework.web.bind.annotation.*; | |
| 13 | + | |
| 14 | +import javax.validation.Valid; | |
| 15 | +import java.util.List; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * Created by Zhang.Rui on 2016/3/18. | |
| 19 | + */ | |
| 20 | +@Controller | |
| 21 | +public class CommunityConfigController extends RestController { | |
| 22 | + @Autowired | |
| 23 | + private CommunityConfigService communityConfigService; | |
| 24 | + | |
| 25 | + //新增区域 | |
| 26 | + @RequestMapping(value = "communityConfig", method = RequestMethod.POST) | |
| 27 | + @ResponseBody | |
| 28 | + public BaseResponse appendArea(@RequestBody @Valid CommunityConfigRequest communityConfigRequest) { | |
| 29 | + CommunityConfig communityConfig = null; | |
| 30 | + for(String tmp : communityConfigRequest.getNames()) { | |
| 31 | + communityConfig = new CommunityConfig(communityConfigRequest.getParentId(), tmp); | |
| 32 | + communityConfigService.appendArea(communityConfig); | |
| 33 | + } | |
| 34 | + return new BaseResponse() | |
| 35 | + .setErrorcode(ErrorCodeConstants.SUCCESS) | |
| 36 | + .setErrormsg("添加成功!"); | |
| 37 | + } | |
| 38 | + | |
| 39 | + //删除区域 | |
| 40 | + @RequestMapping(value = "communityConfig/{id}", method = RequestMethod.DELETE) | |
| 41 | + @ResponseBody | |
| 42 | + public BaseResponse deleteArea(@PathVariable String id) { | |
| 43 | + CommunityConfig communityConfig = new CommunityConfig(); | |
| 44 | + communityConfig.setId(id); | |
| 45 | + communityConfigService.deleteArea(communityConfig); | |
| 46 | + return new BaseResponse() | |
| 47 | + .setErrorcode(ErrorCodeConstants.SUCCESS) | |
| 48 | + .setErrormsg("删除成功!"); | |
| 49 | + } | |
| 50 | + | |
| 51 | + //更新区域 | |
| 52 | + @RequestMapping(value = "communityConfig/{id}", method = RequestMethod.PUT) | |
| 53 | + @ResponseBody | |
| 54 | + public BaseResponse updateArea(@RequestParam(required=true) String name,@RequestParam(required=true) String parentId, @PathVariable String id) { | |
| 55 | + CommunityConfig communityConfig = new CommunityConfig(); | |
| 56 | + communityConfig.setParentId(parentId); | |
| 57 | + communityConfig.setId(id); | |
| 58 | + communityConfig.setName(name); | |
| 59 | + communityConfigService.updateArea(communityConfig); | |
| 60 | + return new BaseResponse() | |
| 61 | + .setErrorcode(ErrorCodeConstants.SUCCESS) | |
| 62 | + .setErrormsg("更新成功!"); | |
| 63 | + } | |
| 64 | + | |
| 65 | + //查询区域 | |
| 66 | + @RequestMapping(value = "communityConfig", method = RequestMethod.GET) | |
| 67 | + @ResponseBody | |
| 68 | + public BaseListResponse queryArea(String keyword) { | |
| 69 | + List<CommunityConfig> communityConfigList = communityConfigService.queryArea(keyword); | |
| 70 | + return new BaseListResponse().setData(communityConfigList) | |
| 71 | + .setErrorcode(ErrorCodeConstants.SUCCESS) | |
| 72 | + .setErrormsg("查询成功!"); | |
| 73 | + } | |
| 74 | + | |
| 75 | + | |
| 76 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CommunityController.java
View file @
537888f
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReferConfigController.java
View file @
537888f
| 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 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/CommunityConfigRequest.java
View file @
537888f
| 1 | +package com.lyms.platform.operate.web.request; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.core.annotation.form.Form; | |
| 4 | + | |
| 5 | +import javax.validation.constraints.NotNull; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Created by Zhang.Rui on 2016/3/18. | |
| 9 | + */ | |
| 10 | +@Form | |
| 11 | +public class CommunityConfigRequest { | |
| 12 | + @NotNull(message = "父ID不能为空") | |
| 13 | + private String parentId; | |
| 14 | + @NotNull(message = "添加内容不能为空") | |
| 15 | + private String[] names; | |
| 16 | + | |
| 17 | + public String getParentId() { | |
| 18 | + return parentId; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public void setParentId(String parentId) { | |
| 22 | + this.parentId = parentId; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public String[] getNames() { | |
| 26 | + return names; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public void setNames(String[] names) { | |
| 30 | + this.names = names; | |
| 31 | + } | |
| 32 | +} |