浏览代码

Merge branch 'dev' of yeshijie/patient-co-management into dev

lyr 8 年之前
父节点
当前提交
e8fe85c542

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java

@ -20,7 +20,7 @@ import java.util.Map;
public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>, JpaSpecificationExecutor<Followup> {
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    List<Followup> findByDoctor(String doctor, Date begin, Date end, Pageable pageRequest) throws Exception;
    List<Followup> findByDoctor(String doctor, Date begin, Date end) throws Exception;
    @Query("select a from Followup a where a.creater = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    List<Followup> findByCreater(String creater, Date begin, Date end, Pageable pageRequest) throws Exception;

+ 32 - 15
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -1,7 +1,5 @@
package com.yihu.wlyy.service.app.followup;
import javax.transaction.Transactional;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.dict.SystemDict;
@ -12,16 +10,17 @@ import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.repository.followup.FollowupContentDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.task.FollowupUploadTask;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -33,9 +32,7 @@ import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.service.BaseService;
import javax.transaction.Transactional;
import java.util.*;
/**
@ -140,19 +137,39 @@ public class FollowUpService extends BaseService {
    /**
     * 获取医生随访列表
     */
    public List<Map<String, String>> getListByDoctor(String doctorCode, String startTime, String endTime, String page, String pageSize) throws Exception {
        List<Map<String, String>> re = new ArrayList<>();
        // 排序
        Sort sort = new Sort(Sort.Direction.ASC, "followupDate");
        // 分页信息
        int pageInt = Integer.valueOf(page) - 1;
        int pageSizeInt = Integer.valueOf(pageSize);
        Pageable pageRequest = new PageRequest(pageInt, pageSizeInt, sort);
        List<Followup> list = followupDao.findByDoctor(doctorCode, DateUtil.strToDate(startTime), DateUtil.strToDate(endTime), pageRequest);
    public List<Map<String, Object>> getListByDoctor(String doctorCode, String startTime, String endTime) throws Exception {
        List<Map<String, Object>> re = new ArrayList<>();
        Map<String, Map<String, Object>> temp = new HashMap<>();
        List<Followup> list = followupDao.findByDoctor(doctorCode, DateUtil.strToDate(startTime), DateUtil.strToDate(endTime));
        if (list != null && list.size() > 0) {
            for (Followup followup : list) {
                String status = followup.getStatus();
                String date = DateUtil.dateToStrShort(followup.getFollowupDate());
                Map<String, String> map = getFollowupDetail(followup);
                if(temp.containsKey(date)){
                    Map<String, Object> vo = temp.get(date);
                    if(!"1".equals(status)){
                        vo.put("num",Integer.parseInt(vo.get("num").toString())+1);
                    }
                    ((List<Map<String, String>>)vo.get("list")).add(map);
                    temp.put(date,vo);
                }else{
                    Map<String, Object> vo = new HashMap<>();
                    List<Map<String, String>> list1 = new ArrayList<>();
                    vo.put("date",date);
                    if(!"1".equals(status)){
                        vo.put("num",1);//未完成数量
                    }else{
                        vo.put("num",0);
                    }
                    list1.add(map);
                    vo.put("list",list1);
                    temp.put(date,vo);
                }
            }
            for (Map<String, Object> map:temp.values()){
                re.add(map);
            }
        }

+ 9 - 14
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java

@ -1,10 +1,9 @@
package com.yihu.wlyy.web.doctor.followup;
import java.util.*;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.service.app.followup.FollowUpService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -14,13 +13,13 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import java.util.List;
import java.util.Map;
/**
 * 医生端:随访接口
@ -42,13 +41,9 @@ public class DoctorFollowUpController extends BaseController {
    public String getList(@ApiParam(name = "startTime", value = "开始时间", defaultValue = "2016-12-07 00:00:00")
                          @RequestParam(value = "startTime", required = true) String startTime,
                          @ApiParam(name = "endTime", value = "结束时间", defaultValue = "2016-12-14 00:00:00")
                          @RequestParam(value = "endTime", required = true) String endTime,
                          @ApiParam(name = "page", value = "第几页", defaultValue = "1")
                          @RequestParam(value = "page", required = true) String page,
                          @ApiParam(name = "pageSize", value = "每页几行", defaultValue = "10")
                          @RequestParam(value = "pageSize", required = true) String pageSize) {
                          @RequestParam(value = "endTime", required = true) String endTime) {
        try {
            List<Map<String, String>> result = followUpService.getListByDoctor(getUID(), startTime, endTime, page, pageSize);     //"64de9952-5b15-11e6-8344-fa163e8aee56"
            List<Map<String, Object>> result = followUpService.getListByDoctor(getUID(), startTime, endTime);     //"64de9952-5b15-11e6-8344-fa163e8aee56"
            return write(200, "获取随访列表成功!", "data", result);
        } catch (Exception e) {