Commit 45146210d7d96e811f7b0f94e4b49c02a5d2b59d

Authored by yangfei
1 parent 88e2ec2bc0

听力诊断模块

Showing 9 changed files with 390 additions and 15 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/BabyPatientExtendEarScreenMapper.java View file @ 4514621
... ... @@ -22,5 +22,6 @@
22 22  
23 23 public List<BabyPatientExtendEarScreen> notAuscultationBabyPatientExtendEarScreen(BabyPatientExtendEarScreenQuery query);
24 24  
  25 + public List<BabyPatientExtendEarScreen> dubiousScreen(BabyPatientExtendEarScreenQuery screenQuery);
25 26 }
platform-biz-service/src/main/java/com/lyms/platform/permission/model/BabyPatientExtendEarScreenQuery.java View file @ 4514621
... ... @@ -34,6 +34,16 @@
34 34 private Date screenDate;
35 35  
36 36 /**
  37 + * 筛查开始时间
  38 + */
  39 + private Date screenStartDate;
  40 +
  41 + /**
  42 + * 筛查结束时间
  43 + */
  44 + private Date screenEndDate;
  45 +
  46 + /**
37 47 * 高危因素 1=早产 2=晚产
38 48 */
39 49 private Integer highRiskCause;
... ... @@ -171,6 +181,22 @@
171 181 public void setHighRiskCause(Integer highRiskCause) {
172 182 this.highRiskCause = highRiskCause;
173 183  
  184 + }
  185 +
  186 + public Date getScreenStartDate() {
  187 + return screenStartDate;
  188 + }
  189 +
  190 + public void setScreenStartDate(Date screenStartDate) {
  191 + this.screenStartDate = screenStartDate;
  192 + }
  193 +
  194 + public Date getScreenEndDate() {
  195 + return screenEndDate;
  196 + }
  197 +
  198 + public void setScreenEndDate(Date screenEndDate) {
  199 + this.screenEndDate = screenEndDate;
174 200 }
175 201  
176 202 public String[] getBabyIds() {
platform-biz-service/src/main/java/com/lyms/platform/permission/model/ChildrenPersonQuery.java View file @ 4514621
... ... @@ -14,6 +14,8 @@
14 14 private Integer gender;
15 15 private String papersNum;
16 16 private Date birthday;
  17 + private Date endBirthday;
  18 + private Date startBirthday;
17 19 private String addressProvince;
18 20 private String addressCity;
19 21 private String addressArea;
20 22  
... ... @@ -27,9 +29,18 @@
27 29 private String basePapersNumber;
28 30 private Date baseWomanBirth;
29 31 private String contactWomanWay;
  32 + private String keyWord;
30 33 private Integer degree;
31 34 private Integer occupation;
32 35  
  36 + public String getKeyWord() {
  37 + return keyWord;
  38 + }
  39 +
  40 + public void setKeyWord(String keyWord) {
  41 + this.keyWord = keyWord;
  42 + }
  43 +
33 44 public String getId()
34 45 {
35 46 return id;
... ... @@ -47,6 +58,21 @@
47 58 return motherId;
48 59 }
49 60  
  61 + public Date getEndBirthday() {
  62 + return endBirthday;
  63 + }
  64 +
  65 + public void setEndBirthday(Date endBirthday) {
  66 + this.endBirthday = endBirthday;
  67 + }
  68 +
  69 + public Date getStartBirthday() {
  70 + return startBirthday;
  71 + }
  72 +
  73 + public void setStartBirthday(Date startBirthday) {
  74 + this.startBirthday = startBirthday;
  75 + }
50 76  
51 77 public void setMotherId(String motherId)
52 78 {
platform-biz-service/src/main/java/com/lyms/platform/permission/service/BabyPatientExtendEarScreenService.java View file @ 4514621
... ... @@ -22,5 +22,6 @@
22 22  
23 23 public List<BabyPatientExtendEarScreen> notAuscultationBabyPatientExtendEarScreen(BabyPatientExtendEarScreenQuery query);
24 24  
  25 + public List<BabyPatientExtendEarScreen> dubiousScreen(BabyPatientExtendEarScreenQuery screenQuery);
25 26 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/BabyPatientExtendEarScreenServiceImpl.java View file @ 4514621
... ... @@ -54,6 +54,11 @@
54 54 }
55 55  
56 56 @Override
  57 + public List<BabyPatientExtendEarScreen> dubiousScreen(BabyPatientExtendEarScreenQuery screenQuery) {
  58 + return babyPatientExtendEarScreenMapper.dubiousScreen(screenQuery);
  59 + }
  60 +
  61 + @Override
57 62 public List<String> queryScrBabyIds(BabyPatientExtendEarScreenQuery query) {
58 63 return babyPatientExtendEarScreenMapper.queryScrBabyIds(query);
59 64 }
platform-biz-service/src/main/resources/mainOrm/master/BabyPatientExtendEarScreen.xml View file @ 4514621
... ... @@ -282,6 +282,43 @@
282 282 <include refid="orderAndLimit"/>
283 283 </select>
284 284  
  285 + <select id="dubiousScreen" resultMap="BabyPatientExtendEarScreenResultMap"
  286 + parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarScreenQuery">
  287 + select
  288 + id,baby_id,screen_type,check_hospital_id,screen_date,high_risk_cause,oae_left,oae_right,aabr_left,aabr_right,gjb2_del_35,gjb2_del_176,gjb2_del_235,gjb2_del_299,gjb3_slc26a4_538,gjb3_slc26a4_2168,gjb3_slc26a4_ivs7,process_option_type,process_option_desc,guid_opinion,check_doctor_id,referral_date,create_date,create_user_id,create_hospital_id,last_update_date,last_update_user_id,last_update_hospital_id,status
  289 + from baby_patient_extend_ear_screen
  290 + <where>
  291 + (oae_left =-1 or oae_right = -1 or aabr_left = -1 or aabr_right = -1)
  292 + and screen_type = 2
  293 + <if test="screenStartDate!=null">
  294 + and
  295 + <![CDATA[
  296 + DATEDIFF(#{screenStartDate},screen_date)<=0
  297 + ]]>
  298 + </if>
  299 + <if test="screenEndDate!=null">
  300 + AND
  301 + <![CDATA[
  302 + DATEDIFF(#{screenEndDate},screen_date) >=0
  303 + ]]>
  304 + </if>
  305 + <if test="checkDoctorId!=null and checkDoctorId != ''">
  306 + and check_doctor_id = #{checkDoctorId}
  307 + </if>
  308 + <if test="checkHospitalId != null and checkHospitalId != ''">
  309 + and check_hospital_id = #{checkHospitalId}
  310 + </if>
  311 + <if test="babyIds!=null">
  312 + and baby_id in (
  313 + <foreach item="babyId" collection="babyIds" separator="," >
  314 + #{babyId}
  315 + </foreach>
  316 + )
  317 + </if>
  318 + GROUP BY baby_id
  319 + </where>
  320 + </select>
  321 +
285 322  
286 323 <select id="queryBabyPatientExtendEarScreenCount" resultType="int"
287 324 parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarScreenQuery">
platform-biz-service/src/main/resources/mainOrm/master/ChildrenPerson.xml View file @ 4514621
... ... @@ -142,6 +142,18 @@
142 142 <if test="birthday != null">
143 143 and BIRTHDAY = #{birthday,jdbcType=TIMESTAMP}
144 144 </if>
  145 + <if test="startBirthday != null">
  146 + and
  147 + <![CDATA[
  148 + DATEDIFF(#{startBirthday},BIRTHDAY)<=0
  149 + ]]>
  150 + </if>
  151 + <if test="endBirthday != null">
  152 + AND
  153 + <![CDATA[
  154 + DATEDIFF(#{endBirthday},BIRTHDAY) >=0
  155 + ]]>
  156 + </if>
145 157 <if test="addressProvince != null and addressProvince != ''">
146 158 and ADDRESS_PROVINCE = #{addressProvince,jdbcType=VARCHAR}
147 159 </if>
... ... @@ -186,6 +198,12 @@
186 198 </if>
187 199 <if test="occupation != null and occupation >= 0">
188 200 and OCCUPATION = #{occupation,jdbcType=INTEGER}
  201 + </if>
  202 + <if test="keyWord != null and keyWord >= 0">
  203 + and (
  204 + NAME like concat('%',#{name},'%')
  205 + or CONTACT_WOMAN_WAY LIKE concat('%',#{name},'%')
  206 + )
189 207 </if>
190 208 </where>
191 209 </sql>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HearDiagnManageController.java View file @ 4514621
1 1 package com.lyms.platform.operate.web.controller;
2 2  
  3 +import com.lyms.platform.biz.service.BabyService;
3 4 import com.lyms.platform.common.annotation.TokenRequired;
4 5 import com.lyms.platform.common.base.BaseController;
5 6 import com.lyms.platform.common.base.LoginContext;
  7 +import com.lyms.platform.common.base.PageInfo;
6 8 import com.lyms.platform.common.constants.ErrorCodeConstants;
7 9 import com.lyms.platform.common.enums.ConfirmedEnums;
8 10 import com.lyms.platform.common.enums.HighRiskEnum;
  11 +import com.lyms.platform.common.enums.SexEnum;
9 12 import com.lyms.platform.common.result.BaseListResponse;
10 13 import com.lyms.platform.common.result.BaseResponse;
11 14 import com.lyms.platform.common.utils.DateUtil;
12 15 import com.lyms.platform.operate.web.facade.AutoMatchFacade;
13 16 import com.lyms.platform.operate.web.request.HearDiaManageRequest;
  17 +import com.lyms.platform.operate.web.result.HearDiagnManageListResult;
14 18 import com.lyms.platform.operate.web.result.HearingDiagnoseListResult;
15   -import com.lyms.platform.permission.model.BabyPatientExtendEarHearingDiagnose;
16   -import com.lyms.platform.permission.model.BabyPatientExtendEarHearingDiagnoseQuery;
17   -import com.lyms.platform.permission.model.Users;
  19 +import com.lyms.platform.permission.model.*;
18 20 import com.lyms.platform.permission.service.BabyPatientExtendEarHearingDiagnoseService;
  21 +import com.lyms.platform.permission.service.BabyPatientExtendEarScreenService;
  22 +import com.lyms.platform.permission.service.ChildrenPersonService;
19 23 import com.lyms.platform.permission.service.UsersService;
  24 +import com.lyms.platform.pojo.BabyModel;
  25 +import org.apache.commons.collections.CollectionUtils;
20 26 import org.apache.commons.lang.StringUtils;
21 27 import org.springframework.beans.factory.annotation.Autowired;
22 28 import org.springframework.stereotype.Controller;
... ... @@ -25,10 +31,7 @@
25 31 import org.springframework.web.bind.annotation.ResponseBody;
26 32  
27 33 import javax.servlet.http.HttpServletRequest;
28   -import java.util.ArrayList;
29   -import java.util.HashMap;
30   -import java.util.List;
31   -import java.util.Map;
  34 +import java.util.*;
32 35  
33 36 /**
34 37 * @auther yangfei
35 38  
... ... @@ -39,11 +42,19 @@
39 42 @RequestMapping("hearDiaManage")
40 43 public class HearDiagnManageController extends BaseController {
41 44 @Autowired
42   - private BabyPatientExtendEarHearingDiagnoseService hearingDiagnoseService;
43   - @Autowired
44 45 private AutoMatchFacade autoMatchFacade;
45 46 @Autowired
46 47 private UsersService usersService;
  48 + //听筛记录
  49 + @Autowired
  50 + private BabyPatientExtendEarScreenService screenService;
  51 + //儿童记录
  52 + @Autowired
  53 + private ChildrenPersonService childrenPersonService;
  54 + @Autowired
  55 + private BabyService babyService;
  56 + @Autowired
  57 + private BabyPatientExtendEarHearingDiagnoseService hearingDiagnoseService;
47 58  
48 59 /**
49 60 * 获取确诊儿童列表(听力诊断表,当前医院的确诊的数据)
50 61  
... ... @@ -109,13 +120,13 @@
109 120  
110 121 List<HearingDiagnoseListResult> hdList = new ArrayList<>();
111 122  
112   - for(BabyPatientExtendEarHearingDiagnose hd :hearingDiagnoseList ){
  123 + for (BabyPatientExtendEarHearingDiagnose hd : hearingDiagnoseList) {
113 124 HearingDiagnoseListResult hea = new HearingDiagnoseListResult();
114 125 hea.setIsconfirm(hd.getIsconfirm() == null ? "未确诊" : hd.getIsconfirm() == 0 ? "未确诊" : "已确诊");
115 126 hea.setId(hd.getId());
116 127 hea.setDiagnoseTime(DateUtil.getyyyy_MM_dd(hd.getDiagnoseTime()));
117 128 String docotorId = hd.getDiagnDoctorId();
118   - Users users = usersService.getUsers(Integer.parseInt(docotorId==null?"0":docotorId));
  129 + Users users = usersService.getUsers(Integer.parseInt(docotorId == null ? "0" : docotorId));
119 130 if (users != null) {
120 131 hea.setDoctorName(users.getName() == null ? "-" : users.getName());
121 132 }
... ... @@ -130,7 +141,7 @@
130 141 String title = HighRiskEnum.getTitle(Integer.parseInt(hf[b]));
131 142 map.put(Integer.parseInt(hf[b]), title);
132 143 // highRiskEnums.add(map);
133   - hrSb.append(title+",");
  144 + hrSb.append(title + ",");
134 145 }
135 146 }
136 147 // hea.setHighRiskEnums(highRiskEnums);
... ... @@ -147,7 +158,7 @@
147 158 String title = ConfirmedEnums.getTitle(Integer.parseInt(cr[b]));
148 159 map.put(Integer.parseInt(cr[b]), title);
149 160 // hdEnums.add(map);
150   - hdSb.append(title+",");
  161 + hdSb.append(title + ",");
151 162 }
152 163 }
153 164 // hea.setDiagnResult(hdEnums);
154 165  
... ... @@ -178,8 +189,119 @@
178 189 }
179 190 //当前登录人医院Id
180 191 String hospitalId = autoMatchFacade.getHospitalId(loginState.getId());
181   - return null;
182   - }
183 192  
  193 + ChildrenPersonQuery query = new ChildrenPersonQuery();
  194 + if (StringUtils.isNotEmpty(model.getKeyWord())) {//查询号不为空
  195 + query.setKeyWord(model.getKeyWord());
  196 + }
  197 +
  198 + if (model.getBirthStartTime() != null) {//儿童出生开始日期
  199 + query.setStartBirthday(model.getBirthStartTime());
  200 + }
  201 +
  202 + if (model.getBirthEndTime() != null) {//儿童出生结束日期
  203 + query.setEndBirthday(model.getBirthEndTime());
  204 + }
  205 + List<String> babyIds = new ArrayList<>();
  206 + List<ChildrenPerson> childrenPersonList = childrenPersonService.queryChildrenPerson(query);
  207 + if (CollectionUtils.isNotEmpty(childrenPersonList)) {
  208 + for (ChildrenPerson cp : childrenPersonList) {
  209 + //获取babyid,还未表还未增加
  210 + }
  211 + }
  212 +
  213 +
  214 + BabyPatientExtendEarScreenQuery screenQuery = new BabyPatientExtendEarScreenQuery();
  215 + //听筛开始时间
  216 + if (model.getSecrStartTime() != null) {
  217 + screenQuery.setScreenStartDate(model.getSecrStartTime());
  218 + }
  219 + //开始结束时间
  220 + if (model.getSecrEndTime() != null) {
  221 + screenQuery.setScreenEndDate(model.getSecrEndTime());
  222 + }
  223 + //检测医生ID
  224 + if (model.getDiagnDoctorId() != null) {
  225 + screenQuery.setCheckDoctorId(model.getDiagnDoctorId());
  226 + }
  227 + //查询全部数据
  228 + List<BabyPatientExtendEarScreen> earScreens = screenService.dubiousScreen(screenQuery);
  229 +
  230 + //已诊断数据
  231 + List<HearDiagnManageListResult> alrScreens = new ArrayList<>();
  232 + //未诊断数据
  233 + List<HearDiagnManageListResult> notScreens = new ArrayList<>();
  234 + //全部数据
  235 + List<HearDiagnManageListResult> hearDiagnManageListResults = new ArrayList<>();
  236 + //要返回的数据
  237 + List<HearDiagnManageListResult> hdmResult = new ArrayList<>();
  238 + if (CollectionUtils.isNotEmpty(earScreens)) {
  239 + for (BabyPatientExtendEarScreen es : earScreens) {
  240 + HearDiagnManageListResult hdm = new HearDiagnManageListResult();
  241 + hdm.setId(es.getId());
  242 + String docotorId = es.getCheckDoctorId();
  243 + Users users = usersService.getUsers(Integer.parseInt(docotorId == null ? "0" : docotorId));
  244 + if (users != null) {
  245 + hdm.setDoctorName(users.getName() == null ? "-" : users.getName());
  246 + }
  247 + hdm.setSecrTime(DateUtil.getyyyy_MM_dd(es.getScreenDate()));
  248 + BabyModel babyModel = babyService.getOneBabyById(es.getBabyId());
  249 + if (babyModel != null) {
  250 + hdm.setBabyName(babyModel.getName());
  251 + hdm.setBabyId(es.getBabyId());
  252 + hdm.setMommyName(com.lyms.platform.common.utils.StringUtils.emptyDeal(babyModel.getMname()));
  253 + hdm.setMommnyPhone(com.lyms.platform.common.utils.StringUtils.emptyDeal(babyModel.getMphone()));
  254 + hdm.setMommnyEncryptPhone(com.lyms.platform.common.utils.StringUtils.encryPhone(babyModel.getMphone()));
  255 + hdm.setMonthAge(DateUtil.getBabyMonthAge(babyModel.getBirth(), new Date()));
  256 + hdm.setBirthday(com.lyms.platform.common.utils.StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(babyModel.getBirth())));
  257 + hdm.setSex(com.lyms.platform.common.utils.StringUtils.emptyDeal(SexEnum.getTextById(babyModel.getSex())));
  258 + }
  259 + String babyId = es.getBabyId();
  260 + BabyPatientExtendEarHearingDiagnoseQuery hdQuery = new BabyPatientExtendEarHearingDiagnoseQuery();
  261 + hdQuery.setBabyId(babyId);
  262 + //根据babyId查询听力诊断,如果有数据则已诊断
  263 + int count = hearingDiagnoseService.queryBabyPatientExtendEarHearingDiagnoseCount(hdQuery);
  264 + if(count>0){//儿童在医院里做过听力诊断记录,标记为已诊断
  265 + hdm.setStatus("已诊断");
  266 + alrScreens.add(hdm);
  267 + }else{
  268 + hdm.setStatus("未诊断");
  269 + notScreens.add(hdm);
  270 + }
  271 + hearDiagnManageListResults.add(hdm);
  272 +
  273 + }
  274 + }else{
  275 + return new BaseResponse().setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("没有数据");
  276 + }
  277 + BaseListResponse result = new BaseListResponse();
  278 + PageInfo pageInfo = new PageInfo();
  279 + // 1-已诊断、2-待诊断、3-全部
  280 + if(model.getStatus() == 1){
  281 + for (int i = (model.getPage() - 1) * model.getLimit(); (i < alrScreens.size() && i < model.getLimit()); i++) {
  282 + hdmResult.add(alrScreens.get(i));
  283 + }
  284 + pageInfo.setCount(alrScreens.size());
  285 + result.setData(hdmResult);
  286 + }else if(model.getStatus() == 2){
  287 + for (int i = (model.getPage() - 1) * model.getLimit(); (i < notScreens.size() && i < model.getLimit()); i++) {
  288 + hdmResult.add(notScreens.get(i));
  289 + }
  290 + pageInfo.setCount(alrScreens.size());
  291 + result.setData(hdmResult);
  292 + }else{
  293 + for (int i = (model.getPage() - 1) * model.getLimit(); (i < hearDiagnManageListResults.size() && i < model.getLimit()); i++) {
  294 + hdmResult.add(notScreens.get(i));
  295 + }
  296 + pageInfo.setCount(alrScreens.size());
  297 + result.setData(hdmResult);
  298 + }
  299 +
  300 + pageInfo.setLimit(model.getLimit());
  301 + pageInfo.setPage(model.getPage());
  302 + result.setPageInfo(pageInfo);
  303 + result.setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("查询成功");
  304 + return result;
  305 + }
184 306 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/HearDiagnManageListResult.java View file @ 4514621
  1 +package com.lyms.platform.operate.web.result;
  2 +
  3 +/**
  4 + * @auther yangfei
  5 + * @createTime 2017年07月27日 17时23分
  6 + * @discription 听力可疑儿童返回信息
  7 + */
  8 +public class HearDiagnManageListResult {
  9 + //主键
  10 + private String id;
  11 + //儿童id
  12 + private String babyId;
  13 + //儿童名称
  14 + private String babyName;
  15 + //母亲姓名
  16 + private String mommyName;
  17 + //月龄
  18 + private String monthAge;
  19 + //出生日期
  20 + private String birthday;
  21 + //高危因素
  22 + private String highRiskEnums;
  23 + //筛查时间
  24 + private String secrTime;
  25 + //性别
  26 + private String sex;
  27 + //状态
  28 + private String status;
  29 + //医生名称
  30 + private String doctorName;
  31 + //母亲联系方式
  32 + private String mommnyPhone;
  33 + //母亲加密联系方式
  34 + private String mommnyEncryptPhone;
  35 +
  36 + public String getId() {
  37 + return id;
  38 + }
  39 +
  40 + public void setId(String id) {
  41 + this.id = id;
  42 + }
  43 +
  44 + public String getBabyId() {
  45 + return babyId;
  46 + }
  47 +
  48 + public void setBabyId(String babyId) {
  49 + this.babyId = babyId;
  50 + }
  51 +
  52 + public String getBabyName() {
  53 + return babyName;
  54 + }
  55 +
  56 + public void setBabyName(String babyName) {
  57 + this.babyName = babyName;
  58 + }
  59 +
  60 + public String getMommyName() {
  61 + return mommyName;
  62 + }
  63 +
  64 + public void setMommyName(String mommyName) {
  65 + this.mommyName = mommyName;
  66 + }
  67 +
  68 + public String getMonthAge() {
  69 + return monthAge;
  70 + }
  71 +
  72 + public void setMonthAge(String monthAge) {
  73 + this.monthAge = monthAge;
  74 + }
  75 +
  76 + public String getBirthday() {
  77 + return birthday;
  78 + }
  79 +
  80 + public void setBirthday(String birthday) {
  81 + this.birthday = birthday;
  82 + }
  83 +
  84 + public String getHighRiskEnums() {
  85 + return highRiskEnums;
  86 + }
  87 +
  88 + public void setHighRiskEnums(String highRiskEnums) {
  89 + this.highRiskEnums = highRiskEnums;
  90 + }
  91 +
  92 + public String getSecrTime() {
  93 + return secrTime;
  94 + }
  95 +
  96 + public void setSecrTime(String secrTime) {
  97 + this.secrTime = secrTime;
  98 + }
  99 +
  100 + public String getSex() {
  101 + return sex;
  102 + }
  103 +
  104 + public void setSex(String sex) {
  105 + this.sex = sex;
  106 + }
  107 +
  108 + public String getStatus() {
  109 + return status;
  110 + }
  111 +
  112 + public void setStatus(String status) {
  113 + this.status = status;
  114 + }
  115 +
  116 + public String getDoctorName() {
  117 + return doctorName;
  118 + }
  119 +
  120 + public void setDoctorName(String doctorName) {
  121 + this.doctorName = doctorName;
  122 + }
  123 +
  124 + public String getMommnyPhone() {
  125 + return mommnyPhone;
  126 + }
  127 +
  128 + public void setMommnyPhone(String mommnyPhone) {
  129 + this.mommnyPhone = mommnyPhone;
  130 + }
  131 +
  132 + public String getMommnyEncryptPhone() {
  133 + return mommnyEncryptPhone;
  134 + }
  135 +
  136 + public void setMommnyEncryptPhone(String mommnyEncryptPhone) {
  137 + this.mommnyEncryptPhone = mommnyEncryptPhone;
  138 + }
  139 +}