Commit 6d104f61222dfa10f706938ad878d8a3ee22be13

Authored by yangfei
1 parent 1d0023acc4

查询号bug修改

Showing 8 changed files with 432 additions and 8 deletions

platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java View file @ 6d104f6
... ... @@ -29,8 +29,35 @@
29 29 //大于修改时间
30 30 private Date gteModified;
31 31 private Date gteCreated;
  32 + private List<String> pids;
32 33 private String pid;
  34 + private Date checkTimeStart;
  35 + private Date checkTimeEnd;
33 36  
  37 + public List<String> getPids() {
  38 + return pids;
  39 + }
  40 +
  41 + public void setPids(List<String> pids) {
  42 + this.pids = pids;
  43 + }
  44 +
  45 + public Date getCheckTimeStart() {
  46 + return checkTimeStart;
  47 + }
  48 +
  49 + public void setCheckTimeStart(Date checkTimeStart) {
  50 + this.checkTimeStart = checkTimeStart;
  51 + }
  52 +
  53 + public Date getCheckTimeEnd() {
  54 + return checkTimeEnd;
  55 + }
  56 +
  57 + public void setCheckTimeEnd(Date checkTimeEnd) {
  58 + this.checkTimeEnd = checkTimeEnd;
  59 + }
  60 +
34 61 //医院id
35 62 private List<String> hospitalList;
36 63  
... ... @@ -143,6 +170,9 @@
143 170 }
144 171 if (null != pid) {
145 172 condition = condition.and("pid", pid, MongoOper.IS);
  173 + }
  174 + if(CollectionUtils.isNotEmpty(pids)){
  175 + condition = condition.and("pid", pids, MongoOper.IN);
146 176 }
147 177 if(CollectionUtils.isNotEmpty(hospitalList)){
148 178 condition = condition.and("hospitalId", hospitalList, MongoOper.IN);
platform-dal/src/main/java/com/lyms/platform/query/AntExQuery.java View file @ 6d104f6
... ... @@ -5,9 +5,11 @@
5 5 import com.lyms.platform.common.dao.operator.MongoCondition;
6 6 import com.lyms.platform.common.dao.operator.MongoOper;
7 7 import com.lyms.platform.common.dao.operator.MongoQuery;
  8 +import org.apache.commons.collections.CollectionUtils;
8 9 import org.springframework.data.mongodb.core.query.Criteria;
9 10  
10 11 import java.util.Date;
  12 +import java.util.List;
11 13  
12 14 /**
13 15 * 产前检查查询
... ... @@ -19,6 +21,7 @@
19 21 private Integer yn;
20 22 private String id;
21 23 private String pid;
  24 + private List<String> pids;
22 25 //创建时间
23 26 private Date start;
24 27  
... ... @@ -33,6 +36,14 @@
33 36  
34 37 private Date gteCreated;
35 38  
  39 + public List<String> getPids() {
  40 + return pids;
  41 + }
  42 +
  43 + public void setPids(List<String> pids) {
  44 + this.pids = pids;
  45 + }
  46 +
36 47 public Date getGteCreated() {
37 48 return gteCreated;
38 49 }
... ... @@ -108,6 +119,9 @@
108 119 }
109 120 if(null!=pid){
110 121 condition= condition.and("pid",pid, MongoOper.IS);
  122 + }
  123 + if(CollectionUtils.isNotEmpty(pids)){
  124 + condition = condition.and("pid", pids, MongoOper.IN);
111 125 }
112 126 if(null!=yn){
113 127 condition= condition.and("yn",yn, MongoOper.IS);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java View file @ 6d104f6
1 1 package com.lyms.platform.operate.web;
2 2  
  3 +import java.text.DecimalFormat;
  4 +
3 5 /**
4 6 * Created by Administrator on 2016/8/22 0022.
5 7 */
... ... @@ -12,11 +14,15 @@
12 14 // List<String> arrayList = new ArrayList<>();
13 15 // arrayList.add(3,"aaa");
14 16 // System.out.println(arrayList.size());
15   - String[] strs = new String[4];
16   - strs[0] = "111";
17   - strs[2] = "111";
18   - strs[3] = "111";
19   - strs[1] = "111";
  17 + // String[] strs = new String[4];
  18 + // strs[0] = "111";
  19 + // strs[2] = "111";
  20 + // strs[3] = "111";
  21 + // strs[1] = "111";
  22 + DecimalFormat df = new DecimalFormat("0.0");//格式化小数,不足的补0
  23 + String num = df.format((float)56/96*100);//返回的是String类型的
  24 +
  25 + System.out.println(num);
20 26  
21 27 // ConfirmedEnums [] strs = ConfirmedEnums.values();
22 28 // String vas = ConfirmedEnums.getTitle(1);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntexDoctorStatistController.java View file @ 6d104f6
  1 +package com.lyms.platform.operate.web.controller;
  2 +
  3 +import com.lyms.hospitalapi.pojo.ReportModel;
  4 +import com.lyms.platform.biz.service.AntenatalExaminationService;
  5 +import com.lyms.platform.biz.service.YunBookbuildingService;
  6 +import com.lyms.platform.common.annotation.TokenRequired;
  7 +import com.lyms.platform.common.base.BaseController;
  8 +import com.lyms.platform.common.base.LoginContext;
  9 +import com.lyms.platform.common.result.BaseObjectResponse;
  10 +import com.lyms.platform.common.utils.BeanUtils;
  11 +import com.lyms.platform.operate.web.facade.AutoMatchFacade;
  12 +import com.lyms.platform.operate.web.result.AntextDoctorPatient;
  13 +import com.lyms.platform.operate.web.result.AntextDoctorResult;
  14 +import com.lyms.platform.permission.model.Users;
  15 +import com.lyms.platform.permission.service.UsersService;
  16 +import com.lyms.platform.pojo.AntExChuModel;
  17 +import com.lyms.platform.pojo.AntenatalExaminationModel;
  18 +import com.lyms.platform.pojo.Patients;
  19 +import com.lyms.platform.query.AntExChuQuery;
  20 +import com.lyms.platform.query.AntExQuery;
  21 +import com.lyms.platform.query.PatientsQuery;
  22 +import org.apache.commons.collections.map.HashedMap;
  23 +import org.apache.commons.lang.StringUtils;
  24 +import org.springframework.beans.factory.annotation.Autowired;
  25 +import org.springframework.stereotype.Controller;
  26 +import org.springframework.web.bind.annotation.RequestMapping;
  27 +import org.springframework.web.bind.annotation.RequestMethod;
  28 +import org.springframework.web.bind.annotation.ResponseBody;
  29 +
  30 +import javax.servlet.http.HttpServletRequest;
  31 +import java.text.DecimalFormat;
  32 +import java.util.*;
  33 +
  34 +/**
  35 + * @auther yangfei
  36 + * @createTime 2017年07月05日 14时55分
  37 + * @discription 产检医生统计
  38 + */
  39 +@Controller
  40 +public class AntexDoctorStatistController extends BaseController {
  41 +
  42 + @Autowired
  43 + private AntenatalExaminationService antExService;
  44 + @Autowired
  45 + private AutoMatchFacade autoMatchFacade;
  46 + @Autowired
  47 + private YunBookbuildingService yunBookbuildingService;
  48 + @Autowired
  49 + private UsersService usersService;
  50 +
  51 + /**
  52 + * 产检医生统计
  53 + *
  54 + * @param startDate 建档开始时间
  55 + * @param endDate 建档结束时间
  56 + * @param childBirth 统计范围 1=孕妇 3=产妇 不传=全部
  57 + * @return
  58 + */
  59 + @RequestMapping(method = RequestMethod.GET,value = "/getDoctorStatic")
  60 + @ResponseBody
  61 + @TokenRequired
  62 + public BaseObjectResponse getDoctorStatic(Date startDate,Date endDate,int childBirth ,HttpServletRequest request){
  63 + BaseObjectResponse rest = new BaseObjectResponse();
  64 +
  65 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  66 + //根据当前登录人获取医院id
  67 + String hospital = autoMatchFacade.getHospitalId(loginState.getId());
  68 + PatientsQuery patientsQuery = new PatientsQuery();
  69 + //医院id
  70 + patientsQuery.setHospitalId(hospital);
  71 + if(startDate!=null){
  72 + //建档开始时间
  73 + patientsQuery.setBookbuildingDateStart(startDate);
  74 + }
  75 + if(endDate!=null){
  76 + //建档结束时间
  77 + patientsQuery.setBookbuildingDateEnd(endDate);
  78 + }
  79 + //有效
  80 + patientsQuery.setYn(1);
  81 + if(childBirth!=0){
  82 + patientsQuery.setType(childBirth);
  83 + }
  84 + //获取患者集合
  85 + List<Patients> patientss = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  86 + //患者id
  87 + List<String> pIds = new ArrayList<>();
  88 + for(Patients ps : patientss){
  89 + pIds.add(ps.getId());
  90 + }
  91 + //根据patientId集合查询产检表、产检复查表,获取医生id、patientId列表
  92 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  93 + //患者集合
  94 + antExChuQuery.setPids(pIds);
  95 + antExChuQuery.setYn(1);
  96 + antExChuQuery.setHospitalId(hospital);
  97 + //初诊集合列表
  98 + List<AntExChuModel> antExChuModels = antExService.queryAntExChu(antExChuQuery);
  99 + AntExQuery antExQuery = new AntExQuery();
  100 + antExQuery.setHospitalId(hospital);
  101 + antExQuery.setPids(pIds);
  102 + antExQuery.setYn(1);
  103 + //复诊集合列表
  104 + List<AntenatalExaminationModel> antenatalExaminationModels = antExService.queryAntenatalExamination(antExQuery.convertToQuery());
  105 +
  106 + List<AntextDoctorPatient> antextDoctorPatient = new ArrayList<>();
  107 + for(AntExChuModel ac : antExChuModels){
  108 + AntextDoctorPatient adp = new AntextDoctorPatient();
  109 + adp.setDoctorId(ac.getProdDoctor());
  110 + adp.setpId(ac.getPid());
  111 + antextDoctorPatient.add(adp);
  112 + }
  113 + for(AntenatalExaminationModel aec : antenatalExaminationModels){
  114 + AntextDoctorPatient adp = new AntextDoctorPatient();
  115 + adp.setDoctorId(aec.getCheckDoctor());
  116 + adp.setpId(aec.getPid());
  117 + antextDoctorPatient.add(adp);
  118 + }
  119 + Map<String,AntextDoctorResult> adr1 = new HashMap<>();
  120 + //医生ID+患者ID 用与医生对于产检人数 + 总人数:患者ID
  121 + Map<String,Integer> dpm = new HashMap<>();
  122 +
  123 + //产检总人数
  124 + int allCount = 0;
  125 + //产检总人次
  126 + int allCjrc = 0;
  127 + //产检两次及以上
  128 + int allDoub = 0;
  129 + //产检五次及以上;
  130 + int allFive = 0;
  131 +
  132 + for(AntextDoctorPatient adp : antextDoctorPatient){
  133 + if(!dpm.containsKey(adp.getpId())){
  134 + allCount++;
  135 + dpm.put(adp.getpId(),1);
  136 + }else{
  137 + Integer cjrc = dpm.get(adp.getpId());
  138 + cjrc++;
  139 + if(cjrc == 2){
  140 + allDoub++;
  141 + }
  142 + if(cjrc == 5){
  143 + allFive++;
  144 + }
  145 + dpm.put(adp.getpId(),cjrc);
  146 + }
  147 + allCjrc++;
  148 +
  149 + if(adr1.containsKey(adp.getDoctorId())){
  150 + AntextDoctorResult adr = adr1.get(adp.getDoctorId());
  151 + if(!dpm.containsKey(adp.getDoctorId()+adp.getpId())){//如果不存在,产检人数加1
  152 + adr.setInspectPeople(adr.getInspectPeople()+1);
  153 + dpm.put(adp.getDoctorId()+adp.getpId(),1);
  154 + }else{//如果存在,则检测测试加一
  155 + Integer num = dpm.get(adp.getDoctorId()+adp.getpId());
  156 + ++num;
  157 + if(num == 2){
  158 + adr.setTwice(adr.getTwice()+1);
  159 + }else if(num==5){
  160 + adr.setFiveTimes(adr.getFiveTimes()+1);
  161 + }
  162 + dpm.put(adp.getDoctorId()+adp.getpId(),num);
  163 + }
  164 + adr.setInspectTime(adr.getInspectTime()+1);
  165 + }else{
  166 + AntextDoctorResult adr = new AntextDoctorResult();
  167 + adr.setDoctorId(adp.getDoctorId());
  168 + adr.setInspectPeople(1);
  169 + adr.setInspectTime(1);
  170 + adr.setTwice(0);
  171 + adr.setFiveTimes(0);
  172 + adr.setTwiceProportion("");
  173 + adr.setFiveTimeProportion("");
  174 + adr1.put(adp.getDoctorId(),adr);
  175 + dpm.put(adp.getDoctorId()+adp.getpId(),1);
  176 + }
  177 + }
  178 +
  179 + List<Map<String,Object>> gridList = new ArrayList<>();
  180 + //存总计
  181 + gridList.add(new HashedMap());
  182 + //表表图数据
  183 + List<Object> doctorInfo = new ArrayList<>();
  184 +
  185 + for(Map.Entry<String,AntextDoctorResult> adr : adr1.entrySet()){
  186 + // System.out.println(adr.getValue().toString());
  187 + AntextDoctorResult ar = adr.getValue();
  188 +
  189 + if(StringUtils.isNotEmpty(ar.getDoctorId())){
  190 + Users users = usersService.getUsers(Integer.parseInt(ar.getDoctorId()));
  191 + if(users!=null){
  192 + ar.setDoctorName(users.getName());
  193 + }else{
  194 + ar.setDoctorName("产检医生");
  195 + }
  196 + }else{
  197 + ar.setDoctorName("产检医生");
  198 + }
  199 + if(ar.getTwice()>0){
  200 + DecimalFormat df = new DecimalFormat("0.0");//格式化小数,不足的补0
  201 + ar.setTwiceProportion(df.format((float)ar.getTwice()/ar.getInspectPeople()*100)+"%");
  202 + }
  203 + if(ar.getFiveTimes()>0){
  204 + DecimalFormat df = new DecimalFormat("0.0");//格式化小数,不足的补0
  205 + ar.setFiveTimeProportion(df.format((float)ar.getFiveTimes()/ar.getInspectPeople()*100)+"%");
  206 + }
  207 + gridList.add(BeanUtils.objectToObjectMap(ar));
  208 +
  209 + //柱状图图标数据
  210 + List<Object> doctorList = new ArrayList<>();
  211 + Map<String, Object> doctorMap = new HashMap<>();
  212 + doctorList.add(ar.getInspectPeople());
  213 + doctorList.add(ar.getTwice());
  214 + doctorList.add(ar.getFiveTimes());
  215 + doctorMap.put("name", ar.getDoctorName());
  216 + doctorMap.put("type", "bar");
  217 + doctorMap.put("data", doctorList);
  218 + doctorInfo.add(doctorMap);
  219 +
  220 + System.out.println(ar.toString());
  221 + }
  222 +
  223 + DecimalFormat df = new DecimalFormat("0.0");//格式化小数,不足的补0
  224 + String allDoubBl = "";
  225 + String allFiveBl = "";
  226 +
  227 + if(allDoub>0){
  228 + //两次比例
  229 + allDoubBl = df.format((float)allDoub/allCount*100)+"%";
  230 + }
  231 + if(allFive>0){
  232 + //五次比例
  233 + allFiveBl = df.format((float)allFive/allCount*100)+"%";
  234 + }
  235 +
  236 + System.out.println("总人数:"+allCount+",总人次:"+allCjrc+",总2次以上:"+allDoub+",总5次以上:"+allFive+",总两次比例:"+allDoubBl+",总五次比例:"+allFiveBl);
  237 +
  238 + //填充总计数据
  239 + Map<String,Object> allMap = gridList.get(0);
  240 + allMap.put("doctorName","总计");
  241 + allMap.put("inspectTime",allCjrc);
  242 + allMap.put("inspectPeople",allCount);
  243 + allMap.put("twice",allDoub);
  244 + allMap.put("twiceProportion",allDoubBl);
  245 + allMap.put("fiveTimes",allFive);
  246 + allMap.put("fiveTimeProportion",allFiveBl);
  247 +
  248 + ReportModel reportModel = new ReportModel();
  249 + reportModel.setDoctorInfo(doctorInfo); /** 医生数据详情 */
  250 + reportModel.setGrid(gridList); /** 表格数据 */
  251 + reportModel.setxAxis(Arrays.asList("产检人数", "两次(含)以上人数", "五次(含)以上人数"));
  252 + rest.setData(reportModel);
  253 + return rest;
  254 + }
  255 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/FollowUpController.java View file @ 6d104f6
... ... @@ -33,7 +33,7 @@
33 33 /**
34 34 * @auther yangfei
35 35 * @createTime 2017年05月09日 16时54分
36   - * @discription 跟踪相关接口
  36 + * @discription 随访相关接口
37 37 */
38 38 @Controller
39 39 @RequestMapping("followUp")
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HighriskChangeHospitalController.java View file @ 6d104f6
... ... @@ -34,7 +34,7 @@
34 34 /**
35 35 * @auther yangfei
36 36 * @createTime 2017年05月09日 16时54分
37   - * @discription 跟踪相关接口
  37 + * @discription 听力转诊相关接口
38 38 */
39 39 @Controller
40 40 @RequestMapping("highrChangeHosp")
... ... @@ -127,7 +127,7 @@
127 127 }
128 128  
129 129 /**
130   - * 获取听力转诊列表 分页
  130 + * 获取听力转诊详情
131 131 *
132 132 * @param chId 随访记录Id
133 133 * @param request
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/AntextDoctorPatient.java View file @ 6d104f6
  1 +package com.lyms.platform.operate.web.result;
  2 +
  3 +/**
  4 + * @auther yangfei
  5 + * @createTime 2017年07月05日 16时58分
  6 + * @discription
  7 + */
  8 +public class AntextDoctorPatient {
  9 + //医生ID
  10 + private String doctorId;
  11 + //患者ID
  12 + private String pId;
  13 +
  14 + public String getDoctorId() {
  15 + return doctorId;
  16 + }
  17 +
  18 + public void setDoctorId(String doctorId) {
  19 + this.doctorId = doctorId;
  20 + }
  21 +
  22 + public String getpId() {
  23 + return pId;
  24 + }
  25 +
  26 + public void setpId(String pId) {
  27 + this.pId = pId;
  28 + }
  29 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/AntextDoctorResult.java View file @ 6d104f6
  1 +package com.lyms.platform.operate.web.result;
  2 +
  3 +/**
  4 + * @auther yangfei
  5 + * @createTime 2017年07月05日 17时09分
  6 + * @discription
  7 + */
  8 +public class AntextDoctorResult {
  9 + //医生ID
  10 + public String doctorId;
  11 + //医生名称
  12 + public String doctorName;
  13 + //产检人次
  14 + public int inspectTime;
  15 + //产检人数
  16 + public int inspectPeople;
  17 + //两次含,以上人数
  18 + public int twice;
  19 + //两次含以上比例
  20 + public String twiceProportion;
  21 + //五次含,以上人数
  22 + public int fiveTimes;
  23 + //五次含以上比例
  24 + public String fiveTimeProportion;
  25 +
  26 + public String getDoctorId() {
  27 + return doctorId;
  28 + }
  29 +
  30 + public void setDoctorId(String doctorId) {
  31 + this.doctorId = doctorId;
  32 + }
  33 +
  34 + public String getDoctorName() {
  35 + return doctorName;
  36 + }
  37 +
  38 + public void setDoctorName(String doctorName) {
  39 + this.doctorName = doctorName;
  40 + }
  41 +
  42 + public int getInspectTime() {
  43 + return inspectTime;
  44 + }
  45 +
  46 + public void setInspectTime(int inspectTime) {
  47 + this.inspectTime = inspectTime;
  48 + }
  49 +
  50 + public int getInspectPeople() {
  51 + return inspectPeople;
  52 + }
  53 +
  54 + public void setInspectPeople(int inspectPeople) {
  55 + this.inspectPeople = inspectPeople;
  56 + }
  57 +
  58 + public int getTwice() {
  59 + return twice;
  60 + }
  61 +
  62 + public void setTwice(int twice) {
  63 + this.twice = twice;
  64 + }
  65 +
  66 + public String getTwiceProportion() {
  67 + return twiceProportion;
  68 + }
  69 +
  70 + public void setTwiceProportion(String twiceProportion) {
  71 + this.twiceProportion = twiceProportion;
  72 + }
  73 +
  74 + public int getFiveTimes() {
  75 + return fiveTimes;
  76 + }
  77 +
  78 + public void setFiveTimes(int fiveTimes) {
  79 + this.fiveTimes = fiveTimes;
  80 + }
  81 +
  82 + public String getFiveTimeProportion() {
  83 + return fiveTimeProportion;
  84 + }
  85 +
  86 + public void setFiveTimeProportion(String fiveTimeProportion) {
  87 + this.fiveTimeProportion = fiveTimeProportion;
  88 + }
  89 +
  90 +}