Commit a3b943f81636d4382d273ee5d3aca96f2da819e3
1 parent
8b4c2839d2
Exists in
luanping
and in
1 other branch
#优化小程序孕周查询功能
Showing 7 changed files with 38 additions and 19 deletions
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/ProjectWeekMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/ProjectWeekService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/ProjectWeekServiceImpl.java
- platform-biz-service/src/main/resources/mainOrm/master/ProjectWeekMapper.xml
- platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/FactorProjectController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/ProjectWeekMapper.java
View file @
a3b943f
1 | 1 | package com.lyms.platform.permission.dao.master; |
2 | 2 | |
3 | 3 | import com.lyms.platform.permission.model.ProjectWeekEntity; |
4 | +import org.apache.ibatis.annotations.Param; | |
4 | 5 | |
5 | 6 | import java.util.List; |
6 | 7 | |
... | ... | @@ -10,5 +11,6 @@ |
10 | 11 | void update(ProjectWeekEntity factorProject); |
11 | 12 | void del(Integer id); |
12 | 13 | ProjectWeekEntity selectById(Integer id); |
14 | + String selectByWeek(@Param("hospitalId") Integer hospitalId, @Param("week")String week); | |
13 | 15 | } |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/ProjectWeekService.java
View file @
a3b943f
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | public interface ProjectWeekService { |
8 | 8 | List<ProjectWeekEntity> getList(Integer hospitalId); |
9 | 9 | ProjectWeekEntity selectInfo(Integer id); |
10 | + String selectByWeek(Integer hospitalId,String week); | |
10 | 11 | void add(ProjectWeekEntity projectWay); |
11 | 12 | void update(ProjectWeekEntity projectWay); |
12 | 13 | void del(Integer id); |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/ProjectWeekServiceImpl.java
View file @
a3b943f
... | ... | @@ -23,6 +23,11 @@ |
23 | 23 | } |
24 | 24 | |
25 | 25 | @Override |
26 | + public String selectByWeek(Integer hospitalId,String week) { | |
27 | + return projectWeekMapper.selectByWeek(hospitalId,week); | |
28 | + } | |
29 | + | |
30 | + @Override | |
26 | 31 | public void add(ProjectWeekEntity projectWay) { |
27 | 32 | projectWeekMapper.add(projectWay); |
28 | 33 | } |
platform-biz-service/src/main/resources/mainOrm/master/ProjectWeekMapper.xml
View file @
a3b943f
... | ... | @@ -55,5 +55,15 @@ |
55 | 55 | id = #{id,jdbcType=INTEGER} |
56 | 56 | </select> |
57 | 57 | |
58 | + <select id="selectByWeek" resultType="java.lang.String"> | |
59 | + SELECT | |
60 | + `name` | |
61 | +FROM | |
62 | + project_week | |
63 | +WHERE | |
64 | + hospital_id =#{hospitalId,jdbcType=INTEGER} | |
65 | +AND `week` LIKE CONCAT('%',#{week,jdbcType=VARCHAR}, '%') | |
66 | + </select> | |
67 | + | |
58 | 68 | </mapper> |
platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java
View file @
a3b943f
... | ... | @@ -92,21 +92,24 @@ |
92 | 92 | */ |
93 | 93 | public static boolean hasSameCharacters(String str1,String str2){ |
94 | 94 | boolean hasSameCharacters = false; |
95 | - str1=str1.replace(",",""); | |
96 | - str2=str2.replace(",",""); | |
97 | - for (int i = 0; i < str1.length(); i++) { | |
98 | - char c = str1.charAt(i); | |
99 | - | |
100 | - if (str2.indexOf(c) != -1) { // 若str2包含该字符则说明存在相同的字符 | |
101 | - hasSameCharacters = true; | |
102 | - break; | |
95 | + String [] array1=str1.split(","); | |
96 | + String [] array2=str2.split(","); | |
97 | + for (int i = 0,j=array1.length; i < j; i++) { | |
98 | + String a=array1[i]; | |
99 | + for (int k = 0,l=array2.length; k < l; k++) { | |
100 | + String b= array2[k]; | |
101 | + if (a.equals(b)){ // 若str2包含该字符则说明存在相同的字符 | |
102 | + hasSameCharacters = true; | |
103 | + break; | |
104 | + } | |
103 | 105 | } |
106 | + | |
104 | 107 | } |
105 | 108 | return hasSameCharacters; |
106 | 109 | } |
107 | 110 | |
108 | 111 | public static void main(String[] args) { |
109 | - System.out.println((hasSameCharacters("1","3,4,5,6,7"))); | |
112 | + System.out.println((hasSameCharacters("15,16,17","18,19,20,21"))); | |
110 | 113 | } |
111 | 114 | |
112 | 115 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/FactorProjectController.java
View file @
a3b943f
... | ... | @@ -3,7 +3,6 @@ |
3 | 3 | import com.lyms.platform.common.annotation.TokenRequired; |
4 | 4 | import com.lyms.platform.common.base.BaseController; |
5 | 5 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
6 | -import com.lyms.platform.common.enums.ProjectWeekEnums; | |
7 | 6 | import com.lyms.platform.common.utils.ResultUtils; |
8 | 7 | import com.lyms.platform.common.utils.StringUtils; |
9 | 8 | import com.lyms.platform.operate.web.facade.BookbuildingFacade; |
... | ... | @@ -146,7 +145,7 @@ |
146 | 145 | ResultUtils.buildParameterErrorResultAndWrite(response, "孕周不能为空"); |
147 | 146 | } |
148 | 147 | if (type!=null){ |
149 | - week=ProjectWeekEnums.getWeekName(week); | |
148 | + week=projectWeekService.selectByWeek(hospitalId,week); | |
150 | 149 | } |
151 | 150 | FactorProjectEntity factorProject= factorProjectService.selectByWeek(hospitalId,week); |
152 | 151 | ResultUtils.buildSuccessResultAndWrite(response,factorProject); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
a3b943f
... | ... | @@ -32,10 +32,7 @@ |
32 | 32 | import com.lyms.platform.permission.dao.master.CouponMapper; |
33 | 33 | import com.lyms.platform.permission.dao.master.MasterOrganizationMapper; |
34 | 34 | import com.lyms.platform.permission.model.*; |
35 | -import com.lyms.platform.permission.service.CouponService; | |
36 | -import com.lyms.platform.permission.service.FactorProjectService; | |
37 | -import com.lyms.platform.permission.service.OrganizationService; | |
38 | -import com.lyms.platform.permission.service.UsersService; | |
35 | +import com.lyms.platform.permission.service.*; | |
39 | 36 | import com.lyms.platform.pojo.*; |
40 | 37 | import com.lyms.platform.query.*; |
41 | 38 | import org.apache.commons.collections.CollectionUtils; |
... | ... | @@ -1233,7 +1230,7 @@ |
1233 | 1230 | public void run() { |
1234 | 1231 | for (int i = 0, j = patientList.size(); i < j; i++) { |
1235 | 1232 | Patients patients = patientList.get(i); |
1236 | - String week = getBuildingWeek(patients); | |
1233 | + String week = getBuildingWeek(patients,Integer.valueOf(hospitalId)); | |
1237 | 1234 | sendbuildingMsg(patients, SmsServiceEnums.CJYYTX.getId(), "【产检提醒】", "亲爱的孕妈妈,您当前孕周为" + week + ",请点击此处查看就诊流程。", week); |
1238 | 1235 | |
1239 | 1236 | if (CollectionUtils.isNotEmpty(patients.getRiskFactorId()) && !patients.getRiskFactorId().contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6")) { |
1240 | 1237 | |
1241 | 1238 | |
... | ... | @@ -1259,15 +1256,17 @@ |
1259 | 1256 | } |
1260 | 1257 | logger.info("weekSync end"); |
1261 | 1258 | } |
1259 | + @Autowired | |
1260 | + @Qualifier("projectWeekService") | |
1261 | + private ProjectWeekService projectWeekService; | |
1262 | 1262 | |
1263 | - | |
1264 | 1263 | /** |
1265 | 1264 | * 查询孕期 |
1266 | 1265 | * |
1267 | 1266 | * @param patients |
1268 | 1267 | * @return |
1269 | 1268 | */ |
1270 | - private String getBuildingWeek(Patients patients) { | |
1269 | + private String getBuildingWeek(Patients patients,Integer hospitalId) { | |
1271 | 1270 | String dueWeek = ""; |
1272 | 1271 | try { |
1273 | 1272 | // 徐倩说改的 |
... | ... | @@ -1280,7 +1279,7 @@ |
1280 | 1279 | dueWeek = ""; |
1281 | 1280 | } else { |
1282 | 1281 | String week= days / 7+""; |
1283 | - dueWeek = ProjectWeekEnums.getWeekName(week); | |
1282 | + dueWeek = projectWeekService.selectByWeek(hospitalId,week);; | |
1284 | 1283 | /*int day = (days % 7); |
1285 | 1284 | dueWeek = "孕" + week + "周" + (day > 0 ? "+" + day + "天" : "");*/ |
1286 | 1285 | } |