Commit f9e2a4ddfe0dac6707a3bfe64476209b2925b1fb

Authored by cfl
1 parent e62c2bda46
Exists in dev

小程序登录返回是否孕妇标志

Showing 2 changed files with 48 additions and 1 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java View file @ f9e2a4d
... ... @@ -420,10 +420,30 @@
420 420 lymsPatientService.saveOrUpdate(patient2);
421 421 }
422 422  
  423 + //确定patient后查询病例信息
  424 + LymsPcase pcase=new LymsPcase();
  425 + pcase.setPid(patient2.getId());
  426 + List<LymsPcase> pcases = lymsPcaseService.list(Wrappers.query(pcase));
  427 + //判断是否孕妇
  428 + int flag = 0;
  429 + for(LymsPcase pcase1 : pcases){
  430 + LymsIllness illness = new LymsIllness();
  431 + illness.setPcid(pcase1.getPcid());
  432 + List<LymsIllness> illnesses= lymsIllnessService.list(Wrappers.query(illness));
  433 + for(LymsIllness illness1 : illnesses){
  434 + if(CommonUtil.isPregnantByIllName(illness1.getIname())){
  435 + flag = 1;
  436 + }
  437 + }
  438 +
  439 + }
  440 +
  441 +
423 442 patient.setPpasswd(null);
424 443 map.put("patient", patient2);
425 444 map.put("token", jwt);
426   - map.put("pcaseSize", pcaseSize);
  445 + map.put("pcaseSize", pcases.size());
  446 + map.put("isPregnant",flag);
427 447 baseResponse.setErrorcode(0);
428 448 baseResponse.setObject(map);
429 449 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/CommonUtil.java View file @ f9e2a4d
  1 +package com.lyms.talkonlineweb.util;
  2 +
  3 +import java.util.regex.Matcher;
  4 +import java.util.regex.Pattern;
  5 +
  6 +public class CommonUtil {
  7 +
  8 + static String regex = "孕\\d{1,2}周|已分娩";
  9 + /**
  10 + * 通过病名判断是否是孕妇
  11 + * @param illName
  12 + * @return
  13 + */
  14 + public static boolean isPregnantByIllName(String illName){
  15 + Pattern pattern = Pattern.compile(regex);
  16 + Matcher matcher = pattern.matcher(illName);
  17 + if(matcher.find()){
  18 + return true;
  19 + }
  20 + return false;
  21 + }
  22 +
  23 + public static void main(String[] args) {
  24 + System.out.println(isPregnantByIllName("孕,高血压"));
  25 + }
  26 +
  27 +}