Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

wujunjie 8 years ago
parent
commit
e7f36654b4

+ 24 - 24
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -159,30 +159,30 @@ public class CurrentDayAllQuotaJob implements Job {
        //抽取數據
        List<SignFamily> signFamilies= SpringUtil.getBean(DBExtract.class).extractByPage(SignFamily.class,sql,sqlCount,true);
//        computequota_1(sql,signFamilies,null); //统计今天的签约
//        computequota_2(); //统计今天的解约
//        computequota_3(); //统计今天的健康咨询量
//        computequota_4(); //统计今天的随访量
//        computequota_5(); //统计今天的健康指导
//        computequota_6(sql,signFamilies,null); //统计今天的签约患者性别
//        computequota_7(sql,signFamilies,null);//统计今天的签约患者分组
//        computequota_8(sql,signFamilies,null);//统计今天的签约患者年龄
//        computequota_9();//统计今天的待签约
//        computequota_10();//统计今天的改签
//        computequota_12(sql,signFamilies,null);//统计今天的签约下按年龄分组后再
//        computequota_13(sql,signFamilies,null);//统计今天的签约量
//        computequota_16_1(sql,signFamilies,null);//统计今天的签约数的扣费钱 1
//        computequota_15(sql,signFamilies,null);//统计今天的健康分布统计
//        computequota_16_0(sql,signFamilies,null);//统计今天的签约数的未扣费 0
//        computequota_17(sql,signFamilies,null);//统计今天的年龄疾病
//        computequota_20();//统计今天的已经签约患者绑定设备
//        computequota_21();//统计今天的已经签约微信关注人数
//        computequota_22();//未回复的咨询量
//        computequota_23();//及时回复的咨询量
//        computequota_24();//及时回复的咨询量时间分布
//        computequota_25();//统计质询量总数
//        computequota_26();//统计未缴费签约总数
//        computequota_27();//统计代预约量
        computequota_1(sql,signFamilies,null); //统计今天的签约
        computequota_2(); //统计今天的解约
        computequota_3(); //统计今天的健康咨询量
        computequota_4(); //统计今天的随访量
        computequota_5(); //统计今天的健康指导
        computequota_6(sql,signFamilies,null); //统计今天的签约患者性别
        computequota_7(sql,signFamilies,null);//统计今天的签约患者分组
        computequota_8(sql,signFamilies,null);//统计今天的签约患者年龄
        computequota_9();//统计今天的待签约
        computequota_10();//统计今天的改签
        computequota_12(sql,signFamilies,null);//统计今天的签约下按年龄分组后再
        computequota_13(sql,signFamilies,null);//统计今天的签约量
        computequota_16_1(sql,signFamilies,null);//统计今天的签约数的扣费钱 1
        computequota_15(sql,signFamilies,null);//统计今天的健康分布统计
        computequota_16_0(sql,signFamilies,null);//统计今天的签约数的未扣费 0
        computequota_17(sql,signFamilies,null);//统计今天的年龄疾病
        computequota_20();//统计今天的已经签约患者绑定设备
        computequota_21();//统计今天的已经签约微信关注人数
        computequota_22();//未回复的咨询量
        computequota_23();//及时回复的咨询量
        computequota_24();//及时回复的咨询量时间分布
        computequota_25();//统计质询量总数
        computequota_26();//统计未缴费签约总数
        computequota_27();//统计代预约量
        computequota_28();//统计平均值
        quartzJobLog.setJobContent(allContent.toString());

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/job/RenewToSignJob.java

@ -24,7 +24,7 @@ public class RenewToSignJob implements Job {
            Calendar cal = Calendar.getInstance();
            int year = cal.get(Calendar.YEAR)-1;
            int month = cal.get(Calendar.MONTH)+1;
            if(month <=7){
            if(month >=7){
                //设置已过期
                String sql = "UPDATE wlyy_sign_family t SET t.status = -4 WHERE t.status>=0 AND t.sign_year='"+year+"' AND t.expenses_status='1'";
                //数据迁移

+ 3 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -741,13 +741,13 @@ public class PatientHealthIndexService extends BaseService {
        if(gi_type != 0){
            Sort sort = new Sort(Direction.ASC, "recordDate");
            PageRequest pageRequest = new PageRequest(0, 1000, sort);
            re = patientHealthIndexDao.findIndexByPatient(patient, type,gi_type+"", startDate, endDate, pageRequest).getContent();
            re = patientHealthIndexDao.findIndexByPatientNative(patient, type,gi_type+"", startDate, endDate, pageRequest.getOffset(),pageRequest.getPageSize());
        }else{
            // 排序
            Sort sort = new Sort(Direction.ASC, "recordDate");
            PageRequest pageRequest = new PageRequest(0, 1000, sort);
            re = patientHealthIndexDao.findIndexByPatient(patient, type, startDate, endDate, pageRequest).getContent();
            re = patientHealthIndexDao.findIndexByPatientNative(patient, type, startDate, endDate, pageRequest.getOffset(),pageRequest.getPageSize());
        }
        return re;
@ -776,7 +776,7 @@ public class PatientHealthIndexService extends BaseService {
        {
            PageRequest pageRequest = new PageRequest(page, pageSize);
            //根据时间过滤排序
            List<String> dateList = patientHealthIndexDao.findDateList(patient, startDate, endDate, pageRequest.getPageNumber(),pageRequest.getPageSize());
            List<String> dateList = patientHealthIndexDao.findDateList(patient, startDate, endDate, pageRequest.getOffset(),pageRequest.getPageSize());
            if (dateList != null && dateList.size() > 0) {
                for (String dateString : dateList) {
                    DevicePatientHealthIndex obj = getPatientXT(patient, dateString);

+ 22 - 12
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthRecordService.java

@ -4,6 +4,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.yihu.wlyy.util.DateUtil;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -248,27 +249,36 @@ public class PatientHealthRecordService extends BaseService {
		// 查询最近的饮食
		Page<PatientHealthRecordDiet> diet = patientHealthRecordDietDao.findRecentByPatient(patient, new PageRequest(0, 1));
		if (sports != null && sports.getSize() > 0) {
			JSONObject sportObject = new JSONObject();
			for (PatientHealthRecordSports temp : sports) {
				jsonObject.put("sports", temp.getSportsName());
				jsonObject.put("sports_time",temp.getSportsTime());
				jsonObject.put("sports_type",temp.getSportsType());
				jsonObject.put("sports_typeName",temp.getSportsTypeName());
				jsonObject.put("czrq",DateUtil.dateToStr(temp.getCzrq(), DateUtil.YYYY_MM_DD));
				jsonObject.put("sortDate",DateUtil.dateToStr(temp.getSortDate(), DateUtil.YYYY_MM_DD));
		}
				sportObject.put("sports", temp.getSportsName());
				sportObject.put("sports_time", temp.getSportsTime());
				sportObject.put("sports_type", temp.getSportsType());
				sportObject.put("sports_typeName", temp.getSportsTypeName());
				sportObject.put("czrq", DateUtil.dateToStr(temp.getCzrq(), DateUtil.YYYY_MM_DD));
				sportObject.put("sortDate", DateUtil.dateToStr(temp.getSortDate(), DateUtil.YYYY_MM_DD));
			}
			jsonObject.put("sprot",sportObject);
		}
		if (medication != null) {
			JSONObject medicationObject = new JSONObject();
			for (PatientHealthRecordMedication temp : medication) {
				jsonObject.put("medication", temp.getMedicinesName());
				jsonObject.put("recordDate",DateUtil.dateToStr(temp.getRecordDate(), DateUtil.YYYY_MM_DD));
				medicationObject.put("medication", temp.getMedicinesName());
				medicationObject.put("recordDate",DateUtil.dateToStr(temp.getRecordDate(), DateUtil.YYYY_MM_DD));
			}
			jsonObject.put("medication",medicationObject);
		}
		if (diet != null) {
			JSONObject dietObject = new JSONObject();
			for (PatientHealthRecordDiet temp : diet) {
				jsonObject.put("diet", temp.getContent());
				jsonObject.put("recordDate",DateUtil.dateToStr(temp.getRecordDate(), DateUtil.YYYY_MM_DD));
				jsonObject.put("images",temp.getImages());
				dietObject.put("diet", temp.getContent());
				dietObject.put("recordDate",DateUtil.dateToStr(temp.getRecordDate(), DateUtil.YYYY_MM_DD));
				dietObject.put("images",temp.getImages());
			}
			jsonObject.put("diet",dietObject);
		}
		return jsonObject;
	}

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -209,9 +209,9 @@ public class SignPatientLabelInfoService extends BaseService {
        String timeKey = DateUtil.dateToStr(new Date(),"yyyyMMdd");
        String flag = redisTemplate.opsForValue().get("renew:"+timeKey+":"+patient);
        if(StringUtils.isNotBlank(flag)){
            json.put("isRemainRenew","1");
            json.put("isRemindRenew","1");
        }else{
            json.put("isRemainRenew","0");
            json.put("isRemindRenew","0");
        }
        String sql = "SELECT t.czrq FROM wlyy_sign_family_renew t WHERE t.status>=0 AND t.is_valid =0";
        List<Map<String,Object>> renews =  jdbcTemplate.queryForList(sql);

+ 8 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -963,8 +963,8 @@ public class SignWebService extends BaseService {
     * @return
     */
    public JSONObject getRenewYearCount(Long teamCode){
        StringBuffer sql = new StringBuffer("SELECT t.sign_year labelCode,COUNT(1) amount " +
                "FROM  wlyy_sign_family t WHERE t.admin_team_code ='"+teamCode+"' AND t.end <=NOW() AND t.status=-4 AND sign_year IS NOT NULL GROUP BY t.sign_year DESC");
        StringBuffer sql = new StringBuffer("SELECT t.sign_year labelCode,t.sign_year labelName,COUNT(1) amount " +
                "FROM  wlyy_sign_family t WHERE t.admin_team_code ="+teamCode+"  AND t.status=-4 AND sign_year IS NOT NULL GROUP BY t.sign_year DESC");
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql.toString());
        JSONObject json = new JSONObject();
        json.put("result",rs);
@ -975,12 +975,13 @@ public class SignWebService extends BaseService {
     * 获取用户信息
     * @return
     */
    public JSONObject getOverDuePatients(String year,String doctorCode,Integer page,Integer pageSize){
    public JSONObject getOverDuePatients(String year,Long teamCode,Integer page,Integer pageSize){
        StringBuffer sql = new StringBuffer("SELECT IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                "p.code,p.idcard,p.name,p.mobile,p.openid,p.phone,p.photo," +
                "p.ssc,t.sign_type,p.sex,t.emer_mobile,t.expenses_time,t.expenses_status " +
                "FROM wlyy_sign_family t ,wlyy_patient p " +
                "WHERE t.patient = p.code AND t.doctor ='"+doctorCode+"' AND t.sign_year ='"+year+"' LIMIT "+page*pageSize+","+pageSize+";");
                "t.patient code,t.idcard,t.name,t.mobile,t.openid," +
                "t.ssc,t.sign_type signType,p.sex " +
                " FROM wlyy_sign_family t " +
                " LEFT JOIN wlyy_patient p ON t.patient = p.code " +
                " WHERE t.admin_team_code ="+teamCode+" AND t.sign_year ='"+year+"' AND t.status =-4 LIMIT "+page*pageSize+","+pageSize);
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql.toString());
        JSONObject json = new JSONObject();
        json.put("result",rs);

+ 7 - 6
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -1622,7 +1622,7 @@ public class StatisticsService extends BaseService {
        return json;
    }
    public JSONObject getAVGSocreByMonth(String level ,String area,String statDate,String endDate)throws  Exception{
    public JSONArray getAVGSocreByMonth(String level ,String area,String statDate,String endDate)throws  Exception{
        List<String> times =  getMonthBetween(statDate,endDate);
        if(times==null||times.size()==0){
@ -1656,13 +1656,14 @@ public class StatisticsService extends BaseService {
            }
        }
        Map<String,Object> rsMap = new HashMap<>();
        JSONArray jsRs = new JSONArray();
        for(String time : times){
            rsMap.put(time,map.get(time)==null?0:((Map<String,Object>)map.get(time)).get("avgCount"));
            JSONObject json   = new JSONObject();
            json.put("month",time);
            json.put("socre",map.get(time)==null?0:((Map<String,Object>)map.get(time)).get("avgCount"));
            jsRs.put(json);
        }
        JSONObject data = new JSONObject();
        data.put("data",rsMap);
        return data;
        return jsRs;
    }
    private  List<String> getMonthBetween(String minDate, String maxDate) throws Exception {

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -427,7 +427,7 @@ public class PatientService extends TokenService {
            }
            List<SignFamily> signFamilys2 = jdbcTemplate.queryForList(oldSignSql, SignFamily.class);
            if (signFamilys1 != null && signFamilys1.size() > 0) {
                rs.put("mes", ",可以续签(已到期)");
                rs.put("mes", "可以续签(已到期)");
                rs.put("code", "2");
                return rs;
            } else {
@ -439,7 +439,7 @@ public class PatientService extends TokenService {
    }
    public JSONObject checkRenewData(String sqlRenew,JSONObject rs){
        List<SignFamilyRenew> renews = jdbcTemplate.queryForList(sqlRenew, SignFamilyRenew.class);
        List<Map<String,Object>> renews = jdbcTemplate.queryForList(sqlRenew);
        //如果续签表没有数据,则可以续签,有数据提示已经续签
        if (renews != null && renews.size() > 0) {
            rs.put("mes", "已经提交续签");

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthController.java

@ -265,10 +265,10 @@ public class DoctorHealthController extends BaseController {
										   @RequestParam(value="patient",required = true) String patient) {
		try {
			Map<String,Object> map = new HashMap<>();
			com.alibaba.fastjson.JSONObject xt = healthIndexService.findLastBypatient(patient,1);
			DevicePatientHealthIndex xt = healthIndexService.findLastByPatien(patient,1);
			if(xt!=null)
			{
				map.put("xt",xt.toJSONString());
				map.put("xt",xt);
			}
			DevicePatientHealthIndex xy = healthIndexService.findLastByPatien(patient,2);
			if(xy!=null)

+ 6 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -137,7 +137,11 @@ public class SignPatientLabelInfoController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/patients_by_label")
    public String getPatientInfoByLabel(String labelCode, String labelType, Long teamCode, int page, int pagesize) {
    public String getPatientInfoByLabel(@RequestParam(required = false) String labelCode,
                                        @RequestParam(required = false) String labelType,
                                        @RequestParam(required = false)Long teamCode,
                                        @RequestParam(required = false)int page,
                                        @RequestParam(required = false)int pagesize) {
        try {
            if (StringUtils.isEmpty(labelCode)) {
                return error(-1, "标签cdoe不能为空");
@ -151,7 +155,7 @@ public class SignPatientLabelInfoController extends BaseController {
            page = page - 1;
            if(labelType.equals("9")){
                JSONObject jsonObject = signWebService.getOverDuePatients(labelCode,getUID(),page,pagesize);
                JSONObject jsonObject = signWebService.getOverDuePatients(labelCode,teamCode,page,pagesize);
                return write(200, "查询成功", "data", jsonObject);
            }

+ 23 - 23
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -458,27 +458,27 @@ public class DoctorSignController extends WeixinBaseController {
        }
    }
    /**
     * 获取用户详情列表
     * @param year
     * @param page
     * @param pageSize
     * @return
     */
    @RequestMapping("/getOverDuePatients")
    @ApiOperation(value = "获取用户详情列表")
    public String getOverDuePatients(@RequestParam(required = true)String year,
                                     @RequestParam(required = true)Integer page,
                                     @RequestParam(required = true)Integer pageSize){
        try{
            JSONObject rs =signWebService.getOverDuePatients(year,getUID(),page,pageSize);
            //JSONObject rs =signWebService.getOverDuePatients(year,"64de930c-5b15-11e6-8344-fa163e8aee56",page,pageSize);
            return write(200, "操作成功!", "data", rs);
        }catch (Exception e){
            return error(-1, "请求失败");
        }
    }
//    /**
//     * 获取用户详情列表
//     * @param year
//     * @param page
//     * @param pageSize
//     * @return
//     */
//    @RequestMapping("/getOverDuePatients")
//    @ApiOperation(value = "获取用户详情列表")
//    public String getOverDuePatients(@RequestParam(required = true)String year,
//                                     @RequestParam(required = true)Integer page,
//                                     @RequestParam(required = true)Integer pageSize){
//        try{
//            JSONObject rs =signWebService.getOverDuePatients(year,getUID(),page,pageSize);
//            //JSONObject rs =signWebService.getOverDuePatients(year,"64de930c-5b15-11e6-8344-fa163e8aee56",page,pageSize);
//
//            return write(200, "操作成功!", "data", rs);
//        }catch (Exception e){
//            return error(-1, "请求失败");
//        }
//    }
    /**
     *
@ -515,9 +515,9 @@ public class DoctorSignController extends WeixinBaseController {
        }
    }
    @RequestMapping("/remainPatientRenew")
    @RequestMapping("/remindPatientRenew")
    @ApiOperation(value = "提醒居民续签")
    public String remainPatientRenew(@RequestParam(required = true)String patient){
    public String remindPatientRenew(@RequestParam(required = true)String patient){
        try{
            int rs =signWebService.remainPatientRenew(getAccessToken(),patient,getUID());
            if(rs==-1){

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/PatientHealthController.java

@ -276,7 +276,7 @@ public class PatientHealthController extends BaseController {
			DevicePatientHealthIndex xt = healthIndexService.findLastByPatien(patient,1);
			if(xt!=null)
			{
				map.put("xt",xt.toString());
				map.put("xt",xt);
			}
			DevicePatientHealthIndex xy = healthIndexService.findLastByPatien(patient,2);
			if(xy!=null)