Commit ebf75d2294b267cf45801779387bb264c542864c

Authored by jiangjiazhi
1 parent 20bdcf2f0d

分娩作废产检劵

Showing 6 changed files with 69 additions and 14 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IAntExRecordMDao.java View file @ ebf75d2
... ... @@ -4,6 +4,9 @@
4 4 import com.lyms.platform.pojo.AntExPRecordModel;
5 5 import com.lyms.platform.pojo.AntExRecordModel;
6 6  
  7 +import java.util.HashMap;
  8 +import java.util.List;
  9 +
7 10 /**
8 11 * Created by Administrator on 2017/1/13 0013.
9 12 */
... ... @@ -25,5 +28,10 @@
25 28 * @param id
26 29 */
27 30 void deleteById(String id);
  31 +
  32 + List<HashMap> aggregateOne(MongoQuery mongoQuery) ;
  33 +
  34 +
  35 + List<AntExPRecordModel> queryRecord(MongoQuery mongoQuery);
28 36 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntExRecordMDaoImpl.java View file @ ebf75d2
... ... @@ -6,19 +6,22 @@
6 6 import com.lyms.platform.common.dao.operator.MongoOper;
7 7 import com.lyms.platform.common.dao.operator.MongoQuery;
8 8 import com.lyms.platform.pojo.AntExPRecordModel;
9   -import com.lyms.platform.pojo.AntExRecordModel;
  9 +import org.springframework.data.mongodb.core.aggregation.Aggregation;
  10 +import org.springframework.data.mongodb.core.aggregation.AggregationOperation;
  11 +import org.springframework.data.mongodb.core.aggregation.AggregationResults;
10 12 import org.springframework.stereotype.Repository;
11 13  
  14 +import java.util.HashMap;
  15 +import java.util.List;
  16 +
12 17 /**
13   - *
14   - *
15 18 * Created by Administrator on 2017/1/13 0013.
16 19 */
17 20 @Repository("antExRecordMDao")
18   -public class AntExRecordMDaoImpl extends BaseMongoDAOImpl<AntExPRecordModel>implements IAntExRecordMDao {
  21 +public class AntExRecordMDaoImpl extends BaseMongoDAOImpl<AntExPRecordModel> implements IAntExRecordMDao {
19 22 @Override
20 23 public Integer count(MongoQuery mongoQuery) {
21   - return (int)count(mongoQuery.convertToMongoQuery());
  24 + return (int) count(mongoQuery.convertToMongoQuery());
22 25 }
23 26  
24 27 @Override
... ... @@ -29,6 +32,32 @@
29 32 @Override
30 33 public void deleteById(String id) {
31 34 delete(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery());
  35 + }
  36 + /**
  37 + * 查询符合条件的产检
  38 + *
  39 + * @param mongoQuery
  40 + * @return
  41 + */
  42 + public List<AntExPRecordModel> queryRecord(MongoQuery mongoQuery) {
  43 + return find(mongoQuery.convertToMongoQuery());
  44 + }
  45 +
  46 + /**
  47 + * 统计单个医院的产检情况
  48 + *
  49 + * @param mongoQuery
  50 + * @return
  51 + */
  52 + public List<HashMap> aggregateOne(MongoQuery mongoQuery) {
  53 + AggregationOperation match = Aggregation.match(mongoQuery.getCriteria());
  54 +
  55 + AggregationOperation group = Aggregation.group("checkDoctor").count().as("count");
  56 +
  57 + Aggregation aggregation = Aggregation.newAggregation(match, group);
  58 +
  59 + AggregationResults<HashMap> result = mongoTemplate.aggregate(aggregation, "lyms_antexprecord", HashMap.class);
  60 + return result.getMappedResults();
32 61 }
33 62 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java View file @ ebf75d2
... ... @@ -45,8 +45,28 @@
45 45 private IAntExRecordMDao iAntExRecordMDao;
46 46  
47 47 public List aggregateOne(AntExRecordQuery antExRecordQuery) {
48   - return antExRecordDao.aggregateOne(antExRecordQuery.convertToQuery());
  48 + return iAntExRecordMDao.aggregateOne(antExRecordQuery.convertToQuery());
49 49 }
  50 +
  51 + public Integer countM(AntExRecordQuery antExRecordQuery){
  52 + return iAntExRecordMDao.count(antExRecordQuery.convertToQuery());
  53 + }
  54 +
  55 + /**
  56 + * 查询符合条件的产检记录
  57 + *
  58 + * @param antExRecordQuery
  59 + * @return
  60 + */
  61 + public List<AntExPRecordModel> queryAntExRecords1(AntExRecordQuery antExRecordQuery) {
  62 + MongoQuery query = antExRecordQuery.convertToQuery();
  63 + if (StringUtils.isNotEmpty(antExRecordQuery.getNeed())) {
  64 + antExRecordQuery.mysqlBuild(iAntExRecordMDao.count(query));
  65 + query.start(antExRecordQuery.getOffset()).end(antExRecordQuery.getLimit());
  66 + }
  67 + return iAntExRecordMDao.queryRecord(query.addOrder(Sort.Direction.DESC, "checkTime"));
  68 + }
  69 +
50 70  
51 71  
52 72 private void handRecord( AntExRecordModel record ){
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java View file @ ebf75d2
... ... @@ -331,9 +331,9 @@
331 331 }
332 332  
333 333 if (statisticsQueryRequest.getType() == 1) {
334   - List<AntExRecordModel> list2 = recordService.queryAntExRecords(antExRecordQuery);
  334 + List<AntExPRecordModel> list2 = recordService.queryAntExRecords1(antExRecordQuery);
335 335 if (CollectionUtils.isNotEmpty(list2)) {
336   - for (AntExRecordModel record : list2) {
  336 + for (AntExPRecordModel record : list2) {
337 337 CjStatisticsListResult cjStatisticsListResult = new CjStatisticsListResult();
338 338 cjStatisticsListResult.convertToResult(record);
339 339 Patients patients = patientsService.findOnePatientById(record.getParentId());
... ... @@ -406,7 +406,7 @@
406 406 for (HashMap map : list) {
407 407 CjStatisticsResult cjStatisticsResult = new CjStatisticsResult();
408 408 String dId = null;
409   - Object id = map.get("checkDoctor");
  409 + Object id = map.get("_id");
410 410 if (null != id) {
411 411 dId = id.toString();
412 412 } else {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/AntExManagerResult.java View file @ ebf75d2
... ... @@ -3,10 +3,7 @@
3 3 import com.lyms.platform.common.base.IBasicResultConvert;
4 4 import com.lyms.platform.common.utils.DateUtil;
5 5 import com.lyms.platform.common.utils.StringUtils;
6   -import com.lyms.platform.pojo.AntExChuModel;
7   -import com.lyms.platform.pojo.AntExRecordModel;
8   -import com.lyms.platform.pojo.AntenatalExaminationModel;
9   -import com.lyms.platform.pojo.Patients;
  6 +import com.lyms.platform.pojo.*;
10 7  
11 8 import java.util.List;
12 9 import java.util.Map;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsListResult.java View file @ ebf75d2
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import com.lyms.platform.common.utils.DateUtil;
4 4 import com.lyms.platform.common.utils.StringUtils;
  5 +import com.lyms.platform.pojo.AntExPRecordModel;
5 6 import com.lyms.platform.pojo.AntExRecordModel;
6 7 import com.lyms.platform.pojo.Patients;
7 8 import org.codehaus.jackson.annotate.JsonIgnore;
... ... @@ -48,7 +49,7 @@
48 49 setType(record.getType());
49 50 return this;
50 51 }
51   - public CjStatisticsListResult convertToResult(AntExRecordModel record) {
  52 + public CjStatisticsListResult convertToResult(AntExPRecordModel record) {
52 53 setDueDate(DateUtil.getyyyy_MM_dd(record.getDueDate()));
53 54 if(null!=record.getLastMenses()){
54 55 int days= DateUtil.daysBetween(record.getLastMenses(),new Date());