Selaa lähdekoodia

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

lyr 8 vuotta sitten
vanhempi
commit
c5bce3f6f2

+ 6 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -143,6 +143,10 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
	// 查询待签约总数
	@Query("select count(1) from SignFamily a where a.doctor = ?1 and a.status = 0 and a.type = 2")
	int countAmountUnsignByDoctor(String doctor);
	// 查询待签约总数
	@Query("select count(1) from SignFamily a where a.doctorHealth = ?1 and a.status = 0 and a.type = 2")
	int countAmountUnsignByDoctorHealth(String doctor);
	
	// 查询团队中的健康管理师 sf.doctorHealth,sf.doctorHealthName,
	//select sf.doctorHealth,sf.doctorHealthName,count(*) totalContract from SignFamily sf where sf.healthDoctor = ?1
@ -329,7 +333,7 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
	 * @param status
	 * @return
	 */
	@Query("select f from SignFamily f where f.adminTeamId = ?1 and status >= ?2 ")
	List<SignFamily> findByAdminTeamIdAndStatus(long teamCode,int status);
	@Query("select count(f) from SignFamily f where f.adminTeamId = ?1 and status >= ?2 ")
	int findByAdminTeamIdAndStatus(long teamCode,int status);
}

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

@ -665,8 +665,8 @@ public class SignPatientLabelInfoService extends BaseService {
     * @throws Exception
     */
    public int getPatientAmountByTeam(Long teamCode) throws Exception {
        List<SignFamily> signFamilies = signFamilyDao.findByAdminTeamIdAndStatus(teamCode, 1);
        return signFamilies.size();
        int count = signFamilyDao.findByAdminTeamIdAndStatus(teamCode, 1);
        return count;
    }
    /**
@ -719,7 +719,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    Calendar today = Calendar.getInstance();
                    Calendar startDate = Calendar.getInstance();
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                    sql = "select *" +
                    sql = "select count(DISTINCT  patient) count" +
                            " from " +
                            "     wlyy_sign_family " +
                            " where status > 0 " +
@ -749,7 +749,7 @@ public class SignPatientLabelInfoService extends BaseService {
                } else {
                    if (label.getLabelCode().equals("0")) {
                        sql = " SELECT " +
                                "     t1.* " +
                                "     count(DISTINCT t1.patient) count" +
                                " FROM" +
                                "     wlyy_sign_family t1 " +
                                " left join " +
@ -763,7 +763,7 @@ public class SignPatientLabelInfoService extends BaseService {
                        args = new Object[]{teamCode, labelType, teamCode};
                    } else {
                        sql = " SELECT " +
                                "     t1.* " +
                                "     count(DISTINCT t1.patient) count" +
                                " FROM" +
                                "     wlyy_sign_family t1, " +
                                "     wlyy_sign_patient_label_info t2 " +
@ -779,8 +779,6 @@ public class SignPatientLabelInfoService extends BaseService {
                    }
                }
                sql = "select count(DISTINCT t.patient) count from (" + sql + ") t";
                List<Map<String, Object>> count = jdbcTemplate.queryForList(sql, args);
                if (count != null && count.size() > 0 && count.get(0).containsKey("count")) {

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

@ -1274,6 +1274,17 @@ public class FamilyContractService extends BaseService {
        return signFamilyDao.countAmountUnsignByDoctor(doctor);
    }
    /**
     * 查询待签约总数
     *
     * @param doctor
     * @return
     */
    public int countAmountUnsign2(String doctor) {
        return signFamilyDao.countAmountUnsignByDoctorHealth(doctor);
    }
    public List<?> amountPatients(String uid) {
        return null;
    }

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

@ -39,79 +39,90 @@ public class SignWebService extends BaseService {
     *
     * @param doctor
     * @param status
     * @param doctorType
     * @return
     */
    public List<Map<String, Object>> getSignWebByDoctor(String doctor, int status, int doctorType) {
    public List<Map<String, Object>> getSignWebByDoctor(String doctor, int status, int page, int pagesize) {
        // 查询语句
        String sql = "select " +
                "    a.code " +
                "    ,a.doctor " +
                "    ,b.code  as  patient" +
                "    ,b.idcard " +
                "    ,b.name " +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
                "    ,b.town_name  as townName" +
                "    ,b.address " +
                "    ,b.photo " +
                "    ,a.status " +
                "    ,a.id " +
                (status == 1? "    ,a.patient_apply_date as applyDate ":"    ,a.expenses_time as applyDate ") +
                "    ,a.reason " +
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                "    a1.code " +
                "    ,a1.repdoctor doctor" +
                "    ,b1.code  as  patient" +
                "    ,b1.idcard " +
                "    ,b1.name " +
                "    ,b1.province_name  as provinceName" +
                "    ,b1.city_name  as cityName" +
                "    ,b1.town_name  as townName" +
                "    ,b1.address " +
                "    ,b1.photo " +
                "    ,a1.status " +
                "    ,a1.id " +
                (status == 1 ? "    ,a1.patient_apply_date as applyDate " : "    ,a1.expenses_time as applyDate ") +
                "    ,a1.reason " +
                "    ,b1.street_name as streetName" +
                "    ,b1.sex" +
                " from " +
                " ( select code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and status = ? and type = 2" +
                (status == 3 ? " and expenses_status = '1'" : "") + " order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code  order by a.begin desc ";
                " ( select code,patient,repdoctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family where repdoctor = ? and status = ? and type = 2 " +
                (status == 3 ? " and expenses_status = '1'" : "") + ") a1 " +
                " ,wlyy_patient b1 " +
                " where a1.patient = b1.code ";
        sql = "select t.* from (" + sql.replaceAll("repdoctor","doctor") + " union all "
                + sql.replaceAll("repdoctor","doctor_health").replaceAll("a1","a2").replaceAll("b1","b2")
                + ") t order by t.begin desc limit " + page * pagesize  + "," + pagesize;
        // 未缴费查询语句
        String sqlExpenses = "select " +
                "    a.code " +
                "    ,a.doctor " +
                "    ,b.code  as  patient" +
                "    ,b.name " +
                "    ,b.idcard " +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
                "    ,b.town_name  as townName" +
                "    ,b.address " +
                "    ,b.photo " +
                "    ,a.status " +
                "    ,a.id " +
                "    ,a.apply_date as applyDate " +
                "    ,a.reason " +
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                "    a1.code " +
                "    ,a1.repdoctor doctor" +
                "    ,b1.code  as  patient" +
                "    ,b1.name " +
                "    ,b1.idcard " +
                "    ,b1.province_name  as provinceName" +
                "    ,b1.city_name  as cityName" +
                "    ,b1.town_name  as townName" +
                "    ,b1.address " +
                "    ,b1.photo " +
                "    ,a1.status " +
                "    ,a1.id " +
                "    ,a1.apply_date as applyDate " +
                "    ,a1.reason " +
                "    ,b1.street_name as streetName" +
                "    ,b1.sex" +
                " from " +
                " ( select code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and status > ? and type = 2 order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code and (a.expenses_status = '0' or a.len < 1) order by a.begin desc ";
                " ( select code,patient,repdoctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family where repdoctor = ? and status > ? and type = 2 ) a1 " +
                " ,wlyy_patient b1 " +
                " where a1.patient = b1.code and (a1.expenses_status = '0' or a1.len < 1) ";
        sqlExpenses = "select t.* from (" + sqlExpenses.replaceAll("repdoctor","doctor") + " union all "
                + sqlExpenses.replaceAll("repdoctor","doctor_health").replaceAll("a1","a2").replaceAll("b1","b2")
                + ") t order by t.begin desc limit " + page * pagesize  + "," + pagesize;
        // 已解约查询语句
        String surrSql = "select " +
                "    a.code " +
                "    ,a.doctor " +
                "    ,b.code  as  patient" +
                "    ,b.name " +
                "    ,b.idcard " +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
                "    ,b.town_name  as townName" +
                "    ,b.address " +
                "    ,b.photo " +
                "    ,a.status " +
                "    ,a.id " +
                "    ,a.apply_unsign_date as applyDate" +
                "    ,a.reason " +
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                "    a1.code " +
                "    ,a1.repdoctor doctor" +
                "    ,b1.code  as  patient" +
                "    ,b1.name " +
                "    ,b1.idcard " +
                "    ,b1.province_name  as provinceName" +
                "    ,b1.city_name  as cityName" +
                "    ,b1.town_name  as townName" +
                "    ,b1.address " +
                "    ,b1.photo " +
                "    ,a1.status " +
                "    ,a1.id " +
                "    ,a1.apply_unsign_date as applyDate" +
                "    ,a1.reason " +
                "    ,b1.street_name as streetName" +
                "    ,b1.sex" +
                " from " +
                " ( select code,patient,doctor,status,id,apply_date,apply_unsign_date,reason,begin from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and ( status = ? or status = ? ) and type = 2 order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code  order by a.begin desc ";
                " ( select code,patient,repdoctor,status,id,apply_date,apply_unsign_date,reason,begin from wlyy_sign_family where repdoctor = ? and ( status = ? or status = ? ) and type = 2 ) a1 " +
                " ,wlyy_patient b1 " +
                " where a1.patient = b1.code ";
        surrSql = "select t.* from (" + surrSql.replaceAll("repdoctor","doctor") + " union all "
                + surrSql.replaceAll("repdoctor","doctor_health").replaceAll("a1","a2").replaceAll("b1","b2")
                + ") t order by t.begin desc limit " + page * pagesize  + "," + pagesize;
        // 分页信息
        //PageRequest pageRequest = new PageRequest(page - 1, pageSize);
@ -120,19 +131,19 @@ public class SignWebService extends BaseService {
        List<Map<String, Object>> patients = null;
        switch (status) {
            case 1:// 待签约
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 0});
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 0, doctor, 0});
                break;
            case 2:// 待解约
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 2});
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 2, doctor, 2});
                break;
            case 3:// 已签约
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 1});
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 1, doctor, 1});
                break;
            case 4:// 4已经解约
                patients = jdbcTemplate.queryForList(surrSql, new Object[]{doctor, -3, -4});
                patients = jdbcTemplate.queryForList(surrSql, new Object[]{doctor, -3, -4, doctor, -3, -4});
                break;
            case 5: // 未缴费
                patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, 0});
                patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, 0, doctor, 0});
        }
        return patients;

+ 7 - 8
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -613,16 +613,15 @@ public class DoctorController extends BaseController {
            Doctor temp = doctorInfoService.findDoctorByCode(getUID());
            if (temp != null) {
                JSONObject json = new JSONObject();
                int count1 = familyContractService.countAmountSigned(getUID());
                int count2 = familyContractService.countAmountSigned2(getUID());
                // 审核总数
                if ("2".equals(doctorType)) {
                    //全科医生
                    json.put("signed_amount", familyContractService.countAmountSigned(getUID()));
                } else {
                    //健康管理师
                    json.put("signed_amount", familyContractService.countAmountSigned2(getUID()));
                }
                json.put("signed_amount", count1 + count2);
                int count3 = familyContractService.countAmountUnsign(getUID());
                int count4 = familyContractService.countAmountUnsign2(getUID());
                // 等审核总数
                json.put("unsign_amount", familyContractService.countAmountUnsign(getUID()));
                json.put("unsign_amount", count3 + count4);
                return write(200, "医生信息查询成功!", "data", json);
            } else {
                return error(-1, "医生信息查询失败!");

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

@ -210,25 +210,14 @@ public class DoctorSignController extends BaseController {
            int page,
            int pageSize) {
        try {
            List<Map<String, Object>> listSign = signWebService.getSignWebByDoctor(getUID(), status, doctorType);
            List<Map<String, Object>> listSub = new ArrayList<>();
            int totalPage = 0;
            int start = (page - 1) * pageSize;
            int end = (page - 1) * pageSize + pageSize;
            page = page > 0 ? page -1 : 0;
            List<Map<String, Object>> listSign = signWebService.getSignWebByDoctor(getUID(), status, page, pageSize);
            if (listSign != null) {
                totalPage = listSign.size() % pageSize > 0 ? (listSign.size() / pageSize + 1) : listSign.size() / pageSize;
                if (end < listSign.size()) {
                    listSub = listSign.subList(start, end);
                } else if (start < listSign.size() && end >= listSign.size()) {
                    listSub = listSign.subList(start, listSign.size());
                }
            }
            JSONObject data = new JSONObject();
            List<JSONObject> jsonArray = new ArrayList<>();
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
            if (listSub != null) {
                for (Map<String, Object> temp : listSub) {
            if (listSign != null) {
                for (Map<String, Object> temp : listSign) {
                    if (temp == null) {
                        continue;
                    }
@ -297,8 +286,8 @@ public class DoctorSignController extends BaseController {
            }
            data.put("list", jsonArray);
            data.put("totalPage", totalPage);
            data.put("page", page);
//            data.put("totalPage", totalPage);
//            data.put("page", page);
            return write(200, "查询成功!", "data", data);
        } catch (Exception ex) {
            ex.printStackTrace();