Commit 0a3cde6891597a1290c048ac4a623d19f3a8f7d9

Authored by yangfei
1 parent ec9ccaa075

开通VIP增值服务

Showing 4 changed files with 141 additions and 12 deletions

platform-operate-api/src/main/java/com/lyms/hospitalapi/llfy/LlfyHisService.java View file @ 0a3cde6
... ... @@ -2,11 +2,14 @@
2 2  
3 3 import com.lyms.hospitalapi.pojo.LcfyPatient;
4 4 import com.lyms.platform.pojo.Patients;
  5 +import org.apache.commons.collections.CollectionUtils;
  6 +import org.apache.commons.collections.map.HashedMap;
5 7 import org.apache.commons.dbutils.QueryRunner;
6 8 import org.apache.commons.dbutils.handlers.BeanListHandler;
7 9 import org.springframework.stereotype.Service;
8 10  
9 11 import java.sql.Connection;
  12 +import java.util.ArrayList;
10 13 import java.util.List;
11 14 import java.util.Map;
12 15  
13 16  
14 17  
15 18  
16 19  
... ... @@ -17,15 +20,24 @@
17 20 */
18 21 @Service("llfyHisService")
19 22 public class LlfyHisService {
20   - public Map<String,Object> getPatientInfo(Patients ps,String startDate,String endDate) {
  23 + public List<Map<String,Object>> getPatientInfo(Patients ps,String startDate,String endDate) {
21 24 Connection conn = com.lyms.hospitalapi.llfy.ConnTools.makeHisConnection();
22 25 QueryRunner queryRunner = new QueryRunner();
  26 + List<Map<String,Object>> resultList = new ArrayList<>();
  27 + Map<String,Object> map = new HashedMap();
23 28 try {
24 29 List<LcfyPatient> list = queryRunner.query(conn, "select 入院日期 as inHospDate,入院诊断 as inHospDiagn from fvw_住院病人档案 where (姓名= '"+ps.getUsername()+"' and 证件号 ='"+ps.getCardNo()+"') or (姓名='"+ps.getUsername()+"' and 手机号 ='"+ps.getPhone()+"') or (姓名='"+ps.getUsername()+"' and 就诊卡='"+ps.getVcCardNo()+"') and 入院日期 is not null and 入院日期 between '"+startDate+"' and '"+endDate+"'", new BeanListHandler<LcfyPatient>(LcfyPatient.class));
  30 + if(CollectionUtils.isNotEmpty(list)){
  31 + for(LcfyPatient lp:list){
  32 + map.put("inHospDate",lp.getInHospDate());
  33 + map.put("inHospDiagn",lp.getInHospDiagn());
  34 + resultList.add(map);
  35 + }
  36 + }
25 37 } catch (Exception e) {
26   -
  38 + e.printStackTrace();
27 39 }
28   - return null;
  40 + return resultList;
29 41 }
30 42 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientMarkHospServiceFacade.java View file @ 0a3cde6
... ... @@ -334,7 +334,10 @@
334 334 public void synUpdateHisData(PatientMarkHospital ps){
335 335 Patients patients = patientsService.findOnePatientById(ps.getPatientId());
336 336 if (null != patients) {
337   - llfyHisService.getPatientInfo(patients,DateUtil.getyyyy_MM_dd(ps.getMakeDate()),DateUtil.getyyyy_MM_dd(new Date()));
  337 + List<Map<String,Object>> makePatients = llfyHisService.getPatientInfo(patients,DateUtil.getyyyy_MM_dd(ps.getMakeDate()),DateUtil.getyyyy_MM_dd(new Date()));
  338 + if(ps.getHospitType()==null){
  339 +
  340 + }
338 341 }
339 342 }
340 343  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java View file @ 0a3cde6
1 1 package com.lyms.platform.operate.web.facade;
2 2  
  3 +import com.lyms.platform.biz.service.AntExRecordService;
  4 +import com.lyms.platform.biz.service.AntenatalExaminationService;
  5 +import com.lyms.platform.biz.service.CommonService;
3 6 import com.lyms.platform.biz.service.PatientsService;
4 7 import com.lyms.platform.common.constants.ErrorCodeConstants;
5 8 import com.lyms.platform.common.enums.PatientSerEnums;
6 9  
... ... @@ -16,7 +19,11 @@
16 19 import com.lyms.platform.permission.service.OrganizationService;
17 20 import com.lyms.platform.permission.service.PatientServiceService;
18 21 import com.lyms.platform.permission.service.UsersService;
  22 +import com.lyms.platform.pojo.AntExChuModel;
  23 +import com.lyms.platform.pojo.AntExRecordModel;
  24 +import com.lyms.platform.pojo.AntenatalExaminationModel;
19 25 import com.lyms.platform.pojo.Patients;
  26 +import com.lyms.platform.query.AntExRecordQuery;
20 27 import com.lyms.platform.query.PatientsQuery;
21 28 import org.apache.commons.collections.CollectionUtils;
22 29 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -42,6 +49,12 @@
42 49 private UsersService usersService;
43 50 @Autowired
44 51 private PatientsService patientsService;
  52 + @Autowired
  53 + private AntExRecordService recordService;
  54 + @Autowired
  55 + private CommonService commonService;
  56 + @Autowired
  57 + private AntenatalExaminationService antenatalExaminationService;
45 58  
46 59 public BaseResponse patientServiceInit() {
47 60 Map map = new HashMap();
... ... @@ -185,7 +198,7 @@
185 198 result.setId(ps.getId());
186 199 Patients patients = patientsService.findOnePatientById(ps.getParentid());
187 200 if (null != patients) {
188   - String weekDesc = DateUtil.getWeekDesc(patients.getLastMenses(),new Date());
  201 + String weekDesc = DateUtil.getWeekDesc(patients.getLastMenses(), new Date());
189 202 result.setcDueWeek(weekDesc);
190 203 if (null != patients.getDueStatus() && 1 == patients.getDueStatus())
191 204 result.setcDueWeek("终止妊娠");
... ... @@ -195,6 +208,15 @@
195 208 result.setAge(DateUtil.getAge(patients.getBirth()) + "岁");
196 209 result.setName(patients.getUsername());
197 210 }
  211 + AntExRecordQuery antExRecordQuery = new AntExRecordQuery();
  212 + antExRecordQuery.setParentId(ps.getParentid());
  213 + List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery);
  214 + if(CollectionUtils.isNotEmpty(antExRecordModelList)){
  215 + AntExRecordModel antExRecordModel = antExRecordModelList.get(0);
  216 + handleRisk(antExRecordModel,result);
  217 + result.setDueDate(DateUtil.getyyyy_MM_dd(antExRecordModel.getDueDate()));
  218 + }
  219 +
198 220 result.setParentid(ps.getParentid());
199 221 result.setCreateDate(DateUtil.getyyyy_MM_dd(ps.getCreateDate()));
200 222 result.setPid(ps.getPid());
201 223  
... ... @@ -206,9 +228,11 @@
206 228 result.setSerStatusStr(serStatus);
207 229 result.setSerDoct(ps.getSerDoct());
208 230 result.setStatus(ps.getStatus());
209   - result.setStatusStr(ps.getStatus()==1?"待领取":"已领取");
  231 + result.setStatusStr(ps.getStatus() == 1 ? "待领取" : "已领取");
210 232 result.setSerCode(ps.getSerCode());
211 233 result.setCreateUser(ps.getCreateUser());
  234 + result.setUpdateDate(DateUtil.getyyyy_MM_dd(ps.getUpdateDate()));
  235 +
212 236 Users users = usersService.getUsers(Integer.parseInt(ps.getSerDoct()));
213 237 if (users != null) {
214 238 result.setSerDoctStr(users.getName());
... ... @@ -228,6 +252,49 @@
228 252 }
229 253  
230 254 /**
  255 + * 处理高危
  256 + *
  257 + * @param e
  258 + * @param patientSerResult
  259 + */
  260 + private void handleRisk(AntExRecordModel e, PatientSerResult patientSerResult) {
  261 + if (StringUtils.isNotEmpty(e.getfId())) {
  262 + String risk = null;
  263 + if (e.getType() == 2) {
  264 + AntExChuModel model = antenatalExaminationService.findOne(e.getfId());
  265 + if (null != model) {
  266 + risk = model.getOtherHighRisk();
  267 + }
  268 + } else if (e.getType() == 1) {
  269 + AntenatalExaminationModel model = antenatalExaminationService.findOneById(e.getfId());
  270 + if (null != model) {
  271 + risk = model.getOtherRisk();
  272 + }
  273 + }
  274 + Map result = commonService.resolveOtherRisk(risk);
  275 + String name = null, level = null, score = null;
  276 + if (!result.isEmpty()) {
  277 + //高危因素名字
  278 + name = result.get("name").toString();
  279 + level = result.get("levelId").toString();
  280 + score = result.get("score").toString();
  281 +
  282 + if (org.apache.commons.lang.StringUtils.isNotEmpty(level) && !"null".equals(level)) {
  283 + e.gethLevel().add(level);
  284 + }
  285 + }
  286 + //高危因素
  287 + patientSerResult.setrLevel(commonService.findRiskLevel(e.gethLevel()));
  288 + String ri = commonService.resloveFactor(e.gethRisk());
  289 + if (ri.isEmpty()) {
  290 + ri = name;
  291 + } else if (StringUtils.isNotEmpty(name)) {
  292 + ri += "," + name;
  293 + }
  294 + patientSerResult.setRiskFactor(ri);
  295 + }
  296 + }
  297 + /**
231 298 * 根据条件查询开通服务记录
232 299 *
233 300 * @param serType 服务类型(1-高危精准指导、2-体重、3-血糖、4-血压、5-专家咨询)
234 301  
... ... @@ -286,14 +353,14 @@
286 353 PatientsQuery patientsQuery = new PatientsQuery();
287 354 List<Patients> patientses = null;
288 355 //根据查询号、当前孕周进行查询
289   - if (StringUtils.isNotEmpty(queryNo)||null != cDueWeekStart||null != cDueWeekEnd) {
  356 + if (StringUtils.isNotEmpty(queryNo) || null != cDueWeekStart || null != cDueWeekEnd) {
290 357 if (null != cDueWeekStart) {
291 358 patientsQuery.setLastMensesEnd(DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(cDueWeekStart * 7)));
292 359 }
293 360 if (null != cDueWeekEnd) {
294 361 patientsQuery.setLastMensesStart(DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(cDueWeekEnd * 7) - 6));
295 362 }
296   - if(StringUtils.isNotEmpty(queryNo)){
  363 + if (StringUtils.isNotEmpty(queryNo)) {
297 364 patientsQuery.setQueryNo(queryNo);
298 365 }
299 366 patientsQuery.setHospitalId(hospitalId);
... ... @@ -306,7 +373,7 @@
306 373 parentIds.add(pa.getId());
307 374 }
308 375 patientQuery.setParentIds((String[]) parentIds.toArray(new String[parentIds.size()]));
309   - } else if (StringUtils.isNotEmpty(queryNo)||null != cDueWeekStart||null != cDueWeekEnd) {
  376 + } else if (StringUtils.isNotEmpty(queryNo) || null != cDueWeekStart || null != cDueWeekEnd) {
310 377 return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(patientQuery.getPageInfo());
311 378 }
312 379  
313 380  
314 381  
... ... @@ -330,20 +397,20 @@
330 397 * 修改状态为领取
331 398 *
332 399 * @param psId 服务记录Id
333   - * @param id 用户id
  400 + * @param id 用户id
334 401 * @return
335 402 */
336 403 public BaseResponse receivePatientService(String psId, Integer id) {
337 404  
338 405 PatientService ps = patientServiceService.getPatientService(psId);
339   - if(ps==null){
  406 + if (ps == null) {
340 407 BaseResponse baseResponse = new BaseResponse();
341 408 baseResponse.setErrorcode(ErrorCodeConstants.NO_DATA);
342 409 baseResponse.setErrormsg("没有找到对应的数据");
343 410 return baseResponse;
344 411 }
345 412 //已经领取
346   - if(ps.getStatus()==2){
  413 + if (ps.getStatus() == 2) {
347 414 BaseResponse baseResponse = new BaseResponse();
348 415 baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
349 416 baseResponse.setErrormsg("已经领取,请勿重复领取");
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PatientSerResult.java View file @ 0a3cde6
1 1 package com.lyms.platform.operate.web.result;
2 2  
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
3 6 /**
4 7 * @auther yangfei
5 8 * @createTime 2017年09月11日 15时56分
... ... @@ -29,6 +32,14 @@
29 32 */
30 33 private String cDueWeek;
31 34 /**
  35 + * 预产期
  36 + */
  37 + private String dueDate;
  38 + //风险等级
  39 + private List<Map> rLevel;
  40 + //高危因素
  41 + private String riskFactor;
  42 + /**
32 43 * 服务类型(1-高危精准指导、2-体重、3-血糖、4-血压、5-专家咨询)
33 44 */
34 45 private Integer serType;
... ... @@ -50,6 +61,10 @@
50 61 */
51 62 private String createUser;
52 63 /**
  64 + * 修改时间
  65 + */
  66 + private String updateDate;
  67 + /**
53 68 * 开通医生名称
54 69 */
55 70 private String createUserStr;
56 71  
... ... @@ -77,12 +92,44 @@
77 92 */
78 93 private String backUser;
79 94  
  95 + public List<Map> getrLevel() {
  96 + return rLevel;
  97 + }
  98 +
  99 + public String getDueDate() {
  100 + return dueDate;
  101 + }
  102 +
  103 + public void setDueDate(String dueDate) {
  104 + this.dueDate = dueDate;
  105 + }
  106 +
  107 + public void setrLevel(List<Map> rLevel) {
  108 + this.rLevel = rLevel;
  109 + }
  110 +
  111 + public String getRiskFactor() {
  112 + return riskFactor;
  113 + }
  114 +
  115 + public void setRiskFactor(String riskFactor) {
  116 + this.riskFactor = riskFactor;
  117 + }
  118 +
80 119 public String getCreateUser() {
81 120 return createUser;
82 121 }
83 122  
84 123 public void setCreateUser(String createUser) {
85 124 this.createUser = createUser;
  125 + }
  126 +
  127 + public String getUpdateDate() {
  128 + return updateDate;
  129 + }
  130 +
  131 + public void setUpdateDate(String updateDate) {
  132 + this.updateDate = updateDate;
86 133 }
87 134  
88 135 public String getCreateUserStr() {