Commit db8041c469bc99f2492ced52525ddf39c9bb7a22
1 parent
0a96105ab2
Exists in
master
and in
6 other branches
儿童区域隐藏建档
Showing 7 changed files with 378 additions and 260 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyBookbuildingService.java
 - platform-dal/src/main/java/com/lyms/platform/pojo/BabyModel.java
 - platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
 - platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
 - platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
 - platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyCheckRequest.java
 - platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyBuildResult.java
 
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyBookbuildingService.java
View file @
db8041c
| ... | ... | @@ -2,8 +2,11 @@ | 
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.dao.operator.MongoQuery; | 
| 4 | 4 | import com.lyms.platform.pojo.BabyCheckModel; | 
| 5 | +import com.lyms.platform.pojo.Patients; | |
| 5 | 6 | import com.lyms.platform.pojo.PostReviewModel; | 
| 6 | 7 | import com.lyms.platform.query.BabyModelQuery; | 
| 8 | +import com.lyms.platform.query.PatientsQuery; | |
| 9 | +import org.apache.commons.collections.CollectionUtils; | |
| 7 | 10 | import org.apache.commons.lang.StringUtils; | 
| 8 | 11 | import org.springframework.beans.factory.annotation.Autowired; | 
| 9 | 12 | import org.springframework.data.domain.Sort; | 
| ... | ... | @@ -21,6 +24,8 @@ | 
| 21 | 24 | |
| 22 | 25 | @Autowired | 
| 23 | 26 | private IBabyBookBuildingDao babyBookBuildingDao; | 
| 27 | + @Autowired | |
| 28 | + private PatientsService patientsService; | |
| 24 | 29 | |
| 25 | 30 | |
| 26 | 31 | public BabyModel addBabyBookbuilding(BabyModel babyModel) { | 
| ... | ... | @@ -38,6 +43,28 @@ | 
| 38 | 43 | public void updateBabyBuild(BabyModel model, String id) { | 
| 39 | 44 | model.setId(id); | 
| 40 | 45 | babyBookBuildingDao.updateBaby(model, id); | 
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 修改非建档医院基本信息 | |
| 50 | + */ | |
| 51 | + public void updateBaseData(BabyModel babyModel){ | |
| 52 | + BabyModelQuery babyModelQuery=new BabyModelQuery(); | |
| 53 | + babyModelQuery.setPid(babyModel.getPid()); | |
| 54 | + babyModelQuery.setEnable("2"); | |
| 55 | + babyModelQuery.setSource(babyModel.getId()); | |
| 56 | + //查询出其他医院的隐藏建档 | |
| 57 | + List<BabyModel> patientses=queryBabyBuildByCond(babyModelQuery); | |
| 58 | + if(CollectionUtils.isNotEmpty(patientses)){ | |
| 59 | + for(BabyModel patients1:patientses){ | |
| 60 | + babyModel.setId(patients1.getId()); | |
| 61 | + babyModel.setBuildDate(patients1.getBuildDate()); | |
| 62 | + babyModel.setHospitalId(patients1.getHospitalId()); | |
| 63 | + babyModel.setBuildDoctor(patients1.getBuildDoctor()); | |
| 64 | + babyModel.setCreated(patients1.getCreated()); | |
| 65 | + patientsService.updateRefer(babyModel); | |
| 66 | + } | |
| 67 | + } | |
| 41 | 68 | } | 
| 42 | 69 | |
| 43 | 70 | public List<BabyModel> queryBabyBuildByCond(BabyModelQuery babyQuery) { | 
platform-dal/src/main/java/com/lyms/platform/pojo/BabyModel.java
View file @
db8041c
| ... | ... | @@ -19,6 +19,17 @@ | 
| 19 | 19 | private static final long serialVersionUID = SerialIdEnum.BabyModel.getCid(); | 
| 20 | 20 | |
| 21 | 21 | private String id; | 
| 22 | + //来源id | |
| 23 | + private String source; | |
| 24 | + | |
| 25 | + public String getSource() { | |
| 26 | + return source; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public void setSource(String source) { | |
| 30 | + this.source = source; | |
| 31 | + } | |
| 32 | + | |
| 22 | 33 | // 编号 | 
| 23 | 34 | private String sNumber; | 
| 24 | 35 | |
| ... | ... | @@ -203,6 +214,7 @@ | 
| 203 | 214 | |
| 204 | 215 | //分娩孕周 | 
| 205 | 216 | private Integer dueWeek; | 
| 217 | + //1 隐藏不显示 2 区域隐藏建档 | |
| 206 | 218 | private String enable; | 
| 207 | 219 | //操作人 | 
| 208 | 220 | private Integer operator; | 
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
View file @
db8041c
| ... | ... | @@ -51,6 +51,25 @@ | 
| 51 | 51 | |
| 52 | 52 | private String buildDoctor; | 
| 53 | 53 | |
| 54 | + private String enable; | |
| 55 | + private String source; | |
| 56 | + | |
| 57 | + public String getSource() { | |
| 58 | + return source; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setSource(String source) { | |
| 62 | + this.source = source; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public String getEnable() { | |
| 66 | + return enable; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setEnable(String enable) { | |
| 70 | + this.enable = enable; | |
| 71 | + } | |
| 72 | + | |
| 54 | 73 | public String getBuildDoctor() { | 
| 55 | 74 | return buildDoctor; | 
| 56 | 75 | } | 
| ... | ... | @@ -486,6 +505,9 @@ | 
| 486 | 505 | if (null != id) { | 
| 487 | 506 | condition = condition.and("id", id, MongoOper.IS); | 
| 488 | 507 | } | 
| 508 | + if (null != source) { | |
| 509 | + condition = condition.and("source", source, MongoOper.IS); | |
| 510 | + } | |
| 489 | 511 | if (-1 != yn) { | 
| 490 | 512 | condition = condition.and("yn", yn, MongoOper.IS); | 
| 491 | 513 | } | 
| ... | ... | @@ -500,6 +522,10 @@ | 
| 500 | 522 | } | 
| 501 | 523 | if (null != areaId) { | 
| 502 | 524 | condition = condition.and("areaId", areaId, MongoOper.IS); | 
| 525 | + } | |
| 526 | + | |
| 527 | + if (null != enable) { | |
| 528 | + condition = condition.and("enable", enable, MongoOper.IS); | |
| 503 | 529 | } | 
| 504 | 530 | if (null != communityId) { | 
| 505 | 531 | condition = condition.and("communityId", communityId, MongoOper.IS); | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
db8041c
| ... | ... | @@ -11,6 +11,7 @@ | 
| 11 | 11 | import com.lyms.platform.common.result.BaseObjectResponse; | 
| 12 | 12 | import com.lyms.platform.common.result.BaseResponse; | 
| 13 | 13 | import com.lyms.platform.common.utils.*; | 
| 14 | +import com.lyms.platform.common.utils.StringUtils; | |
| 14 | 15 | import com.lyms.platform.operate.web.request.*; | 
| 15 | 16 | import com.lyms.platform.operate.web.result.*; | 
| 16 | 17 | import com.lyms.platform.operate.web.utils.BabyListTask; | 
| 17 | 18 | |
| ... | ... | @@ -24,7 +25,9 @@ | 
| 24 | 25 | import com.lyms.platform.pojo.*; | 
| 25 | 26 | import com.lyms.platform.query.*; | 
| 26 | 27 | import org.apache.commons.collections.CollectionUtils; | 
| 28 | +import org.apache.commons.lang.*; | |
| 27 | 29 | import org.apache.commons.lang.math.*; | 
| 30 | +import org.apache.commons.lang.math.NumberUtils; | |
| 28 | 31 | import org.springframework.beans.factory.annotation.Autowired; | 
| 29 | 32 | import org.springframework.data.domain.Sort; | 
| 30 | 33 | import org.springframework.stereotype.Component; | 
| ... | ... | @@ -105,6 +108,8 @@ | 
| 105 | 108 | private DataPermissionService dataPermissionService; | 
| 106 | 109 | @Autowired | 
| 107 | 110 | private AutoMatchFacade autoMatchFacade; | 
| 111 | + @Autowired | |
| 112 | + private OrganizationGroupsFacade groupsFacade; | |
| 108 | 113 | |
| 109 | 114 | |
| 110 | 115 | |
| ... | ... | @@ -121,6 +126,83 @@ | 
| 121 | 126 | } | 
| 122 | 127 | |
| 123 | 128 | /** | 
| 129 | + * 查询符合条件的小孩 | |
| 130 | + * | |
| 131 | + * @param babyModelQuery | |
| 132 | + * @param hospitalId | |
| 133 | + * @param isEnable | |
| 134 | + * @return | |
| 135 | + */ | |
| 136 | + private BabyModel findBabyCond(BabyModelQuery babyModelQuery,List<String> hospitalId,boolean isEnable){ | |
| 137 | + babyModelQuery.setHospitalIdList(hospitalId); | |
| 138 | + if(isEnable){ | |
| 139 | + babyModelQuery.setEnable("2"); | |
| 140 | + } | |
| 141 | + | |
| 142 | + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 143 | + if(CollectionUtils.isNotEmpty(babyModels)){ | |
| 144 | + return babyModels.get(0); | |
| 145 | + } | |
| 146 | + return null; | |
| 147 | + } | |
| 148 | + | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * 处理区域隐藏建档 | |
| 152 | + * | |
| 153 | + * @param pid 系统中 | |
| 154 | + * @param parentId | |
| 155 | + * @param userId | |
| 156 | + * @return | |
| 157 | + */ | |
| 158 | + public String handHideBuild(String pid, String parentId, Integer userId, int type) { | |
| 159 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 160 | + BabyModel babyModel = null; | |
| 161 | + BabyModel babyModel1 = null; | |
| 162 | + if(org.apache.commons.lang.StringUtils.isNotEmpty(parentId)){ | |
| 163 | + BabyModelQuery babyModelQuery=new BabyModelQuery(); | |
| 164 | + babyModelQuery.setParentId(parentId); | |
| 165 | + List<BabyModel> patients1 = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 166 | + if(CollectionUtils.isNotEmpty(patients1)){ | |
| 167 | + babyModel1=patients1.get(0); | |
| 168 | + } | |
| 169 | + if (org.apache.commons.lang.StringUtils.isEmpty(pid)) { | |
| 170 | + pid = babyModel1.getPid(); | |
| 171 | + } | |
| 172 | + } | |
| 173 | + | |
| 174 | + BabyModelQuery babyModelQuery=new BabyModelQuery(); | |
| 175 | + | |
| 176 | + babyModelQuery.setParentId(parentId); | |
| 177 | + | |
| 178 | + List li = new ArrayList(); | |
| 179 | + li.add(hospitalId); | |
| 180 | + babyModel = findBabyCond(babyModelQuery,li, true); | |
| 181 | + //表示本院已经有隐藏建档 | |
| 182 | + if (null != babyModel) { | |
| 183 | + return babyModel.getId(); | |
| 184 | + } | |
| 185 | + if (babyModel1.getHospitalId().equals(hospitalId)) { | |
| 186 | + return babyModel1.getId(); | |
| 187 | + } | |
| 188 | + | |
| 189 | + //表示区域的 | |
| 190 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(groupsFacade.findByCurrentUserId(hospitalId)) && org.apache.commons.lang.StringUtils.isNotEmpty(pid)) { | |
| 191 | + babyModelQuery.setParentId(null); | |
| 192 | + babyModelQuery.setPid(pid); | |
| 193 | + babyModel= findBabyCond(babyModelQuery,li, false); | |
| 194 | + babyModel.setSource(babyModel.getId()); | |
| 195 | + babyModel.setId(null); | |
| 196 | + babyModel.setHospitalId(hospitalId); | |
| 197 | + babyModel.setCreated(new Date()); | |
| 198 | + babyModel.setEnable("2"); | |
| 199 | + babyBookbuildingService.addBabyBookbuilding(babyModel); | |
| 200 | + return babyModel.getId(); | |
| 201 | + } | |
| 202 | + return null; | |
| 203 | + } | |
| 204 | + | |
| 205 | + /** | |
| 124 | 206 | * 儿童电子病历 | 
| 125 | 207 | * | 
| 126 | 208 | * @return | 
| ... | ... | @@ -278,6 +360,12 @@ | 
| 278 | 360 | |
| 279 | 361 | babyBookbuildingService.updateBabyBuild(model, request.getId()); | 
| 280 | 362 | patientsService.updateRefer(model); | 
| 363 | + | |
| 364 | + //如果当前是建档医院,那么需要修改其他非建档医院的数据 | |
| 365 | + if (autoMatchFacade.checkBStatus(userId)) { | |
| 366 | + babyBookbuildingService.updateBaseData(model); | |
| 367 | + } | |
| 368 | + | |
| 281 | 369 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | 
| 282 | 370 | } | 
| 283 | 371 | |
| ... | ... | @@ -897,6 +985,7 @@ | 
| 897 | 985 | private BabyBuildResult getBabyBuildResult(BabyModel model) { | 
| 898 | 986 | BabyBuildResult result = new BabyBuildResult(); | 
| 899 | 987 | result.setId(model.getId()); | 
| 988 | + result.setPid(model.getPid()); | |
| 900 | 989 | //母亲信息 | 
| 901 | 990 | result.setMommyName(model.getMname()); | 
| 902 | 991 | result.setMommyCertificateTypeId(model.getMcertTypeId()); | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
db8041c
| ... | ... | @@ -55,6 +55,14 @@ | 
| 55 | 55 | |
| 56 | 56 | @Autowired | 
| 57 | 57 | private AntenatalExaminationFacade antenatalExaminationFacade; | 
| 58 | + | |
| 59 | + @Autowired | |
| 60 | + private BabyBookbuildingFacade babyBookbuildingFacade; | |
| 61 | + @Autowired | |
| 62 | + private OrganizationGroupsFacade groupsFacade; | |
| 63 | + @Autowired | |
| 64 | + private AutoMatchFacade autoMatchFacade; | |
| 65 | + | |
| 58 | 66 | /** | 
| 59 | 67 | * 更新检查 | 
| 60 | 68 | * | 
| 61 | 69 | |
| ... | ... | @@ -72,14 +80,11 @@ | 
| 72 | 80 | bm.setModified(new Date()); | 
| 73 | 81 | if (request.getHighRisk() == null) { | 
| 74 | 82 | bm.setLastHighRisk(0); | 
| 75 | - } | |
| 76 | - else | |
| 77 | - { | |
| 83 | + } else { | |
| 78 | 84 | bm.setLastHighRisk(request.getHighRisk()); | 
| 79 | 85 | } | 
| 80 | 86 | bm.setNextDate(DateUtil.parseYMD(request.getNextDate())); | 
| 81 | - if (CollectionUtils.isNotEmpty(request.getDiagnose())) | |
| 82 | - { | |
| 87 | + if (CollectionUtils.isNotEmpty(request.getDiagnose())) { | |
| 83 | 88 | BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); | 
| 84 | 89 | basicConfigQuery.setYn(YnEnums.YES.getId()); | 
| 85 | 90 | basicConfigQuery.setParentId(SystemConfig.DIAGNOSE_TYPE_ID); | 
| 86 | 91 | |
| ... | ... | @@ -174,11 +179,9 @@ | 
| 174 | 179 | model.setNextDate(DateUtil.parseYMD(request.getNextDate())); | 
| 175 | 180 | |
| 176 | 181 | |
| 177 | - if (request.getHighRisk() == null){ | |
| 182 | + if (request.getHighRisk() == null) { | |
| 178 | 183 | model.setHighRisk(0); | 
| 179 | - } | |
| 180 | - else | |
| 181 | - { | |
| 184 | + } else { | |
| 182 | 185 | model.setHighRisk(request.getHighRisk()); | 
| 183 | 186 | } | 
| 184 | 187 | |
| 185 | 188 | |
| ... | ... | @@ -189,14 +192,13 @@ | 
| 189 | 192 | model.setHeadEvaluate(request.getHeadEvaluate()); | 
| 190 | 193 | model.setHeightEvaluate(request.getHeightEvaluate()); | 
| 191 | 194 | |
| 192 | - if (StringUtils.isNotEmpty(request.getBuildId())) | |
| 193 | - { | |
| 194 | - BabyModelQuery babyModelQuery=new BabyModelQuery(); | |
| 195 | + if (StringUtils.isNotEmpty(request.getBuildId())) { | |
| 196 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 195 | 197 | babyModelQuery.setId(request.getBuildId()); | 
| 196 | 198 | babyModelQuery.setYn(YnEnums.YES.getId()); | 
| 197 | - List<BabyModel> babyModelList= babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 198 | - if(CollectionUtils.isNotEmpty(babyModelList)){ | |
| 199 | - model.setCheckMonth(DateUtil.getBabyAgeMonth(babyModelList.get(0).getBirth(),DateUtil.parseYMD(request.getCheckDate()))); | |
| 199 | + List<BabyModel> babyModelList = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 200 | + if (CollectionUtils.isNotEmpty(babyModelList)) { | |
| 201 | + model.setCheckMonth(DateUtil.getBabyAgeMonth(babyModelList.get(0).getBirth(), DateUtil.parseYMD(request.getCheckDate()))); | |
| 200 | 202 | } | 
| 201 | 203 | } | 
| 202 | 204 | |
| 203 | 205 | |
| 204 | 206 | |
| 205 | 207 | |
| 206 | 208 | |
| ... | ... | @@ -209,37 +211,30 @@ | 
| 209 | 211 | * @param request | 
| 210 | 212 | * @return | 
| 211 | 213 | */ | 
| 212 | - public BaseResponse addBabyCheck(BabyCheckRequest request,Integer userId) { | |
| 214 | + public BaseResponse addBabyCheck(BabyCheckRequest request, Integer userId) { | |
| 213 | 215 | |
| 216 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 217 | + //表示区域的 | |
| 218 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(groupsFacade.findByCurrentUserId(hospitalId))) { | |
| 219 | + String parentId = babyBookbuildingFacade.handHideBuild(request.getPid(), request.getBuildId(), userId, 1); | |
| 220 | + if (org.apache.commons.lang.StringUtils.isEmpty(parentId)) { | |
| 221 | + //打印日志 | |
| 222 | + } | |
| 223 | + request.setBuildId(parentId); | |
| 224 | + } | |
| 225 | + | |
| 214 | 226 | //儿童体检后 更新下次预约时间和是否高危 在基础数据表里面 | 
| 215 | 227 | BabyModel bm = new BabyModel(); | 
| 216 | 228 | bm.setModified(new Date()); | 
| 217 | - if (request.getHighRisk() == null) | |
| 218 | - { | |
| 229 | + if (request.getHighRisk() == null) { | |
| 219 | 230 | bm.setLastHighRisk(0); | 
| 220 | - } | |
| 221 | - else | |
| 222 | - { | |
| 231 | + } else { | |
| 223 | 232 | bm.setLastHighRisk(request.getHighRisk()); | 
| 224 | 233 | } | 
| 225 | 234 | |
| 226 | 235 | bm.setNextDate(DateUtil.parseYMD(request.getNextDate())); | 
| 227 | 236 | |
| 228 | - | |
| 229 | - String hospitalId = ""; | |
| 230 | - | |
| 231 | - //得到当前登录的医院id | |
| 232 | - if (userId != null) | |
| 233 | - { | |
| 234 | - Users dbuser = usersService.getUsers(userId); | |
| 235 | - if (dbuser != null) { | |
| 236 | - hospitalId = String.valueOf(dbuser.getOrgId()); | |
| 237 | - } | |
| 238 | - } | |
| 239 | - | |
| 240 | - | |
| 241 | - if (CollectionUtils.isNotEmpty(request.getDiagnose())) | |
| 242 | - { | |
| 237 | + if (CollectionUtils.isNotEmpty(request.getDiagnose())) { | |
| 243 | 238 | BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); | 
| 244 | 239 | basicConfigQuery.setYn(YnEnums.YES.getId()); | 
| 245 | 240 | basicConfigQuery.setParentId(SystemConfig.DIAGNOSE_TYPE_ID); | 
| ... | ... | @@ -255,7 +250,7 @@ | 
| 255 | 250 | } | 
| 256 | 251 | |
| 257 | 252 | babyBookbuildingService.updateBabyBuild(bm, request.getBuildId()); | 
| 258 | - | |
| 253 | + syncMaster(request.getBuildId()); | |
| 259 | 254 | BabyCheckModel model = getBabyCheckModel(request); | 
| 260 | 255 | model.setHospitalId(hospitalId); | 
| 261 | 256 | model.setCreated(new Date()); | 
| 262 | 257 | |
| 263 | 258 | |
| 264 | 259 | |
| ... | ... | @@ -266,20 +261,20 @@ | 
| 266 | 261 | br.setErrormsg("失败"); | 
| 267 | 262 | |
| 268 | 263 | } | 
| 269 | - BabyModelQuery babyModelQuery=new BabyModelQuery(); | |
| 264 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 270 | 265 | babyModelQuery.setId(request.getBuildId()); | 
| 271 | 266 | babyModelQuery.setYn(YnEnums.YES.getId()); | 
| 272 | 267 | babyModelQuery.setBuildType(3); | 
| 273 | - List<BabyModel> babyModelList= babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 274 | - if(CollectionUtils.isNotEmpty(babyModelList)){ | |
| 268 | + List<BabyModel> babyModelList = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 269 | + if (CollectionUtils.isNotEmpty(babyModelList)) { | |
| 275 | 270 | |
| 276 | 271 | BabyModel babyModel = new BabyModel(); | 
| 277 | 272 | babyModel.setEnable("1"); | 
| 278 | - babyBookbuildingService.updateBabyBuild(babyModel,babyModelList.get(0).getId()); | |
| 273 | + babyBookbuildingService.updateBabyBuild(babyModel, babyModelList.get(0).getId()); | |
| 279 | 274 | |
| 280 | 275 | ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery(); | 
| 281 | 276 | referralApplyOrderQuery.setParentId(request.getBuildId()); | 
| 282 | - String hospital =babyModelList.get(0).getHospitalId(); | |
| 277 | + String hospital = babyModelList.get(0).getHospitalId(); | |
| 283 | 278 | referralApplyOrderQuery.setHospitalId(hospital); | 
| 284 | 279 | referralApplyOrderQuery.setStatus(1); | 
| 285 | 280 | List<ReferralApplyOrderModel> orderModelList = applyOrderService.queryReferralApplyOrderWithQuery(referralApplyOrderQuery); | 
| 286 | 281 | |
| ... | ... | @@ -316,9 +311,43 @@ | 
| 316 | 311 | return br; | 
| 317 | 312 | } | 
| 318 | 313 | |
| 314 | + private void syncMaster(String id) { | |
| 315 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 316 | + babyModelQuery.setId(id); | |
| 317 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
| 318 | + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 319 | + BabyModel babyModel = null; | |
| 320 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 321 | + babyModel = babyModels.get(0); | |
| 322 | + } | |
| 323 | + //表示这个记录是子档 | |
| 324 | + if(babyModel!=null&&org.apache.commons.lang.StringUtils.isNotEmpty(babyModel.getSource())){ | |
| 325 | + BabyModel babyModel1=new BabyModel(); | |
| 326 | + babyModel1.setNextDate(babyModel.getNextDate()); | |
| 327 | + babyModel1.setLastHighRisk(babyModel.getLastHighRisk()); | |
| 328 | + babyModel1.setLastDiagnose(babyModel.getLastDiagnose()); | |
| 329 | + babyModel1.setId(babyModel.getSource()); | |
| 330 | + babyBookbuildingService.updateBabyBuild(babyModel1,babyModel.getSource()); | |
| 331 | + }else if(babyModel!=null){ | |
| 332 | + babyModelQuery.setId(null); | |
| 333 | + babyModelQuery.setSource(id); | |
| 334 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
| 335 | + babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 336 | + if(CollectionUtils.isNotEmpty(babyModels)){ | |
| 337 | + for(BabyModel baby:babyModels){ | |
| 338 | + BabyModel babyModel1=new BabyModel(); | |
| 339 | + babyModel1.setNextDate(babyModel.getNextDate()); | |
| 340 | + babyModel1.setLastHighRisk(babyModel.getLastHighRisk()); | |
| 341 | + babyModel1.setLastDiagnose(babyModel.getLastDiagnose()); | |
| 342 | + babyModel1.setId(baby.getId()); | |
| 343 | + babyBookbuildingService.updateBabyBuild(babyModel1,baby.getId()); | |
| 344 | + } | |
| 345 | + } | |
| 346 | + } | |
| 347 | + } | |
| 319 | 348 | |
| 320 | - public void updateLastGrowth(BabyCheckModel model) | |
| 321 | - { | |
| 349 | + | |
| 350 | + public void updateLastGrowth(BabyCheckModel model) { | |
| 322 | 351 | babyBookbuildingService.updateBabyLastGrowth(model); | 
| 323 | 352 | } | 
| 324 | 353 | |
| 325 | 354 | |
| 326 | 355 | |
| ... | ... | @@ -333,16 +362,14 @@ | 
| 333 | 362 | query.setYn(YnEnums.YES.getId()); | 
| 334 | 363 | query.setId(id); | 
| 335 | 364 | //查询儿童的检查记录 | 
| 336 | - List<BabyCheckModel> checkModels = babyCheckService.queryBabyCheckRecord(query,"checkDate", Sort.Direction.DESC); | |
| 365 | + List<BabyCheckModel> checkModels = babyCheckService.queryBabyCheckRecord(query, "checkDate", Sort.Direction.DESC); | |
| 337 | 366 | |
| 338 | 367 | babyCheckService.deleteBabyCheckById(id); | 
| 339 | - if (CollectionUtils.isNotEmpty(checkModels)) | |
| 340 | - { | |
| 368 | + if (CollectionUtils.isNotEmpty(checkModels)) { | |
| 341 | 369 | query.setId(null); | 
| 342 | 370 | query.setBuildId(checkModels.get(0).getBuildId()); | 
| 343 | - checkModels = babyCheckService.queryBabyCheckRecord(query,"checkDate", Sort.Direction.DESC); | |
| 344 | - if (CollectionUtils.isNotEmpty(checkModels)) | |
| 345 | - { | |
| 371 | + checkModels = babyCheckService.queryBabyCheckRecord(query, "checkDate", Sort.Direction.DESC); | |
| 372 | + if (CollectionUtils.isNotEmpty(checkModels)) { | |
| 346 | 373 | updateLastGrowth(checkModels.get(0)); | 
| 347 | 374 | } | 
| 348 | 375 | } | 
| ... | ... | @@ -360,7 +387,7 @@ | 
| 360 | 387 | BaseObjectResponse br = new BaseObjectResponse(); | 
| 361 | 388 | BabyBasicResult base = new BabyBasicResult(); | 
| 362 | 389 | Map<String, Object> resMap = new HashMap<>(); | 
| 363 | - BabyModel model = getBabyModel(id, base); | |
| 390 | + BabyModel model = getBabyModel(id, base); | |
| 364 | 391 | |
| 365 | 392 | BabyModelQuery babyQuery = new BabyModelQuery(); | 
| 366 | 393 | babyQuery.setPid(model.getPid()); | 
| 367 | 394 | |
| ... | ... | @@ -377,12 +404,11 @@ | 
| 377 | 404 | personModelQuery.setYn(YnEnums.YES.getId()); | 
| 378 | 405 | personModelQuery.setId(model.getPid()); | 
| 379 | 406 | |
| 380 | - List<PersonModel> personModels = personService.queryPersons(personModelQuery); | |
| 407 | + List<PersonModel> personModels = personService.queryPersons(personModelQuery); | |
| 381 | 408 | |
| 382 | 409 | int len = models.size(); | 
| 383 | 410 | String[] buildIds = new String[len]; | 
| 384 | - for(int i = 0;i < len ; i++) | |
| 385 | - { | |
| 411 | + for (int i = 0; i < len; i++) { | |
| 386 | 412 | buildIds[i] = models.get(i).getId(); | 
| 387 | 413 | } | 
| 388 | 414 | |
| 389 | 415 | |
| ... | ... | @@ -405,10 +431,9 @@ | 
| 405 | 431 | query.setYn(YnEnums.YES.getId()); | 
| 406 | 432 | query.setBuildIds(ids); | 
| 407 | 433 | //查询儿童的检查记录 | 
| 408 | - checkModels = babyCheckService.queryBabyCheckRecord(query,"checkDate", Sort.Direction.DESC); | |
| 434 | + checkModels = babyCheckService.queryBabyCheckRecord(query, "checkDate", Sort.Direction.DESC); | |
| 409 | 435 | Date babyBirth = personModel.getBirth(); | 
| 410 | - if (CollectionUtils.isNotEmpty(checkModels)) | |
| 411 | - { | |
| 436 | + if (CollectionUtils.isNotEmpty(checkModels)) { | |
| 412 | 437 | |
| 413 | 438 | for (BabyCheckModel cmodel : checkModels) { | 
| 414 | 439 | |
| 415 | 440 | |
| 416 | 441 | |
| ... | ... | @@ -423,16 +448,15 @@ | 
| 423 | 448 | Map<String, String> checkRecord = new HashMap<>(); | 
| 424 | 449 | Date checkDate = cmodel.getCheckDate(); | 
| 425 | 450 | String monthAge = ""; | 
| 426 | - if(babyBirth != null && checkDate != null) | |
| 427 | - { | |
| 451 | + if (babyBirth != null && checkDate != null) { | |
| 428 | 452 | monthAge = DateUtil.getBabyMonthAge(babyBirth, checkDate); | 
| 429 | 453 | } | 
| 430 | - checkRecord.put("parentId",cmodel.getBuildId()); | |
| 454 | + checkRecord.put("parentId", cmodel.getBuildId()); | |
| 431 | 455 | checkRecord.put("id", cmodel.getId()); | 
| 432 | 456 | checkRecord.put("checkDate", DateUtil.getyyyy_MM_dd(checkDate)); | 
| 433 | 457 | checkRecord.put("monthAge", monthAge); | 
| 434 | 458 | checkRecord.put("buildId", cmodel.getBuildId()); | 
| 435 | - checkRecord.put("type","2"); | |
| 459 | + checkRecord.put("type", "2"); | |
| 436 | 460 | |
| 437 | 461 | checkRecord.put("hospitalId", models.get(0).getHospitalId()); | 
| 438 | 462 | //查询建档医院 | 
| 439 | 463 | |
| 440 | 464 | |
| 441 | 465 | |
| 442 | 466 | |
| ... | ... | @@ -460,25 +484,23 @@ | 
| 460 | 484 | //查询儿童的检查记录 | 
| 461 | 485 | checkModels = babyCheckService.queryBabyCheckRecord(query); | 
| 462 | 486 | Date babyBirth = model.getBirth(); | 
| 463 | - if (CollectionUtils.isNotEmpty(checkModels)) | |
| 464 | - { | |
| 487 | + if (CollectionUtils.isNotEmpty(checkModels)) { | |
| 465 | 488 | |
| 466 | 489 | for (BabyCheckModel cmodel : checkModels) { | 
| 467 | 490 | Map<String, String> checkRecord = new HashMap<>(); | 
| 468 | 491 | Date checkDate = cmodel.getCheckDate(); | 
| 469 | 492 | String monthAge = ""; | 
| 470 | - if(babyBirth != null && checkDate != null) | |
| 471 | - { | |
| 493 | + if (babyBirth != null && checkDate != null) { | |
| 472 | 494 | monthAge = DateUtil.getBabyMonthAge(babyBirth, checkDate); | 
| 473 | 495 | } | 
| 474 | - checkRecord.put("parentId",cmodel.getBuildId()); | |
| 496 | + checkRecord.put("parentId", cmodel.getBuildId()); | |
| 475 | 497 | checkRecord.put("id", cmodel.getId()); | 
| 476 | 498 | checkRecord.put("checkDate", DateUtil.getyyyy_MM_dd(checkDate)); | 
| 477 | 499 | checkRecord.put("monthAge", monthAge); | 
| 478 | 500 | checkRecord.put("buildId", cmodel.getBuildId()); | 
| 479 | - checkRecord.put("type","2"); | |
| 501 | + checkRecord.put("type", "2"); | |
| 480 | 502 | |
| 481 | - checkRecord.put("hospitalId",model.getHospitalId()); | |
| 503 | + checkRecord.put("hospitalId", model.getHospitalId()); | |
| 482 | 504 | //查询建档医院 | 
| 483 | 505 | Organization org = organizationService.getOrganization(Integer.valueOf(model.getHospitalId())); | 
| 484 | 506 | if (org != null) { | 
| ... | ... | @@ -496,7 +518,7 @@ | 
| 496 | 518 | |
| 497 | 519 | |
| 498 | 520 | public BabyModel getBabyModel(String id, BabyBasicResult base) { | 
| 499 | - BabyModel model=null; | |
| 521 | + BabyModel model = null; | |
| 500 | 522 | if (!StringUtils.isEmpty(id)) { | 
| 501 | 523 | BabyModelQuery babyQuery = new BabyModelQuery(); | 
| 502 | 524 | babyQuery.setId(id); | 
| 503 | 525 | |
| ... | ... | @@ -512,10 +534,9 @@ | 
| 512 | 534 | base.setCardNo(model.getMcertNo()); | 
| 513 | 535 | base.setMonthAge(DateUtil.getBabyMonthAge(model.getBirth(), new Date())); | 
| 514 | 536 | base.setBirthday(DateUtil.getyyyy_MM_dd(model.getBirth())); | 
| 515 | - if (model.getPid() != null) | |
| 516 | - { | |
| 537 | + if (model.getPid() != null) { | |
| 517 | 538 | //诊断 | 
| 518 | - List list = getBabyLastDiagnose(model.getPid()); | |
| 539 | + List list = getBabyLastDiagnose(model.getPid()); | |
| 519 | 540 | List<Map> dlist = new ArrayList<>(); | 
| 520 | 541 | if (CollectionUtils.isNotEmpty(list)) { | 
| 521 | 542 | for (Object did : list) { | 
| 522 | 543 | |
| 523 | 544 | |
| 524 | 545 | |
| 525 | 546 | |
| ... | ... | @@ -537,32 +558,24 @@ | 
| 537 | 558 | |
| 538 | 559 | |
| 539 | 560 | //母亲是否高危 | 
| 540 | - if (!StringUtils.isEmpty(model.getMcertNo())) | |
| 541 | - { | |
| 561 | + if (!StringUtils.isEmpty(model.getMcertNo())) { | |
| 542 | 562 | |
| 543 | 563 | PatientsQuery patientsQuery = new PatientsQuery(); | 
| 544 | 564 | patientsQuery.setCardNo(model.getMcertNo()); | 
| 545 | 565 | patientsQuery.setYn(YnEnums.YES.getId()); | 
| 546 | 566 | |
| 547 | 567 | List<Patients> list = patientsService.queryPatient(patientsQuery); | 
| 548 | - if (CollectionUtils.isNotEmpty(list)) | |
| 549 | - { | |
| 550 | - HighScoreResult res = antenatalExaminationFacade.getPatLastRiskByDate(list.get(0).getPid(), false,list.get(0).getLastMenses() ,model.getBirth()); | |
| 551 | - List<String> listHighRisk = res.getHighRisk(); | |
| 568 | + if (CollectionUtils.isNotEmpty(list)) { | |
| 569 | + HighScoreResult res = antenatalExaminationFacade.getPatLastRiskByDate(list.get(0).getPid(), false, list.get(0).getLastMenses(), model.getBirth()); | |
| 570 | + List<String> listHighRisk = res.getHighRisk(); | |
| 552 | 571 | |
| 553 | - if (CollectionUtils.isNotEmpty(listHighRisk)) | |
| 554 | - { | |
| 555 | - if (listHighRisk.contains("健康")) | |
| 556 | - { | |
| 572 | + if (CollectionUtils.isNotEmpty(listHighRisk)) { | |
| 573 | + if (listHighRisk.contains("健康")) { | |
| 557 | 574 | base.setHighRisk("健康"); | 
| 558 | - } | |
| 559 | - else | |
| 560 | - { | |
| 575 | + } else { | |
| 561 | 576 | base.setHighRisk("高危"); | 
| 562 | 577 | } | 
| 563 | - } | |
| 564 | - else | |
| 565 | - { | |
| 578 | + } else { | |
| 566 | 579 | base.setHighRisk("健康"); | 
| 567 | 580 | } | 
| 568 | 581 | } | 
| 569 | 582 | |
| 570 | 583 | |
| 571 | 584 | |
| 572 | 585 | |
| 573 | 586 | |
| ... | ... | @@ -580,33 +593,27 @@ | 
| 580 | 593 | |
| 581 | 594 | /** | 
| 582 | 595 | * 获取儿童最后一次是否高危 | 
| 596 | + * | |
| 583 | 597 | * @param pid | 
| 584 | 598 | * @return | 
| 585 | 599 | */ | 
| 586 | - public Integer getBabyLastHighRisk(String pid) | |
| 587 | - { | |
| 600 | + public Integer getBabyLastHighRisk(String pid) { | |
| 588 | 601 | Integer highRisk = null; | 
| 589 | 602 | List<String> ids = new ArrayList<>(); | 
| 590 | 603 | BabyModelQuery babyQuery = new BabyModelQuery(); | 
| 591 | 604 | babyQuery.setPid(pid); | 
| 592 | 605 | babyQuery.setYn(YnEnums.YES.getId()); | 
| 593 | 606 | //查询儿童的基本信息 | 
| 594 | - List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery,"created", Sort.Direction.DESC); | |
| 595 | - if (CollectionUtils.isNotEmpty(models)) | |
| 596 | - { | |
| 597 | - for(BabyModel model : models) | |
| 598 | - { | |
| 607 | + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery, "created", Sort.Direction.DESC); | |
| 608 | + if (CollectionUtils.isNotEmpty(models)) { | |
| 609 | + for (BabyModel model : models) { | |
| 599 | 610 | ids.add(model.getId()); | 
| 600 | 611 | } | 
| 601 | - if (CollectionUtils.isNotEmpty(ids)) | |
| 602 | - { | |
| 612 | + if (CollectionUtils.isNotEmpty(ids)) { | |
| 603 | 613 | List<BabyCheckModel> checkModels = babyCheckService.queryLastCheck(ids); | 
| 604 | - if (CollectionUtils.isNotEmpty(checkModels) && checkModels.get(0) != null) | |
| 605 | - { | |
| 614 | + if (CollectionUtils.isNotEmpty(checkModels) && checkModels.get(0) != null) { | |
| 606 | 615 | highRisk = checkModels.get(0).getHighRisk(); | 
| 607 | - } | |
| 608 | - else | |
| 609 | - { | |
| 616 | + } else { | |
| 610 | 617 | highRisk = models.get(0).getHighRisk(); | 
| 611 | 618 | } | 
| 612 | 619 | } | 
| 613 | 620 | |
| ... | ... | @@ -649,12 +656,12 @@ | 
| 649 | 656 | |
| 650 | 657 | /** | 
| 651 | 658 | * 获取儿童最后一次检查诊断因素 所有医院 | 
| 659 | + * | |
| 652 | 660 | * @param pid person表的id | 
| 653 | 661 | * @return | 
| 654 | 662 | */ | 
| 655 | - public List getBabyLastDiagnose(String pid) | |
| 656 | - { | |
| 657 | - //诊断 | |
| 663 | + public List getBabyLastDiagnose(String pid) { | |
| 664 | + //诊断 | |
| 658 | 665 | List list = null; | 
| 659 | 666 | String diagnose = null; | 
| 660 | 667 | List<String> ids = new ArrayList<>(); | 
| 661 | 668 | |
| 662 | 669 | |
| 663 | 670 | |
| 664 | 671 | |
| ... | ... | @@ -663,30 +670,23 @@ | 
| 663 | 670 | babyQuery.setYn(YnEnums.YES.getId()); | 
| 664 | 671 | //查询儿童的基本信息 | 
| 665 | 672 | List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | 
| 666 | - if (CollectionUtils.isNotEmpty(models)) | |
| 667 | - { | |
| 668 | - for(BabyModel model : models) | |
| 669 | - { | |
| 673 | + if (CollectionUtils.isNotEmpty(models)) { | |
| 674 | + for (BabyModel model : models) { | |
| 670 | 675 | ids.add(model.getId()); | 
| 671 | 676 | } | 
| 672 | - if (CollectionUtils.isNotEmpty(ids)) | |
| 673 | - { | |
| 677 | + if (CollectionUtils.isNotEmpty(ids)) { | |
| 674 | 678 | List<BabyCheckModel> checkModels = babyCheckService.queryLastDiagnoseCheck(ids); | 
| 675 | - if (CollectionUtils.isNotEmpty(checkModels) && checkModels.get(0) != null) | |
| 676 | - { | |
| 679 | + if (CollectionUtils.isNotEmpty(checkModels) && checkModels.get(0) != null) { | |
| 677 | 680 | diagnose = checkModels.get(0).getDiagnose(); | 
| 678 | - } | |
| 679 | - else | |
| 680 | - { | |
| 681 | + } else { | |
| 681 | 682 | diagnose = models.get(0).getDiagnose(); | 
| 682 | 683 | } | 
| 683 | 684 | } | 
| 684 | 685 | |
| 685 | 686 | } | 
| 686 | 687 | |
| 687 | - if (StringUtils.isNotEmpty(diagnose)) | |
| 688 | - { | |
| 689 | - list = JsonUtil.toList(diagnose, List.class); | |
| 688 | + if (StringUtils.isNotEmpty(diagnose)) { | |
| 689 | + list = JsonUtil.toList(diagnose, List.class); | |
| 690 | 690 | } | 
| 691 | 691 | return list; | 
| 692 | 692 | } | 
| ... | ... | @@ -699,7 +699,7 @@ | 
| 699 | 699 | * @param cardNo | 
| 700 | 700 | * @return | 
| 701 | 701 | */ | 
| 702 | - public BaseObjectResponse queryChooseBabys(String vcCardNo, String cardNo,Integer userId) { | |
| 702 | + public BaseObjectResponse queryChooseBabys(String vcCardNo, String cardNo, Integer userId) { | |
| 703 | 703 | |
| 704 | 704 | |
| 705 | 705 | Map map = new HashMap(); | 
| 706 | 706 | |
| ... | ... | @@ -707,11 +707,10 @@ | 
| 707 | 707 | String hospitalId = ""; | 
| 708 | 708 | |
| 709 | 709 | //得到当前登录的医院id | 
| 710 | - if (userId != null) | |
| 711 | - { | |
| 710 | + if (userId != null) { | |
| 712 | 711 | Users dbuser = usersService.getUsers(userId); | 
| 713 | 712 | if (dbuser != null) { | 
| 714 | - hospitalId = String.valueOf(dbuser.getOrgId()); | |
| 713 | + hospitalId = String.valueOf(dbuser.getOrgId()); | |
| 715 | 714 | } | 
| 716 | 715 | } | 
| 717 | 716 | |
| ... | ... | @@ -728,8 +727,7 @@ | 
| 728 | 727 | |
| 729 | 728 | List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | 
| 730 | 729 | for (BabyModel model : models) { | 
| 731 | - if (model != null && model.getHospitalId() != null && model.getHospitalId().equals(hospitalId)) | |
| 732 | - { | |
| 730 | + if (model != null && model.getHospitalId() != null && model.getHospitalId().equals(hospitalId)) { | |
| 733 | 731 | isBuild = true; | 
| 734 | 732 | } | 
| 735 | 733 | BabyChooseResult result = new BabyChooseResult(); | 
| ... | ... | @@ -809,7 +807,7 @@ | 
| 809 | 807 | model.setWeight(checkModel.getWeight()); | 
| 810 | 808 | model.setHead(checkModel.getHead()); | 
| 811 | 809 | model.setHeightWeight(checkModel.getHeightWeight()); | 
| 812 | - model.setGrowthEvaluate(JsonUtil.toList(checkModel.getGrowthEvaluate(),String.class)); | |
| 810 | + model.setGrowthEvaluate(JsonUtil.toList(checkModel.getGrowthEvaluate(), String.class)); | |
| 813 | 811 | |
| 814 | 812 | |
| 815 | 813 | model.setBilirubinHead(checkModel.getBilirubinHead()); | 
| 816 | 814 | |
| 817 | 815 | |
| ... | ... | @@ -847,23 +845,19 @@ | 
| 847 | 845 | model.setOtherUrine(checkModel.getOtherUrine()); | 
| 848 | 846 | List<Map<String, String>> list = new ArrayList<>(); | 
| 849 | 847 | String diagnoseStr = checkModel.getDiagnose(); | 
| 850 | - if (!StringUtils.isEmpty(diagnoseStr)) | |
| 851 | - { | |
| 852 | - List diagnoses = JsonUtil.toList(diagnoseStr,List.class); | |
| 853 | - for (Object obj : diagnoses) | |
| 854 | - { | |
| 855 | - if (obj != null) | |
| 856 | - { | |
| 848 | + if (!StringUtils.isEmpty(diagnoseStr)) { | |
| 849 | + List diagnoses = JsonUtil.toList(diagnoseStr, List.class); | |
| 850 | + for (Object obj : diagnoses) { | |
| 851 | + if (obj != null) { | |
| 857 | 852 | BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); | 
| 858 | 853 | basicConfigQuery.setYn(YnEnums.YES.getId()); | 
| 859 | 854 | basicConfigQuery.setParentId(SystemConfig.DIAGNOSE_TYPE_ID); | 
| 860 | 855 | basicConfigQuery.setId(String.valueOf(obj)); | 
| 861 | 856 | List<BasicConfig> datas = basicConfigService.queryBasicConfig(basicConfigQuery); | 
| 862 | - if (CollectionUtils.isNotEmpty(datas)) | |
| 863 | - { | |
| 864 | - Map<String,String> map = new HashMap<>(); | |
| 857 | + if (CollectionUtils.isNotEmpty(datas)) { | |
| 858 | + Map<String, String> map = new HashMap<>(); | |
| 865 | 859 | map.put("id", datas.get(0).getId()); | 
| 866 | - map.put("name",datas.get(0).getName()); | |
| 860 | + map.put("name", datas.get(0).getName()); | |
| 867 | 861 | list.add(map); | 
| 868 | 862 | } | 
| 869 | 863 | } | 
| 870 | 864 | |
| ... | ... | @@ -874,14 +868,12 @@ | 
| 874 | 868 | model.setHandlSuggest(checkModel.getHandlSuggest()); | 
| 875 | 869 | model.setGuideSuggest(checkModel.getGuideSuggest()); | 
| 876 | 870 | |
| 877 | - if (StringUtils.isNotEmpty(checkModel.getCheckDoctor())) | |
| 878 | - { | |
| 871 | + if (StringUtils.isNotEmpty(checkModel.getCheckDoctor())) { | |
| 879 | 872 | Users users = usersService.getUsers(Integer.parseInt(checkModel.getCheckDoctor())); | 
| 880 | - if (users != null) | |
| 881 | - { | |
| 882 | - Map<String,String> doctorObj = new HashMap<>(); | |
| 883 | - doctorObj.put("id",checkModel.getCheckDoctor()); | |
| 884 | - doctorObj.put("name",users.getName()); | |
| 873 | + if (users != null) { | |
| 874 | + Map<String, String> doctorObj = new HashMap<>(); | |
| 875 | + doctorObj.put("id", checkModel.getCheckDoctor()); | |
| 876 | + doctorObj.put("name", users.getName()); | |
| 885 | 877 | model.setCheckDoctor(doctorObj); | 
| 886 | 878 | } | 
| 887 | 879 | } | 
| ... | ... | @@ -896,8 +888,7 @@ | 
| 896 | 888 | |
| 897 | 889 | List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | 
| 898 | 890 | |
| 899 | - if (CollectionUtils.isNotEmpty(models)) | |
| 900 | - { | |
| 891 | + if (CollectionUtils.isNotEmpty(models)) { | |
| 901 | 892 | model.setMonthAge(DateUtil.getBabyMonthAge(models.get(0).getBirth(), checkModel.getCheckDate())); | 
| 902 | 893 | } | 
| 903 | 894 | |
| 904 | 895 | |
| 905 | 896 | |
| ... | ... | @@ -914,14 +905,15 @@ | 
| 914 | 905 | |
| 915 | 906 | /** | 
| 916 | 907 | * 根据身长和性别来查询身长别体重值 | 
| 908 | + * | |
| 917 | 909 | * @param height | 
| 918 | 910 | * @param sex | 
| 919 | 911 | * @return | 
| 920 | 912 | */ | 
| 921 | - public BaseObjectResponse queryHWByHeight(Double height,Double weight, Integer sex,String birth) { | |
| 913 | + public BaseObjectResponse queryHWByHeight(Double height, Double weight, Integer sex, String birth) { | |
| 922 | 914 | |
| 923 | 915 | |
| 924 | - String res = getBabyHW(height,weight,sex,birth); | |
| 916 | + String res = getBabyHW(height, weight, sex, birth); | |
| 925 | 917 | BaseObjectResponse br = new BaseObjectResponse(); | 
| 926 | 918 | br.setData(res); | 
| 927 | 919 | br.setErrorcode(ErrorCodeConstants.SUCCESS); | 
| 928 | 920 | |
| 929 | 921 | |
| 930 | 922 | |
| 931 | 923 | |
| 932 | 924 | |
| 933 | 925 | |
| 934 | 926 | |
| 935 | 927 | |
| 936 | 928 | |
| ... | ... | @@ -930,51 +922,36 @@ | 
| 930 | 922 | } | 
| 931 | 923 | |
| 932 | 924 | |
| 933 | - public String getBabyHW(Double height,Double weight, Integer sex,String birth) | |
| 934 | - { | |
| 925 | + public String getBabyHW(Double height, Double weight, Integer sex, String birth) { | |
| 935 | 926 | Double hw = getHw(height); | 
| 936 | 927 | |
| 937 | 928 | //计算儿童的月龄 | 
| 938 | 929 | int monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), new Date()); | 
| 939 | 930 | int ageType = 0; | 
| 940 | - if (monthAge > 24) | |
| 941 | - { | |
| 931 | + if (monthAge > 24) { | |
| 942 | 932 | ageType = 1; | 
| 943 | 933 | } | 
| 944 | 934 | |
| 945 | 935 | //查询该月龄的年龄别体重值 | 
| 946 | - List<AwModel> list = babyCheckService.queryBabyHealthConfig(ageType,sex,3,hw); | |
| 936 | + List<AwModel> list = babyCheckService.queryBabyHealthConfig(ageType, sex, 3, hw); | |
| 947 | 937 | |
| 948 | 938 | String res = ""; | 
| 949 | 939 | if (CollectionUtils.isNotEmpty(list)) { | 
| 950 | 940 | AwModel model = list.get(0); | 
| 951 | 941 | |
| 952 | - if (model.getPthreeDs() < weight) | |
| 953 | - { | |
| 942 | + if (model.getPthreeDs() < weight) { | |
| 954 | 943 | res = "上"; | 
| 955 | - } | |
| 956 | - else if (model.getPthreeDs() >=weight && weight > model.getPtwoDs()) | |
| 957 | - { | |
| 944 | + } else if (model.getPthreeDs() >= weight && weight > model.getPtwoDs()) { | |
| 958 | 945 | res = "中上"; | 
| 959 | - } | |
| 960 | - else if (model.getPtwoDs() >=weight && weight > model.getPoneDs()) | |
| 961 | - { | |
| 946 | + } else if (model.getPtwoDs() >= weight && weight > model.getPoneDs()) { | |
| 962 | 947 | res = "中+"; | 
| 963 | - } | |
| 964 | - else if (model.getPoneDs() >=weight && weight >= model.getRoneDs()) | |
| 965 | - { | |
| 948 | + } else if (model.getPoneDs() >= weight && weight >= model.getRoneDs()) { | |
| 966 | 949 | res = "中"; | 
| 967 | - } | |
| 968 | - else if (model.getRoneDs() >weight && weight >= model.getRtwoDs()) | |
| 969 | - { | |
| 950 | + } else if (model.getRoneDs() > weight && weight >= model.getRtwoDs()) { | |
| 970 | 951 | res = "中-"; | 
| 971 | - } | |
| 972 | - else if (model.getRtwoDs() >weight && weight >= model.getRthreeDs()) | |
| 973 | - { | |
| 952 | + } else if (model.getRtwoDs() > weight && weight >= model.getRthreeDs()) { | |
| 974 | 953 | res = "中下"; | 
| 975 | - } | |
| 976 | - else if (model.getRtwoDs() >weight) | |
| 977 | - { | |
| 954 | + } else if (model.getRtwoDs() > weight) { | |
| 978 | 955 | res = "下"; | 
| 979 | 956 | } | 
| 980 | 957 | } | 
| 981 | 958 | |
| 982 | 959 | |
| 983 | 960 | |
| ... | ... | @@ -985,19 +962,16 @@ | 
| 985 | 962 | * 计算出要查询的身长 | 
| 986 | 963 | * 如传入的是 49.3 则返回 49.0 如传入的是 49.5 则返回 49.5 | 
| 987 | 964 | * 如传入的是 49.6 则返回 49.5 | 
| 965 | + * | |
| 988 | 966 | * @param hd | 
| 989 | 967 | * @return | 
| 990 | 968 | */ | 
| 991 | - private Double getHw(Double hd) | |
| 992 | - { | |
| 969 | + private Double getHw(Double hd) { | |
| 993 | 970 | Double d = Math.floor(hd); | 
| 994 | 971 | Double md = d + 0.5; | 
| 995 | - if (md > hd) | |
| 996 | - { | |
| 972 | + if (md > hd) { | |
| 997 | 973 | return d; | 
| 998 | - } | |
| 999 | - else | |
| 1000 | - { | |
| 974 | + } else { | |
| 1001 | 975 | return md; | 
| 1002 | 976 | } | 
| 1003 | 977 | } | 
| 1004 | 978 | |
| 1005 | 979 | |
| 1006 | 980 | |
| ... | ... | @@ -1005,28 +979,28 @@ | 
| 1005 | 979 | |
| 1006 | 980 | /** | 
| 1007 | 981 | * 计算体格发育评价 | 
| 1008 | - * | |
| 982 | + * <p/> | |
| 1009 | 983 | * 计算规则如下 | 
| 1010 | - * | |
| 984 | + * <p/> | |
| 1011 | 985 | * 1.低体重 | 
| 1012 | - * 低于参考人群的年龄别体重的M -2s | |
| 1013 | - *2.超重与肥胖 | |
| 1014 | - * 中位数百分比 = 体重值/身高别体重中的体重中值 * 100% | |
| 1015 | - * 中位数百分比 < 80%以下评价为中重度消瘦 | |
| 1016 | - * 中位数百分比 >= 80% && <90%评价为轻度消瘦 | |
| 1017 | - * 中位数百分比 >110% && <=120%评价为超重 | |
| 1018 | - * 中位数百分比 > 120%以上评价为肥胖 | |
| 1019 | - *3.生长迟缓 | |
| 1020 | - * 身高别体重》M-2s && 年龄别身高小于M-2s | |
| 1021 | - *4.慢性严重营养不良 | |
| 1022 | - * 身高别体重小于M-2s && 年龄别身高小于M-2s。 | |
| 986 | + * 低于参考人群的年龄别体重的M -2s | |
| 987 | + * 2.超重与肥胖 | |
| 988 | + * 中位数百分比 = 体重值/身高别体重中的体重中值 * 100% | |
| 989 | + * 中位数百分比 < 80%以下评价为中重度消瘦 | |
| 990 | + * 中位数百分比 >= 80% && <90%评价为轻度消瘦 | |
| 991 | + * 中位数百分比 >110% && <=120%评价为超重 | |
| 992 | + * 中位数百分比 > 120%以上评价为肥胖 | |
| 993 | + * 3.生长迟缓 | |
| 994 | + * 身高别体重》M-2s && 年龄别身高小于M-2s | |
| 995 | + * 4.慢性严重营养不良 | |
| 996 | + * 身高别体重小于M-2s && 年龄别身高小于M-2s。 | |
| 1023 | 997 | * | 
| 1024 | 998 | * @param height | 
| 1025 | 999 | * @param sex | 
| 1026 | 1000 | * @param birth | 
| 1027 | 1001 | * @return | 
| 1028 | 1002 | */ | 
| 1029 | - public BaseObjectResponse queryGrowthEvaluate(Double height, Integer sex, String birth,Double weight) { | |
| 1003 | + public BaseObjectResponse queryGrowthEvaluate(Double height, Integer sex, String birth, Double weight) { | |
| 1030 | 1004 | |
| 1031 | 1005 | List<String> list = getBabyGrowthEvaluate(height, sex, birth, weight); | 
| 1032 | 1006 | BaseObjectResponse br = new BaseObjectResponse(); | 
| 1033 | 1007 | |
| 1034 | 1008 | |
| 1035 | 1009 | |
| 1036 | 1010 | |
| 1037 | 1011 | |
| 1038 | 1012 | |
| 1039 | 1013 | |
| 1040 | 1014 | |
| 1041 | 1015 | |
| 1042 | 1016 | |
| 1043 | 1017 | |
| 1044 | 1018 | |
| ... | ... | @@ -1036,71 +1010,55 @@ | 
| 1036 | 1010 | return br; | 
| 1037 | 1011 | } | 
| 1038 | 1012 | |
| 1039 | - public List<String> getBabyGrowthEvaluate(Double height, Integer sex, String birth,Double weight) | |
| 1040 | - { | |
| 1013 | + public List<String> getBabyGrowthEvaluate(Double height, Integer sex, String birth, Double weight) { | |
| 1041 | 1014 | List<String> growthEvaluate = new ArrayList<>(); | 
| 1042 | 1015 | Double hw = getHw(height); | 
| 1043 | 1016 | |
| 1044 | 1017 | //计算儿童的月龄 | 
| 1045 | 1018 | int monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), new Date()); | 
| 1046 | 1019 | int ageType = 0; | 
| 1047 | - if (monthAge > 24) | |
| 1048 | - { | |
| 1020 | + if (monthAge > 24) { | |
| 1049 | 1021 | ageType = 1; | 
| 1050 | 1022 | } | 
| 1051 | 1023 | |
| 1052 | 1024 | //查询身高别体重 | 
| 1053 | 1025 | List<AwModel> list = babyCheckService.queryBabyHealthConfig(ageType, sex, 3, hw); | 
| 1054 | 1026 | |
| 1055 | - if(CollectionUtils.isNotEmpty(list)) | |
| 1056 | - { | |
| 1057 | - Double value = list.get(0).getMiddleDs(); | |
| 1027 | + if (CollectionUtils.isNotEmpty(list)) { | |
| 1028 | + Double value = list.get(0).getMiddleDs(); | |
| 1058 | 1029 | |
| 1059 | 1030 | //查询该月龄的年龄别体重值 | 
| 1060 | - List<AwModel> aws = babyCheckService.queryBabyHealthConfig(monthAge, sex,0); | |
| 1061 | - if (CollectionUtils.isNotEmpty(aws)) | |
| 1062 | - { | |
| 1031 | + List<AwModel> aws = babyCheckService.queryBabyHealthConfig(monthAge, sex, 0); | |
| 1032 | + if (CollectionUtils.isNotEmpty(aws)) { | |
| 1063 | 1033 | AwModel model = aws.get(0); | 
| 1064 | 1034 | |
| 1065 | 1035 | //低于参考人群的年龄别体重的M -2s | 
| 1066 | - if (model.getRtwoDs() > weight) | |
| 1067 | - { | |
| 1036 | + if (model.getRtwoDs() > weight) { | |
| 1068 | 1037 | growthEvaluate.add("低体重"); | 
| 1069 | 1038 | } | 
| 1070 | 1039 | } | 
| 1071 | 1040 | |
| 1072 | - List<AwModel> aws1 = babyCheckService.queryBabyHealthConfig(monthAge, sex,1); | |
| 1073 | - if (CollectionUtils.isNotEmpty(aws1)) | |
| 1074 | - { | |
| 1041 | + List<AwModel> aws1 = babyCheckService.queryBabyHealthConfig(monthAge, sex, 1); | |
| 1042 | + if (CollectionUtils.isNotEmpty(aws1)) { | |
| 1075 | 1043 | AwModel model = aws1.get(0); | 
| 1076 | - if (weight > list.get(0).getPtwoDs() && height < model.getRtwoDs()) | |
| 1077 | - { | |
| 1044 | + if (weight > list.get(0).getPtwoDs() && height < model.getRtwoDs()) { | |
| 1078 | 1045 | growthEvaluate.add("生长迟缓"); | 
| 1079 | 1046 | } | 
| 1080 | - if (weight < list.get(0).getPtwoDs() && height < model.getRtwoDs()) | |
| 1081 | - { | |
| 1047 | + if (weight < list.get(0).getPtwoDs() && height < model.getRtwoDs()) { | |
| 1082 | 1048 | growthEvaluate.add("慢性严重营养不良"); | 
| 1083 | 1049 | } | 
| 1084 | 1050 | } | 
| 1085 | 1051 | |
| 1086 | - if (value != null) | |
| 1087 | - { | |
| 1052 | + if (value != null) { | |
| 1088 | 1053 | //中位数百分比 | 
| 1089 | - Double mp = weight/value; | |
| 1090 | - if (mp < 0.8) | |
| 1091 | - { | |
| 1054 | + Double mp = weight / value; | |
| 1055 | + if (mp < 0.8) { | |
| 1092 | 1056 | growthEvaluate.add("重度消瘦"); | 
| 1093 | - } | |
| 1094 | - else if (0.8 <= mp && mp < 0.9) | |
| 1095 | - { | |
| 1057 | + } else if (0.8 <= mp && mp < 0.9) { | |
| 1096 | 1058 | growthEvaluate.add("轻度消瘦"); | 
| 1097 | - } | |
| 1098 | - else if (1.1 < mp && mp <= 1.2) | |
| 1099 | - { | |
| 1059 | + } else if (1.1 < mp && mp <= 1.2) { | |
| 1100 | 1060 | growthEvaluate.add("超重"); | 
| 1101 | - } | |
| 1102 | - else if ( mp > 1.2) | |
| 1103 | - { | |
| 1061 | + } else if (mp > 1.2) { | |
| 1104 | 1062 | growthEvaluate.add("肥胖"); | 
| 1105 | 1063 | } | 
| 1106 | 1064 | } | 
| 1107 | 1065 | |
| 1108 | 1066 | |
| ... | ... | @@ -1111,14 +1069,14 @@ | 
| 1111 | 1069 | |
| 1112 | 1070 | public BaseObjectResponse getBaseConfig() { | 
| 1113 | 1071 | |
| 1114 | - Map<String,Object> map = new HashMap(); | |
| 1072 | + Map<String, Object> map = new HashMap(); | |
| 1115 | 1073 | |
| 1116 | 1074 | //抚养方式 | 
| 1117 | - List fyType = FyTypeEnums.getFyTypeEnums(); | |
| 1075 | + List fyType = FyTypeEnums.getFyTypeEnums(); | |
| 1118 | 1076 | map.put("fyType", fyType); | 
| 1119 | 1077 | |
| 1120 | 1078 | //喂养方式 | 
| 1121 | - List wyType = WyTypeEnums.getWyTypeEnums(); | |
| 1079 | + List wyType = WyTypeEnums.getWyTypeEnums(); | |
| 1122 | 1080 | map.put("wyType", wyType); | 
| 1123 | 1081 | |
| 1124 | 1082 | map.put("initCheckDate", DateUtil.getyyyy_MM_dd(new Date())); | 
| 1125 | 1083 | |
| ... | ... | @@ -1135,11 +1093,10 @@ | 
| 1135 | 1093 | public BaseObjectResponse getBabyMonthAge(String birth, String checkDate) { | 
| 1136 | 1094 | Date birthDate = DateUtil.parseYMD(birth); | 
| 1137 | 1095 | Date date = new Date(); | 
| 1138 | - if (StringUtils.isNotEmpty(checkDate)) | |
| 1139 | - { | |
| 1096 | + if (StringUtils.isNotEmpty(checkDate)) { | |
| 1140 | 1097 | date = DateUtil.parseYMD(checkDate); | 
| 1141 | 1098 | } | 
| 1142 | - String ageStr = DateUtil.getBabyMonthAge(birthDate,date); | |
| 1099 | + String ageStr = DateUtil.getBabyMonthAge(birthDate, date); | |
| 1143 | 1100 | BaseObjectResponse objectResponse = new BaseObjectResponse(); | 
| 1144 | 1101 | objectResponse.setData(ageStr); | 
| 1145 | 1102 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | 
| 1146 | 1103 | |
| 1147 | 1104 | |
| 1148 | 1105 | |
| 1149 | 1106 | |
| 1150 | 1107 | |
| 1151 | 1108 | |
| 1152 | 1109 | |
| 1153 | 1110 | |
| 1154 | 1111 | |
| 1155 | 1112 | |
| ... | ... | @@ -1148,54 +1105,40 @@ | 
| 1148 | 1105 | return objectResponse; | 
| 1149 | 1106 | } | 
| 1150 | 1107 | |
| 1151 | - public BaseObjectResponse queryBabyHealthStatus(String birth,Double value, Integer sex, Integer type) { | |
| 1152 | - String res = getGrowthValue(birth,value,sex,type); | |
| 1108 | + public BaseObjectResponse queryBabyHealthStatus(String birth, Double value, Integer sex, Integer type) { | |
| 1109 | + String res = getGrowthValue(birth, value, sex, type); | |
| 1153 | 1110 | BaseObjectResponse objectResponse = new BaseObjectResponse(); | 
| 1154 | 1111 | objectResponse.setData(res); | 
| 1155 | 1112 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | 
| 1156 | 1113 | objectResponse.setErrormsg("成功"); | 
| 1157 | - return objectResponse; | |
| 1114 | + return objectResponse; | |
| 1158 | 1115 | } | 
| 1159 | 1116 | |
| 1160 | 1117 | |
| 1161 | - public String getGrowthValue(String birth,Double value, Integer sex, Integer type) | |
| 1162 | - { | |
| 1118 | + public String getGrowthValue(String birth, Double value, Integer sex, Integer type) { | |
| 1163 | 1119 | //计算儿童的月龄 | 
| 1164 | 1120 | int monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), new Date()); | 
| 1165 | 1121 | |
| 1166 | 1122 | |
| 1167 | 1123 | //查询该月龄的年龄别体重值 | 
| 1168 | - List<AwModel> list = babyCheckService.queryBabyHealthConfig(monthAge, sex,type); | |
| 1124 | + List<AwModel> list = babyCheckService.queryBabyHealthConfig(monthAge, sex, type); | |
| 1169 | 1125 | String res = ""; | 
| 1170 | 1126 | if (CollectionUtils.isNotEmpty(list)) { | 
| 1171 | 1127 | AwModel model = list.get(0); | 
| 1172 | 1128 | |
| 1173 | - if (model.getPthreeDs() < value) | |
| 1174 | - { | |
| 1129 | + if (model.getPthreeDs() < value) { | |
| 1175 | 1130 | res = "上"; | 
| 1176 | - } | |
| 1177 | - else if (model.getPthreeDs() >=value && value > model.getPtwoDs()) | |
| 1178 | - { | |
| 1131 | + } else if (model.getPthreeDs() >= value && value > model.getPtwoDs()) { | |
| 1179 | 1132 | res = "中上"; | 
| 1180 | - } | |
| 1181 | - else if (model.getPtwoDs() >=value && value > model.getPoneDs()) | |
| 1182 | - { | |
| 1133 | + } else if (model.getPtwoDs() >= value && value > model.getPoneDs()) { | |
| 1183 | 1134 | res = "中+"; | 
| 1184 | - } | |
| 1185 | - else if (model.getPoneDs() >=value && value >= model.getRoneDs()) | |
| 1186 | - { | |
| 1135 | + } else if (model.getPoneDs() >= value && value >= model.getRoneDs()) { | |
| 1187 | 1136 | res = "中"; | 
| 1188 | - } | |
| 1189 | - else if (model.getRoneDs() >value && value >= model.getRtwoDs()) | |
| 1190 | - { | |
| 1137 | + } else if (model.getRoneDs() > value && value >= model.getRtwoDs()) { | |
| 1191 | 1138 | res = "中-"; | 
| 1192 | - } | |
| 1193 | - else if (model.getRtwoDs() >value && value >= model.getRthreeDs()) | |
| 1194 | - { | |
| 1139 | + } else if (model.getRtwoDs() > value && value >= model.getRthreeDs()) { | |
| 1195 | 1140 | res = "中下"; | 
| 1196 | - } | |
| 1197 | - else if (model.getRtwoDs() >value) | |
| 1198 | - { | |
| 1141 | + } else if (model.getRtwoDs() > value) { | |
| 1199 | 1142 | res = "下"; | 
| 1200 | 1143 | } | 
| 1201 | 1144 | } | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyCheckRequest.java
View file @
db8041c
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyBuildResult.java
View file @
db8041c