Commit 3fa691599c23c141aecfff2df94bf9f6e59796e7
1 parent
4f228cf74c
Exists in
master
and in
8 other branches
code update
Showing 12 changed files with 169 additions and 37 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntenatalExaminationDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyBookbuildingDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PostReviewDaoImpl.java
- platform-common/pom.xml
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java
- platform-dal/src/main/java/com/lyms/platform/pojo/BabyCheckModel.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java
- platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
- platform-data-api/src/main/java/com/lyms/platform/data/util/AmsMessageService.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/facade/SmsTemplateFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntenatalExaminationDaoImpl.java
View file @
3fa6915
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | @Override |
64 | 64 | public List<AntenatalExaminationModel> queryYuyueAntenatalExamination(Date yuYueDate,String hospitalId) { |
65 | 65 | AggregationOperation match = Aggregation.match(Criteria.where("nextCheckTime").gte(yuYueDate).lte(yuYueDate).and("hospitalId").is(hospitalId)); |
66 | - AggregationOperation group = Aggregation.group("parentId").max("modified").as("modified"); | |
66 | + AggregationOperation group = Aggregation.group("parentId").max("created").as("created"); | |
67 | 67 | Aggregation aggregation = Aggregation.newAggregation(match, group); |
68 | 68 | AggregationResults<AntenatalExaminationModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_antex", AntenatalExaminationModel.class); |
69 | 69 | return result.getMappedResults(); |
... | ... | @@ -71,8 +71,8 @@ |
71 | 71 | @Override |
72 | 72 | public List<AntenatalExaminationModel> queryYuyueAntenatalExamination(Date startDate,String hospitalId,String pid) { |
73 | 73 | |
74 | - AggregationOperation match = Aggregation.match(Criteria.where("nextCheckTime").gte("startDate").and("parentId").is("pid").and("hospitalId").is(hospitalId)); | |
75 | - AggregationOperation group = Aggregation.group("parentId").max("modified").as("modified"); | |
74 | + AggregationOperation match = Aggregation.match(Criteria.where("nextCheckTime").gte("startDate").lte(startDate).and("parentId").is("pid").and("hospitalId").is(hospitalId)); | |
75 | + AggregationOperation group = Aggregation.group("parentId").max("created").as("created"); | |
76 | 76 | Aggregation aggregation = Aggregation.newAggregation(match, group); |
77 | 77 | AggregationResults<AntenatalExaminationModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_antex", AntenatalExaminationModel.class); |
78 | 78 | return result.getMappedResults(); |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyBookbuildingDaoImpl.java
View file @
3fa6915
... | ... | @@ -48,8 +48,8 @@ |
48 | 48 | |
49 | 49 | @Override |
50 | 50 | public List<BabyCheckModel> queryBabyYuYueRecord(Date yuYueDate, String hospitalId) { |
51 | - AggregationOperation match = Aggregation.match(Criteria.where("nextDate").gte(yuYueDate).and("hospitalId").is(hospitalId)); | |
52 | - AggregationOperation group = Aggregation.group("buildId").max("modified").as("modified"); | |
51 | + AggregationOperation match = Aggregation.match(Criteria.where("nextDate").gte(yuYueDate).lte(yuYueDate).and("hospitalId").is(hospitalId)); | |
52 | + AggregationOperation group = Aggregation.group("buildId").max("created").as("created"); | |
53 | 53 | Aggregation aggregation = Aggregation.newAggregation(match, group); |
54 | 54 | AggregationResults<BabyCheckModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_babycheck", BabyCheckModel.class); |
55 | 55 | return result.getMappedResults(); |
... | ... | @@ -57,8 +57,8 @@ |
57 | 57 | |
58 | 58 | @Override |
59 | 59 | public List<BabyCheckModel> queryBabyOrder(Date startDate, String hospitalId, String buildId) { |
60 | - AggregationOperation match = Aggregation.match(Criteria.where("nextDate").gte(startDate).and("hospitalId").is(hospitalId).and("buildId").is(buildId)); | |
61 | - AggregationOperation group = Aggregation.group("buildId").max("modified").as("modified"); | |
60 | + AggregationOperation match = Aggregation.match(Criteria.where("nextDate").gte(startDate).lte(startDate).and("buildId").is(buildId)); | |
61 | + AggregationOperation group = Aggregation.group("buildId").max("created").as("created"); | |
62 | 62 | Aggregation aggregation = Aggregation.newAggregation(match, group); |
63 | 63 | AggregationResults<BabyCheckModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_babycheck", BabyCheckModel.class); |
64 | 64 | return result.getMappedResults(); |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PostReviewDaoImpl.java
View file @
3fa6915
... | ... | @@ -78,16 +78,16 @@ |
78 | 78 | |
79 | 79 | @Override |
80 | 80 | public List<PostReviewModel> queryPostOrder(Date orderDate, String hospitalId) { |
81 | - AggregationOperation match = Aggregation.match(Criteria.where("nextCheckDate").gte(orderDate).and("nextCheckDate").lte(orderDate).and("hospitalId").is(hospitalId)); | |
82 | - AggregationOperation group = Aggregation.group("parentId").max("modified").as("modified"); | |
81 | + AggregationOperation match = Aggregation.match(Criteria.where("nextCheckDate").gte(orderDate).lte(orderDate).and("hospitalId").is(hospitalId)); | |
82 | + AggregationOperation group = Aggregation.group("parentId").max("created").as("created"); | |
83 | 83 | Aggregation aggregation = Aggregation.newAggregation(match, group); |
84 | 84 | AggregationResults<PostReviewModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_postreview", PostReviewModel.class); |
85 | 85 | return result.getMappedResults(); |
86 | 86 | } |
87 | 87 | @Override |
88 | - public List<PostReviewModel> queryPostOrder(Date orderDate, String hospitalId,String pid) { | |
89 | - AggregationOperation match = Aggregation.match(Criteria.where("nextCheckDate").gte(orderDate).and("nextCheckDate").lte(orderDate).and("hospitalId").is(hospitalId).and("parentId")); | |
90 | - AggregationOperation group = Aggregation.group("parentId").max("modified").as("modified"); | |
88 | + public List<PostReviewModel> queryPostOrder(Date orderDate, String hospitalId,String parentId) { | |
89 | + AggregationOperation match = Aggregation.match(Criteria.where("nextCheckDate").gte(orderDate).lte(orderDate).and("hospitalId").is(hospitalId).and("parentId").is(parentId)); | |
90 | + AggregationOperation group = Aggregation.group("parentId").max("created").as("created"); | |
91 | 91 | Aggregation aggregation = Aggregation.newAggregation(match, group); |
92 | 92 | AggregationResults<PostReviewModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_postreview", PostReviewModel.class); |
93 | 93 | return result.getMappedResults(); |
platform-common/pom.xml
View file @
3fa6915
... | ... | @@ -19,6 +19,13 @@ |
19 | 19 | <artifactId>pinyin4j</artifactId> |
20 | 20 | <version>2.5.0</version> |
21 | 21 | </dependency> |
22 | + <!-- Execl --> | |
23 | + <dependency> | |
24 | + <groupId>net.sourceforge.jexcelapi</groupId> | |
25 | + <artifactId>jxl</artifactId> | |
26 | + <version>2.6.12</version> | |
27 | + </dependency> | |
28 | + <!-- end Execl --> | |
22 | 29 | </dependencies> |
23 | 30 | <build> |
24 | 31 | <plugins> |
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
3fa6915
... | ... | @@ -714,8 +714,8 @@ |
714 | 714 | |
715 | 715 | // Date lastLmess = parseYMD("2016-07-02"); |
716 | 716 | // Date startDate = DateUtil.getRangeDate(lastLmess, 1, "周", -2); |
717 | - Date startDate = DateUtil.addDay(new Date(), -100); | |
718 | - System.out.println(getyyyy_MM_dd(startDate)); | |
717 | +// Date startDate = DateUtil.addDay(new Date(), -100); | |
718 | +// System.out.println(getyyyy_MM_dd(startDate)); | |
719 | 719 | try { |
720 | 720 | |
721 | 721 | // Date startDate = DateUtil.addMonth(new Date(), -1); |
722 | 722 | |
... | ... | @@ -738,10 +738,14 @@ |
738 | 738 | // String st = md.format(new Date()); |
739 | 739 | // System.out.print(st); |
740 | 740 | |
741 | - int s = getBabyMonthAge1(parseYMD("2016-09-07"), new Date()); | |
742 | - System.out.println(s); | |
741 | +// int s = getBabyMonthAge1(parseYMD("2016-09-07"), new Date()); | |
742 | +// System.out.println(s); | |
743 | 743 | // Date s = addDay(parseYMD("2016-02-26"), 168); |
744 | -// System.out.println(getyyyy_MM_dd(s)); | |
744 | + | |
745 | + Date startDate = DateUtil.getNewDate(-0,"天",0); | |
746 | + Date endDate = DateUtil.getNewDate(-5,"天",0); | |
747 | + | |
748 | + System.out.println(startDate + "==="+ endDate); | |
745 | 749 | } catch (Exception e) |
746 | 750 | { |
747 | 751 |
platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java
View file @
3fa6915
1 | +package com.lyms.platform.common.utils; | |
2 | + | |
3 | +import java.io.File; | |
4 | +import java.io.FileOutputStream; | |
5 | +import java.io.IOException; | |
6 | +import java.io.OutputStream; | |
7 | +import java.util.Iterator; | |
8 | +import java.util.List; | |
9 | +import java.util.Map; | |
10 | + | |
11 | + | |
12 | +import jxl.SheetSettings; | |
13 | +import jxl.Workbook; | |
14 | +import jxl.format.Colour; | |
15 | +import jxl.format.UnderlineStyle; | |
16 | +import jxl.write.Label; | |
17 | +import jxl.write.WritableCellFormat; | |
18 | +import jxl.write.WritableFont; | |
19 | +import jxl.write.WritableSheet; | |
20 | +import jxl.write.WritableWorkbook; | |
21 | +import jxl.write.WriteException; | |
22 | +import jxl.write.biff.RowsExceededException; | |
23 | + | |
24 | +/** | |
25 | + * Excel 工具类 | |
26 | + * | |
27 | + * @author lqy | |
28 | + * | |
29 | + */ | |
30 | +public class ExcelUtil | |
31 | +{ | |
32 | + | |
33 | + static File from_file; | |
34 | + | |
35 | + static WritableWorkbook to_wwb; // 创建可写入workbook对象 | |
36 | + | |
37 | + public static OutputStream toExcel(OutputStream out, List<Map<String, Object>> data, Map<String, String> columName) | |
38 | + { | |
39 | + WritableWorkbook wwb; | |
40 | + try | |
41 | + { | |
42 | + wwb = Workbook.createWorkbook(out); | |
43 | + WritableSheet ws = wwb.createSheet("sheet", 0); // 创建一个工作表 | |
44 | + /** | |
45 | + * 设置单元格样式 | |
46 | + */ | |
47 | + WritableFont wf = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); | |
48 | + WritableCellFormat wcf = new WritableCellFormat(wf); | |
49 | + ws.setRowView(0, 300); // 设置指定行高 | |
50 | + // 设置列宽 | |
51 | + for (int j = 0, columLen = columName.size(); j < columLen; j++) | |
52 | + { | |
53 | + ws.setColumnView(j, 15); | |
54 | + } | |
55 | + // 填充数据的内容 | |
56 | + Map<String, Object> map; | |
57 | + for (int i = 0, len = data.size(); i < len; i++) | |
58 | + { | |
59 | + map = data.get(i); | |
60 | + Iterator<String> ite = columName.keySet().iterator(); | |
61 | + int j = 0; | |
62 | + String keyORvalue = ""; | |
63 | + String keyName = ""; | |
64 | + while (ite.hasNext()) | |
65 | + { | |
66 | + keyName = ite.next(); | |
67 | + if (i > 0) | |
68 | + { // 类容数据 | |
69 | + keyORvalue = map.get(keyName).toString(); | |
70 | + } | |
71 | + else | |
72 | + { // 第一行列名 | |
73 | + keyORvalue = map.get(keyName).toString(); | |
74 | + keyName = columName.get(keyName); | |
75 | + ws.addCell(new Label(j, 0, keyName, wcf)); | |
76 | + } | |
77 | + ws.addCell(new Label(j, 1 + i, keyORvalue)); | |
78 | + j++; | |
79 | + } | |
80 | + } | |
81 | + | |
82 | + wwb.write(); | |
83 | + wwb.close(); | |
84 | + } | |
85 | + catch (IOException e) | |
86 | + { | |
87 | + e.printStackTrace(); | |
88 | + } | |
89 | + catch (RowsExceededException e) | |
90 | + { | |
91 | + e.printStackTrace(); | |
92 | + } | |
93 | + catch (WriteException e) | |
94 | + { | |
95 | + e.printStackTrace(); | |
96 | + } | |
97 | + return out; | |
98 | + } | |
99 | + | |
100 | + | |
101 | + | |
102 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/BabyCheckModel.java
View file @
3fa6915
... | ... | @@ -220,6 +220,15 @@ |
220 | 220 | //创建时间 |
221 | 221 | private Date created; |
222 | 222 | |
223 | + private String hospitalId; | |
224 | + | |
225 | + public String getHospitalId() { | |
226 | + return hospitalId; | |
227 | + } | |
228 | + | |
229 | + public void setHospitalId(String hospitalId) { | |
230 | + this.hospitalId = hospitalId; | |
231 | + } | |
223 | 232 | |
224 | 233 | public String getDrugGllergic() { |
225 | 234 | return drugGllergic; |
platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java
View file @
3fa6915
... | ... | @@ -130,15 +130,9 @@ |
130 | 130 | isAddStart = Boolean.TRUE; |
131 | 131 | } |
132 | 132 | |
133 | - if (null != nextCheckTimeStart) { | |
134 | - if (c == null) | |
135 | - { | |
136 | - c = Criteria.where("nextCheckTime").gte(nextCheckTimeStart); | |
137 | - } | |
138 | - else | |
139 | - { | |
140 | - c.and("nextCheckTime").gte(nextCheckTimeStart); | |
141 | - } | |
133 | + if (null != nextCheckTimeStart && nextCheckTimeEnd != null) { | |
134 | + Criteria nc = Criteria.where("nextCheckTime").gte(nextCheckTimeStart).lte(nextCheckTimeEnd); | |
135 | + condition= condition.andCondition(new MongoCondition(nc)); | |
142 | 136 | } |
143 | 137 | |
144 | 138 | if (isAddStart) { |
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
View file @
3fa6915
... | ... | @@ -622,7 +622,8 @@ |
622 | 622 | public void productTemplateSms() { |
623 | 623 | SmsConfigQuery configQuery = new SmsConfigQuery(); |
624 | 624 | configQuery.setYn(YnEnums.YES.getId()); |
625 | - configQuery.setPrefixTypes(new Integer[]{0,1}); | |
625 | + configQuery.setPrefixTypes(new Integer[]{0, 1}); | |
626 | + configQuery.setHospitalId(221+""); | |
626 | 627 | |
627 | 628 | //查询出对应医院配置 |
628 | 629 | List<SmsConfigModel> configs = smsConfigService.querySmsConfig(configQuery); |
... | ... | @@ -763,7 +764,7 @@ |
763 | 764 | |
764 | 765 | if (start != null && end != null) |
765 | 766 | { |
766 | - Date startDate = DateUtil.getNewDate(-end,"周",sendTimeType); | |
767 | + Date startDate = DateUtil.getNewDate(-end-1,"周",sendTimeType); | |
767 | 768 | Date endDate = DateUtil.getNewDate(-start,"周",sendTimeType); |
768 | 769 | patientsQuery.setLastMensesStart(startDate); |
769 | 770 | patientsQuery.setLastMensesEnd(endDate); |
... | ... | @@ -989,7 +990,7 @@ |
989 | 990 | if (end != null && start != null) |
990 | 991 | { |
991 | 992 | |
992 | - Date startDate = DateUtil.getNewDate(-end,"周",sendTimeType); | |
993 | + Date startDate = DateUtil.getNewDate(-end-1,"周",sendTimeType); | |
993 | 994 | Date endDate = DateUtil.getNewDate(-start,"周",sendTimeType); |
994 | 995 | patientsQuery.setLastMensesStart(startDate); |
995 | 996 | patientsQuery.setLastMensesEnd(endDate); |
... | ... | @@ -1020,6 +1021,7 @@ |
1020 | 1021 | if (smsType == SmsServiceEnums.EBYYTX.getId()) |
1021 | 1022 | { |
1022 | 1023 | Date yuYueDate = DateUtil.addDay(new Date(), sendTimeType); |
1024 | + yuYueDate = DateUtil.formatDate(yuYueDate); | |
1023 | 1025 | List<BabyCheckModel> checkModels = babyBookbuildingService.queryBabyYuYueRecord(yuYueDate, tempHid); |
1024 | 1026 | if (CollectionUtils.isNotEmpty(checkModels)) |
1025 | 1027 | { |
1026 | 1028 | |
... | ... | @@ -1028,10 +1030,10 @@ |
1028 | 1030 | |
1029 | 1031 | BabyModelQuery query = new BabyModelQuery(); |
1030 | 1032 | query.setYn(YnEnums.YES.getId()); |
1031 | - query.setId(checkModel.getBuildId()); | |
1033 | + query.setId(checkModel.getId()); //这里返回的id就是buildId | |
1032 | 1034 | |
1033 | 1035 | //查询符合条件儿童 |
1034 | - List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
1036 | + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(query); | |
1035 | 1037 | if (CollectionUtils.isNotEmpty(babyModels)) |
1036 | 1038 | { |
1037 | 1039 | for (BabyModel model : babyModels) |
... | ... | @@ -1383,7 +1385,7 @@ |
1383 | 1385 | { |
1384 | 1386 | PatientsQuery query = new PatientsQuery(); |
1385 | 1387 | query.setYn(YnEnums.YES.getId()); |
1386 | - query.setId(orderModel.getParentId()); | |
1388 | + query.setId(orderModel.getId()); //id就是parentId | |
1387 | 1389 | |
1388 | 1390 | //查询符合条件的产妇 |
1389 | 1391 | List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); |
... | ... | @@ -1847,7 +1849,7 @@ |
1847 | 1849 | List<PostReviewModel> models = postReviewService.queryPostOrder(startDate, tempHid, pid); |
1848 | 1850 | for (PostReviewModel model : models) |
1849 | 1851 | { |
1850 | - idset.add(model.getParentId()); | |
1852 | + idset.add(model.getId()); //这里的id就是parentid | |
1851 | 1853 | } |
1852 | 1854 | return idset.size() > 0; |
1853 | 1855 | } |
... | ... | @@ -1874,7 +1876,7 @@ |
1874 | 1876 | List<BabyCheckModel> models = babyBookbuildingService.queryBabyOrder(startDate, tempHid, pid); |
1875 | 1877 | for (BabyCheckModel model : models) |
1876 | 1878 | { |
1877 | - idset.add(model.getBuildId()); | |
1879 | + idset.add(model.getId()); | |
1878 | 1880 | } |
1879 | 1881 | return idset.size() > 0; |
1880 | 1882 | } |
... | ... | @@ -2110,6 +2112,7 @@ |
2110 | 2112 | antExChuQuery.setYn(YnEnums.YES.getId()); |
2111 | 2113 | antExChuQuery.setNextCheckTimeStart(yuYueDate); |
2112 | 2114 | antExChuQuery.setNextCheckTimeEnd(yuYueDate); |
2115 | + antExChuQuery.setHospitalId(tempHid); | |
2113 | 2116 | List<AntExChuModel> chus = antenatalExaminationService.queryAntExChu(antExChuQuery); |
2114 | 2117 | for (AntExChuModel chu : chus) |
2115 | 2118 | { |
... | ... | @@ -2119,7 +2122,7 @@ |
2119 | 2122 | |
2120 | 2123 | for (AntenatalExaminationModel f : fuzs) |
2121 | 2124 | { |
2122 | - idset.add(f.getParentId()); | |
2125 | + idset.add(f.getId()); //这里的id就是parentid | |
2123 | 2126 | } |
2124 | 2127 | return idset; |
2125 | 2128 | } |
platform-data-api/src/main/java/com/lyms/platform/data/util/AmsMessageService.java
View file @
3fa6915
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
3fa6915
... | ... | @@ -212,6 +212,18 @@ |
212 | 212 | bm.setNextDate(DateUtil.parseYMD(request.getNextDate())); |
213 | 213 | |
214 | 214 | |
215 | + String hospitalId = ""; | |
216 | + | |
217 | + //得到当前登录的医院id | |
218 | + if (userId != null) | |
219 | + { | |
220 | + Users dbuser = usersService.getUsers(userId); | |
221 | + if (dbuser != null) { | |
222 | + hospitalId = String.valueOf(dbuser.getOrgId()); | |
223 | + } | |
224 | + } | |
225 | + | |
226 | + | |
215 | 227 | if (CollectionUtils.isNotEmpty(request.getDiagnose())) |
216 | 228 | { |
217 | 229 | BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); |
... | ... | @@ -231,6 +243,7 @@ |
231 | 243 | babyBookbuildingService.updateBabyBuild(bm, request.getBuildId()); |
232 | 244 | |
233 | 245 | BabyCheckModel model = getBabyCheckModel(request); |
246 | + model.setHospitalId(hospitalId); | |
234 | 247 | model.setCreated(new Date()); |
235 | 248 | model = babyCheckService.addBabyCheck(model); |
236 | 249 | BaseObjectResponse br = new BaseObjectResponse(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SmsTemplateFacade.java
View file @
3fa6915
... | ... | @@ -236,7 +236,7 @@ |
236 | 236 | //发送频次 |
237 | 237 | Integer sendFreq = temp.getSendFrequency(); |
238 | 238 | |
239 | - String sendDate = SendDateEnums.getNameById(temp.getSendDateType()); | |
239 | + String sendDate = temp.getSendDateType() == null ? "" : SendDateEnums.getNameById(temp.getSendDateType()); | |
240 | 240 | |
241 | 241 | |
242 | 242 | String dateRange = temp.getStart() == null ? "" : (temp.getStart() + " "+ temp.getEnd()); |