Commit 8de841ceb67ed28227065fc5bbcbda01180e584b
1 parent
26632d588c
Exists in
master
and in
8 other branches
增加统计
Showing 5 changed files with 106 additions and 70 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/AntExRecordModel.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsListResult.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java
View file @
8de841c
| ... | ... | @@ -108,10 +108,14 @@ |
| 108 | 108 | antExRecordModel.setPid(antEx.getPid()); |
| 109 | 109 | Patients patients = patientsService.findOnePatientById(antEx.getParentId()); |
| 110 | 110 | if (null != patients) { |
| 111 | - if (patients.getType() == 3 && patients.getFmDate() != null) { | |
| 111 | + if (patients.getType() == 1) { | |
| 112 | 112 | antExRecordModel.setStatus(1); |
| 113 | + }else{ | |
| 114 | + antExRecordModel.setStatus(2); | |
| 113 | 115 | } |
| 114 | 116 | antExRecordModel.setBrith(patients.getBirth()); |
| 117 | + antExRecordModel.setBuildTime(patients.getBookbuildingDate()); | |
| 118 | + antExRecordModel.setLastMenses(patients.getLastMenses()); | |
| 115 | 119 | antExRecordModel.setDueDate(patients.getDueDate()); |
| 116 | 120 | antExRecordModel.setName(patients.getUsername()); |
| 117 | 121 | antExRecordModel.sethScore(patients.getRiskScore()); |
| 118 | 122 | |
| ... | ... | @@ -135,7 +139,11 @@ |
| 135 | 139 | if (null != patients) { |
| 136 | 140 | if (patients.getType() == 1) { |
| 137 | 141 | antExRecordModel.setStatus(1); |
| 142 | + }else{ | |
| 143 | + antExRecordModel.setStatus(2); | |
| 138 | 144 | } |
| 145 | + antExRecordModel.setLastMenses(patients.getLastMenses()); | |
| 146 | + antExRecordModel.setBuildTime(patients.getBookbuildingDate()); | |
| 139 | 147 | antExRecordModel.setDueDate(patients.getDueDate()); |
| 140 | 148 | antExRecordModel.setBrith(patients.getBirth()); |
| 141 | 149 | antExRecordModel.setName(patients.getUsername()); |
platform-dal/src/main/java/com/lyms/platform/pojo/AntExRecordModel.java
View file @
8de841c
| ... | ... | @@ -40,6 +40,26 @@ |
| 40 | 40 | //风险因素 |
| 41 | 41 | private List hRisk; |
| 42 | 42 | private String pid; |
| 43 | + //建档时间 | |
| 44 | + private Date buildTime; | |
| 45 | + //末次月经 | |
| 46 | + private Date lastMenses; | |
| 47 | + | |
| 48 | + public Date getBuildTime() { | |
| 49 | + return buildTime; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public void setBuildTime(Date buildTime) { | |
| 53 | + this.buildTime = buildTime; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public Date getLastMenses() { | |
| 57 | + return lastMenses; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public void setLastMenses(Date lastMenses) { | |
| 61 | + this.lastMenses = lastMenses; | |
| 62 | + } | |
| 43 | 63 | |
| 44 | 64 | public String getPid() { |
| 45 | 65 | return pid; |
platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java
View file @
8de841c
| ... | ... | @@ -5,6 +5,7 @@ |
| 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 com.lyms.platform.common.utils.StringUtils; | |
| 8 | 9 | import org.springframework.data.mongodb.core.query.Criteria; |
| 9 | 10 | |
| 10 | 11 | import java.util.Date; |
| ... | ... | @@ -20,7 +21,8 @@ |
| 20 | 21 | //孕妇状态 |
| 21 | 22 | private Integer status; |
| 22 | 23 | private String levelId; |
| 23 | - | |
| 24 | + //产检医生id | |
| 25 | + private String cId; | |
| 24 | 26 | private Date buildTimeStart; |
| 25 | 27 | private Date buildTimeEnd; |
| 26 | 28 | private Date dueDateStart; |
| ... | ... | @@ -30,6 +32,14 @@ |
| 30 | 32 | private Date gteCreated; |
| 31 | 33 | private String pid; |
| 32 | 34 | |
| 35 | + public String getcId() { | |
| 36 | + return cId; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public void setcId(String cId) { | |
| 40 | + this.cId = cId; | |
| 41 | + } | |
| 42 | + | |
| 33 | 43 | public Integer getStatus() { |
| 34 | 44 | return status; |
| 35 | 45 | } |
| ... | ... | @@ -127,7 +137,9 @@ |
| 127 | 137 | if (null != id) { |
| 128 | 138 | condition = condition.and("id", id, MongoOper.IS); |
| 129 | 139 | } |
| 130 | - | |
| 140 | + if (StringUtils.isNotEmpty(levelId)) { | |
| 141 | + condition = condition.and("hLevel", levelId, MongoOper.IN); | |
| 142 | + } | |
| 131 | 143 | if (null != status) { |
| 132 | 144 | condition = condition.and("status", status, MongoOper.IS); |
| 133 | 145 | } |
| 134 | 146 | |
| 135 | 147 | |
| 136 | 148 | |
| 137 | 149 | |
| ... | ... | @@ -141,29 +153,23 @@ |
| 141 | 153 | |
| 142 | 154 | Criteria c = null; |
| 143 | 155 | if (null != buildTimeStart) { |
| 144 | - c = Criteria.where("checkTime").gte(buildTimeStart); | |
| 156 | + c = Criteria.where("buildTime").gte(buildTimeStart); | |
| 145 | 157 | } |
| 146 | 158 | |
| 147 | 159 | if (null != buildTimeEnd) { |
| 148 | 160 | if (null != c) { |
| 149 | 161 | c = c.lte(buildTimeEnd); |
| 150 | 162 | } else { |
| 151 | - c = Criteria.where("checkTime").lte(buildTimeEnd); | |
| 163 | + c = Criteria.where("buildTime").lte(buildTimeEnd); | |
| 152 | 164 | } |
| 153 | 165 | } |
| 154 | 166 | |
| 155 | 167 | if (null != dueDateStart && dueDateEnd != null) { |
| 156 | 168 | if (null != c) { |
| 157 | - c = c.where("nextCheckTime").gte(dueDateStart).lte(dueDateEnd); | |
| 169 | + c = c.where("dueDate").gte(dueDateStart).lte(dueDateEnd); | |
| 158 | 170 | } else { |
| 159 | - c = Criteria.where("nextCheckTime").gte(dueDateStart).lte(dueDateEnd); | |
| 171 | + c = Criteria.where("dueDate").gte(dueDateStart).lte(dueDateEnd); | |
| 160 | 172 | } |
| 161 | - } | |
| 162 | - | |
| 163 | - if (null != gteModified && null != gteCreated) { | |
| 164 | - MongoCondition mongoCondition = new MongoCondition("modified", gteModified, MongoOper.GTE); | |
| 165 | - MongoCondition condition2 = new MongoCondition("created", gteCreated, MongoOper.GTE); | |
| 166 | - condition = condition.orCondition(new MongoCondition[]{mongoCondition, condition2}); | |
| 167 | 173 | } |
| 168 | 174 | |
| 169 | 175 | if (null != c) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
View file @
8de841c
| ... | ... | @@ -54,41 +54,33 @@ |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * | |
| 58 | 57 | * 产检统计 |
| 59 | 58 | * |
| 60 | 59 | * @param userId |
| 61 | 60 | * @return |
| 62 | 61 | */ |
| 63 | - public BaseResponse queryStatis(Integer userId,CjStatisticsQueryRequest statisticsQueryRequest) { | |
| 62 | + public BaseResponse queryStatis(Integer userId, CjStatisticsQueryRequest statisticsQueryRequest) { | |
| 64 | 63 | BaseListResponse baseListResponse = new BaseListResponse(); |
| 65 | 64 | List data = new ArrayList<>(); |
| 66 | 65 | |
| 67 | 66 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
| 68 | - if(StringUtils.isEmpty(hospitalId)){ | |
| 67 | + if (StringUtils.isEmpty(hospitalId)) { | |
| 69 | 68 | baseListResponse.setErrormsg("获取医院id为空").setErrorcode(ErrorCodeConstants.SUCCESS); |
| 70 | 69 | return baseListResponse; |
| 71 | 70 | } |
| 72 | - | |
| 73 | - PatientsQuery patientsQuery1=new PatientsQuery(); | |
| 74 | - patientsQuery1.setLastCheckEId(true); | |
| 75 | - patientsQuery1.setHospitalId(hospitalId); | |
| 76 | - patientsQuery1.setYn(YnEnums.YES.getId()); | |
| 77 | - patientsQuery1.setNeed("1"); | |
| 78 | - patientsQuery1.setPage(statisticsQueryRequest.getPage()); | |
| 79 | - patientsQuery1.setLimit(statisticsQueryRequest.getLimit()); | |
| 80 | - patientsQuery1.setrLevel(statisticsQueryRequest.getLevelId()); | |
| 81 | - patientsQuery1.setLastCheckEmployeeId(statisticsQueryRequest.getdId()); | |
| 82 | - List buildType = new ArrayList(); | |
| 83 | - buildType.add(0); | |
| 84 | - buildType.add(2); | |
| 85 | - patientsQuery1.setBuildTypeList(buildType); | |
| 86 | - if(null!=statisticsQueryRequest.getStatus()){ | |
| 71 | + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
| 72 | +// PatientsQuery patientsQuery1=new PatientsQuery(); | |
| 73 | + antExRecordQuery.setHospitalId(hospitalId); | |
| 74 | + antExRecordQuery.setNeed("1"); | |
| 75 | + antExRecordQuery.setPage(statisticsQueryRequest.getPage()); | |
| 76 | + antExRecordQuery.setLimit(statisticsQueryRequest.getLimit()); | |
| 77 | + antExRecordQuery.setLevelId(statisticsQueryRequest.getLevelId()); | |
| 78 | + if (null != statisticsQueryRequest.getStatus()) { | |
| 87 | 79 | //1 |
| 88 | - if(1==statisticsQueryRequest.getStatus()){ | |
| 89 | - patientsQuery1.setType(3); | |
| 90 | - }else if(2==statisticsQueryRequest.getStatus()){ | |
| 91 | - patientsQuery1.setType(1); | |
| 80 | + if (1 == statisticsQueryRequest.getStatus()) { | |
| 81 | + antExRecordQuery.setStatus(1); | |
| 82 | + } else if (2 == statisticsQueryRequest.getStatus()) { | |
| 83 | + antExRecordQuery.setStatus(2); | |
| 92 | 84 | } |
| 93 | 85 | } |
| 94 | 86 | |
| 95 | 87 | |
| ... | ... | @@ -96,10 +88,9 @@ |
| 96 | 88 | if (org.apache.commons.lang.StringUtils.isNotEmpty(statisticsQueryRequest.getbTime())) { |
| 97 | 89 | String nextDateStr = statisticsQueryRequest.getbTime(); |
| 98 | 90 | String[] dates = nextDateStr.split(" - "); |
| 99 | - | |
| 100 | - patientsQuery1.setBookbuildingDateStart(DateUtil.parseYMD(dates[0])); | |
| 91 | + antExRecordQuery.setBuildTimeStart(DateUtil.parseYMD(dates[0])); | |
| 101 | 92 | if (dates.length == 2) { |
| 102 | - patientsQuery1.setBookbuildingDateEnd(DateUtil.parseYMD(dates[1])); | |
| 93 | + antExRecordQuery.setBuildTimeEnd(DateUtil.parseYMD(dates[1])); | |
| 103 | 94 | } |
| 104 | 95 | } |
| 105 | 96 | |
| 106 | 97 | |
| 107 | 98 | |
| 108 | 99 | |
| 109 | 100 | |
| ... | ... | @@ -107,24 +98,23 @@ |
| 107 | 98 | if (org.apache.commons.lang.StringUtils.isNotEmpty(statisticsQueryRequest.getDueDate())) { |
| 108 | 99 | String nextDateStr = statisticsQueryRequest.getDueDate(); |
| 109 | 100 | String[] dates = nextDateStr.split(" - "); |
| 110 | - | |
| 111 | - patientsQuery1.setDueDateStart(DateUtil.parseYMD(dates[0])); | |
| 101 | + antExRecordQuery.setDueDateStart(DateUtil.parseYMD(dates[0])); | |
| 112 | 102 | if (dates.length == 2) { |
| 113 | - patientsQuery1.setDueDateEnd(DateUtil.parseYMD(dates[1])); | |
| 103 | + antExRecordQuery.setDueDateEnd(DateUtil.parseYMD(dates[0])); | |
| 114 | 104 | } |
| 115 | 105 | } |
| 116 | 106 | |
| 117 | - if(statisticsQueryRequest.getType()==1){ | |
| 118 | - List<Patients> patientses= patientsService.queryPatient(patientsQuery1); | |
| 119 | - if(CollectionUtils.isNotEmpty(patientses)){ | |
| 120 | - for(Patients record:patientses){ | |
| 121 | - CjStatisticsListResult cjStatisticsListResult=new CjStatisticsListResult(); | |
| 107 | + if (statisticsQueryRequest.getType() == 1) { | |
| 108 | + List<AntExRecordModel> list2 = recordService.queryAntExRecords(antExRecordQuery); | |
| 109 | + if (CollectionUtils.isNotEmpty(list2)) { | |
| 110 | + for (AntExRecordModel record : list2) { | |
| 111 | + CjStatisticsListResult cjStatisticsListResult = new CjStatisticsListResult(); | |
| 122 | 112 | cjStatisticsListResult.convertToResult(record); |
| 123 | - Users users = usersService.getUsers(NumberUtils.toInt(record.getLastCheckEmployeeId())); | |
| 113 | + Users users = usersService.getUsers(NumberUtils.toInt(record.getCheckDoctor())); | |
| 124 | 114 | if (null != users) { |
| 125 | 115 | cjStatisticsListResult.setCheckDoctor(users.getName()); |
| 126 | 116 | } |
| 127 | - List<String> factor = record.getRiskFactorId(); | |
| 117 | + List<String> factor = record.gethRisk(); | |
| 128 | 118 | |
| 129 | 119 | if (CollectionUtils.isNotEmpty(factor)) { |
| 130 | 120 | StringBuilder sb = new StringBuilder(56); |
| 131 | 121 | |
| 132 | 122 | |
| 133 | 123 | |
| 134 | 124 | |
| 135 | 125 | |
| ... | ... | @@ -143,33 +133,31 @@ |
| 143 | 133 | } |
| 144 | 134 | } |
| 145 | 135 | List level = new ArrayList(); |
| 146 | - if (org.apache.commons.lang.StringUtils.isNotEmpty(record.getRiskLevelId())) { | |
| 147 | - try { | |
| 148 | - List<String> list = JsonUtil.jkstr2Obj(record.getRiskLevelId(), List.class); | |
| 149 | - for (String str : list) { | |
| 150 | - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(str); | |
| 151 | - if (null != basicConfig) { | |
| 152 | - Map map = new HashMap(); | |
| 153 | - String name = basicConfig.getName(); | |
| 154 | - if (name.indexOf("预警") > -1) { | |
| 155 | - name = name.replace("预警", ""); | |
| 156 | - } | |
| 157 | - map.put("name",name); | |
| 158 | - map.put("color", "risk_" + RiskDefaultTypeEnum.getColor(name)); | |
| 159 | - level.add(map); | |
| 136 | + try { | |
| 137 | + for (Object str : record.gethLevel()) { | |
| 138 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(str.toString()); | |
| 139 | + if (null != basicConfig) { | |
| 140 | + Map map = new HashMap(); | |
| 141 | + String name = basicConfig.getName(); | |
| 142 | + if (name.indexOf("预警") > -1) { | |
| 143 | + name = name.replace("预警", ""); | |
| 160 | 144 | } |
| 145 | + map.put("name", name); | |
| 146 | + map.put("color", "risk_" + RiskDefaultTypeEnum.getColor(name)); | |
| 147 | + level.add(map); | |
| 161 | 148 | } |
| 162 | - } catch (Exception e) { | |
| 163 | - ExceptionUtils.catchException(e, "patients.getRiskLevelId error."); | |
| 164 | 149 | } |
| 165 | - cjStatisticsListResult.setrLevel(HighScoreResult.filter(level)); | |
| 166 | -// cjStatisticsListResult.setrLevel(HighScoreResult.getLevelStr(HighScoreResult.filter(level))); | |
| 150 | + } catch (Exception e) { | |
| 151 | + ExceptionUtils.catchException(e, "patients.getRiskLevelId error."); | |
| 167 | 152 | } |
| 153 | + cjStatisticsListResult.setrLevel(HighScoreResult.filter(level)); | |
| 168 | 154 | data.add(cjStatisticsListResult); |
| 169 | 155 | } |
| 170 | 156 | } |
| 171 | - }else { | |
| 172 | - List<HashMap> list = patientsService.aggregateOne(patientsQuery1); | |
| 157 | + } else { | |
| 158 | +// List<HashMap> list = patientsService.aggregateOne(patientsQuery1); | |
| 159 | + | |
| 160 | + List<HashMap> list = recordService.aggregateOne(antExRecordQuery); | |
| 173 | 161 | for (HashMap map : list) { |
| 174 | 162 | CjStatisticsResult cjStatisticsResult = new CjStatisticsResult(); |
| 175 | 163 | String dId = map.get("_id").toString(); |
| 176 | 164 | |
| ... | ... | @@ -184,9 +172,9 @@ |
| 184 | 172 | } |
| 185 | 173 | data.add(cjStatisticsResult); |
| 186 | 174 | } |
| 187 | - Collections.sort(data,new CjStatisticsResult()); | |
| 175 | + Collections.sort(data, new CjStatisticsResult()); | |
| 188 | 176 | } |
| 189 | - return baseListResponse.setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(patientsQuery1.getPageInfo()); | |
| 177 | + return baseListResponse.setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(antExRecordQuery.getPageInfo()); | |
| 190 | 178 | } |
| 191 | 179 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsListResult.java
View file @
8de841c
| ... | ... | @@ -48,6 +48,20 @@ |
| 48 | 48 | setType(record.getType()); |
| 49 | 49 | return this; |
| 50 | 50 | } |
| 51 | + public CjStatisticsListResult convertToResult(AntExRecordModel record) { | |
| 52 | + setDueDate(DateUtil.getyyyy_MM_dd(record.getDueDate())); | |
| 53 | + if(null!=record.getLastMenses()){ | |
| 54 | + int days= DateUtil.daysBetween(record.getLastMenses(),new Date()); | |
| 55 | + this.dueWeek= StringUtils.dueWeek(days); | |
| 56 | + } | |
| 57 | + setId(record.getId()); | |
| 58 | + setName(record.getName()); | |
| 59 | + setPid(record.getPid()); | |
| 60 | + setScore(record.gethScore()); | |
| 61 | + setType(record.getType()); | |
| 62 | + return this; | |
| 63 | + } | |
| 64 | + | |
| 51 | 65 | public String getId() { |
| 52 | 66 | return id; |
| 53 | 67 | } |