Commit 6e3b4f15642ca56b26672537b64bcc94ea0d3fe6
Exists in
master
and in
1 other branch
c
Showing 7 changed files
- 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-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RestController.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ReferConfigDao.java
View file @
6e3b4f1
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 4 | +import com.lyms.platform.pojo.ReferValue; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * Created by Zhang.Rui on 2016/3/17. | |
| 8 | + */ | |
| 9 | +public interface ReferConfigDao { | |
| 10 | + void addRefer(ReferValue referValue); | |
| 11 | + | |
| 12 | + | |
| 13 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/ReferConfigDaoImpl.java
View file @
6e3b4f1
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IBasicConfigDao; | |
| 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.common.dao.operator.Page; | |
| 8 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 9 | +import com.lyms.platform.pojo.BasicConfig; | |
| 10 | +import com.lyms.platform.pojo.ReferValue; | |
| 11 | +import org.springframework.stereotype.Repository; | |
| 12 | + | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * Created by Zhang.Rui on 2016/3/17. | |
| 17 | + */ | |
| 18 | +@Repository("referConfigDao") | |
| 19 | +public class ReferConfigDaoImpl extends BaseMongoDAOImpl<ReferValue> implements ReferConfigDao { | |
| 20 | + | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + public void addRefer(ReferValue referValue) { | |
| 24 | + this.save(referValue); | |
| 25 | + } | |
| 26 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/ReferConfigService.java
View file @
6e3b4f1
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.ReferConfigDao; | |
| 4 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 5 | +import com.lyms.platform.pojo.ReferValue; | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by Zhang.Rui on 2016/3/17. | |
| 11 | + * 参考值服务 | |
| 12 | + */ | |
| 13 | +@Service | |
| 14 | +public class ReferConfigService { | |
| 15 | + @Autowired | |
| 16 | + private ReferConfigDao referConfigDao; | |
| 17 | + | |
| 18 | + public BaseListResponse queryRefer() { | |
| 19 | + return null; | |
| 20 | + } | |
| 21 | + | |
| 22 | + public void addRefer(ReferValue referValue) { | |
| 23 | + referConfigDao.addRefer(referValue); | |
| 24 | + } | |
| 25 | + | |
| 26 | + public BaseListResponse updateRefer() { | |
| 27 | + return null; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public BaseListResponse delRefer() { | |
| 31 | + return null; | |
| 32 | + } | |
| 33 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/ReferValue.java
View file @
6e3b4f1
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.core.annotation.form.Form; | |
| 4 | +import com.lyms.platform.common.result.BaseModel; | |
| 5 | +import org.hibernate.validator.constraints.NotEmpty; | |
| 6 | + | |
| 7 | +import javax.validation.constraints.NotNull; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by Zhang.Rui on 2016/3/17. | |
| 11 | + * 参考值模型 | |
| 12 | + */ | |
| 13 | +@Form | |
| 14 | +public class ReferValue extends BaseModel{ | |
| 15 | + @NotNull(message = "项目名称不能为空") | |
| 16 | + @NotEmpty(message = "项目名称不能为空") | |
| 17 | + private String name; | |
| 18 | + @NotNull(message = "项目代码不能为空") | |
| 19 | + @NotEmpty(message = "项目代码不能为空") | |
| 20 | + private String code; | |
| 21 | + private String sample; //样本 | |
| 22 | + private String sampleDesc; //样本说明 | |
| 23 | + private int sex; | |
| 24 | + private String feature; //病人特征 | |
| 25 | + private int ageDepartment; //年龄单位 | |
| 26 | + private int beginAge; | |
| 27 | + private int endAge; | |
| 28 | + private String unit; //项目单位 | |
| 29 | + private String charRefer; //字符参考 | |
| 30 | + private String min; //下限 | |
| 31 | + private String max; //上限 | |
| 32 | + | |
| 33 | + private String emergencyMin;//危机下限 | |
| 34 | + private String emergencyMax;//危机上限 | |
| 35 | + private String emergencyChar; //危机字符 | |
| 36 | + | |
| 37 | + private String deal; //处理 | |
| 38 | + private String serviceContent;//服务内容 | |
| 39 | + private int department; //科室 | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + public String getName() { | |
| 44 | + return name; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public void setName(String name) { | |
| 48 | + this.name = name; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public String getCode() { | |
| 52 | + return code; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public void setCode(String code) { | |
| 56 | + this.code = code; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public String getSample() { | |
| 60 | + return sample; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public void setSample(String sample) { | |
| 64 | + this.sample = sample; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public String getSampleDesc() { | |
| 68 | + return sampleDesc; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public void setSampleDesc(String sampleDesc) { | |
| 72 | + this.sampleDesc = sampleDesc; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public int getSex() { | |
| 76 | + return sex; | |
| 77 | + } | |
| 78 | + | |
| 79 | + public void setSex(int sex) { | |
| 80 | + this.sex = sex; | |
| 81 | + } | |
| 82 | + | |
| 83 | + public String getFeature() { | |
| 84 | + return feature; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public void setFeature(String feature) { | |
| 88 | + this.feature = feature; | |
| 89 | + } | |
| 90 | + | |
| 91 | + public int getAgeDepartment() { | |
| 92 | + return ageDepartment; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public void setAgeDepartment(int ageDepartment) { | |
| 96 | + this.ageDepartment = ageDepartment; | |
| 97 | + } | |
| 98 | + | |
| 99 | + public int getBeginAge() { | |
| 100 | + return beginAge; | |
| 101 | + } | |
| 102 | + | |
| 103 | + public void setBeginAge(int beginAge) { | |
| 104 | + this.beginAge = beginAge; | |
| 105 | + } | |
| 106 | + | |
| 107 | + public int getEndAge() { | |
| 108 | + return endAge; | |
| 109 | + } | |
| 110 | + | |
| 111 | + public void setEndAge(int endAge) { | |
| 112 | + this.endAge = endAge; | |
| 113 | + } | |
| 114 | + | |
| 115 | + public String getUnit() { | |
| 116 | + return unit; | |
| 117 | + } | |
| 118 | + | |
| 119 | + public void setUnit(String unit) { | |
| 120 | + this.unit = unit; | |
| 121 | + } | |
| 122 | + | |
| 123 | + public String getCharRefer() { | |
| 124 | + return charRefer; | |
| 125 | + } | |
| 126 | + | |
| 127 | + public void setCharRefer(String charRefer) { | |
| 128 | + this.charRefer = charRefer; | |
| 129 | + } | |
| 130 | + | |
| 131 | + public String getMin() { | |
| 132 | + return min; | |
| 133 | + } | |
| 134 | + | |
| 135 | + public void setMin(String min) { | |
| 136 | + this.min = min; | |
| 137 | + } | |
| 138 | + | |
| 139 | + public String getMax() { | |
| 140 | + return max; | |
| 141 | + } | |
| 142 | + | |
| 143 | + public void setMax(String max) { | |
| 144 | + this.max = max; | |
| 145 | + } | |
| 146 | + | |
| 147 | + public String getEmergencyMin() { | |
| 148 | + return emergencyMin; | |
| 149 | + } | |
| 150 | + | |
| 151 | + public void setEmergencyMin(String emergencyMin) { | |
| 152 | + this.emergencyMin = emergencyMin; | |
| 153 | + } | |
| 154 | + | |
| 155 | + public String getEmergencyMax() { | |
| 156 | + return emergencyMax; | |
| 157 | + } | |
| 158 | + | |
| 159 | + public void setEmergencyMax(String emergencyMax) { | |
| 160 | + this.emergencyMax = emergencyMax; | |
| 161 | + } | |
| 162 | + | |
| 163 | + public String getEmergencyChar() { | |
| 164 | + return emergencyChar; | |
| 165 | + } | |
| 166 | + | |
| 167 | + public void setEmergencyChar(String emergencyChar) { | |
| 168 | + this.emergencyChar = emergencyChar; | |
| 169 | + } | |
| 170 | + | |
| 171 | + public String getDeal() { | |
| 172 | + return deal; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public void setDeal(String deal) { | |
| 176 | + this.deal = deal; | |
| 177 | + } | |
| 178 | + | |
| 179 | + public String getServiceContent() { | |
| 180 | + return serviceContent; | |
| 181 | + } | |
| 182 | + | |
| 183 | + public void setServiceContent(String serviceContent) { | |
| 184 | + this.serviceContent = serviceContent; | |
| 185 | + } | |
| 186 | + | |
| 187 | + public int getDepartment() { | |
| 188 | + return department; | |
| 189 | + } | |
| 190 | + | |
| 191 | + public void setDepartment(int department) { | |
| 192 | + this.department = department; | |
| 193 | + } | |
| 194 | +} |
platform-dal/src/main/java/com/lyms/platform/query/ReferConfigQuery.java
View file @
6e3b4f1
| 1 | +package com.lyms.platform.query; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by Zhang.Rui on 2016/3/17. | |
| 7 | + * 参考值查询对象 | |
| 8 | + */ | |
| 9 | +public class ReferConfigQuery extends BaseQuery { | |
| 10 | + private int hospitalId; | |
| 11 | + private int codeType; | |
| 12 | + private String keyword; | |
| 13 | + private int referVal; | |
| 14 | + private int emergencyVal; | |
| 15 | + | |
| 16 | + public int getHospitalId() { | |
| 17 | + return hospitalId; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public void setHospitalId(int hospitalId) { | |
| 21 | + this.hospitalId = hospitalId; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public int getCodeType() { | |
| 25 | + return codeType; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void setCodeType(int codeType) { | |
| 29 | + this.codeType = codeType; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public String getKeyword() { | |
| 33 | + return keyword; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public void setKeyword(String keyword) { | |
| 37 | + this.keyword = keyword; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public int getReferVal() { | |
| 41 | + return referVal; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public void setReferVal(int referVal) { | |
| 45 | + this.referVal = referVal; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public int getEmergencyVal() { | |
| 49 | + return emergencyVal; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public void setEmergencyVal(int emergencyVal) { | |
| 53 | + this.emergencyVal = emergencyVal; | |
| 54 | + } | |
| 55 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReferConfigController.java
View file @
6e3b4f1
| 1 | +package com.lyms.platform.operate.web.controller; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.ReferConfigService; | |
| 4 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 5 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 6 | +import com.lyms.platform.common.result.BaseResponse; | |
| 7 | +import com.lyms.platform.pojo.ReferValue; | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +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; | |
| 13 | + | |
| 14 | +import javax.validation.Valid; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * Created by Zhang.Rui on 2016/3/17. | |
| 18 | + * 参考值配置 | |
| 19 | + */ | |
| 20 | +@Controller | |
| 21 | +public class ReferConfigController extends RestController{ | |
| 22 | + @Autowired | |
| 23 | + ReferConfigService referConfigService; | |
| 24 | + | |
| 25 | + public BaseListResponse queryRefer() { | |
| 26 | + return null; | |
| 27 | + } | |
| 28 | + | |
| 29 | + @RequestMapping("referConfig") | |
| 30 | + @ResponseBody | |
| 31 | + public BaseResponse addRefer(@RequestBody @Valid ReferValue referValue) { | |
| 32 | + referConfigService.addRefer(referValue); | |
| 33 | + return new BaseResponse() | |
| 34 | + .setErrorcode(ErrorCodeConstants.SUCCESS) | |
| 35 | + .setErrormsg("添加成功!"); | |
| 36 | + } | |
| 37 | + | |
| 38 | + public BaseListResponse updateRefer() { | |
| 39 | + return null; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public BaseListResponse delRefer() { | |
| 43 | + return null; | |
| 44 | + } | |
| 45 | + | |
| 46 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RestController.java
View file @
6e3b4f1
| 1 | +package com.lyms.platform.operate.web.controller; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +import com.lyms.platform.common.result.BaseResponse; | |
| 6 | +import org.apache.commons.collections.CollectionUtils; | |
| 7 | +import org.springframework.http.HttpStatus; | |
| 8 | +import org.springframework.validation.BindException; | |
| 9 | +import org.springframework.validation.BindingResult; | |
| 10 | +import org.springframework.web.bind.MethodArgumentNotValidException; | |
| 11 | +import org.springframework.web.bind.annotation.ExceptionHandler; | |
| 12 | +import org.springframework.web.bind.annotation.ResponseBody; | |
| 13 | +import org.springframework.web.bind.annotation.ResponseStatus; | |
| 14 | + | |
| 15 | + | |
| 16 | +public class RestController { | |
| 17 | + | |
| 18 | + private static final int ARG_ERROR = 4039; | |
| 19 | + | |
| 20 | + @ExceptionHandler(MethodArgumentNotValidException.class) | |
| 21 | + @ResponseStatus(HttpStatus.OK) | |
| 22 | + @ResponseBody | |
| 23 | + public BaseResponse validationError(MethodArgumentNotValidException e) { | |
| 24 | + return createValidationResponse(e.getBindingResult()); | |
| 25 | + } | |
| 26 | + | |
| 27 | + @ExceptionHandler(BindException.class) | |
| 28 | + @ResponseStatus(HttpStatus.OK) | |
| 29 | + @ResponseBody | |
| 30 | + public BaseResponse validationError(BindException e) { | |
| 31 | + return createValidationResponse(e.getBindingResult()); | |
| 32 | + } | |
| 33 | + | |
| 34 | + private BaseResponse createValidationResponse(BindingResult bindingResult) { | |
| 35 | + BaseResponse error = new BaseResponse(); | |
| 36 | + List<org.springframework.validation.FieldError> fieldErrors = bindingResult | |
| 37 | + .getFieldErrors(); | |
| 38 | + | |
| 39 | + if (CollectionUtils.isNotEmpty(fieldErrors)) { | |
| 40 | + org.springframework.validation.FieldError fieldError = fieldErrors | |
| 41 | + .get(0); | |
| 42 | + | |
| 43 | + error.setErrorcode(ARG_ERROR ); | |
| 44 | + error.setErrormsg(fieldError | |
| 45 | + .getDefaultMessage()); | |
| 46 | + } | |
| 47 | + return error; | |
| 48 | + } | |
| 49 | +} |