소스 검색

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

trick9191 8 년 전
부모
커밋
09d3b799f4

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -40,6 +40,9 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query(" from Message a where a.read = 1 and over ='1' and a.sender = ?1 and a.receiver=?2 and a.signStatus='1'")
    Message findByPatient(String patient,String doctor);
    @Query(" from Message a where a.read = 1 and over ='1' and a.sender = ?1 and a.receiver=?2 ")
    Message findByPatientRenew(String patient,String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.sender=?2 and a.tzType=?3 order by a.createTime desc")
    List<Message> getHealthIndexMessageByPatient(String doctor,String patient,String type,Pageable pageRequest);

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyRenewDao.java

@ -56,4 +56,7 @@ public interface SignFamilyRenewDao extends PagingAndSortingRepository<SignFamil
    @Query("select a from SignFamilyRenew a where a.patient = ?1 and a.type = ?2 and a.status > 0")
    SignFamilyRenew findSignByPatient(String patient, int type);
    @Query("select a from SignFamilyRenew a where a.doctor = ?1 and a.patient = ?2 and a.type = 2 and a.status >= 0")
    SignFamilyRenew findByDoctorPatient(String doctor, String patient);
}

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

@ -290,7 +290,7 @@ public class SignPatientLabelInfoService extends BaseService {
                args = new Object[]{doctor, doctor, teamCode};
            }else{
                sql = "SELECT " +
                        "    t1.* " +
                        "    t1.* "+
                        " FROM " +
                        "    wlyy_sign_family t1 " +
                        " WHERE (t1.doctor = ? or t1.doctor_health = ?) " +

+ 32 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -665,6 +665,38 @@ public class FamilyContractService extends BaseService {
        return 200;
    }
    /**
     * 取消续签
     * @param patient
     * @param doctor
     * @return
     * @throws Exception
     */
    public int unsignRenew(String patient, String doctor) throws Exception {
        if(DateUtil.getNowMonth()<7){
            SignFamilyRenew  sf = signFamilyRenewDao.findByDoctorPatient(doctor, patient);
            if (sf!=null&&sf.getStatus() != 0 && sf.getStatus() != 2) {
                return -2;
            }
            sf.setStatus(-1);
        }else{
            SignFamily  sf = signFamilyDao.findByDoctorPatient(doctor, patient);
            if (sf!=null&&sf.getStatus() != 0 && sf.getStatus() != 2) {
                return -2;
            }
            sf.setStatus(-1);
        }
        Message message = messageDao.findByPatientRenew(patient, doctor);
        //修改信息为无效
        if (message != null) {
            message.setRead(0);
            message.setOver("0");
        }
        return 200;
    }
    /**
     * 申请解约
     *

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

@ -485,7 +485,11 @@ public class SignWebService extends BaseService {
            jsonObject.put("createTime", signFamily.getCzrq());
            jsonObject.put("type", signFamily.getType());
            jsonObject.put("typeName", signFamily.getType() == 1 ? "三师签约" : "家庭签约");
            jsonObject.put("isRenew", "0");
            if(StringUtils.isNotBlank(signFamily.getRenewFlag())){
                jsonObject.put("isRenew", "1");
            }else{
                jsonObject.put("isRenew", "0");
            }
            String statusName = "";
            switch (jsonObject.getInt("status")) {
                case -4:
@ -573,7 +577,7 @@ public class SignWebService extends BaseService {
        //统计当年咨询数量
        String consult_sql = "select count(1) as count from wlyy_consult_team  w where w.doctor = ? and w.patient =? and YEAR(w.czrq) = ? ";
        //统计随访数量
        String followup_sql = "select count(1) as count from wlyy_followup  w where (w.doctor_code = ? or w.doctor_code =?) and w.patient_code =? and YEAR(w.create_time) = ?  and w.followup_class is not null ";
        String followup_sql = "select count(1) as count from wlyy_followup  w where (w.doctor_code = ? or w.doctor_code =?) and w.patient_code =? and YEAR(w.create_time) = ? ";
        //统计待预约数量
        String reservation_sql = "select count(1) as count from wlyy_patient_reservation  w where (w.doctor = ? or w.doctor =?) and w.patient =? and YEAR(w.czrq) = ? ";
        //统计健康教育数量
@ -615,7 +619,7 @@ public class SignWebService extends BaseService {
        //获取咨询
        String consult_sql = "select w.consult,w.symptoms,w.czrq,w.status,1 as type from wlyy_consult_team  w where w.doctor = ? and w.patient =? and YEAR(w.czrq) = ? ";
        //获取随访
        String followup_sql = "select w.id,w.followup_type,w.followup_class,w.followup_date as czrq,w.followup_manager_status,w.status,2 as type from wlyy_followup  w where (w.doctor_code = ? or w.doctor_code =?) and w.patient_code =? and YEAR(w.create_time) = ? and w.followup_class is not null ";
        String followup_sql = "select w.id,w.followup_type,w.followup_class,w.followup_date as czrq,w.followup_manager_status,w.status,2 as type from wlyy_followup  w where (w.doctor_code = ? or w.doctor_code =?) and w.patient_code =? and YEAR(w.create_time) = ?  ";
        //获取待预约
        String reservation_sql = "select w.code,w.id, w.doctor_name,w.doctor_code,w.doctor_job,w.doctor,w.dname,w.org_code,w.status,w.start_time as czrq,3 as type from wlyy_patient_reservation  w where (w.doctor = ? or w.doctor =?) and w.patient =? and YEAR(w.czrq) = ? ";
        //获取健康教育
@ -1609,7 +1613,7 @@ public class SignWebService extends BaseService {
        //统计当年咨询数量
        String consult_sql = "select count(1) as count from wlyy_consult_team  w where w.doctor = ? and w.patient =? and YEAR(w.czrq) = ? ";
        //统计随访数量
        String followup_sql = "select count(1) as count from wlyy_followup  w where (w.doctor_code = ? or w.doctor_code =?) and w.patient_code =? and YEAR(w.create_time) = ?  and w.followup_class is not null ";
        String followup_sql = "select count(1) as count from wlyy_followup  w where (w.doctor_code = ? or w.doctor_code =?) and w.patient_code =? and YEAR(w.create_time) = ? ";
        //统计待预约数量
        String reservation_sql = "select count(1) as count from wlyy_patient_reservation  w where (w.doctor = ? or w.doctor =?) and w.patient =? and YEAR(w.czrq) = ? ";
        //统计健康教育数量
@ -1915,7 +1919,8 @@ public class SignWebService extends BaseService {
        if(list!=null&&list.size()>0){
            sign = list.get(0);
        }
        Long id = (Long)sign.get("admin_team_code");
        Integer i = (Integer)sign.get("admin_team_code");
        Long id = i.longValue();
        if(id==null){
            renew.setRenewFlag("2");
        }else{
@ -1937,7 +1942,8 @@ public class SignWebService extends BaseService {
        if(list!=null&&list.size()>0){
            sign = list.get(0);
        }
        Long id = (Long)sign.get("admin_team_code");
        Integer i = (Integer)sign.get("admin_team_code");
        Long id = i.longValue();
        if(id==null){
            renew.setRenewFlag("2");
        }else{

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

@ -2275,7 +2275,7 @@ public class StatisticsService extends BaseService {
//        startDate = startDate + " 00:00:00";
//        endDate = endDate + " 23:59:59";
        //随访数目
        String followup_sql = "SELECT COUNT(1) AS followupCount from wlyy_followup w WHERE w.admin_team_code=" + id + " AND  w.create_time >='" + startDate + "' AND w.create_time<='" + endDate + "' AND w.followup_class IS NOT NULL ";
        String followup_sql = "SELECT COUNT(1) AS followupCount from wlyy_followup w WHERE w.admin_team_code=" + id + " AND  w.create_time >='" + startDate + "' AND w.create_time<='" + endDate + "' ";
        //随访数目
        Map<String, Object> followupCout = jdbcTemplate.queryForMap(followup_sql);
        if (followupCout.get("followupCount") == null) {
@ -2917,7 +2917,6 @@ public class StatisticsService extends BaseService {
                    " AND w.doctor_code ='" + doctor + "'" +
                    " AND w.create_time >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY dateNo";
            planSQL = "SELECT " +
@ -2930,7 +2929,6 @@ public class StatisticsService extends BaseService {
                    " AND w.create_time >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.status ='2'" +
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY dateNo";
        } else {
            //按月
@ -2945,7 +2943,6 @@ public class StatisticsService extends BaseService {
                    " AND w.doctor_code ='" + doctor + "'" +
                    " AND w.create_time >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
            planSQL = "SELECT " +
                    " ( " +
@ -2959,7 +2956,6 @@ public class StatisticsService extends BaseService {
                    " AND w.create_time >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.status ='2'" +
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
        }
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSQL);
@ -2985,7 +2981,6 @@ public class StatisticsService extends BaseService {
                    " w.admin_team_code =" + teamCode +
                    " AND w.create_time >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY dateNo";
            planSQL = "SELECT " +
@ -2999,7 +2994,6 @@ public class StatisticsService extends BaseService {
                    " AND w.create_time >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.status ='2'" +
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
        } else {
            //按月
@ -3013,7 +3007,6 @@ public class StatisticsService extends BaseService {
                    " w.admin_team_code =" + teamCode +
                    " AND w.create_time >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
            planSQL = "SELECT " +
                    " ( " +
@ -3026,7 +3019,6 @@ public class StatisticsService extends BaseService {
                    " AND w.create_time >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.status ='2'" +
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
        }
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSQL);
@ -3056,7 +3048,6 @@ public class StatisticsService extends BaseService {
                " WHERE " +
                " w.admin_team_code =" + teamCode +
                " AND w.create_time <= '" + endDate + "' " +
                " AND w.followup_class IS NOT NULL " +
                " GROUP BY " +
                "  w.doctor_code " +
                " ) c ON c.doctor_code =m.doctor_code, " +
@ -3088,7 +3079,6 @@ public class StatisticsService extends BaseService {
                " w.admin_team_code =" + teamCode +
                " AND w.create_time >= '" + startDate + "' " +
                " AND w.create_time <= '" + endDate + "' " +
                " AND w.followup_class IS NOT NULL " +
                " GROUP BY " +
                "  w.doctor_code " +
                " ) c ON c.doctor_code =m.doctor_code, " +
@ -3121,7 +3111,6 @@ public class StatisticsService extends BaseService {
                " AND w.create_time >= '" + startDate + "' " +
                " AND w.create_time <= '" + endDate + "' " +
                " AND w.status ='2'" +
                " AND w.followup_class IS NOT NULL " +
                " GROUP BY " +
                "  w.doctor_code " +
                " ) c ON c.doctor_code =m.doctor_code, " +
@ -3257,8 +3246,7 @@ public class StatisticsService extends BaseService {
                " WHERE " +
                " w.admin_team_code =" + teamCode +
                " AND w.doctor_code ='" + doctor + "' " +
                " AND w.create_time <= '" + endDate + "' " +
                " AND w.followup_class IS NOT NULL";
                " AND w.create_time <= '" + endDate + "' ";
        String addSql = "SELECT " +
                " COUNT(1) AS addCount " +
                " FROM " +
@ -3267,8 +3255,7 @@ public class StatisticsService extends BaseService {
                " w.admin_team_code =" + teamCode +
                " AND w.doctor_code ='" + doctor + "' " +
                " AND w.create_time >= '" + startDate + "' " +
                " AND w.create_time <= '" + endDate + "' " +
                " AND w.followup_class IS NOT NULL";
                " AND w.create_time <= '" + endDate + "' ";
        String planSql = "SELECT " +
                " COUNT(1) AS planCount " +
                " FROM " +
@ -3278,8 +3265,7 @@ public class StatisticsService extends BaseService {
                " AND w.doctor_code ='" + doctor + "' " +
                " AND w.create_time >= '" + startDate + "' " +
                " AND w.create_time <= '" + endDate + "' " +
                " AND w.status ='2'" +
                " AND w.followup_class IS NOT NULL";
                " AND w.status ='2'";
        JSONObject rs = new JSONObject();
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql);

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

@ -482,11 +482,13 @@ public class DoctorSignController extends WeixinBaseController {
                rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
//            int rs =signWebService.agreeRenew(getAccessToken(),"test00000000005",patient,state);
            }else{
                rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
                //如果没有续签记录,走签约记录
                if(rs!=0){
                    rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
                }
//                rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
//                //如果没有续签记录,走签约记录
//                if(rs!=0){
//                    rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
//                }
                rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
            }
            if(rs != 1){
                //设置代码为已读

+ 23 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -567,6 +567,29 @@ public class FamilyContractController extends BaseController {
        }
    }
    @RequestMapping(value = "unsignRenew")
    @ResponseBody
    public String unsignRenew(
            String doctor,
            @RequestParam(required = false) String patientCode
    ) {
        try {
            patientCode = StringUtils.isNoneBlank(patientCode) ? patientCode : getRepUID();
//            patientCode = StringUtils.isNoneBlank(patientCode) ? patientCode : getUID();
            int res = familyContractService.unsignRenew(patientCode, doctor);
            if (res == -1) {
                return error(-1, "取消签约失败!");
            } else if (res == 200) {
                return success("签约申请已取消!");
            } else {
                return error(-1, "签约状态已变化,无法申请取消签约!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "取消签约失败!");
        }
    }
    /**
     * 申请解约
     *