diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java b/platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java index 1dc8daf..cde1567 100644 --- a/platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java @@ -37,6 +37,16 @@ public class PatientWeight extends BaseModel { private String dayWeigthsJson; + private String dayWeights2Json; + + public String getDayWeights2Json() { + return dayWeights2Json; + } + + public void setDayWeights2Json(String dayWeights2Json) { + this.dayWeights2Json = dayWeights2Json; + } + private String created2; public String getCreated2() { diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java index 4d6b9ed..a6feda3 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java @@ -16,6 +16,7 @@ import com.lyms.platform.operate.web.utils.MongoUtil; import com.lyms.platform.permission.dao.master.CouponMapper; import com.lyms.platform.pojo.PatientWeight; import com.lyms.platform.pojo.Patients; +import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; @@ -424,6 +425,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient m.put("nowWeight", nowWeight); dayWeights2.add(m); } + pw.setDayWeights2(dayWeights2); patientWeightService2.update(Query.query(Criteria.where("id").is(pw.getId())), pw); return RespBuilder.buildSuccess(pw); } @@ -454,6 +456,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } patientWeight.setYn("1"); patientWeight.setPid(patients.getPid()); + pw.setDayWeights2(dayWeights2); patientWeightService2.add(patientWeight); return RespBuilder.buildSuccess(patientWeight); } @@ -469,7 +472,23 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient map.put(entry.getKey() + "", entry.getValue() + ""); } patientWeight.setDayWeights(map); + + JSONArray dayWeights2 = JSONArray.fromObject(patientWeight.getDayWeights2Json()); + List> dayWeights2List = new ArrayList<>(); + Iterator iterator = dayWeights2.iterator(); + while (iterator.hasNext()) { + JSONObject jsonObject = JSONObject.fromObject(iterator.next().toString()); + Map temp = new HashMap<>(); + temp.put("hospitalId", jsonObject.getString("hospitalId")); + temp.put("hospitalName", jsonObject.getString("hospitalName")); + temp.put("date", jsonObject.getString("date")); + temp.put("nowWeight", jsonObject.getString("nowWeight")); + dayWeights2List.add(temp); + } + patientWeight.setDayWeigthsJson(null); + patientWeight.setDayWeights2Json(null); + patientWeight.setDayWeights2(dayWeights2); patientWeight.setCreated(new Date(Long.parseLong(patientWeight.getCreated2()))); patientWeight.setCreated2(null);