Commit ff0b0b2f479ab9b5c4d6a42e870f9f9feb53b568

Authored by dongqin
1 parent e1364c4269
Exists in master and in 1 other branch dev

修复bug

Showing 1 changed file with 22 additions and 3 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java View file @ ff0b0b2
... ... @@ -1266,10 +1266,29 @@
1266 1266 }
1267 1267 data.put("weekRange",weekRange);
1268 1268  
1269   - BloodSugar bloodSugar = mongoTemplate.findOne(Query.query(Criteria.where("id").is(lsbId)), BloodSugar.class);
  1269 + // 添加报告解读人
  1270 + List<BloodSugar> bloodSugars = mongoTemplate.find(Query.query(Criteria.where("pid").is(patientId).and("created").gt(DateUtil.getYMDTime())), BloodSugar.class);
  1271 + List<Date> dateList = new ArrayList<>();
  1272 + if (CollectionUtils.isNotEmpty(bloodSugars)){
  1273 + for (BloodSugar sugar: bloodSugars){
  1274 + Date created = sugar.getCreated();
  1275 + if (created != null){
  1276 + String dbCreated = DateUtil.getyyyy_MM_dd(created);
  1277 + String currentDate = DateUtil.getyyyy_MM_dd(new Date());
  1278 + if (dbCreated.equals(currentDate)){
  1279 + dateList.add(created);
  1280 + }
  1281 + }
  1282 + }
  1283 + }
1270 1284 String doctorId = "";
1271   - if (bloodSugar != null){
1272   - doctorId = bloodSugar.getDoctorId();
  1285 + if (CollectionUtils.isNotEmpty(dateList)){
  1286 + Date maxDate = Collections.max(dateList);
  1287 + List<BloodSugar> sugarList = mongoTemplate.find(Query.query(Criteria.where("pid").is(patientId).and("created").is(maxDate)), BloodSugar.class);
  1288 + if (CollectionUtils.isNotEmpty(sugarList)){
  1289 + BloodSugar bloodSugar = sugarList.get(0);
  1290 + doctorId = bloodSugar.getDoctorId();
  1291 + }
1273 1292 }
1274 1293 healthChargeFacade.addHealthCharge(hospitalId, 2, patientId, 1, 1, userId, doctorId, false);
1275 1294