Commit 7c4b393dea632bac4a2aa7966098f89391595f48

Authored by yangfei
1 parent 4b4154cfc9

产检医生统计

Showing 1 changed file with 43 additions and 5 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntexDoctorStatistController.java View file @ 7c4b393
... ... @@ -87,7 +87,7 @@
87 87 }
88 88  
89 89 //获取患者信息
90   - List<AntextDoctorPatient> antextDoctorPatient = getPatientList(loginState.getId(), startDate, endDate, childBirth, doctorId, number);
  90 + List<AntextDoctorPatient> antextDoctorPatient = getPatientList(loginState.getId(), startDate, endDate, childBirth, doctorId);
91 91 //结果数据集合
92 92 Map<String, AntextDoctorPatient> resultInfo = new HashMap<>();
93 93  
... ... @@ -116,7 +116,7 @@
116 116 }
117 117 }
118 118 if (CollectionUtils.isNotEmpty(patientIds)) {
119   - getAllPatientList(patientIds, resultInfo);
  119 + getAllPatientList(patientIds, resultInfo,loginState.getId());
120 120 }
121 121  
122 122  
... ... @@ -169,7 +169,11 @@
169 169 }
170 170  
171 171 //获取患者全部检测数据
172   - public void getAllPatientList(List<String> patientId, Map<String, AntextDoctorPatient> resultInfo) {
  172 + public void getAllPatientList(List<String> patientId, Map<String, AntextDoctorPatient> resultInfo,Integer userId) {
  173 +
  174 + //根据当前登录人获取医院id
  175 + String hospital = autoMatchFacade.getHospitalId(userId);
  176 +
173 177 //根据patientId集合查询产检表、产检复查表,获取医生id、patientId列表
174 178 AntExChuQuery antExChuQuery = new AntExChuQuery();
175 179 //患者集合
176 180  
... ... @@ -194,9 +198,26 @@
194 198 }
195 199 doctorPatient.setCheckTimeStr(DateUtil.getyyyy_MM_dd(doctorPatient.getCheckTime()));
196 200 }
  201 +
  202 + //复诊:本院id+医生Id
  203 + Map<String,Integer> hostNum = new HashMap<>();
  204 +
197 205 //添加复诊结果
198 206 for (AntenatalExaminationModel aec : antenatalExaminationModels) {
199 207 AntextDoctorPatient doctorPatient = resultInfo.get(aec.getParentId());
  208 + if(aec.getHospitalId().equals(hospital)){//如果医院id相同,
  209 + if(hostNum.containsKey(aec.getId())){//则当次数大于已经记录次数时进行加加,同一医院只有一次初检,所以初检不做处理
  210 + int num = hostNum.get(aec.getId());
  211 + num++;
  212 + if(num>doctorPatient.getCjNum()){
  213 + doctorPatient.setCjNum(num);
  214 + }
  215 + hostNum.put(aec.getId(),num);
  216 + }else{
  217 + hostNum.put(aec.getId(),1);
  218 + }
  219 + }
  220 +
200 221 doctorPatient.setAllCjNum(doctorPatient.getAllCjNum() + 1);
201 222 if (aec.getCheckDate().after(doctorPatient.getCheckTime())) {
202 223 doctorPatient.setCheckTime(aec.getCheckDate());
... ... @@ -207,7 +228,7 @@
207 228 }
208 229  
209 230  
210   - public List<AntextDoctorPatient> getPatientList(Integer userId, Date startDate, Date endDate, Integer childBirth, String doctorId, Integer number) {
  231 + public List<AntextDoctorPatient> getPatientList(Integer userId, Date startDate, Date endDate, Integer childBirth, String doctorId) {
211 232  
212 233 //根据当前登录人获取医院id
213 234 String hospital = autoMatchFacade.getHospitalId(userId);
... ... @@ -293,6 +314,23 @@
293 314 adp.setDoctorId(aec.getCheckDoctor());
294 315 adp.setpId(aec.getParentId());
295 316 adp.setCheckTime(aec.getCheckDate());
  317 + Patients patients = patientsMap.get(aec.getParentId());
  318 + if (patients.getType() == 1) {//孕妇
  319 + //计算孕周
  320 + adp.setcDueWeek(com.lyms.platform.common.utils.StringUtils.dueWeek(DateUtil.daysBetween(patients.getLastMenses(), new Date())));
  321 + adp.setDueFmDate(patients.getDueDate());
  322 + adp.setDueFmDateStr(DateUtil.getyyyy_MM_dd(patients.getDueDate()));
  323 + } else if (patients.getType() == 3) {//3-产妇
  324 + adp.setcDueWeek("已分娩");
  325 + adp.setDueFmDate(patients.getFmDate());
  326 + adp.setDueFmDateStr(DateUtil.getyyyy_MM_dd(patients.getFmDate()));
  327 + }
  328 + adp.setpName(patients.getUsername());
  329 + //高危因数
  330 + adp.setRiskFactors(commonService.resloveFactor(patients.getRiskFactorId()));
  331 + //高危等级颜色
  332 + adp.setRiskLevelId(commonService.findRiskLevel(patients.getRiskLevelId()));
  333 +
296 334 antextDoctorPatient.add(adp);
297 335 }
298 336  
... ... @@ -317,7 +355,7 @@
317 355 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
318 356  
319 357 //获取患者信息
320   - List<AntextDoctorPatient> antextDoctorPatient = getPatientList(loginState.getId(), startDate, endDate, childBirth, null, null);
  358 + List<AntextDoctorPatient> antextDoctorPatient = getPatientList(loginState.getId(), startDate, endDate, childBirth, null);
321 359  
322 360 Map<String, AntextDoctorResult> adr1 = new HashMap<>();
323 361 //医生ID+患者ID 用与医生对于产检人数 + 总人数:患者ID