Commit 714fe7120a59a0d70caf6c990bcd47fd0b34fed5
1 parent
9b3abe45b6
Exists in
master
and in
2 other branches
威县统计功能开发
Showing 7 changed files with 260 additions and 10 deletions
- platform-biz-service/src/main/resources/mainOrm/master/HospitalCheckItemConf.xml
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatDeliverController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/WxStatisticsController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/WxStatisticsService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/WxStatisticsServiceImpl.java
- platform-operate-api/src/main/resources/spring/applicationContext-quartz.xml
platform-biz-service/src/main/resources/mainOrm/master/HospitalCheckItemConf.xml
View file @
714fe71
| ... | ... | @@ -36,17 +36,13 @@ | 
| 36 | 36 | <update id="updateHospitalCheckItemConf" parameterType="com.lyms.platform.pojo.HospitalCheckItemConf"> | 
| 37 | 37 | update hosptial_check_itme_conf | 
| 38 | 38 | <set> | 
| 39 | + need_check_item = #{needCheckItem,jdbcType=VARCHAR}, | |
| 40 | + backup_check_item = #{backupCheckItem,jdbcType=VARCHAR}, | |
| 39 | 41 | <if test="startWeek != null"> | 
| 40 | 42 | start_week = #{startWeek,jdbcType=INTEGER}, | 
| 41 | 43 | </if> | 
| 42 | 44 | <if test="endWeek != null"> | 
| 43 | 45 | end_week = #{endWeek,jdbcType=INTEGER}, | 
| 44 | - </if> | |
| 45 | - <if test="needCheckItem != null and needCheckItem != '' "> | |
| 46 | - need_check_item = #{needCheckItem,jdbcType=VARCHAR}, | |
| 47 | - </if> | |
| 48 | - <if test="backupCheckItem != null and needCheckItem != '' "> | |
| 49 | - backup_check_item = #{backupCheckItem,jdbcType=VARCHAR}, | |
| 50 | 46 | </if> | 
| 51 | 47 | <if test="yn != null "> | 
| 52 | 48 | yn = #{yn,jdbcType=INTEGER}, | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatDeliverController.java
View file @
714fe71
| ... | ... | @@ -195,9 +195,10 @@ | 
| 195 | 195 | String hospitalId = autoMatchFacade.getHospitalId(childbirthManagerRequest.getOperatorId()); | 
| 196 | 196 | |
| 197 | 197 | //威县数据流转 根据接诊医生查询 | 
| 198 | - if(OrganizationConstant.XT_WX.equals(hospitalId)){ | |
| 198 | + //又说去掉了 | |
| 199 | + /*if(OrganizationConstant.XT_WX.equals(hospitalId)){ | |
| 199 | 200 | childbirthManagerRequest.setDeliverDoctor(String.valueOf(childbirthManagerRequest.getOperatorId())); | 
| 200 | - } | |
| 201 | + }*/ | |
| 201 | 202 | |
| 202 | 203 | try { | 
| 203 | 204 | Map<String, String> query; | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/WxStatisticsController.java
View file @
714fe71
| 1 | +package com.lyms.platform.operate.web.controller; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.annotation.TokenRequired; | |
| 4 | +import com.lyms.platform.common.base.LoginContext; | |
| 5 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 6 | +import com.lyms.platform.common.result.BaseResponse; | |
| 7 | +import com.lyms.platform.common.utils.HttpRequest; | |
| 8 | +import com.lyms.platform.operate.web.service.WxStatisticsService; | |
| 9 | +import org.omg.PortableInterceptor.SUCCESSFUL; | |
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | +import org.springframework.stereotype.Controller; | |
| 12 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 13 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 14 | +import org.springframework.web.bind.annotation.ResponseBody; | |
| 15 | + | |
| 16 | +import javax.servlet.http.HttpServletRequest; | |
| 17 | +import java.util.HashMap; | |
| 18 | +import java.util.Map; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * 邢台威县统计Controller | |
| 22 | + */ | |
| 23 | +@Controller | |
| 24 | +@RequestMapping("/wxtj") | |
| 25 | +public class WxStatisticsController { | |
| 26 | + | |
| 27 | + | |
| 28 | + @Autowired | |
| 29 | + WxStatisticsService wxStatisticsService; | |
| 30 | + //@TokenRequired | |
| 31 | + @ResponseBody | |
| 32 | + @RequestMapping(value = "/zhuifang", method = RequestMethod.GET) | |
| 33 | + public BaseResponse statistics(HttpServletRequest httpServletRequest, Integer type, String startDate, String endDate){ | |
| 34 | + BaseResponse baseResponse = new BaseResponse(); | |
| 35 | + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 36 | + Integer userId = 1000000185;//((LoginContext) httpServletRequest.getAttribute("loginContext")).getId(); | |
| 37 | + Map<String,String> map = new HashMap<>(); | |
| 38 | + if(type == 1){ | |
| 39 | + map =wxStatisticsService.postReviewStatistic(startDate,endDate,userId); | |
| 40 | + }else if(type == 2){ | |
| 41 | + map = wxStatisticsService.matdeliverFollowStatistic(startDate,endDate,userId); | |
| 42 | + }else if(type == 3){ | |
| 43 | + map = wxStatisticsService.antexOverDateTraceDownStatistic(startDate,endDate,userId); | |
| 44 | + } | |
| 45 | + baseResponse.setObject(map); | |
| 46 | + | |
| 47 | + return baseResponse; | |
| 48 | + } | |
| 49 | +} | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java
View file @
714fe71
| ... | ... | @@ -991,7 +991,8 @@ | 
| 991 | 991 | for (TrackDownRecord downRecord : downRecordList) | 
| 992 | 992 | { | 
| 993 | 993 | downRecord.setOverTimes(downRecord.getOverTimes() == null ? 1 : downRecord.getOverTimes()+1); | 
| 994 | - downRecord.setNextCheckTime(DateUtil.addDay(time,7)); | |
| 994 | + //不能自动更新 cfl | |
| 995 | + //downRecord.setNextCheckTime(DateUtil.addDay(time,7)); | |
| 995 | 996 | trackDownRecordService.updateTrackDown(downRecord,downRecord.getId()); | 
| 996 | 997 | } | 
| 997 | 998 | } | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/WxStatisticsService.java
View file @
714fe71
| 1 | +package com.lyms.platform.operate.web.service; | |
| 2 | + | |
| 3 | +import java.util.Map; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * | |
| 7 | + */ | |
| 8 | +public interface WxStatisticsService { | |
| 9 | + /** | |
| 10 | + * 产后复查率统计 | |
| 11 | + * @param startDate | |
| 12 | + * @param endDate | |
| 13 | + * @param userId | |
| 14 | + * @return | |
| 15 | + */ | |
| 16 | + Map<String,String> postReviewStatistic(String startDate, String endDate, Integer userId); | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 产后访视率统计 | |
| 20 | + * @param startDate | |
| 21 | + * @param endDate | |
| 22 | + * @param userId | |
| 23 | + * @return | |
| 24 | + */ | |
| 25 | + Map<String,String> matdeliverFollowStatistic(String startDate, String endDate, Integer userId); | |
| 26 | + | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 产检追访率=产检逾期已追访人数/产检逾期总人数*100% | |
| 30 | + * @param startDate | |
| 31 | + * @param endDate | |
| 32 | + * @param userId | |
| 33 | + * @return | |
| 34 | + */ | |
| 35 | + Map<String,String> antexOverDateTraceDownStatistic(String startDate, String endDate, Integer userId); | |
| 36 | + | |
| 37 | +} | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/WxStatisticsServiceImpl.java
View file @
714fe71
| 1 | +package com.lyms.platform.operate.web.service.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.AntExRecordService; | |
| 4 | +import com.lyms.platform.biz.service.PatientsService; | |
| 5 | +import com.lyms.platform.biz.service.TrackDownRecordService; | |
| 6 | +import com.lyms.platform.biz.service.YunBookbuildingService; | |
| 7 | +import com.lyms.platform.common.enums.TrackDownDateEnums; | |
| 8 | +import com.lyms.platform.common.enums.TrackDownTypeEnums; | |
| 9 | +import com.lyms.platform.common.enums.YnEnums; | |
| 10 | +import com.lyms.platform.common.utils.DateUtil; | |
| 11 | +import com.lyms.platform.operate.web.facade.AutoMatchFacade; | |
| 12 | +import com.lyms.platform.operate.web.service.WxStatisticsService; | |
| 13 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
| 14 | +import com.lyms.platform.pojo.AntExRecordModel; | |
| 15 | +import com.lyms.platform.pojo.Patients; | |
| 16 | +import com.lyms.platform.pojo.TrackDown; | |
| 17 | +import com.lyms.platform.pojo.TrackDownRecord; | |
| 18 | +import com.lyms.platform.query.AntExRecordQuery; | |
| 19 | +import com.lyms.platform.query.PatientsQuery; | |
| 20 | +import com.lyms.platform.query.TrackDownRecordQuery; | |
| 21 | +import com.mongodb.DBCollection; | |
| 22 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 23 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
| 24 | +import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
| 25 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 26 | +import org.springframework.data.mongodb.core.query.Query; | |
| 27 | +import org.springframework.stereotype.Service; | |
| 28 | + | |
| 29 | +import java.util.*; | |
| 30 | + | |
| 31 | +@Service | |
| 32 | +public class WxStatisticsServiceImpl implements WxStatisticsService { | |
| 33 | + | |
| 34 | + @Autowired | |
| 35 | + private AutoMatchFacade autoMatchFacade; | |
| 36 | + | |
| 37 | + @Autowired | |
| 38 | + private YunBookbuildingService yunBookbuildingService; | |
| 39 | + | |
| 40 | + @Autowired | |
| 41 | + private PatientsService patientsService; | |
| 42 | + | |
| 43 | + @Autowired | |
| 44 | + private TrackDownRecordService trackDownRecordService; | |
| 45 | + | |
| 46 | + @Autowired | |
| 47 | + MongoTemplate mongoTemplate; | |
| 48 | + | |
| 49 | + @Override | |
| 50 | + public Map<String,String> postReviewStatistic(String startDate,String endDate,Integer userId) { | |
| 51 | + | |
| 52 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
| 53 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 54 | + patientsQuery.setFmDateStart(DateUtil.parseYMD(startDate)); | |
| 55 | + patientsQuery.setFmDateEnd(DateUtil.parseYMDEnd(endDate)); | |
| 56 | + patientsQuery.setHospitalId(hospital); | |
| 57 | + patientsQuery.setType(3); | |
| 58 | + patientsQuery.setIsAutoFm(YnEnums.NO.getId()); | |
| 59 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 60 | + List<Patients> patientss = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 61 | + | |
| 62 | + List<String> pids = new ArrayList<>(); | |
| 63 | + for(Patients p:patientss){ | |
| 64 | + pids.add(p.getId()); | |
| 65 | + } | |
| 66 | + | |
| 67 | + Query query = Query.query(Criteria.where("parentId").in(pids).andOperator(Criteria.where("yn").is(YnEnums.YES.getId()))); | |
| 68 | + //分娩人数 | |
| 69 | + long count = mongoTemplate.count(query, "lyms_matdeliver"); | |
| 70 | + | |
| 71 | + long fuchaCount = mongoTemplate.count(query, "lyms_postreview"); | |
| 72 | + | |
| 73 | + Map<String,String> returnMap = new HashMap<>(); | |
| 74 | + returnMap.put("fz",String.valueOf(fuchaCount)); | |
| 75 | + returnMap.put("fm",String.valueOf(count)); | |
| 76 | + returnMap.put("rate",count == 0 ?"--":(Math.round(fuchaCount*100/Double.valueOf(count))+"%")); | |
| 77 | + System.out.println("postReviewStatistic==="+count+"========"+fuchaCount); | |
| 78 | + return returnMap; | |
| 79 | + } | |
| 80 | + | |
| 81 | + @Override | |
| 82 | + public Map<String, String> matdeliverFollowStatistic(String startDate, String endDate, Integer userId) { | |
| 83 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
| 84 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 85 | + patientsQuery.setFmDateStart(DateUtil.parseYMD(startDate)); | |
| 86 | + patientsQuery.setFmDateEnd(DateUtil.parseYMDEnd(endDate)); | |
| 87 | + patientsQuery.setHospitalId(hospital); | |
| 88 | + patientsQuery.setType(3); | |
| 89 | + patientsQuery.setIsAutoFm(YnEnums.NO.getId()); | |
| 90 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 91 | + List<Patients> patientss = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 92 | + | |
| 93 | + List<String> pids = new ArrayList<>(); | |
| 94 | + for(Patients p:patientss){ | |
| 95 | + pids.add(p.getId()); | |
| 96 | + } | |
| 97 | + | |
| 98 | + Query query = Query.query(Criteria.where("parentId").in(pids).andOperator(Criteria.where("yn").is(YnEnums.YES.getId()))); | |
| 99 | + //分娩人数 | |
| 100 | + long count = mongoTemplate.count(query, "lyms_matdeliver"); | |
| 101 | + | |
| 102 | + | |
| 103 | + Query query1 = Query.query(Criteria.where("parentId").in(pids) | |
| 104 | + .andOperator(Criteria.where("visitStatus").is(2))); | |
| 105 | + query1.addCriteria(Criteria.where("yn").is(YnEnums.YES.getId())); | |
| 106 | + | |
| 107 | + long fuchaCount = mongoTemplate.count(query1, "lyms_matdeliver"); | |
| 108 | + | |
| 109 | + Map<String,String> returnMap = new HashMap<>(); | |
| 110 | + returnMap.put("fz",String.valueOf(fuchaCount)); | |
| 111 | + returnMap.put("fm",String.valueOf(count)); | |
| 112 | + returnMap.put("rate",count == 0 ?"--":(Math.round(fuchaCount*100/Double.valueOf(count))+"%")); | |
| 113 | + System.out.println(count+"========"+fuchaCount); | |
| 114 | + return returnMap; | |
| 115 | + } | |
| 116 | + | |
| 117 | + @Override | |
| 118 | + public Map<String, String> antexOverDateTraceDownStatistic(String startDate, String endDate, Integer userId) { | |
| 119 | + Map<String,String> returnMap = new HashMap<>(); | |
| 120 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
| 121 | + //查询这个时间段内的产检记录 | |
| 122 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 123 | + patientsQuery.setHospitalId(hospital); | |
| 124 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 125 | + patientsQuery.setBookbuildingDateStart(DateUtil.parseYMD(startDate)); | |
| 126 | + patientsQuery.setBookbuildingDateEnd(DateUtil.parseYMDEnd(endDate)); | |
| 127 | + List<Patients> patientses = patientsService.queryPatient(patientsQuery); | |
| 128 | + //这段时间无预约产检记录 | |
| 129 | + if(CollectionUtils.isEmpty(patientses)){ | |
| 130 | + returnMap.put("fz","0"); | |
| 131 | + returnMap.put("fm","0"); | |
| 132 | + returnMap.put("rate","--"); | |
| 133 | + return returnMap; | |
| 134 | + } | |
| 135 | + List<String> patientsIds = new ArrayList<>(); | |
| 136 | + for(Patients patients: patientses){ | |
| 137 | + patientsIds.add(patients.getId()); | |
| 138 | + } | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + Query query = Query.query(Criteria.where("parentId").in(patientsIds) | |
| 143 | + .andOperator(Criteria.where("trackType").is(TrackDownDateEnums.C.getId()))); | |
| 144 | + query.addCriteria(Criteria.where("overTimes").gte(1)); | |
| 145 | + | |
| 146 | + long fm = mongoTemplate.count(query, "lyms_trackdown_record"); | |
| 147 | + | |
| 148 | + Query query1 = Query.query(Criteria.where("parentId").in(patientsIds) | |
| 149 | + .andOperator(Criteria.where("trackDownDateType").is(TrackDownDateEnums.C.getId()))); | |
| 150 | + | |
| 151 | + List<TrackDown> trackDowns = mongoTemplate.find(query1, TrackDown.class); | |
| 152 | + Set<String> set= new HashSet<>(); | |
| 153 | + for(TrackDown td: trackDowns){ | |
| 154 | + set.add(td.getPid()); | |
| 155 | + } | |
| 156 | + long fz = set.size(); | |
| 157 | + | |
| 158 | + | |
| 159 | + returnMap.put("fz",String.valueOf(fz)); | |
| 160 | + returnMap.put("fm",String.valueOf(fm)); | |
| 161 | + returnMap.put("rate",fm == 0 ?"--":(Math.round(fz*100/Double.valueOf(fm))+"%")); | |
| 162 | + System.out.println(fz+"========"+fm); | |
| 163 | + return returnMap; | |
| 164 | + | |
| 165 | + } | |
| 166 | +} | 
platform-operate-api/src/main/resources/spring/applicationContext-quartz.xml
View file @
714fe71
| ... | ... | @@ -677,7 +677,7 @@ | 
| 677 | 677 | |
| 678 | 678 | <ref bean="autoGetSieveTrigger" /> | 
| 679 | 679 | <ref bean="genWeightTrigger" /> | 
| 680 | -<!-- <ref bean="handleTrackDownTrigger" />--> | |
| 680 | + <ref bean="handleTrackDownTrigger" /> | |
| 681 | 681 | |
| 682 | 682 | <!--<ref bean="patientRiskTrigger"/>--> | 
| 683 | 683 | <!--<ref bean="babyRiskTrigger"/>--> |