Commit dc87ee9909c0579dbf863491362dfed35ef41eaa
1 parent
1986d68fe4
Exists in
master
and in
6 other branches
体成分分析添加功能修改
Showing 1 changed file with 23 additions and 6 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/VolumeComponentAnalysisFacade.java
View file @
dc87ee9
... | ... | @@ -17,6 +17,7 @@ |
17 | 17 | import com.lyms.platform.pojo.Patients; |
18 | 18 | import com.lyms.platform.pojo.TemporaryUserModel; |
19 | 19 | import com.lyms.platform.pojo.VolumeComponentAnalysisModel; |
20 | +import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIConversion; | |
20 | 21 | import org.apache.poi.util.StringUtil; |
21 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
22 | 23 | import org.springframework.data.domain.Sort; |
23 | 24 | |
24 | 25 | |
... | ... | @@ -49,12 +50,11 @@ |
49 | 50 | |
50 | 51 | public BaseObjectResponse addComponentAnalysis(VolumeComponentAnalysisModel volume) { |
51 | 52 | //20200204 李泉渝 @涛涛 同一天多次测量就是修改 |
52 | - List<VolumeComponentAnalysisModel> vc = mongoTemplate.find(Query.query(Criteria.where("patientId").is(volume.getPatientId()) | |
53 | - .and("pid").is(volume.getPid()) | |
53 | + VolumeComponentAnalysisModel vc= mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(volume.getPatientId()) | |
54 | 54 | .and("certNo").is(volume.getCertNo()) |
55 | - .and("created").is(volume.getCreated()) | |
55 | + .and("created").gte(getStartTime()).lte(getEndTime()) | |
56 | 56 | ), VolumeComponentAnalysisModel.class); |
57 | - if(vc.isEmpty()){ | |
57 | + if(vc==null){ | |
58 | 58 | volume.setCreated(new Date()); |
59 | 59 | volume.setYn(YnEnums.YES.getId()); |
60 | 60 | mongoTemplate.insert(volume); |
61 | 61 | |
62 | 62 | |
... | ... | @@ -62,13 +62,30 @@ |
62 | 62 | volume.setCreated(new Date()); |
63 | 63 | volume.setYn(YnEnums.YES.getId()); |
64 | 64 | Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(volume)); |
65 | - mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(vc.get(0).getId())), update, VolumeComponentAnalysisModel.class); | |
65 | + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(vc.getId())), update, VolumeComponentAnalysisModel.class); | |
66 | 66 | } |
67 | - | |
68 | 67 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
69 | 68 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
70 | 69 | objectResponse.setErrormsg("成功"); |
71 | 70 | return objectResponse; |
71 | + } | |
72 | + | |
73 | + private static Date getStartTime() { | |
74 | + Calendar todayStart = Calendar.getInstance(); | |
75 | + todayStart.set(Calendar.HOUR_OF_DAY,0); | |
76 | + todayStart.set(Calendar.MINUTE,0); | |
77 | + todayStart.set(Calendar.SECOND,0); | |
78 | + todayStart.set(Calendar.MILLISECOND,0); | |
79 | + return todayStart.getTime(); | |
80 | + } | |
81 | + | |
82 | + private static Date getEndTime() { | |
83 | + Calendar todayEnd = Calendar.getInstance(); | |
84 | + todayEnd.set(Calendar.HOUR_OF_DAY,23); | |
85 | + todayEnd.set(Calendar.MINUTE,59); | |
86 | + todayEnd.set(Calendar.SECOND,59); | |
87 | + todayEnd.set(Calendar.MILLISECOND,999); | |
88 | + return todayEnd.getTime(); | |
72 | 89 | } |
73 | 90 | |
74 | 91 |