Commit bbb93af85f8e93be068c3f2e835fdfa4f3809c75
1 parent
8c06453650
Exists in
master
and in
1 other branch
改同步逻辑
Showing 2 changed files with 33 additions and 1 deletions
platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java
View file @
bbb93af
... | ... | @@ -17,6 +17,26 @@ |
17 | 17 | |
18 | 18 | private static final long serialVersionUID = SerialIdEnum.PatientWeight.getCid(); |
19 | 19 | |
20 | + private String dayWeigthsJson; | |
21 | + | |
22 | + private String created2; | |
23 | + | |
24 | + public String getCreated2() { | |
25 | + return created2; | |
26 | + } | |
27 | + | |
28 | + public void setCreated2(String created2) { | |
29 | + this.created2 = created2; | |
30 | + } | |
31 | + | |
32 | + public String getDayWeigthsJson() { | |
33 | + return dayWeigthsJson; | |
34 | + } | |
35 | + | |
36 | + public void setDayWeigthsJson(String dayWeigthsJson) { | |
37 | + this.dayWeigthsJson = dayWeigthsJson; | |
38 | + } | |
39 | + | |
20 | 40 | private String id; |
21 | 41 | |
22 | 42 | private String pid; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
bbb93af
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | import com.lyms.platform.operate.web.utils.MongoUtil; |
17 | 17 | import com.lyms.platform.pojo.PatientWeight; |
18 | 18 | import com.lyms.platform.pojo.Patients; |
19 | +import net.sf.json.JSONObject; | |
19 | 20 | import org.apache.commons.collections.MapUtils; |
20 | 21 | import org.apache.commons.lang.StringUtils; |
21 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -363,7 +364,18 @@ |
363 | 364 | |
364 | 365 | @Override |
365 | 366 | public BaseResponse wxAddOrUpdateSync(PatientWeight patientWeight) { |
366 | - mongoTemplate.save(patientWeight); | |
367 | + String dayWeigthsJson = patientWeight.getDayWeigthsJson(); | |
368 | + JSONObject dayWeights = JSONObject.fromObject(dayWeigthsJson); | |
369 | + Set<Map.Entry> set = dayWeights.entrySet(); | |
370 | + Map<String, String> map = new HashMap<>(); | |
371 | + for (Map.Entry entry : set) { | |
372 | + map.put(entry.getKey() + "", entry.getValue() + ""); | |
373 | + } | |
374 | + patientWeight.setDayWeights(map); | |
375 | + patientWeight.setDayWeigthsJson(null); | |
376 | + patientWeight.setCreated(new Date(Long.parseLong(patientWeight.getCreated2()))); | |
377 | + patientWeight.setCreated2(null); | |
378 | + mongoTemplate.save(patientWeight); | |
367 | 379 | return RespBuilder.buildSuccess(patientWeight.getId()); |
368 | 380 | } |
369 | 381 |