Commit d2ddff5d646969a0ede44add5786312c6d79a29d
1 parent
1392e76274
Exists in
master
and in
1 other branch
增加统计
Showing 17 changed files with 1213 additions and 13 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IAntExRecordDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntExRecordDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
- platform-common/src/main/java/com/lyms/platform/common/dao/operator/MongoQuery.java
- platform-dal/src/main/java/com/lyms/platform/pojo/AntExRecordModel.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StatisticsController.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/request/BasePageQueryRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/CjStatisticsQueryRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsListResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/HighScoreResult.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IAntExRecordDao.java
View file @
d2ddff5
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | +import com.lyms.platform.pojo.AntExRecordModel; | |
| 5 | + | |
| 6 | +import java.util.HashMap; | |
| 7 | +import java.util.List; | |
| 8 | +import java.util.Map; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 产检管理接口 | |
| 12 | + * <p/> | |
| 13 | + * Created by Administrator on 2016/11/28 0028. | |
| 14 | + */ | |
| 15 | +public interface IAntExRecordDao { | |
| 16 | + | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 增加一条记录 | |
| 20 | + * | |
| 21 | + * @return | |
| 22 | + */ | |
| 23 | + AntExRecordModel addOneRecord(AntExRecordModel record); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 批量增加记录 | |
| 27 | + * | |
| 28 | + * @param list | |
| 29 | + */ | |
| 30 | + void batchAddRecord(List<AntExRecordModel> list); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 查询符合条件的产检 | |
| 34 | + * | |
| 35 | + * @param mongoQuery | |
| 36 | + * @return | |
| 37 | + */ | |
| 38 | + List<AntExRecordModel> queryRecord(MongoQuery mongoQuery); | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 根据id删除数据 | |
| 42 | + * | |
| 43 | + * @param id | |
| 44 | + */ | |
| 45 | + void deleteById(String id); | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 获取单挑记录详情 | |
| 49 | + * | |
| 50 | + * @param id | |
| 51 | + */ | |
| 52 | + AntExRecordModel findOneById(String id); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 修改单挑记录 | |
| 56 | + */ | |
| 57 | + void updateOneRecord(AntExRecordModel record, String id); | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 批量修改数据 | |
| 61 | + */ | |
| 62 | + void batchUpdateRecord(AntExRecordModel record, MongoQuery mongoQuery); | |
| 63 | + | |
| 64 | + Integer count(MongoQuery mongoQuery); | |
| 65 | + | |
| 66 | + List<HashMap> aggregateOne(MongoQuery mongoQuery); | |
| 67 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java
View file @
d2ddff5
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | import com.lyms.platform.pojo.Patients; |
| 6 | 6 | import com.lyms.platform.pojo.PuerperaModel; |
| 7 | 7 | |
| 8 | +import java.util.HashMap; | |
| 8 | 9 | import java.util.List; |
| 9 | 10 | |
| 10 | 11 | /** |
| ... | ... | @@ -32,5 +33,7 @@ |
| 32 | 33 | void findAndModify(MongoQuery query,Patients obj); |
| 33 | 34 | |
| 34 | 35 | void updatePatientOneCol(String id, String colName, Object colValue); |
| 36 | + | |
| 37 | + List<HashMap> aggregateOne(MongoQuery mongoQuery); | |
| 35 | 38 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntExRecordDaoImpl.java
View file @
d2ddff5
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IAntExRecordDao; | |
| 4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import com.lyms.platform.common.utils.StringUtils; | |
| 9 | +import com.lyms.platform.pojo.AntExRecordModel; | |
| 10 | +import com.lyms.platform.pojo.BabyCheckModel; | |
| 11 | +import com.lyms.platform.query.AntExRecordQuery; | |
| 12 | +import com.mongodb.DBCollection; | |
| 13 | +import com.mongodb.DBObject; | |
| 14 | +import com.mongodb.MapReduceCommand; | |
| 15 | +import com.mongodb.MapReduceOutput; | |
| 16 | +import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
| 17 | +import org.springframework.data.mongodb.core.aggregation.AggregationOperation; | |
| 18 | +import org.springframework.data.mongodb.core.aggregation.AggregationResults; | |
| 19 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 20 | +import org.springframework.stereotype.Repository; | |
| 21 | + | |
| 22 | +import java.util.ArrayList; | |
| 23 | +import java.util.HashMap; | |
| 24 | +import java.util.List; | |
| 25 | +import java.util.Map; | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * 产检管理接口 | |
| 29 | + * <p/> | |
| 30 | + * <p/> | |
| 31 | + * Created by Administrator on 2016/11/28 0028. | |
| 32 | + */ | |
| 33 | +@Repository("antExRecordDao") | |
| 34 | +public class AntExRecordDaoImpl extends BaseMongoDAOImpl<AntExRecordModel> implements IAntExRecordDao { | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 统计单个医院的产检情况 | |
| 38 | + * | |
| 39 | + * @param mongoQuery | |
| 40 | + * @return | |
| 41 | + */ | |
| 42 | + public List<HashMap> aggregateOne(MongoQuery mongoQuery){ | |
| 43 | + AggregationOperation match = Aggregation.match(/*Criteria.where("hospitalId").is(hospitalId)*/mongoQuery.getCriteria()); | |
| 44 | + AggregationOperation group = Aggregation.group("checkDoctor").count().as("count"); | |
| 45 | + | |
| 46 | + Aggregation aggregation= Aggregation.newAggregation(match, group); | |
| 47 | + | |
| 48 | + AggregationResults<HashMap> result = mongoTemplate.aggregate(aggregation,"lyms_antexrecord", HashMap.class); | |
| 49 | + return result.getMappedResults(); | |
| 50 | + } | |
| 51 | + | |
| 52 | + public void batchAddRecord(List<AntExRecordModel> list){ | |
| 53 | + batchSave(list); | |
| 54 | + } | |
| 55 | + | |
| 56 | + public AntExRecordModel addOneRecord(AntExRecordModel record){ | |
| 57 | + return save(record); | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * 查询符合条件的产检 | |
| 62 | + * | |
| 63 | + * @param mongoQuery | |
| 64 | + * @return | |
| 65 | + */ | |
| 66 | + public List<AntExRecordModel> queryRecord(MongoQuery mongoQuery) { | |
| 67 | + return find(mongoQuery.convertToMongoQuery()); | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 根据id删除数据 | |
| 72 | + * | |
| 73 | + * @param id | |
| 74 | + */ | |
| 75 | + public void deleteById(String id) { | |
| 76 | + delete(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery()); | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 获取单挑记录详情 | |
| 81 | + * | |
| 82 | + * @param id | |
| 83 | + */ | |
| 84 | + public AntExRecordModel findOneById(String id) { | |
| 85 | + return super.findById(id); | |
| 86 | + } | |
| 87 | + | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * 修改单挑记录 | |
| 91 | + */ | |
| 92 | + public void updateOneRecord(AntExRecordModel record, String id) { | |
| 93 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), record); | |
| 94 | + } | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * 批量修改数据 | |
| 98 | + */ | |
| 99 | + public void batchUpdateRecord(AntExRecordModel record, MongoQuery mongoQuery) { | |
| 100 | + updateMulti(mongoQuery.convertToMongoQuery(), record); | |
| 101 | + } | |
| 102 | + public Integer count(MongoQuery mongoQuery){ | |
| 103 | + return (int)count(mongoQuery.convertToMongoQuery()); | |
| 104 | + } | |
| 105 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java
View file @
d2ddff5
| ... | ... | @@ -19,12 +19,13 @@ |
| 19 | 19 | import org.springframework.data.mongodb.core.query.Update; |
| 20 | 20 | import org.springframework.stereotype.Repository; |
| 21 | 21 | |
| 22 | +import java.util.HashMap; | |
| 22 | 23 | import java.util.List; |
| 23 | 24 | |
| 24 | 25 | /** |
| 25 | 26 | * 患者模型 |
| 26 | - * <p> | |
| 27 | - * <p> | |
| 27 | + * <p/> | |
| 28 | + * <p/> | |
| 28 | 29 | * Created by Administrator on 2016/4/22 0022. |
| 29 | 30 | */ |
| 30 | 31 | @Repository("patientDao") |
| ... | ... | @@ -33,8 +34,9 @@ |
| 33 | 34 | public Patients addPatient(Patients obj) { |
| 34 | 35 | return save(obj); |
| 35 | 36 | } |
| 36 | - public void findAndModify(MongoQuery query,Patients obj){ | |
| 37 | - updateMulti(query.convertToMongoQuery(),obj); | |
| 37 | + | |
| 38 | + public void findAndModify(MongoQuery query, Patients obj) { | |
| 39 | + updateMulti(query.convertToMongoQuery(), obj); | |
| 38 | 40 | } |
| 39 | 41 | |
| 40 | 42 | @Override |
| 41 | 43 | |
| ... | ... | @@ -78,9 +80,9 @@ |
| 78 | 80 | @Override |
| 79 | 81 | public Patients findLastBuildRecord(String pid, int yn) { |
| 80 | 82 | AggregationOperation match = Aggregation.match(Criteria.where("pid").is(pid).and("yn").is(yn)); |
| 81 | - AggregationOperation group = Aggregation.group("_id","pid","dueDate").max("modified").as("modified"); | |
| 83 | + AggregationOperation group = Aggregation.group("_id", "pid", "dueDate").max("modified").as("modified"); | |
| 82 | 84 | AggregationOperation fields = Aggregation.project("_id", "pid", "dueDate"); |
| 83 | - Aggregation aggregation = Aggregation.newAggregation(match, group,fields); | |
| 85 | + Aggregation aggregation = Aggregation.newAggregation(match, group, fields); | |
| 84 | 86 | AggregationResults<Patients> result = this.mongoTemplate.aggregate(aggregation, "lyms_patient", Patients.class); |
| 85 | 87 | return result.getMappedResults().size() > 0 ? result.getMappedResults().get(0) : null; |
| 86 | 88 | } |
| ... | ... | @@ -88,6 +90,16 @@ |
| 88 | 90 | @Override |
| 89 | 91 | public void updatePatientByPid(Patients obj, String pid) { |
| 90 | 92 | update(new MongoQuery(new MongoCondition("pid", pid, MongoOper.IS)).convertToMongoQuery(), obj); |
| 93 | + } | |
| 94 | + | |
| 95 | + public List<HashMap> aggregateOne(MongoQuery mongoQuery) { | |
| 96 | + AggregationOperation match = Aggregation.match(mongoQuery.getCriteria()); | |
| 97 | + AggregationOperation group = Aggregation.group("lastCheckEmployeeId").count().as("count"); | |
| 98 | + | |
| 99 | + Aggregation aggregation = Aggregation.newAggregation(match, group); | |
| 100 | + | |
| 101 | + AggregationResults<HashMap> result = mongoTemplate.aggregate(aggregation, "lyms_patient", HashMap.class); | |
| 102 | + return result.getMappedResults(); | |
| 91 | 103 | } |
| 92 | 104 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java
View file @
d2ddff5
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IAntExRecordDao; | |
| 4 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 5 | +import com.lyms.platform.common.enums.YnEnums; | |
| 6 | +import com.lyms.platform.common.utils.JsonUtil; | |
| 7 | +import com.lyms.platform.pojo.AntExChuModel; | |
| 8 | +import com.lyms.platform.pojo.AntExRecordModel; | |
| 9 | +import com.lyms.platform.pojo.AntenatalExaminationModel; | |
| 10 | +import com.lyms.platform.pojo.Patients; | |
| 11 | +import com.lyms.platform.query.AntExChuQuery; | |
| 12 | +import com.lyms.platform.query.AntExQuery; | |
| 13 | +import com.lyms.platform.query.AntExRecordQuery; | |
| 14 | +import org.apache.commons.collections.CollectionUtils; | |
| 15 | +import org.apache.commons.lang.StringUtils; | |
| 16 | +import org.slf4j.Logger; | |
| 17 | +import org.slf4j.LoggerFactory; | |
| 18 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 19 | +import org.springframework.stereotype.Service; | |
| 20 | + | |
| 21 | +import java.util.ArrayList; | |
| 22 | +import java.util.List; | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * 产检记录 | |
| 26 | + * <p/> | |
| 27 | + * Created by Administrator on 2016/11/28 0028. | |
| 28 | + */ | |
| 29 | +@Service | |
| 30 | +public class AntExRecordService { | |
| 31 | + | |
| 32 | + private static final Logger logger = LoggerFactory.getLogger(AntExRecordService.class); | |
| 33 | + @Autowired | |
| 34 | + private IAntExRecordDao antExRecordDao; | |
| 35 | + @Autowired | |
| 36 | + private AntenatalExaminationService antExService; | |
| 37 | + @Autowired | |
| 38 | + private PatientsService patientsService; | |
| 39 | + | |
| 40 | + | |
| 41 | + public List aggregateOne(AntExRecordQuery antExRecordQuery) { | |
| 42 | + return antExRecordDao.aggregateOne(antExRecordQuery.convertToQuery()); | |
| 43 | + } | |
| 44 | + | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 同步初诊和复诊记录到产检管理里面 | |
| 48 | + * | |
| 49 | + * @param hospitalId | |
| 50 | + */ | |
| 51 | + public void syncAntRecordToList(String hospitalId) { | |
| 52 | + AntExQuery antExQuery = new AntExQuery(); | |
| 53 | + antExQuery.setYn(YnEnums.YES.getId()); | |
| 54 | + antExQuery.setHospitalId(hospitalId); | |
| 55 | + | |
| 56 | + //复诊 | |
| 57 | + List<AntenatalExaminationModel> list = antExService.queryAntenatalExamination(antExQuery.convertToQuery()); | |
| 58 | + List<AntExRecordModel> data = new ArrayList<>(); | |
| 59 | + for (AntenatalExaminationModel antEx : list) { | |
| 60 | + AntExRecordModel record = convert(antEx); | |
| 61 | + if(null!=record){ | |
| 62 | + data.add(record); | |
| 63 | + } | |
| 64 | + if (data.size() == 50) { | |
| 65 | + antExRecordDao.batchAddRecord(data); | |
| 66 | + data.clear(); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + if (!data.isEmpty()) { | |
| 70 | + antExRecordDao.batchAddRecord(data); | |
| 71 | + data.clear(); | |
| 72 | + } | |
| 73 | + | |
| 74 | + | |
| 75 | + //初诊 | |
| 76 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 77 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 78 | + antExChuQuery.setHospitalId(hospitalId); | |
| 79 | + List<AntExChuModel> antExChuModelList = antExService.queryAntExChu(antExChuQuery.convertToQuery()); | |
| 80 | + | |
| 81 | + if (CollectionUtils.isNotEmpty(antExChuModelList)) { | |
| 82 | + for (AntExChuModel antEx : antExChuModelList) { | |
| 83 | + AntExRecordModel record = convert(antEx); | |
| 84 | + if(null!=record){ | |
| 85 | + data.add(record); | |
| 86 | + } | |
| 87 | + if (data.size() == 50) { | |
| 88 | + antExRecordDao.batchAddRecord(data); | |
| 89 | + data.clear(); | |
| 90 | + } | |
| 91 | + } | |
| 92 | + if (!data.isEmpty()) { | |
| 93 | + antExRecordDao.batchAddRecord(data); | |
| 94 | + data.clear(); | |
| 95 | + } | |
| 96 | + } | |
| 97 | + } | |
| 98 | + | |
| 99 | + | |
| 100 | + public AntExRecordModel convert(AntenatalExaminationModel antEx) { | |
| 101 | + AntExRecordModel antExRecordModel = new AntExRecordModel(); | |
| 102 | + antExRecordModel.setParentId(antEx.getParentId()); | |
| 103 | + antExRecordModel.setId(antEx.getId()); | |
| 104 | + antExRecordModel.setType(1); | |
| 105 | + antExRecordModel.setHospitalId(antEx.getHospitalId()); | |
| 106 | + antExRecordModel.setCheckDoctor(antEx.getCheckDoctor()); | |
| 107 | + antExRecordModel.setCheckTime(antEx.getCheckDate()); | |
| 108 | + antExRecordModel.setPid(antEx.getPid()); | |
| 109 | + Patients patients = patientsService.findOnePatientById(antEx.getParentId()); | |
| 110 | + if (null != patients) { | |
| 111 | + if (patients.getType() == 3 && patients.getFmDate() != null) { | |
| 112 | + antExRecordModel.setStatus(1); | |
| 113 | + } | |
| 114 | + antExRecordModel.setBrith(patients.getBirth()); | |
| 115 | + antExRecordModel.setDueDate(patients.getDueDate()); | |
| 116 | + antExRecordModel.setName(patients.getUsername()); | |
| 117 | + antExRecordModel.sethScore(patients.getRiskScore()); | |
| 118 | + antExRecordModel.sethRisk(patients.getRiskFactorId()); | |
| 119 | + antExRecordModel.sethLevel(JsonUtil.toList(patients.getRiskLevelId(), List.class)); | |
| 120 | + }else{ | |
| 121 | + logger.info("antex find patient by id is null. parentId:"+antEx.getParentId()); | |
| 122 | + return null; | |
| 123 | + } | |
| 124 | + return antExRecordModel; | |
| 125 | + } | |
| 126 | + | |
| 127 | + public AntExRecordModel convert(AntExChuModel antExChuModel) { | |
| 128 | + AntExRecordModel antExRecordModel = new AntExRecordModel(); | |
| 129 | + antExRecordModel.setCheckDoctor(antExChuModel.getProdDoctor()); | |
| 130 | + antExRecordModel.setHospitalId(antExChuModel.getHospitalId()); | |
| 131 | + antExRecordModel.setParentId(antExChuModel.getParentId()); | |
| 132 | + antExRecordModel.setType(2); | |
| 133 | + antExRecordModel.setPid(antExChuModel.getPid()); | |
| 134 | + Patients patients = patientsService.findOnePatientById(antExChuModel.getParentId()); | |
| 135 | + if (null != patients) { | |
| 136 | + if (patients.getType() == 1) { | |
| 137 | + antExRecordModel.setStatus(1); | |
| 138 | + } | |
| 139 | + antExRecordModel.setDueDate(patients.getDueDate()); | |
| 140 | + antExRecordModel.setBrith(patients.getBirth()); | |
| 141 | + antExRecordModel.setName(patients.getUsername()); | |
| 142 | + antExRecordModel.sethScore(patients.getRiskScore()); | |
| 143 | + antExRecordModel.sethRisk(patients.getRiskFactorId()); | |
| 144 | + antExRecordModel.sethLevel(JsonUtil.toList(patients.getRiskLevelId(), List.class)); | |
| 145 | + }else{ | |
| 146 | + logger.info("antexc find patient by id is null. parentId:"+antExChuModel.getParentId()); | |
| 147 | + return null; | |
| 148 | + } | |
| 149 | + return antExRecordModel; | |
| 150 | + } | |
| 151 | + | |
| 152 | + | |
| 153 | + public AntExRecordModel addOneRecord(AntExRecordModel record) { | |
| 154 | + return antExRecordDao.addOneRecord(record); | |
| 155 | + } | |
| 156 | + | |
| 157 | + /** | |
| 158 | + * 查询符合条件的产检记录 | |
| 159 | + * | |
| 160 | + * @param antExRecordQuery | |
| 161 | + * @return | |
| 162 | + */ | |
| 163 | + public List<AntExRecordModel> queryAntExRecords(AntExRecordQuery antExRecordQuery) { | |
| 164 | + MongoQuery query = antExRecordQuery.convertToQuery(); | |
| 165 | + if (StringUtils.isNotEmpty(antExRecordQuery.getNeed())) { | |
| 166 | + antExRecordQuery.mysqlBuild(antExRecordDao.count(query)); | |
| 167 | + query.start(antExRecordQuery.getOffset()).end(antExRecordQuery.getLimit()); | |
| 168 | + } | |
| 169 | + return antExRecordDao.queryRecord(antExRecordQuery.convertToQuery()); | |
| 170 | + } | |
| 171 | + | |
| 172 | + /** | |
| 173 | + * 修改单条数据 | |
| 174 | + * | |
| 175 | + * @param antExRecordModel | |
| 176 | + * @param id | |
| 177 | + */ | |
| 178 | + public void updateOne(AntExRecordModel antExRecordModel, String id) { | |
| 179 | + antExRecordDao.updateOneRecord(antExRecordModel, id); | |
| 180 | + } | |
| 181 | + | |
| 182 | + /** | |
| 183 | + * 修改批量数据 | |
| 184 | + * | |
| 185 | + * @param record | |
| 186 | + * @param antExRecordQuery | |
| 187 | + */ | |
| 188 | + public void batchUpdate(AntExRecordModel record, AntExRecordQuery antExRecordQuery) { | |
| 189 | + antExRecordDao.batchUpdateRecord(record, antExRecordQuery.convertToQuery()); | |
| 190 | + } | |
| 191 | + | |
| 192 | + public void deleteOne(String id) { | |
| 193 | + antExRecordDao.deleteById(id); | |
| 194 | + } | |
| 195 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
View file @
d2ddff5
| ... | ... | @@ -50,6 +50,15 @@ |
| 50 | 50 | iPatientDao.findAndModify(query.convertToQuery(), obj); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | + public List aggregateOne(PatientsQuery patientsQuery) { | |
| 54 | + MongoQuery query = patientsQuery.convertToQuery(); | |
| 55 | + if (StringUtils.isNotEmpty(patientsQuery.getNeed())) { | |
| 56 | + patientsQuery.mysqlBuild(iPatientDao.queryPatientCount(query)); | |
| 57 | + query.start(patientsQuery.getOffset()).end(patientsQuery.getLimit()); | |
| 58 | + } | |
| 59 | + return iPatientDao.aggregateOne(query); | |
| 60 | + } | |
| 61 | + | |
| 53 | 62 | public List<Patients> queryPatient(PatientsQuery patientsQuery) { |
| 54 | 63 | MongoQuery query = patientsQuery.convertToQuery(); |
| 55 | 64 | if (StringUtils.isNotEmpty(patientsQuery.getNeed())) { |
platform-common/src/main/java/com/lyms/platform/common/dao/operator/MongoQuery.java
View file @
d2ddff5
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | import org.apache.commons.collections.CollectionUtils; |
| 7 | 7 | import org.springframework.data.domain.Sort; |
| 8 | 8 | import org.springframework.data.domain.Sort.Direction; |
| 9 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 9 | 10 | import org.springframework.data.mongodb.core.query.Query; |
| 10 | 11 | |
| 11 | 12 | /** |
| ... | ... | @@ -24,6 +25,14 @@ |
| 24 | 25 | private int start; |
| 25 | 26 | // 结束 |
| 26 | 27 | private int end; |
| 28 | + | |
| 29 | + | |
| 30 | + public Criteria getCriteria(){ | |
| 31 | + if(null != coniticon){ | |
| 32 | + return coniticon.getCriteria(); | |
| 33 | + } | |
| 34 | + return null; | |
| 35 | + } | |
| 27 | 36 | |
| 28 | 37 | /** |
| 29 | 38 | * 转换成spring data 的query 对象 |
platform-dal/src/main/java/com/lyms/platform/pojo/AntExRecordModel.java
View file @
d2ddff5
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 4 | + | |
| 5 | +import java.io.Serializable; | |
| 6 | +import java.util.Date; | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 产检记录表 | |
| 11 | + * <p/> | |
| 12 | + * Created by Administrator on 2016/11/28 0028. | |
| 13 | + */ | |
| 14 | +@Document(collection = "lyms_antexrecord") | |
| 15 | +public class AntExRecordModel implements Serializable { | |
| 16 | + | |
| 17 | + private String id; | |
| 18 | + | |
| 19 | + private String parentId; | |
| 20 | + | |
| 21 | + private String hospitalId; | |
| 22 | + //状态 1 已分娩 2未分娩 | |
| 23 | + private int status; | |
| 24 | + //类型 1 初诊 2复诊 | |
| 25 | + private Integer type; | |
| 26 | + //产检医生 | |
| 27 | + private String checkDoctor; | |
| 28 | + //产检时间 | |
| 29 | + private Date checkTime; | |
| 30 | + //孕妇姓名 | |
| 31 | + private String name; | |
| 32 | + //生日用于算年龄 | |
| 33 | + private Date brith; | |
| 34 | + //预产期 | |
| 35 | + private Date dueDate; | |
| 36 | + //高危评分 | |
| 37 | + private Integer hScore; | |
| 38 | + //高危等级 | |
| 39 | + private List hLevel; | |
| 40 | + //风险因素 | |
| 41 | + private List hRisk; | |
| 42 | + private String pid; | |
| 43 | + | |
| 44 | + public String getPid() { | |
| 45 | + return pid; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setPid(String pid) { | |
| 49 | + this.pid = pid; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public String getHospitalId() { | |
| 53 | + return hospitalId; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setHospitalId(String hospitalId) { | |
| 57 | + this.hospitalId = hospitalId; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public String getId() { | |
| 61 | + return id; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public void setId(String id) { | |
| 65 | + this.id = id; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public String getParentId() { | |
| 69 | + return parentId; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public void setParentId(String parentId) { | |
| 73 | + this.parentId = parentId; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public int getStatus() { | |
| 77 | + return status; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public void setStatus(int status) { | |
| 81 | + this.status = status; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public Integer getType() { | |
| 85 | + return type; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public void setType(Integer type) { | |
| 89 | + this.type = type; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public String getCheckDoctor() { | |
| 93 | + return checkDoctor; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public void setCheckDoctor(String checkDoctor) { | |
| 97 | + this.checkDoctor = checkDoctor; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public Date getCheckTime() { | |
| 101 | + return checkTime; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public void setCheckTime(Date checkTime) { | |
| 105 | + this.checkTime = checkTime; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public String getName() { | |
| 109 | + return name; | |
| 110 | + } | |
| 111 | + | |
| 112 | + public void setName(String name) { | |
| 113 | + this.name = name; | |
| 114 | + } | |
| 115 | + | |
| 116 | + public Date getBrith() { | |
| 117 | + return brith; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public void setBrith(Date brith) { | |
| 121 | + this.brith = brith; | |
| 122 | + } | |
| 123 | + | |
| 124 | + public Date getDueDate() { | |
| 125 | + return dueDate; | |
| 126 | + } | |
| 127 | + | |
| 128 | + public void setDueDate(Date dueDate) { | |
| 129 | + this.dueDate = dueDate; | |
| 130 | + } | |
| 131 | + | |
| 132 | + public Integer gethScore() { | |
| 133 | + return hScore; | |
| 134 | + } | |
| 135 | + | |
| 136 | + public void sethScore(Integer hScore) { | |
| 137 | + this.hScore = hScore; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public List gethLevel() { | |
| 141 | + return hLevel; | |
| 142 | + } | |
| 143 | + | |
| 144 | + public void sethLevel(List hLevel) { | |
| 145 | + this.hLevel = hLevel; | |
| 146 | + } | |
| 147 | + | |
| 148 | + public List gethRisk() { | |
| 149 | + return hRisk; | |
| 150 | + } | |
| 151 | + | |
| 152 | + public void sethRisk(List hRisk) { | |
| 153 | + this.hRisk = hRisk; | |
| 154 | + } | |
| 155 | +} |
platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java
View file @
d2ddff5
| 1 | +package com.lyms.platform.query; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.base.IConvertToNativeQuery; | |
| 4 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 9 | + | |
| 10 | +import java.util.Date; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * Created by Administrator on 2016/6/21 0021. | |
| 14 | + */ | |
| 15 | +public class AntExRecordQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 16 | + private String parentId; | |
| 17 | + private String id; | |
| 18 | + //创建时间 | |
| 19 | + private String hospitalId; | |
| 20 | + //孕妇状态 | |
| 21 | + private Integer status; | |
| 22 | + private String levelId; | |
| 23 | + | |
| 24 | + private Date buildTimeStart; | |
| 25 | + private Date buildTimeEnd; | |
| 26 | + private Date dueDateStart; | |
| 27 | + private Date dueDateEnd; | |
| 28 | + //大于修改时间 | |
| 29 | + private Date gteModified; | |
| 30 | + private Date gteCreated; | |
| 31 | + private String pid; | |
| 32 | + | |
| 33 | + public Integer getStatus() { | |
| 34 | + return status; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public String getLevelId() { | |
| 38 | + return levelId; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setLevelId(String levelId) { | |
| 42 | + this.levelId = levelId; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setStatus(Integer status) { | |
| 46 | + this.status = status; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public Date getBuildTimeStart() { | |
| 50 | + return buildTimeStart; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setBuildTimeStart(Date buildTimeStart) { | |
| 54 | + this.buildTimeStart = buildTimeStart; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public Date getBuildTimeEnd() { | |
| 58 | + return buildTimeEnd; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setBuildTimeEnd(Date buildTimeEnd) { | |
| 62 | + this.buildTimeEnd = buildTimeEnd; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public Date getGteCreated() { | |
| 66 | + return gteCreated; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setGteCreated(Date gteCreated) { | |
| 70 | + this.gteCreated = gteCreated; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public Date getGteModified() { | |
| 74 | + return gteModified; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setGteModified(Date gteModified) { | |
| 78 | + this.gteModified = gteModified; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public String getPid() { | |
| 82 | + return pid; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setPid(String pid) { | |
| 86 | + this.pid = pid; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public String getHospitalId() { | |
| 90 | + return hospitalId; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public void setHospitalId(String hospitalId) { | |
| 94 | + this.hospitalId = hospitalId; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public Date getDueDateStart() { | |
| 98 | + return dueDateStart; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public void setDueDateStart(Date dueDateStart) { | |
| 102 | + this.dueDateStart = dueDateStart; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public Date getDueDateEnd() { | |
| 106 | + return dueDateEnd; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public void setDueDateEnd(Date dueDateEnd) { | |
| 110 | + this.dueDateEnd = dueDateEnd; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public String getId() { | |
| 114 | + return id; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public void setId(String id) { | |
| 118 | + this.id = id; | |
| 119 | + } | |
| 120 | + | |
| 121 | + @Override | |
| 122 | + public MongoQuery convertToQuery() { | |
| 123 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 124 | + if (null != parentId) { | |
| 125 | + condition = condition.and("parentId", parentId, MongoOper.IS); | |
| 126 | + } | |
| 127 | + if (null != id) { | |
| 128 | + condition = condition.and("id", id, MongoOper.IS); | |
| 129 | + } | |
| 130 | + | |
| 131 | + if (null != status) { | |
| 132 | + condition = condition.and("status", status, MongoOper.IS); | |
| 133 | + } | |
| 134 | + | |
| 135 | + if (null != hospitalId) { | |
| 136 | + condition = condition.and("hospitalId", hospitalId, MongoOper.IS); | |
| 137 | + } | |
| 138 | + if (null != pid) { | |
| 139 | + condition = condition.and("pid", pid, MongoOper.IS); | |
| 140 | + } | |
| 141 | + | |
| 142 | + Criteria c = null; | |
| 143 | + if (null != buildTimeStart) { | |
| 144 | + c = Criteria.where("checkTime").gte(buildTimeStart); | |
| 145 | + } | |
| 146 | + | |
| 147 | + if (null != buildTimeEnd) { | |
| 148 | + if (null != c) { | |
| 149 | + c = c.lte(buildTimeEnd); | |
| 150 | + } else { | |
| 151 | + c = Criteria.where("checkTime").lte(buildTimeEnd); | |
| 152 | + } | |
| 153 | + } | |
| 154 | + | |
| 155 | + if (null != dueDateStart && dueDateEnd != null) { | |
| 156 | + if (null != c) { | |
| 157 | + c = c.where("nextCheckTime").gte(dueDateStart).lte(dueDateEnd); | |
| 158 | + } else { | |
| 159 | + c = Criteria.where("nextCheckTime").gte(dueDateStart).lte(dueDateEnd); | |
| 160 | + } | |
| 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 | + } | |
| 168 | + | |
| 169 | + if (null != c) { | |
| 170 | + condition = condition.andCondition(new MongoCondition(c)); | |
| 171 | + } | |
| 172 | + return condition.toMongoQuery(); | |
| 173 | + } | |
| 174 | + | |
| 175 | + public String getParentId() { | |
| 176 | + return parentId; | |
| 177 | + } | |
| 178 | + | |
| 179 | + public void setParentId(String parentId) { | |
| 180 | + this.parentId = parentId; | |
| 181 | + } | |
| 182 | +} |
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
d2ddff5
| ... | ... | @@ -105,6 +105,8 @@ |
| 105 | 105 | //医院id |
| 106 | 106 | private List<String> hospitalList; |
| 107 | 107 | |
| 108 | + | |
| 109 | + | |
| 108 | 110 | public String getProvinceRegisterId() { |
| 109 | 111 | return provinceRegisterId; |
| 110 | 112 | } |
| 111 | 113 | |
| 112 | 114 | |
| ... | ... | @@ -323,11 +325,20 @@ |
| 323 | 325 | |
| 324 | 326 | //最后一次产检医生职工ID |
| 325 | 327 | private String lastCheckEmployeeId; |
| 328 | + //排除最后一次产检员工id不为空的情况 | |
| 329 | + private boolean lastCheckEId; | |
| 326 | 330 | |
| 327 | 331 | //建档医生 |
| 328 | 332 | private String bookbuildingDoctor; |
| 329 | 333 | |
| 334 | + public boolean isLastCheckEId() { | |
| 335 | + return lastCheckEId; | |
| 336 | + } | |
| 330 | 337 | |
| 338 | + public void setLastCheckEId(boolean lastCheckEId) { | |
| 339 | + this.lastCheckEId = lastCheckEId; | |
| 340 | + } | |
| 341 | + | |
| 331 | 342 | public String getLastCheckEmployeeId() { |
| 332 | 343 | return lastCheckEmployeeId; |
| 333 | 344 | } |
| ... | ... | @@ -717,6 +728,10 @@ |
| 717 | 728 | } |
| 718 | 729 | if (lastCheckEmployeeId != null) { |
| 719 | 730 | condition = condition.and("lastCheckEmployeeId", lastCheckEmployeeId, MongoOper.IS); |
| 731 | + } | |
| 732 | + else if(lastCheckEId){ | |
| 733 | + condition = condition.and("lastCheckEmployeeId", "", MongoOper.NE); | |
| 734 | + condition = condition.andCondition(MongoCondition.newInstance("lastCheckEmployeeId", null, MongoOper.NE)); | |
| 720 | 735 | } |
| 721 | 736 | if (bookbuildingDoctor != null) { |
| 722 | 737 | condition = condition.and("bookbuildingDoctor", bookbuildingDoctor, MongoOper.IS); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StatisticsController.java
View file @
d2ddff5
| ... | ... | @@ -2,10 +2,14 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.annotation.TokenRequired; |
| 4 | 4 | import com.lyms.platform.common.base.BaseController; |
| 5 | +import com.lyms.platform.common.base.LoginContext; | |
| 5 | 6 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 7 | +import com.lyms.platform.common.result.BaseResponse; | |
| 6 | 8 | import com.lyms.platform.common.utils.DateUtil; |
| 7 | 9 | import com.lyms.platform.common.utils.JsonUtil; |
| 8 | 10 | import com.lyms.platform.common.utils.ResultUtils; |
| 11 | +import com.lyms.platform.operate.web.facade.AntExRecordFacade; | |
| 12 | +import com.lyms.platform.operate.web.request.CjStatisticsQueryRequest; | |
| 9 | 13 | import com.lymsh.platform.reportdata.model.AreaData; |
| 10 | 14 | import com.lymsh.platform.reportdata.model.AreaDataQuery; |
| 11 | 15 | import com.lymsh.platform.reportdata.model.echarts.*; |
| 12 | 16 | |
| 13 | 17 | |
| ... | ... | @@ -15,12 +19,11 @@ |
| 15 | 19 | import org.joda.time.DateTime; |
| 16 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | 21 | import org.springframework.stereotype.Controller; |
| 18 | -import org.springframework.web.bind.annotation.PathVariable; | |
| 19 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 20 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 21 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 22 | +import org.springframework.web.bind.annotation.*; | |
| 22 | 23 | |
| 24 | +import javax.servlet.http.HttpServletRequest; | |
| 23 | 25 | import javax.servlet.http.HttpServletResponse; |
| 26 | +import javax.validation.Valid; | |
| 24 | 27 | import java.util.*; |
| 25 | 28 | |
| 26 | 29 | /** |
| ... | ... | @@ -32,6 +35,8 @@ |
| 32 | 35 | |
| 33 | 36 | @Autowired |
| 34 | 37 | private StatisticsService statisticsService; |
| 38 | + @Autowired | |
| 39 | + private AntExRecordFacade antExRecordFacade; | |
| 35 | 40 | |
| 36 | 41 | |
| 37 | 42 | |
| ... | ... | @@ -1155,5 +1160,18 @@ |
| 1155 | 1160 | writeJson(response, JsonUtil.obj2JsonString(map)); |
| 1156 | 1161 | } |
| 1157 | 1162 | |
| 1163 | + @RequestMapping(value = "/syncToAntExRecord", method = RequestMethod.GET) | |
| 1164 | + @ResponseBody | |
| 1165 | + public String syncToAntExRecord(@RequestParam String hId){ | |
| 1166 | + antExRecordFacade.syncAntRecordToList(hId); | |
| 1167 | + return "sysc finish."; | |
| 1168 | + } | |
| 1169 | + @RequestMapping(value = "/cjStatistics", method = RequestMethod.GET) | |
| 1170 | + @ResponseBody | |
| 1171 | + @TokenRequired | |
| 1172 | + public BaseResponse cjStatistics(HttpServletRequest request,@Valid CjStatisticsQueryRequest statisticsQueryRequest){ | |
| 1173 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 1174 | + return antExRecordFacade.queryStatis(loginState.getId(),statisticsQueryRequest); | |
| 1175 | + } | |
| 1158 | 1176 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
View file @
d2ddff5
| 1 | +package com.lyms.platform.operate.web.facade; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.AntExRecordService; | |
| 4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
| 5 | +import com.lyms.platform.biz.service.PatientsService; | |
| 6 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 7 | +import com.lyms.platform.common.enums.RiskDefaultTypeEnum; | |
| 8 | +import com.lyms.platform.common.enums.YnEnums; | |
| 9 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 10 | +import com.lyms.platform.common.result.BaseResponse; | |
| 11 | +import com.lyms.platform.common.utils.DateUtil; | |
| 12 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
| 13 | +import com.lyms.platform.common.utils.JsonUtil; | |
| 14 | +import com.lyms.platform.common.utils.StringUtils; | |
| 15 | +import com.lyms.platform.operate.web.request.CjStatisticsQueryRequest; | |
| 16 | +import com.lyms.platform.operate.web.result.CjStatisticsListResult; | |
| 17 | +import com.lyms.platform.operate.web.result.CjStatisticsResult; | |
| 18 | +import com.lyms.platform.operate.web.result.HighScoreResult; | |
| 19 | +import com.lyms.platform.permission.model.Users; | |
| 20 | +import com.lyms.platform.permission.service.UsersService; | |
| 21 | +import com.lyms.platform.pojo.AntExRecordModel; | |
| 22 | +import com.lyms.platform.pojo.BasicConfig; | |
| 23 | +import com.lyms.platform.pojo.Patients; | |
| 24 | +import com.lyms.platform.query.AntExRecordQuery; | |
| 25 | +import com.lyms.platform.query.PatientsQuery; | |
| 26 | +import org.apache.commons.collections.CollectionUtils; | |
| 27 | +import org.apache.commons.lang.math.NumberUtils; | |
| 28 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 29 | +import org.springframework.stereotype.Component; | |
| 30 | + | |
| 31 | +import java.util.ArrayList; | |
| 32 | +import java.util.HashMap; | |
| 33 | +import java.util.List; | |
| 34 | +import java.util.Map; | |
| 35 | + | |
| 36 | +/** | |
| 37 | + * 产检管理 | |
| 38 | + * <p/> | |
| 39 | + * Created by Administrator on 2016/11/28 0028. | |
| 40 | + */ | |
| 41 | +@Component | |
| 42 | +public class AntExRecordFacade { | |
| 43 | + | |
| 44 | + @Autowired | |
| 45 | + private AntExRecordService recordService; | |
| 46 | + @Autowired | |
| 47 | + private AutoMatchFacade autoMatchFacade; | |
| 48 | + @Autowired | |
| 49 | + private UsersService usersService; | |
| 50 | + @Autowired | |
| 51 | + private PatientsService patientsService; | |
| 52 | + @Autowired | |
| 53 | + private BasicConfigService basicConfigService; | |
| 54 | + | |
| 55 | + public void syncAntRecordToList(String hospitalId) { | |
| 56 | + recordService.syncAntRecordToList(hospitalId); | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * | |
| 61 | + * 产检统计 | |
| 62 | + * | |
| 63 | + * @param userId | |
| 64 | + * @return | |
| 65 | + */ | |
| 66 | + public BaseResponse queryStatis(Integer userId,CjStatisticsQueryRequest statisticsQueryRequest) { | |
| 67 | + BaseListResponse baseListResponse = new BaseListResponse(); | |
| 68 | + List data = new ArrayList<>(); | |
| 69 | + | |
| 70 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 71 | + if(StringUtils.isEmpty(hospitalId)){ | |
| 72 | + baseListResponse.setErrormsg("获取医院id为空").setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 73 | + return baseListResponse; | |
| 74 | + } | |
| 75 | + | |
| 76 | + PatientsQuery patientsQuery1=new PatientsQuery(); | |
| 77 | + patientsQuery1.setLastCheckEId(true); | |
| 78 | + patientsQuery1.setHospitalId(hospitalId); | |
| 79 | + patientsQuery1.setYn(YnEnums.YES.getId()); | |
| 80 | + patientsQuery1.setNeed("1"); | |
| 81 | + patientsQuery1.setPage(statisticsQueryRequest.getPage()); | |
| 82 | + patientsQuery1.setLimit(statisticsQueryRequest.getLimit()); | |
| 83 | + patientsQuery1.setrLevel(statisticsQueryRequest.getLevelId()); | |
| 84 | + patientsQuery1.setLastCheckEmployeeId(statisticsQueryRequest.getdId()); | |
| 85 | + List buildType = new ArrayList(); | |
| 86 | + buildType.add(0); | |
| 87 | + buildType.add(2); | |
| 88 | + patientsQuery1.setBuildTypeList(buildType); | |
| 89 | + if(null!=statisticsQueryRequest.getStatus()){ | |
| 90 | + //1 | |
| 91 | + if(1==statisticsQueryRequest.getStatus()){ | |
| 92 | + patientsQuery1.setType(3); | |
| 93 | + }else if(2==statisticsQueryRequest.getStatus()){ | |
| 94 | + patientsQuery1.setType(1); | |
| 95 | + } | |
| 96 | + } | |
| 97 | + | |
| 98 | + //建档时间查询 | |
| 99 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(statisticsQueryRequest.getbTime())) { | |
| 100 | + String nextDateStr = statisticsQueryRequest.getbTime(); | |
| 101 | + String[] dates = nextDateStr.split(" - "); | |
| 102 | + | |
| 103 | + patientsQuery1.setBookbuildingDateStart(DateUtil.parseYMD(dates[0])); | |
| 104 | + if (dates.length == 2) { | |
| 105 | + patientsQuery1.setBookbuildingDateEnd(DateUtil.parseYMD(dates[1])); | |
| 106 | + } | |
| 107 | + } | |
| 108 | + | |
| 109 | + //预产期查询 | |
| 110 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(statisticsQueryRequest.getDueDate())) { | |
| 111 | + String nextDateStr = statisticsQueryRequest.getDueDate(); | |
| 112 | + String[] dates = nextDateStr.split(" - "); | |
| 113 | + | |
| 114 | + patientsQuery1.setDueDateStart(DateUtil.parseYMD(dates[0])); | |
| 115 | + if (dates.length == 2) { | |
| 116 | + patientsQuery1.setDueDateEnd(DateUtil.parseYMD(dates[1])); | |
| 117 | + } | |
| 118 | + } | |
| 119 | + | |
| 120 | + if(statisticsQueryRequest.getType()==1){ | |
| 121 | + List<Patients> patientses= patientsService.queryPatient(patientsQuery1); | |
| 122 | + if(CollectionUtils.isNotEmpty(patientses)){ | |
| 123 | + for(Patients record:patientses){ | |
| 124 | + CjStatisticsListResult cjStatisticsListResult=new CjStatisticsListResult(); | |
| 125 | + cjStatisticsListResult.convertToResult(record); | |
| 126 | + Users users = usersService.getUsers(NumberUtils.toInt(record.getLastCheckEmployeeId())); | |
| 127 | + if (null != users) { | |
| 128 | + cjStatisticsListResult.setCheckDoctor(users.getName()); | |
| 129 | + } | |
| 130 | + List<String> factor = record.getRiskFactorId(); | |
| 131 | + | |
| 132 | + if (CollectionUtils.isNotEmpty(factor)) { | |
| 133 | + StringBuilder sb = new StringBuilder(56); | |
| 134 | + for (String srt : factor) { | |
| 135 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(srt)) { | |
| 136 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(srt); | |
| 137 | + if (null != basicConfig && sb.indexOf(basicConfig.getName()) == -1) { | |
| 138 | + sb.append(basicConfig.getName()).append(','); | |
| 139 | + } | |
| 140 | + } | |
| 141 | + } | |
| 142 | + if (sb.toString().endsWith(",")) { | |
| 143 | + cjStatisticsListResult.setrRisk(sb.substring(0, sb.length() - 1)); | |
| 144 | + } else { | |
| 145 | + cjStatisticsListResult.setrRisk(sb.toString()); | |
| 146 | + } | |
| 147 | + } | |
| 148 | + List level = new ArrayList(); | |
| 149 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(record.getRiskLevelId())) { | |
| 150 | + try { | |
| 151 | + List<String> list = JsonUtil.jkstr2Obj(record.getRiskLevelId(), List.class); | |
| 152 | + for (String str : list) { | |
| 153 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(str); | |
| 154 | + if (null != basicConfig) { | |
| 155 | + Map map = new HashMap(); | |
| 156 | + String name = basicConfig.getName(); | |
| 157 | + if (name.indexOf("预警") > -1) { | |
| 158 | + name = name.replace("预警", ""); | |
| 159 | + } | |
| 160 | + map.put("name",name); | |
| 161 | + map.put("color", "risk_" + RiskDefaultTypeEnum.getColor(name)); | |
| 162 | + level.add(map); | |
| 163 | + } | |
| 164 | + } | |
| 165 | + } catch (Exception e) { | |
| 166 | + ExceptionUtils.catchException(e, "patients.getRiskLevelId error."); | |
| 167 | + } | |
| 168 | + cjStatisticsListResult.setrLevel(HighScoreResult.getLevelStr(HighScoreResult.filter(level))); | |
| 169 | + } | |
| 170 | + data.add(cjStatisticsListResult); | |
| 171 | + } | |
| 172 | + } | |
| 173 | + }else { | |
| 174 | + List<HashMap> list = patientsService.aggregateOne(patientsQuery1); | |
| 175 | + for (HashMap map : list) { | |
| 176 | + CjStatisticsResult cjStatisticsResult = new CjStatisticsResult(); | |
| 177 | + String dId = map.get("_id").toString(); | |
| 178 | + cjStatisticsResult.setdId(dId); | |
| 179 | + cjStatisticsResult.setCount(map.get("count").toString()); | |
| 180 | + try { | |
| 181 | + Users users = usersService.getUsers(Integer.valueOf(dId)); | |
| 182 | + if (null != users) { | |
| 183 | + cjStatisticsResult.setdName(users.getName()); | |
| 184 | + } | |
| 185 | + } catch (Exception e) { | |
| 186 | + } | |
| 187 | + data.add(cjStatisticsResult); | |
| 188 | + } | |
| 189 | + } | |
| 190 | + return baseListResponse.setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data); | |
| 191 | + } | |
| 192 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BasePageQueryRequest.java
View file @
d2ddff5
| ... | ... | @@ -22,13 +22,13 @@ |
| 22 | 22 | @Min(value = 1, message = "page.min") |
| 23 | 23 | @FormParam |
| 24 | 24 | @NotNull(message = "page.not.null") |
| 25 | - protected Integer page; | |
| 25 | + protected Integer page=1; | |
| 26 | 26 | |
| 27 | 27 | @NotNull(message = "page.limit.not.null") |
| 28 | 28 | @Min(value = 1, message = "page.min") |
| 29 | 29 | @Max(value = 10000, message = "page.max") |
| 30 | 30 | @FormParam |
| 31 | - protected Integer limit; | |
| 31 | + protected Integer limit=15; | |
| 32 | 32 | |
| 33 | 33 | public Integer getPage() { |
| 34 | 34 | return page; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/CjStatisticsQueryRequest.java
View file @
d2ddff5
| 1 | +package com.lyms.platform.operate.web.request; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * 产检统计id | |
| 6 | + * Created by Administrator on 2016/11/28 0028. | |
| 7 | + */ | |
| 8 | +public class CjStatisticsQueryRequest extends BasePageQueryRequest{ | |
| 9 | + //0 统计 1 类别 | |
| 10 | + private int type=0; | |
| 11 | + //风险等级 | |
| 12 | + private String levelId; | |
| 13 | + //预产期 | |
| 14 | + private String dueDate; | |
| 15 | + //建档时间 | |
| 16 | + private String bTime; | |
| 17 | + //分娩状态 1 已分娩 2 未分娩 | |
| 18 | + private Integer status; | |
| 19 | + //医生id | |
| 20 | + private String dId; | |
| 21 | + | |
| 22 | + public String getdId() { | |
| 23 | + return dId; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public void setdId(String dId) { | |
| 27 | + this.dId = dId; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public int getType() { | |
| 31 | + return type; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public void setType(int type) { | |
| 35 | + this.type = type; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public String getLevelId() { | |
| 39 | + return levelId; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setLevelId(String levelId) { | |
| 43 | + this.levelId = levelId; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getDueDate() { | |
| 47 | + return dueDate; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setDueDate(String dueDate) { | |
| 51 | + this.dueDate = dueDate; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public String getbTime() { | |
| 55 | + return bTime; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setbTime(String bTime) { | |
| 59 | + this.bTime = bTime; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public Integer getStatus() { | |
| 63 | + return status; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setStatus(Integer status) { | |
| 67 | + this.status = status; | |
| 68 | + } | |
| 69 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsListResult.java
View file @
d2ddff5
| 1 | +package com.lyms.platform.operate.web.result; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.utils.DateUtil; | |
| 4 | +import com.lyms.platform.common.utils.StringUtils; | |
| 5 | +import com.lyms.platform.pojo.AntExRecordModel; | |
| 6 | +import com.lyms.platform.pojo.Patients; | |
| 7 | +import org.codehaus.jackson.annotate.JsonIgnore; | |
| 8 | + | |
| 9 | +import java.util.Date; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * Created by Administrator on 2016/11/29 0029. | |
| 13 | + */ | |
| 14 | +public class CjStatisticsListResult { | |
| 15 | + | |
| 16 | + private String id; | |
| 17 | + | |
| 18 | + private String pid; | |
| 19 | + //名字 | |
| 20 | + private String name; | |
| 21 | + //孕周 | |
| 22 | + private String dueWeek; | |
| 23 | + //预产期 | |
| 24 | + private String dueDate; | |
| 25 | + | |
| 26 | + private Integer score; | |
| 27 | + //等级 | |
| 28 | + private String rLevel; | |
| 29 | + //因素 | |
| 30 | + private String rRisk; | |
| 31 | + //产检医生 | |
| 32 | + private String checkDoctor; | |
| 33 | + //类型 | |
| 34 | + @JsonIgnore | |
| 35 | + private Integer type; | |
| 36 | + | |
| 37 | + public CjStatisticsListResult convertToResult(Patients record) { | |
| 38 | + setDueDate(DateUtil.getyyyy_MM_dd(record.getDueDate())); | |
| 39 | + if(null!=record.getLastMenses()){ | |
| 40 | + int days= DateUtil.daysBetween(record.getLastMenses(),new Date()); | |
| 41 | + this.dueWeek= StringUtils.dueWeek(days); | |
| 42 | + } | |
| 43 | + setId(record.getId()); | |
| 44 | + setName(record.getUsername()); | |
| 45 | + setPid(record.getPid()); | |
| 46 | + setScore(record.getRiskScore()); | |
| 47 | + setType(record.getType()); | |
| 48 | + return this; | |
| 49 | + } | |
| 50 | + public String getId() { | |
| 51 | + return id; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public void setId(String id) { | |
| 55 | + this.id = id; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public String getPid() { | |
| 59 | + return pid; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public void setPid(String pid) { | |
| 63 | + this.pid = pid; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public String getName() { | |
| 67 | + return name; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public void setName(String name) { | |
| 71 | + this.name = name; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public String getDueWeek() { | |
| 75 | + return dueWeek; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public void setDueWeek(String dueWeek) { | |
| 79 | + this.dueWeek = dueWeek; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public String getDueDate() { | |
| 83 | + return dueDate; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public void setDueDate(String dueDate) { | |
| 87 | + this.dueDate = dueDate; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public Integer getScore() { | |
| 91 | + return score; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public void setScore(Integer score) { | |
| 95 | + this.score = score; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public String getrLevel() { | |
| 99 | + return rLevel; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public void setrLevel(String rLevel) { | |
| 103 | + this.rLevel = rLevel; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public String getrRisk() { | |
| 107 | + return rRisk; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public void setrRisk(String rRisk) { | |
| 111 | + this.rRisk = rRisk; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public String getCheckDoctor() { | |
| 115 | + return checkDoctor; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public void setCheckDoctor(String checkDoctor) { | |
| 119 | + this.checkDoctor = checkDoctor; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public Integer getType() { | |
| 123 | + return type; | |
| 124 | + } | |
| 125 | + | |
| 126 | + public void setType(Integer type) { | |
| 127 | + this.type = type; | |
| 128 | + } | |
| 129 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsResult.java
View file @
d2ddff5
| 1 | +package com.lyms.platform.operate.web.result; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * 产检统计 | |
| 6 | + * Created by Administrator on 2016/11/28 0028. | |
| 7 | + */ | |
| 8 | +public class CjStatisticsResult { | |
| 9 | + private String dId; | |
| 10 | + private String dName; | |
| 11 | + private String count; | |
| 12 | + | |
| 13 | + public String getdId() { | |
| 14 | + return dId; | |
| 15 | + } | |
| 16 | + | |
| 17 | + public void setdId(String dId) { | |
| 18 | + this.dId = dId; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public String getdName() { | |
| 22 | + return dName; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setdName(String dName) { | |
| 26 | + this.dName = dName; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public String getCount() { | |
| 30 | + | |
| 31 | + if(null==count){ | |
| 32 | + return "0"; | |
| 33 | + } | |
| 34 | + return count; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setCount(String count) { | |
| 38 | + this.count = count; | |
| 39 | + } | |
| 40 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/HighScoreResult.java
View file @
d2ddff5
| ... | ... | @@ -131,7 +131,7 @@ |
| 131 | 131 | return stringBuilder.toString(); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - public String getLevelStr(List levelList) { | |
| 134 | + public static String getLevelStr(List levelList) { | |
| 135 | 135 | StringBuilder stringBuilder = new StringBuilder(); |
| 136 | 136 | if (null == levelList) { |
| 137 | 137 | return ""; |