Commit c6702bd2166548c0b09dccc415d090e4268ac52e

Authored by wangbo
1 parent 60bbc5e04f

小程序配置项小程端接口

Showing 9 changed files with 185 additions and 62 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/AntExChuModelTemp.java View file @ c6702bd
... ... @@ -21,19 +21,19 @@
21 21 private String cDueWeek;
22 22 private String bg;
23 23 // 既往史
24   - private String pastHistory ;
  24 + private String pastHistory;
25 25 // 家族史
26   - private String familyHistory ;
  26 + private String familyHistory;
27 27 //个人史
28 28 private String personalHistory;
29 29 //疫苗接种史
30   - private String ymjzHistory ;
  30 + private String ymjzHistory;
31 31 //药物过敏史
32   - private String ywgmHistory ;
  32 + private String ywgmHistory;
33 33 //妇科手术史
34   - private String fksxHistory ;
  34 + private String fksxHistory;
35 35 // 叶酸服用
36   - private String ysfyHistory ;
  36 + private String ysfyHistory;
37 37 //孕次
38 38 private Integer pregnancyTimes;
39 39 // 产次
40 40  
41 41  
42 42  
... ... @@ -47,17 +47,17 @@
47 47 //死胎
48 48 private Integer stillbirth;
49 49 //死产
50   - private Integer stillChan ;
  50 + private Integer stillChan;
51 51 //新生儿死亡
52 52 private Integer neoDeath;
53 53 //出生缺陷
54 54 private Integer birthDefect;
55 55 // 身高
56   - private String height;
  56 + private String height;
57 57 //体重
58   - private String weight ;
  58 + private String weight;
59 59 //孕前体重
60   - private String yqWeight ;
  60 + private String yqWeight;
61 61 //体重指数
62 62 private String baricIndex;
63 63 //本次妊娠情况
64 64  
... ... @@ -89,7 +89,19 @@
89 89 private String bp;
90 90 //丈夫健康情况
91 91 private String hHealthInfo;
  92 + /**
  93 + * 产检项
  94 + */
  95 + private String configItemId;
92 96  
  97 + public String getConfigItemId() {
  98 + return configItemId;
  99 + }
  100 +
  101 + public void setConfigItemId(String configItemId) {
  102 + this.configItemId = configItemId;
  103 + }
  104 +
93 105 public String getPid() {
94 106 return pid;
95 107 }
... ... @@ -219,7 +231,7 @@
219 231 // 衔接
220 232 private String join;*/
221 233 //高危因素
222   - private String highrisk ;
  234 + private String highrisk;
223 235 //高危评分
224 236 private String highriskSocre;
225 237 // 其他高危
226 238  
227 239  
228 240  
229 241  
230 242  
231 243  
232 244  
233 245  
234 246  
235 247  
236 248  
237 249  
238 250  
... ... @@ -238,43 +250,43 @@
238 250 private Object nextCheckTime;
239 251 private Integer yn;
240 252 //血红蛋白值
241   - private String xhdb ;
  253 + private String xhdb;
242 254 //白细胞计数值
243   - private String bxbjs ;
  255 + private String bxbjs;
244 256 //血小板
245 257 private String platelet;
246 258 // 血常规其他
247   - private String chgOther ;
  259 + private String chgOther;
248 260 // 尿蛋白
249 261 private String ndb;
250 262 //尿糖
251 263 private String nt;
252 264 //尿同体
253   - private String urineKetone ;
  265 + private String urineKetone;
254 266 // 尿潜血
255   - private String bld ;
  267 + private String bld;
256 268 //尿常规其他
257 269 private String ncgOther;
258 270 //ABO
259   - private String abo ;
  271 + private String abo;
260 272 // rh
261   - private String rh ;
  273 + private String rh;
262 274 // 血糖
263 275 private String bloodSugar;
264 276 //B超
265   - private String bChao ;
  277 + private String bChao;
266 278 //胎数
267   - private String tireNumber ;
  279 + private String tireNumber;
268 280 //血清谷丙转氨酶
269   - private String xqgbzam ;
  281 + private String xqgbzam;
270 282 //血清谷草转氨酶
271   - private String xqgczam ;
  283 + private String xqgczam;
272 284 //白蛋白
273   - private String albumin ;
  285 + private String albumin;
274 286 //总胆红素
275   - private String totalBilirubin;
  287 + private String totalBilirubin;
276 288 // 结合胆红素
277   - private String jhBilirubin ;
  289 + private String jhBilirubin;
278 290  
279 291 public Object getModified() {
280 292 return modified;
... ... @@ -285,7 +297,7 @@
285 297 }
286 298  
287 299 //乙肝表面抗原
288   - private String ygbmky;
  300 + private String ygbmky;
289 301 //乙肝表面抗体
290 302 private String ygbmkt;
291 303 //乙肝e抗原
292 304  
293 305  
294 306  
295 307  
296 308  
... ... @@ -293,19 +305,19 @@
293 305 //乙肝e抗体
294 306 private String ygekt;
295 307 // 乙肝核心抗体
296   - private String yghxkt;
  308 + private String yghxkt;
297 309 // 血清肌
298   - private String xqjq;
  310 + private String xqjq;
299 311 // 血尿素氮
300   - private String xnsd;
  312 + private String xnsd;
301 313 // 梅毒血清实验
302 314 // private String mdxqsy;
303 315 // hit抗体检测
304   - private String hivkt;
  316 + private String hivkt;
305 317 // 阴道分泌物
306   - private String ydfmw;
  318 + private String ydfmw;
307 319 // 阴道清洁度
308   - private String ydqjd;
  320 + private String ydqjd;
309 321  
310 322 private Object modified;
311 323 //操作人
... ... @@ -326,8 +338,6 @@
326 338 public void setCestationInfo(String cestationInfo) {
327 339 this.cestationInfo = cestationInfo;
328 340 }
329   -
330   -
331 341  
332 342  
333 343 public String getDiagnosis() {
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/MasterCheckItemMapper.java View file @ c6702bd
... ... @@ -10,6 +10,6 @@
10 10  
11 11 public String getOne(Integer id);
12 12  
13   -
  13 + public List<CheckItem> xcxGetCheckItemList(Integer id);
14 14 }
platform-biz-service/src/main/java/com/lyms/platform/permission/model/CheckItem.java View file @ c6702bd
... ... @@ -4,6 +4,15 @@
4 4 private Integer id;
5 5 private String project;
6 6 private String projectInfo;
  7 + private String checkAttention;
  8 +
  9 + public String getCheckAttention() {
  10 + return checkAttention;
  11 + }
  12 +
  13 + public void setCheckAttention(String checkAttention) {
  14 + this.checkAttention = checkAttention;
  15 + }
7 16  
8 17 public Integer getId() {
9 18 return id;
platform-biz-service/src/main/java/com/lyms/platform/permission/service/CheckItemService.java View file @ c6702bd
... ... @@ -11,6 +11,8 @@
11 11  
12 12 public String getOne(Integer id);
13 13  
  14 + public List<CheckItem> xcxGetCheckItemList(Integer id);
  15 +
14 16  
15 17 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/CheckItemManageServiceImpl.java View file @ c6702bd
1 1 package com.lyms.platform.permission.service.impl;
2 2  
3 3 import com.lyms.platform.biz.AntExChuModelTemp;
  4 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  5 +import com.lyms.platform.common.result.BaseObjectResponse;
4 6 import com.lyms.platform.common.result.BaseResponse;
  7 +import com.lyms.platform.common.utils.DateUtil;
5 8 import com.lyms.platform.permission.dao.master.MasterCheckItemManageMapper;
  9 +import com.lyms.platform.permission.dao.master.MasterCheckItemMapper;
  10 +import com.lyms.platform.permission.model.CheckItem;
6 11 import com.lyms.platform.permission.model.CheckItemManage;
7 12 import com.lyms.platform.permission.model.CheckItemManageQuery;
8 13 import com.lyms.platform.permission.service.CheckItemManageService;
9 14 import com.lyms.platform.pojo.AntenatalExaminationModel;
  15 +import org.apache.ibatis.reflection.ExceptionUtil;
10 16 import org.springframework.beans.factory.annotation.Autowired;
11 17 import org.springframework.data.mongodb.core.MongoTemplate;
12 18 import org.springframework.data.mongodb.core.query.Criteria;
13 19 import org.springframework.data.mongodb.core.query.Query;
14 20 import org.springframework.stereotype.Service;
15 21  
16   -import java.util.List;
  22 +import java.util.*;
17 23  
18 24 @Service
19 25 public class CheckItemManageServiceImpl implements CheckItemManageService {
... ... @@ -24,6 +30,9 @@
24 30 @Autowired
25 31 private MongoTemplate mongoTemplate;
26 32  
  33 + @Autowired
  34 + private MasterCheckItemMapper checkItemMapper;
  35 +
27 36 @Override
28 37 public List<CheckItemManage> getCheckItemManageList() {
29 38 return checkItemManageMapper.getCheckItemManageList();
30 39  
31 40  
32 41  
33 42  
34 43  
... ... @@ -57,23 +66,74 @@
57 66  
58 67 @Override
59 68 public BaseResponse xcxGetCheckItemManage(String parentId) {
60   - //获取初诊
61   - List<AntExChuModelTemp> antExChuModelTemps = mongoTemplate.find(Query.query(Criteria.where("parentId").is(parentId)), AntExChuModelTemp.class);
62 69 //获取复诊
63 70 List<AntenatalExaminationModel> antenatalExaminationModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(parentId)), AntenatalExaminationModel.class);
64 71 //1.先查询复诊是否为空
  72 + List<Map> list2 = new ArrayList();
65 73 if (antenatalExaminationModels != null && antenatalExaminationModels.size() > 0) {
66   - for (AntenatalExaminationModel examinationModel : antenatalExaminationModels) {
67   - //通过修改时间获取他的最后一次记录
68   - System.out.println("==========>" + examinationModel.getModified());
69   - String string = examinationModel.getConfigItemId();
70   - System.out.println("===========>" + string);
71   - }
  74 + //排序
  75 + Collections.sort(antenatalExaminationModels, new Comparator<AntenatalExaminationModel>() {
  76 + @Override
  77 + public int compare(AntenatalExaminationModel arg0, AntenatalExaminationModel arg1) {
  78 + int mark = 1;
  79 + try {
  80 + Date date0 = arg0.getModified();
  81 + Date date1 = arg1.getModified();
  82 + if (date0.getTime() > date1.getTime()) {
  83 + mark = -1;
  84 + }
  85 + if (date0.equals(date1)) {
  86 + mark = 0;
  87 + }
  88 + } catch (Exception e) {
  89 + e.printStackTrace();
72 90  
73   - }
  91 + }
  92 + return mark;
74 93  
  94 + }
  95 + });
  96 + //获取排序后对象中的第一条数据
  97 + AntenatalExaminationModel examinationModels = antenatalExaminationModels.get(0);
  98 + if (examinationModels != null && examinationModels.getConfigItemId() != null) {
  99 + System.out.println("=======>复诊" + examinationModels.getConfigItemId());
  100 + System.out.println("=====>时间" + DateUtil.getyyyy_MM_dd_hms(examinationModels.getModified()));
  101 + String strCept = examinationModels.getConfigItemId();
  102 + String[] string = strCept.split(",");
  103 + for (String s1 : string) {
  104 + List<CheckItem> list1 = checkItemMapper.xcxGetCheckItemList(Integer.valueOf(s1).intValue());
  105 + for (CheckItem checkItem : list1) {
  106 + Map map = new HashMap();
  107 + map.put("id", checkItem.getId());
  108 + map.put("project", checkItem.getProject());
  109 + map.put("projectInfo", checkItem.getProjectInfo());
  110 + map.put("checkAttention", checkItem.getCheckAttention());
  111 + list2.add(map);
  112 + }
  113 + }
  114 + }
  115 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(list2);
75 116  
76   - return null;
  117 + } else {
  118 + //获取初诊
  119 + AntExChuModelTemp antExChuModelTemps = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(parentId)), AntExChuModelTemp.class);
  120 + if (antExChuModelTemps != null && antExChuModelTemps.getConfigItemId() != null) {
  121 + System.out.println("========初诊:" + antExChuModelTemps.getConfigItemId());
  122 + String[] str = antExChuModelTemps.getConfigItemId().split(",");
  123 + for (String s2 : str) {
  124 + List<CheckItem> list1 = checkItemMapper.xcxGetCheckItemList(Integer.valueOf(s2).intValue());
  125 + for (CheckItem checkItem : list1) {
  126 + Map map = new HashMap();
  127 + map.put("id", checkItem.getId());
  128 + map.put("project", checkItem.getProject());
  129 + map.put("projectInfo", checkItem.getProjectInfo());
  130 + map.put("checkAttention", checkItem.getCheckAttention());
  131 + list2.add(map);
  132 + }
  133 + }
  134 + }
  135 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(list2);
  136 + }
77 137 }
78 138 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/CheckItemServiceImpl.java View file @ c6702bd
... ... @@ -25,6 +25,11 @@
25 25 return checkItemMapper.getOne(id);
26 26 }
27 27  
  28 + @Override
  29 + public List<CheckItem> xcxGetCheckItemList(Integer id) {
  30 + return checkItemMapper.xcxGetCheckItemList(id);
  31 + }
  32 +
28 33  
29 34 }
platform-biz-service/src/main/resources/mainOrm/master/MasterCheckItem.xml View file @ c6702bd
... ... @@ -6,6 +6,7 @@
6 6 <id column="id" property="id" jdbcType="INTEGER"/>
7 7 <result column="project" property="project" jdbcType="VARCHAR"/>
8 8 <result column="project_info" property="projectInfo" jdbcType="VARCHAR"/>
  9 + <result column="check_attention" property="checkAttention" jdbcType="VARCHAR"/>
9 10 </resultMap>
10 11 <select id="getCheckItemList" resultMap="CheckItemMap">
11 12 SELECT id,project FROM lyms_week_project
... ... @@ -14,5 +15,10 @@
14 15 <select id="getOne" resultType="java.lang.String" parameterType="java.lang.Integer">
15 16 SELECT project FROM lyms_week_project WHERE id=#{id,jdbcType=INTEGER}
16 17 </select>
  18 +
  19 + <select id="xcxGetCheckItemList" resultMap="CheckItemMap" parameterType="java.lang.Integer">
  20 + SELECT id,project,project_info,check_attention FROM lyms_week_project WHERE id=#{id,jdbcType=INTEGER}
  21 + </select>
  22 +
17 23 </mapper>
platform-biz-service/src/main/resources/mainOrm/master/MasterCheckItemManage.xml View file @ c6702bd
... ... @@ -17,8 +17,8 @@
17 17 <selectKey order="AFTER" keyProperty="id" resultType="java.lang.Integer">
18 18 SELECT LAST_INSERT_ID()
19 19 </selectKey>
20   - INSERT INTO lyms_checkitem(startweek,endweek,checkItemInfoId,affiliate)
21   - VALUES(#{startWeek},#{endWeek},#{checkItemInfoId},#{affiliateId})
  20 + INSERT INTO lyms_checkitem(startweek,endweek,checkItemInfoId,affiliate,modified,created)
  21 + VALUES(#{startWeek},#{endWeek},#{checkItemInfoId},#{affiliateId},#{modified},#{created})
22 22 </insert>
23 23  
24 24  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CheckItemManageController.java View file @ c6702bd
... ... @@ -2,11 +2,14 @@
2 2  
3 3 import com.lyms.platform.common.annotation.TokenRequired;
4 4 import com.lyms.platform.common.base.BaseController;
  5 +import com.lyms.platform.common.base.LoginContext;
5 6 import com.lyms.platform.common.constants.ErrorCodeConstants;
6 7 import com.lyms.platform.common.result.BaseResponse;
7 8 import com.lyms.platform.common.utils.ResultUtils;
8 9 import com.lyms.platform.common.utils.StringUtils;
  10 +import com.lyms.platform.operate.web.facade.AutoMatchFacade;
9 11 import com.lyms.platform.operate.web.result.FrontEndResult;
  12 +import com.lyms.platform.operate.web.utils.CollectionUtils;
10 13 import com.lyms.platform.permission.model.CheckItemManage;
11 14 import com.lyms.platform.permission.model.CheckItemManageQuery;
12 15 import com.lyms.platform.permission.service.CheckItemManageService;
... ... @@ -16,6 +19,7 @@
16 19 import org.springframework.stereotype.Controller;
17 20 import org.springframework.web.bind.annotation.*;
18 21  
  22 +import javax.servlet.http.HttpServletRequest;
19 23 import javax.servlet.http.HttpServletResponse;
20 24 import java.util.ArrayList;
21 25 import java.util.Date;
... ... @@ -100,7 +104,6 @@
100 104 return result.toString();
101 105 }
102 106  
103   -
104 107 /**
105 108 * 添加展示项信息
106 109 */
... ... @@ -115,15 +118,42 @@
115 118 ResultUtils.buildParameterErrorResultAndWrite(response, "请填写必须项!");
116 119 return;
117 120 } else {
118   - CheckItemManage checkItemManage = new CheckItemManage();
119   - checkItemManage.setStartWeek(startweek);
120   - checkItemManage.setEndWeek(endweek);
121   - checkItemManage.setCheckItemInfoId(checkItemInfoId);
122   - checkItemManage.setAffiliateId(affiliateId);
123   - checkItemManage.setCreated(new Date());
124   - checkItemManage.setModified(new Date());
125   - checkItemManageService.addCheckItem(checkItemManage);
126   - ResultUtils.buildSuccessResultAndWrite(response);
  121 + if (startweek > endweek) {
  122 + ResultUtils.buildParameterErrorResultAndWrite(response, "起始周不能大于结束周!");
  123 + return;
  124 + }
  125 + boolean start = true;
  126 + boolean end = true;
  127 + CheckItemManageQuery checkItemManageQuery = new CheckItemManageQuery();
  128 + checkItemManageQuery.setAffiliateId(affiliateId);
  129 + List<CheckItemManage> list = checkItemManageService.getCheckItemManage(affiliateId);
  130 + if (CollectionUtils.isNotEmpty(list)) {
  131 + for (CheckItemManage checkItemManage : list) {
  132 + if (checkItemManage.getStartWeek() <= startweek && checkItemManage.getEndWeek() >= startweek) {
  133 + start = false;
  134 + break;
  135 + }
  136 + }
  137 + for (CheckItemManage checkItemManage : list) {
  138 + if (checkItemManage.getStartWeek() <= endweek && checkItemManage.getEndWeek() >= endweek) {
  139 + end = false;
  140 + break;
  141 + }
  142 + }
  143 + }
  144 + if (end && start) {
  145 + CheckItemManage checkItemManage = new CheckItemManage();
  146 + checkItemManage.setStartWeek(startweek);
  147 + checkItemManage.setEndWeek(endweek);
  148 + checkItemManage.setCheckItemInfoId(checkItemInfoId);
  149 + checkItemManage.setAffiliateId(affiliateId);
  150 + checkItemManage.setCreated(new Date());
  151 + checkItemManage.setModified(new Date());
  152 + checkItemManageService.addCheckItem(checkItemManage);
  153 + ResultUtils.buildSuccessResultAndWrite(response);
  154 + } else {
  155 + ResultUtils.buildParameterErrorResultAndWrite(response, "此范围以填写!");
  156 + }
127 157 }
128 158  
129 159 }
... ... @@ -157,7 +187,6 @@
157 187 ResultUtils.buildParameterErrorResultAndWrite(response, "修改失败");
158 188 return;
159 189 }
160   -
161 190 }
162 191  
163 192 /**
164 193  
165 194  
... ... @@ -181,13 +210,14 @@
181 210 }
182 211  
183 212 /**
184   - * x小程序获取医院展示项接口
  213 + * 小程序获取医院展示项接口
185 214 */
186 215 @RequestMapping(value = "/xcxGetCheckItem/{parentId}", method = RequestMethod.GET)
187 216 @ResponseBody
188 217 public BaseResponse getCheckItem(@PathVariable String parentId) {
189   - System.out.println("=======>进来了!!");
190 218 return checkItemManageService.xcxGetCheckItemManage(parentId);
191 219 }
  220 +
  221 +
192 222 }