Browse Source

Merge branch 'dev' of yeshijie/wlyy2.0 into dev

叶仕杰 3 years ago
parent
commit
cb7eb0fbd8

+ 12 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseCatalogueDO.java

@ -39,6 +39,10 @@ public class CourseCatalogueDO extends UuidIdentityEntityWithTime {
     * 视频url
     */
    private String videoUrl;
    /**
     * 排序字段
     */
    private Integer sort;
    @Column(name = "course_id")
    public String getCourserId() {
@ -89,4 +93,12 @@ public class CourseCatalogueDO extends UuidIdentityEntityWithTime {
        this.videoUrl = videoUrl;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
}

+ 107 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/NurseryLogDO.java

@ -0,0 +1,107 @@
package com.yihu.jw.entity.care.course;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
@Entity
@Table(name="base_nursery_log")
public class NurseryLogDO extends UuidIdentityEntityWithCreateTime{
    private String patient;
    private String patientName;
    private String doctor;
    private String doctorName;
    private String orgCode;
    private String orgName;
    /**
     * '记录日期'
     */
    private String recordDate;
    /**
     * 状态 暂时没用
     */
    private String status;
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    @Column(name = "org_name")
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    @Column(name = "record_date")
    public String getRecordDate() {
        return recordDate;
    }
    public void setRecordDate(String recordDate) {
        this.recordDate = recordDate;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
}

+ 59 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientCourseRecordDO.java

@ -0,0 +1,59 @@
package com.yihu.jw.entity.care.course;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description: '居民课程记录
 */
@Entity
@Table(name="base_patient_course_record")
public class PatientCourseRecordDO extends UuidIdentityEntityWithCreateTime{
    /**
     * '托育日志id'
     */
    private String nurseryLogId;
    /**
     * '课程记录内容'
     */
    private String content;
    /**
     * '附件'
     */
    private String enclosure;
    @Column(name = "nursery_log_id")
    public String getNurseryLogId() {
        return nurseryLogId;
    }
    public void setNurseryLogId(String nurseryLogId) {
        this.nurseryLogId = nurseryLogId;
    }
    @Column(name = "content")
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    @Column(name = "enclosure")
    public String getEnclosure() {
        return enclosure;
    }
    public void setEnclosure(String enclosure) {
        this.enclosure = enclosure;
    }
}

+ 98 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientDietRecordDO.java

@ -0,0 +1,98 @@
package com.yihu.jw.entity.care.course;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description: 居民饮食记录
 */
@Entity
@Table(name="base_patient_diet_record")
public class PatientDietRecordDO extends UuidIdentityEntityWithCreateTime{
    /**
     * '托育日志id'
     */
    private String nurseryLogId;
    /**
     * '食用食物json格式'
     */
    private String eatFood;
    /**
     * '食用方式 1喂食 2自主进食
     */
    private String eatType;
    /**
     *'摄入量 全部吃完 吃了1/3 吃了1/2 几乎没吃'
     */
    private String intake;
    /**
     *'附加说明'
     */
    private String additionalNotes;
    /**
     *'附件'
     */
    private String enclosure;
    @Column(name = "nursery_log_id")
    public String getNurseryLogId() {
        return nurseryLogId;
    }
    public void setNurseryLogId(String nurseryLogId) {
        this.nurseryLogId = nurseryLogId;
    }
    @Column(name = "eat_food")
    public String getEatFood() {
        return eatFood;
    }
    public void setEatFood(String eatFood) {
        this.eatFood = eatFood;
    }
    @Column(name = "eat_type")
    public String getEatType() {
        return eatType;
    }
    public void setEatType(String eatType) {
        this.eatType = eatType;
    }
    @Column(name = "intake")
    public String getIntake() {
        return intake;
    }
    public void setIntake(String intake) {
        this.intake = intake;
    }
    @Column(name = "additional_notes")
    public String getAdditionalNotes() {
        return additionalNotes;
    }
    public void setAdditionalNotes(String additionalNotes) {
        this.additionalNotes = additionalNotes;
    }
    @Column(name = "enclosure")
    public String getEnclosure() {
        return enclosure;
    }
    public void setEnclosure(String enclosure) {
        this.enclosure = enclosure;
    }
}

+ 16 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/NurseryLogDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.care.dao.course;
import com.yihu.jw.entity.care.course.NurseryLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
public interface NurseryLogDao extends PagingAndSortingRepository<NurseryLogDO, String>, JpaSpecificationExecutor<NurseryLogDO> {
}

+ 20 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/PatientCourseRecordDao.java

@ -0,0 +1,20 @@
package com.yihu.jw.care.dao.course;
import com.yihu.jw.entity.care.course.PatientCourseRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
public interface PatientCourseRecordDao extends PagingAndSortingRepository<PatientCourseRecordDO, String>,
        JpaSpecificationExecutor<PatientCourseRecordDO> {
    List<PatientCourseRecordDO> findByNurseryLogId(String nurseryLogId);
}

+ 19 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/PatientDietRecordDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.care.dao.course;
import com.yihu.jw.entity.care.course.PatientDietRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
public interface PatientDietRecordDao extends PagingAndSortingRepository<PatientDietRecordDO, String>, JpaSpecificationExecutor<PatientDietRecordDO> {
    List<PatientDietRecordDO> findByNurseryLogId(String nurseryLogId);
}

+ 143 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/NurseryLogEndpoint.java

@ -0,0 +1,143 @@
package com.yihu.jw.care.endpoint.course;
import com.yihu.jw.care.service.course.NurseryLogService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
@RestController
@RequestMapping("nursery" )
@Api(tags = "托育日志", description = "托育日志")
public class NurseryLogEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private NurseryLogService nurseryLogService;
    @GetMapping(value = "findNurseryLogByMonth")
    @ApiOperation("获取托育日志按月日历形式")
    public Envelop findNurseryLogByMonth(@ApiParam(name = "orgCode", value = "机构id")
                                      @RequestParam(value = "orgCode", required = true) String orgCode,
                                          @ApiParam(name = "patient", value = "居民")
                                      @RequestParam(value = "patient", required = false) String patient,
                                          @ApiParam(name = "patientName", value = "居民姓名")
                                      @RequestParam(value = "patientName", required = false) String patientName,
                                          @ApiParam(value = "开始时间,格式(yyyy-MM-dd)", name = "startDate",required = false)
                                      @RequestParam(value = "startDate", required = false) String startDate,
                                          @ApiParam(value = "结束时间,格式(yyyy-MM-dd)", name = "endDate",required = false)
                                      @RequestParam(value = "endDate", required = false) String endDate){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.findNurseryLogByMonth(orgCode,patient,patientName,startDate,endDate));
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "findNurseryLogList")
    @ApiOperation("获取托育日志列表-已填写")
    public Envelop findNurseryLogList(@ApiParam(name = "orgCode", value = "机构id")
                                            @RequestParam(value = "orgCode", required = true) String orgCode,
                                            @ApiParam(name = "recordDate", value = "时间")
                                            @RequestParam(value = "recordDate", required = false) String recordDate){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.findNurseryLogList(orgCode,recordDate));
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "nuseryLogUnFilledIn")
    @ApiOperation("获取未填写日志列表")
    public Envelop nuseryLogUnFilledIn(@ApiParam(name = "orgCode", value = "机构id")
                                         @RequestParam(value = "orgCode", required = true) String orgCode,
                                         @ApiParam(name = "recordDate", value = "时间")
                                         @RequestParam(value = "recordDate", required = false) String recordDate){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.nuseryLogUnFilledIn(orgCode,recordDate));
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @PostMapping("addNurseryLog")
    @ApiOperation(value = "新增托育日志")
    public Envelop addNurseryLog(
            @ApiParam(name = "patient", value = "居民id") @RequestParam(value = "patient", required = true) String patient,
            @ApiParam(name = "patientName", value = "居民姓名") @RequestParam(value = "patientName", required = true) String patientName,
            @ApiParam(name = "doctor", value = "医生id") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "orgCode", value = "机构id") @RequestParam(value = "orgCode", required = true) String orgCode,
            @ApiParam(name = "orgName", value = "机构名称") @RequestParam(value = "orgName", required = true) String orgName,
            @ApiParam(name = "recordDate", value = "记录日期 格式 yyyy-MM-dd") @RequestParam(value = "recordDate", required = true) String recordDate) {
        try {
            return success("新增成功",nurseryLogService.addNurseryLog(patient, patientName, doctor, doctorName, orgCode, orgName, recordDate));
        } catch (Exception e) {
            return  failedException(e);
        }
    }
    @PostMapping("addCourseRecord")
    @ApiOperation(value = "新增课程记录")
    public Envelop addCourseRecord(
            @ApiParam(name = "id", value = "托育日志id") @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "content", value = "课程记录内容") @RequestParam(value = "content", required = true) String content,
            @ApiParam(name = "enclosure", value = "附件") @RequestParam(value = "enclosure", required = false) String enclosure) {
        try {
            return success("新增成功",nurseryLogService.addCourseRecord(id, content, enclosure));
        } catch (Exception e) {
            return  failedException(e);
        }
    }
    @PostMapping("addDietRecord")
    @ApiOperation(value = "新增饮食记录")
    public Envelop addDietRecord(
            @ApiParam(name = "id", value = "托育日志id") @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "eatFood", value = "食用食物") @RequestParam(value = "eatFood", required = true) String eatFood,
            @ApiParam(name = "eatType", value = "进食方式") @RequestParam(value = "eatType", required = true) String eatType,
            @ApiParam(name = "enclosure", value = "附件") @RequestParam(value = "enclosure", required = true) String enclosure,
            @ApiParam(name = "intake", value = "摄入量") @RequestParam(value = "intake", required = false) String intake,
            @ApiParam(name = "additionalNotes", value = "附加说明") @RequestParam(value = "additionalNotes", required = false) String additionalNotes) {
        try {
            return success("新增成功",nurseryLogService.addDietRecord(id, eatFood, eatType, enclosure, intake, additionalNotes));
        } catch (Exception e) {
            return  failedException(e);
        }
    }
    @GetMapping(value = "nurseryDetail")
    @ApiOperation("获取课程记录详情")
    public Envelop nurseryDetail(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.nurseryDetail(id));
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "findRecordByNurseryLogId")
    @ApiOperation("根据托育日志id查找")
    public Envelop findRecordByNurseryLogId(@ApiParam(name = "id", value = "id")
                                                   @RequestParam(value = "id", required = true) String id,
                                               @ApiParam(name = "type", value = "类型 diet饮食记录 course课程记录")
                                               @RequestParam(value = "type", required = true) String type){
        try {
            return nurseryLogService.findRecordByNurseryLogId(id,type);
        }catch (Exception e){
            return  failedException(e);
        }
    }
}

+ 285 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/NurseryLogService.java

@ -0,0 +1,285 @@
package com.yihu.jw.care.service.course;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.course.NurseryLogDao;
import com.yihu.jw.care.dao.course.PatientCourseRecordDao;
import com.yihu.jw.care.dao.course.PatientDietRecordDao;
import com.yihu.jw.entity.care.course.NurseryLogDO;
import com.yihu.jw.entity.care.course.PatientCourseRecordDO;
import com.yihu.jw.entity.care.course.PatientDietRecordDO;
import com.yihu.jw.entity.care.course.RecruitStudentsRecordDO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
@Service
public class NurseryLogService {
    @Autowired
    private NurseryLogDao nurseryLogDao;
    @Autowired
    private PatientDietRecordDao patientDietRecordDao;
    @Autowired
    private PatientCourseRecordDao patientCourseRecordDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 根据托育日志id查找
     * @param id
     * @return
     */
    public ObjEnvelop findRecordByNurseryLogId(String id,String type){
        if("diet".equals(type)){
            List<PatientDietRecordDO> dietRecordDOs = patientDietRecordDao.findByNurseryLogId(id);
            if(dietRecordDOs.size()>0){
                return ObjEnvelop.getSuccess("",dietRecordDOs.get(0));
            }
        }else if("course".equals(type)){
            List<PatientCourseRecordDO> courseRecordDOs = patientCourseRecordDao.findByNurseryLogId(id);
            if(courseRecordDOs.size()>0){
                return ObjEnvelop.getSuccess("",courseRecordDOs.get(0));
            }
        }
        return ObjEnvelop.getError("未找到记录");
    }
    /**
     * 获取课程记录详情
     * @param id
     * @return
     */
    public JSONObject nurseryDetail(String id){
        JSONObject json = new JSONObject();
        NurseryLogDO nurseryLogDO = nurseryLogDao.findOne(id);
        json.put("nurseryLog",nurseryLogDO);
        List<PatientDietRecordDO> dietRecordDOs = patientDietRecordDao.findByNurseryLogId(id);
        List<PatientCourseRecordDO> courseRecordDOs = patientCourseRecordDao.findByNurseryLogId(id);
        json.put("diet",dietRecordDOs.size());
        json.put("course",courseRecordDOs.size());
        return json;
    }
    /**
     * 新增托育日志
     * @param patient
     * @param patientName
     * @param doctor
     * @param doctorName
     * @param orgCode
     * @param orgName
     * @param recordDate
     * @return
     */
    public NurseryLogDO addNurseryLog(String patient,String patientName, String doctor,String doctorName,String orgCode,String orgName,String recordDate) {
        NurseryLogDO nurseryLogDO = new NurseryLogDO();
        nurseryLogDO.setPatient(patient);
        nurseryLogDO.setPatientName(patientName);
        nurseryLogDO.setDoctorName(doctorName);
        nurseryLogDO.setDoctor(doctor);
        nurseryLogDO.setOrgName(orgName);
        nurseryLogDO.setOrgCode(orgCode);
        nurseryLogDO.setRecordDate(recordDate);
        nurseryLogDO.setStatus("0");
        nurseryLogDO.setCreateTime(new Date());
        nurseryLogDao.save(nurseryLogDO);
        return nurseryLogDO;
    }
    /**
     * 新增课程记录
     * @return
     */
    public PatientCourseRecordDO addCourseRecord(String id,String content, String enclosure) {
        PatientCourseRecordDO recordDO = new PatientCourseRecordDO();
        recordDO.setCreateTime(new Date());
        recordDO.setContent(content);
        recordDO.setEnclosure(enclosure);
        recordDO.setNurseryLogId(id);
        patientCourseRecordDao.save(recordDO);
        return recordDO;
    }
    /**
     * 新增饮食记录
     * @return
     */
    public PatientDietRecordDO addDietRecord(String id,String eatFood,String eatType, String enclosure,String intake,String additionalNotes) {
        PatientDietRecordDO recordDO = new PatientDietRecordDO();
        recordDO.setCreateTime(new Date());
        recordDO.setEnclosure(enclosure);
        recordDO.setNurseryLogId(id);
        recordDO.setEatFood(eatFood);
        recordDO.setEatType(eatType);
        recordDO.setIntake(intake);
        recordDO.setAdditionalNotes(additionalNotes);
        patientDietRecordDao.save(recordDO);
        return recordDO;
    }
    /**
     *获取托育日志列表
     * @param orgCode
     * @return
     * @throws Exception
     */
    public List<NurseryLogDO> findNurseryLogList(String orgCode, String recordDate){
        String sql = "select * from base_nursery_log wf ";
        sql+= " where wf.org_code = '"+orgCode+"'";
        if(!StringUtil.isEmpty(recordDate)){
            sql+=" and wf.record_date ='"+recordDate+"'";
        }
        sql+=" order by wf.create_time desc";
        List<NurseryLogDO> nurseryLogDOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(NurseryLogDO.class));
        return nurseryLogDOs;
    }
    /**
     * 获取未填写日志列表
     * @param orgCode
     */
    public JSONArray nuseryLogUnFilledIn(String orgCode,String recordDate){
        JSONArray jsonArray = new JSONArray();
        String sql ="SELECT * from base_recruit_students_record " +
                "where org_code = '"+orgCode+"' and `status` in ('3','6') and del =1";
        List<RecruitStudentsRecordDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RecruitStudentsRecordDO.class));
        List<NurseryLogDO> nurseryLogDOs = findNurseryLogList(orgCode, recordDate);
        List<String> nurseryList = nurseryLogDOs.stream().map(NurseryLogDO::getPatient).collect(Collectors.toList());
        for(RecruitStudentsRecordDO recordDO:list){
            if(nurseryList.contains(recordDO.getPatient())){
                continue;
            }
            JSONObject json = new JSONObject();
            json.put("patient",recordDO.getPatient());
            json.put("patientName",recordDO.getPatientName());
            jsonArray.add(json);
        }
        return jsonArray;
    }
    /**
     *获取托育日志按月日历形式
     * @param orgCode
     * @param startTime
     * @param endTime
     * @return
     * @throws Exception
     */
    public Map<String,Object> findNurseryLogByMonth(String orgCode, String patient,  String patientName, String startTime, String endTime)throws Exception{
        String sql = "select * from base_nursery_log wf ";
        sql+= " where wf.org_code = '"+orgCode+"'";
        if(!StringUtil.isEmpty(patient)){
            sql+=" and wf.patient_code = '"+patient+"'";
        }
        if(!StringUtil.isEmpty(patientName)){
            sql+=" and wf.patient_name like '%"+patientName+"%'";
        }
        if(!StringUtil.isEmpty(startTime)){
            sql+=" and wf.record_date >='"+startTime+"'";
        }
        if(!org.apache.commons.lang.StringUtils.isEmpty(endTime)){
            Date currentTime = DateUtil.strToDate(endTime + " 23:59:59");
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String dateString = formatter.format(currentTime);
            sql+=" and wf.record_date <='"+dateString+"'";
        }
        sql+=" order by wf.create_time desc";
        List<NurseryLogDO> nurseryLogDOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(NurseryLogDO.class));
        //按时间分组
        Map<String,Object> date = sortNurseryLogByDate(nurseryLogDOs);
        //统计每一天完成数与计划数目
        if(date!=null&&date.size()>0){
            for(String key : date.keySet()){
                //获取一天的数据
                Map<String,Object> d = (Map<String,Object>)date.get(key);
                // 获取一天随访数据
                List<NurseryLogDO> dateFollowups = (List<NurseryLogDO>)d.get("nurserys");
                //统计一天各项纬度指标
                List<Map<String,Object>> statistics = new ArrayList<>();
                //统计单条
                Map<String,Object> fs = sortNurseryLogList(dateFollowups);
                Integer count = (Integer)fs.get("count");
                if(count!=0){
                    statistics.add(fs);
                }
                d.put("statistics",statistics);
            }
        }
        return date;
    }
    public Map<String,Object> sortNurseryLogByDate(List<NurseryLogDO> nurseryLogDOs){
        //按时间分组
        Map<String,Object> date = new HashedMap();
        if(nurseryLogDOs!=null&&nurseryLogDOs.size()>0){
            Iterator it = nurseryLogDOs.iterator();
            while (it.hasNext()){
                NurseryLogDO nurseryLogDO = (NurseryLogDO)it.next();
                //1.获取日期分组
                Map<String,Object> dateNurserys = (Map<String,Object>)date.get(nurseryLogDO.getRecordDate());
                //判断随访时间是否已经创建分组
                if(dateNurserys!=null&&dateNurserys.size()>0){
                    //同一天时间已经有分组则加入list
                    List<NurseryLogDO> list = (List<NurseryLogDO>)dateNurserys.get("nurserys");
                    list.add(nurseryLogDO);
                }else{
                    //同一天的时间没有该分组则创建这天的随访计划List
                    Map<String,Object> newdateNursery = new HashedMap();
                    List<NurseryLogDO> dateNurseryLogs = new ArrayList<>();
                    dateNurseryLogs.add(nurseryLogDO);
                    newdateNursery.put("nurserys",dateNurseryLogs);
                    date.put(nurseryLogDO.getRecordDate(),newdateNursery);
                }
            }
        }
        return date;
    }
    public Map<String,Object> sortNurseryLogList(List<NurseryLogDO> nurseryLogDOs){
        //统计完成数
        Integer compeleCount = 0;
        //总数
        Integer count = 0;
        //迭代数组
        List<NurseryLogDO> rs = new ArrayList<>();
        if(nurseryLogDOs!=null&&nurseryLogDOs.size()>0){
            Iterator it = nurseryLogDOs.iterator();
            while (it.hasNext()){
                NurseryLogDO nurseryLogDO = (NurseryLogDO)it.next();
                rs.add(nurseryLogDO);
                if("1".equals(nurseryLogDO.getStatus())){
                    compeleCount++;
                }
            }
            //设置总数
            count = rs.size();
        }
        Map<String,Object> mapFollow =new HashedMap();
        mapFollow.put("compeleCount",compeleCount);
        mapFollow.put("count",count);
        return mapFollow;
    }
}