Browse Source

长处方相关接口

trick9191 7 years ago
parent
commit
039703062c

+ 183 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -588,6 +588,74 @@ public class PrescriptionInfoService extends BaseService {
        }
    }
    public void setTotalSQL(StringBuffer pre_sql, List<Object> params, Integer teamCode, String state, String startDate, String endDate, String nameKeyword, String patient) {
        if (teamCode != null && teamCode > 0) {
            pre_sql.append(" AND pr.admin_team_id =?");
        }
        params.add(teamCode);
        if (StringUtils.isNotBlank(state)) {
            pre_sql.append(" AND pr.status IN (" + state + ") ");
        }
        if (StringUtils.isNotBlank(startDate)) {
            pre_sql.append(" AND pr.create_time >= ? ");
            params.add(startDate+" 00:00:00");
        }
        if (StringUtils.isNotBlank(endDate)) {
            pre_sql.append(" AND pr.create_time <= ? ");
            params.add(endDate+" 23:59:59");
        }
        if (StringUtils.isNotBlank(nameKeyword)) {
            pre_sql.append(" AND pr.patient_name like ? ");
            params.add("%" + nameKeyword + "%");
        }
        if (StringUtils.isNotBlank(patient)) {
            pre_sql.append(" AND pr.patient = ?");
            params.add(patient);
        }
    }
    /**
     * 获取处方详情总数
     * @param teamCode
     * @param state
     * @param diseases
     * @param startDate
     * @param endDate
     * @param nameKeyword
     * @param patient
     * @return
     */
    public JSONObject getDoctorPrescriptionTotal(Integer teamCode, String state, String diseases, String startDate, String endDate, String nameKeyword, String patient) {
        StringBuffer pre_sql = new StringBuffer("SELECT count(1) AS total" +
                " FROM " +
                " wlyy_prescription pr " +
                " LEFT JOIN wlyy_patient p ON pr.patient = p.`code` ");
        List<Object> params = new ArrayList<>();
        //先判断疾病类型是否为空
        if (StringUtils.isNotBlank(diseases)) {
            //疾病类型不为空,关联查询疾病类型表
            pre_sql.append(" ,wlyy_prescription_diagnosis s " +
                    " WHERE s.prescription_code = pr.code " +
                    " AND s.health_problem = ?");
            params.add(diseases);
            setTotalSQL(pre_sql, params, teamCode, state, startDate, endDate, nameKeyword, patient);
        } else {
            //查询所有疾病类型表
            pre_sql.append(" WHERE 1=1 ");
            setTotalSQL(pre_sql, params, teamCode, state, startDate, endDate, nameKeyword, patient);
        }
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(), params.toArray());
        JSONObject jsonRs = new JSONObject();
        if(rs!=null && rs.size()>0){
            jsonRs.put("total",rs.get(0).get("total"));
        }else{
            jsonRs.put("total",0);
        }
        return jsonRs;
    }
    /**
     * 获取续方信息
     *
@ -855,6 +923,26 @@ public class PrescriptionInfoService extends BaseService {
        return new JSONArray(rs);
    }
    public JSONObject getHDoctorPrescriptionExpressageTotal(String teamCode, String type, String doctor, String nameKey, String startDate, String endDate, String hospital, String state) {
        StringBuffer pre_sql = new StringBuffer("SELECT count(1) AS total " +
                " FROM " +
                " wlyy_prescription pr " +
                " LEFT JOIN wlyy_patient p ON pr.patient = p.`code` " +
                " JOIN wlyy_prescription_expressage e ON pr.code = e.prescription_code " +
                " WHERE 1=1 AND pr.status >="+PrescriptionLog.PrescriptionLogStatus.pay_success.getValue()+" ");
        List<Object> params = new ArrayList<>();
        setExpressageTotalSql(pre_sql, params, teamCode, type, doctor, nameKey, startDate, endDate, hospital, state);
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(), params.toArray());
        JSONObject jsonRs=new JSONObject();
        if(rs!=null&&rs.size()>0){
            jsonRs.put("total",rs.get(0).get("total"));
        }else{
            jsonRs.put("total",0);
        }
        return jsonRs;
    }
    public void setExpressageSql(StringBuffer pre_sql, List<Object> param, String teamCode, String type, String doctor, String nameKey, String startDate, String endDate, String hospital, String state, Integer page, Integer size) {
        if (StringUtils.isNotBlank(type)) {
@ -896,6 +984,43 @@ public class PrescriptionInfoService extends BaseService {
        }
    }
    public void setExpressageTotalSql(StringBuffer pre_sql, List<Object> param, String teamCode, String type, String doctor, String nameKey, String startDate, String endDate, String hospital, String state) {
        if (StringUtils.isNotBlank(type)) {
            if ("1".equals(type)) {
                pre_sql.append(" AND e.expressage_Code = ?");
                param.add(doctor);
            } else {
                pre_sql.append(" AND e.accept_Code = ?");
                param.add(doctor);
            }
        }
        if (StringUtils.isNotBlank(teamCode)) {
            pre_sql.append(" AND pr.admin_team_id = ? ");
            param.add(teamCode);
        }
        if (StringUtils.isNotBlank(nameKey)) {
            pre_sql.append(" AND p.name LIKE ? ");
            param.add("%" + nameKey + "%");
        }
        if (StringUtils.isNotBlank(startDate)) {
            pre_sql.append(" AND pr.create_time >= ? ");
            param.add(startDate + " 00:00:00");
        }
        if (StringUtils.isNotBlank(endDate)) {
            pre_sql.append(" AND pr.create_time <= ? ");
            param.add(endDate + " 23:59:59");
        }
        if (StringUtils.isNotBlank(hospital)) {
            pre_sql.append(" AND e.hospital_code = ? ");
            param.add(hospital);
        }
        if (StringUtils.isNotBlank(state)) {
            pre_sql.append(" AND pr.status = ? ");
            param.add(state);
        }
    }
    /**
     * 获取订单跟踪下拉列表
     * @param doctor
@ -1076,6 +1201,27 @@ public class PrescriptionInfoService extends BaseService {
        return new JSONArray(rs);
    }
    public JSONObject getDoctorPrescriptionExpressageTotal(Integer teamCode, String nameKey, String startDate, String endDate, String hospital, String state, String dispensaryType, String AllocationType) {
        StringBuffer pre_sql = new StringBuffer("SELECT count(1) AS total " +
                " FROM " +
                " wlyy_prescription pr " +
                " LEFT JOIN wlyy_patient p ON pr.patient = p.`code` " +
                " JOIN wlyy_prescription_expressage e ON pr.code = e.prescription_code " +
                " JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code " +
                " WHERE r.status=1 AND pr.status >="+PrescriptionLog.PrescriptionLogStatus.pay_success.getValue()+" ");
        List<Object> params = new ArrayList<>();
        setDoctorExpressageTotalSql(pre_sql, params, teamCode, nameKey, startDate, endDate, hospital, state, dispensaryType, AllocationType);
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(), params.toArray());
        JSONObject jsonRs = new JSONObject();
        if(rs!=null && rs.size()>0){
            jsonRs.put("total",rs.get(0).get("total"));
        }else{
            jsonRs.put("total",0);
        }
        return jsonRs;
    }
    public void setDoctorExpressageSql(StringBuffer pre_sql, List<Object> param, Integer teamCode, String nameKey, String startDate, String endDate, String hospital, String state, String dispensaryType, String AllocationType, Integer page, Integer size) {
        if (StringUtils.isNotBlank(nameKey)) {
            pre_sql.append(" AND p.name LIKE ? ");
@ -1118,6 +1264,43 @@ public class PrescriptionInfoService extends BaseService {
        }
    }
    public void setDoctorExpressageTotalSql(StringBuffer pre_sql, List<Object> param, Integer teamCode, String nameKey, String startDate, String endDate, String hospital, String state, String dispensaryType, String AllocationType) {
        if (StringUtils.isNotBlank(nameKey)) {
            pre_sql.append(" AND p.name LIKE ? ");
            param.add("%" + nameKey + "%");
        }
        if (teamCode != null && teamCode > 0) {
            pre_sql.append(" AND pr.admin_team_id = ? ");
            param.add(teamCode);
        }
        if (StringUtils.isNotBlank(startDate)) {
            pre_sql.append(" AND pr.create_time >= ? ");
            param.add(startDate + " 00:00:00");
        }
        if (StringUtils.isNotBlank(endDate)) {
            pre_sql.append(" AND pr.create_time <= ? ");
            param.add(endDate + " 23:59:59");
        }
        if (StringUtils.isNotBlank(hospital)) {
            pre_sql.append(" AND e.hospital_code = ? ");
            param.add(hospital);
        }
        if (StringUtils.isNotBlank(state)) {
            pre_sql.append(" AND pr.status = ? ");
            param.add(state);
        }
        if (StringUtils.isNotBlank(dispensaryType)) {
            pre_sql.append(" AND pr.dispensary_type = ? ");
            param.add(dispensaryType);
        }
        if (StringUtils.isNotBlank(AllocationType)) {
            //1为未分配建管师列表
            if ("1".equals(AllocationType)) {
                pre_sql.append(" AND e.expressage_code IS NULL ");
            }
        }
    }
    public JSONObject getCountExpressage(String teamCode) {
        StringBuffer pre_sql = new StringBuffer("SELECT " +
                " count(1) AS count  " +

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

@ -281,6 +281,98 @@ public class SignWebService extends BaseService {
        return patients;
    }
    /**
     * 获取区签约居民数目
     * @param doctor
     * @return
     */
    public JSONObject getSignWebByDoctorCount(String doctor) {
        Doctor d = doctorDao.findByCode(doctor);
        String sql ;
        if (d != null && d.getLevel() == 3) {
             sql ="SELECT  " +
                    "( " +
                    " SELECT " +
                    "  count(1) " +
                    " FROM " +
                    "  wlyy_sign_family " +
                    " WHERE " +
                    "  doctor_health = '"+doctor+"' " +
                    " AND doctor IS NULL " +
                    " AND STATUS = 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0' " +
                    " ) AS waitSignCount, " +
                    "( " +
                    " SELECT " +
                    "  count(1) " +
                    " FROM " +
                    "  wlyy_sign_family " +
                    " WHERE " +
                    "  (doctor = '"+doctor+"' or doctor_health = '"+doctor+"') " +
                    " AND STATUS > 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0'  " +
                    " ) AS waitPayCount, " +
                    "( " +
                    " SELECT " +
                    " count(1) " +
                    " FROM " +
                    " wlyy_sign_family " +
                    " WHERE " +
                    " (doctor = '"+doctor+"' or doctor_health = '"+doctor+"') " +
                    " AND STATUS = 1 " +
                    " AND type = 2 " +
                    " AND expenses_status = '1'  " +
                    " ) AS signCount";
        }else{
             sql ="SELECT  " +
                    "( " +
                    " SELECT " +
                    "  count(1) " +
                    " FROM " +
                    "  wlyy_sign_family " +
                    " WHERE " +
                    "  doctor = '"+doctor+"' " +
                    " AND STATUS = 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0' " +
                    " ) AS waitSignCount, " +
                    "( " +
                    " SELECT " +
                    "  count(1) " +
                    " FROM " +
                    "  wlyy_sign_family " +
                    " WHERE " +
                    "  (doctor = '"+doctor+"' or doctor_health = '"+doctor+"') " +
                    " AND STATUS > 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0'  " +
                    " ) AS waitPayCount, " +
                    "( " +
                    " SELECT " +
                    " count(1) " +
                    " FROM " +
                    " wlyy_sign_family " +
                    " WHERE " +
                    " (doctor = '"+doctor+"' or doctor_health = '"+doctor+"') " +
                    " AND STATUS = 1 " +
                    " AND type = 2 " +
                    " AND expenses_status = '1'  " +
                    " ) AS signCount";
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
            return new JSONObject(list.get(0));
        }
        return new JSONObject();
    }
    /**
     * 查询家庭签约已缴费未关注人数
     *

+ 58 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -80,6 +80,23 @@ public class PrescriptionInfoController extends BaseController {
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getDoctorPrescriptionTotal", method = RequestMethod.GET)
    @ApiOperation(value = "获取全科医生数目/建管师续方列表数目/搜索数目")
    public String getDoctorPrescriptionTotal(@RequestParam(required = false) @ApiParam(value = "团队code", name = "teamCode") Integer teamCode,
                                        @RequestParam(required = false) @ApiParam(value = "续方状态", name = "state") String state,
                                        @RequestParam(required = false) @ApiParam(value = "所有诊断:1 糖尿病 2高血压", name = "dispensary") String diseases,
                                        @RequestParam(required = false) @ApiParam(name = "startDate", value = "开始时间") String startDate,
                                        @RequestParam(required = false) @ApiParam(name = "endDate", value = "结束时间") String endDate,
                                        @RequestParam(required = false) @ApiParam(name = "nameKeyword", value = "患者姓名模糊匹配") String nameKeyword,
                                        @RequestParam(required = false) @ApiParam(name = "patient", value = "患者Code") String patient) {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getDoctorPrescriptionTotal(teamCode, state, diseases, startDate, endDate, nameKeyword, patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getContinuedPrescriptionAsDoctor", method = RequestMethod.GET)
    @ApiOperation(value = "续方详情")
@ -239,6 +256,24 @@ public class PrescriptionInfoController extends BaseController {
        }
    }
    @RequestMapping(value = "/getHDoctorPrescriptionExpressageTotal", method = RequestMethod.GET)
    @ApiOperation(value = "获取健康管理师续方订单列表数目")
    public String getHDoctorPrescriptionExpressageTotal
            (@RequestParam(required = false) @ApiParam(value = "团队Code", name = "teamCode") String teamCode,
             @RequestParam(required = false) @ApiParam(value = "1:需跟踪;2:已接收", name = "type") String type,
             @RequestParam(required = false) @ApiParam(value = "患者姓名关键字", name = "nameKey") String nameKey,
             @RequestParam(required = false) @ApiParam(value = "开始时间", name = "startDate") String startDate,
             @RequestParam(required = false) @ApiParam(value = "结束时间", name = "endDate") String endDate,
             @RequestParam(required = false) @ApiParam(value = "服务站", name = "hospital") String hospital,
             @RequestParam(required = false) @ApiParam(value = "配送状态", name = "state") String state) {
        try {
            return write(200, "操作成功!", "data", prescriptionInfoService.getHDoctorPrescriptionExpressageTotal(teamCode, type, getRepUID(), nameKey, startDate, endDate, hospital, state));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getPrescriptionExpressageFilter", method = RequestMethod.GET)
    @ApiOperation(value = "获取健康管理师续方订单列表过滤条件")
    public String getPrescriptionExpressageFilter() {
@ -286,6 +321,29 @@ public class PrescriptionInfoController extends BaseController {
        }
    }
    @RequestMapping(value = "/getDoctorPrescriptionExpressageTotal", method = RequestMethod.GET)
    @ApiOperation(value = "获取全科医生续方订单列表数目")
    public String getDoctorPrescriptionExpressageTotal
            (@RequestParam(required = false) @ApiParam(value = "团队Code", name = "teamCode") Integer teamCode,
             @RequestParam(required = false) @ApiParam(value = "居民搜素关键字", name = "nameKey") String nameKey,
             @RequestParam(required = false) @ApiParam(value = "开始时间", name = "startDate") String startDate,
             @RequestParam(required = false) @ApiParam(value = "结束时间", name = "endDate") String endDate,
             @RequestParam(required = false) @ApiParam(value = "机构", name = "hospital") String hospital,
             @RequestParam(required = false) @ApiParam(value = "配送状态", name = "state") String state,
             @RequestParam(required = false) @ApiParam(value = "配送方式:1 自取 2快递配送 3健管师配送", name = "dispensaryType") String
                     dispensaryType,
             @RequestParam(required = false) @ApiParam(value = "传1为未分配健管师", name = "AllocationType") String
                     allocationType) {
        try {
            return write(200, "操作成功!", "data",
                    prescriptionInfoService.
                            getDoctorPrescriptionExpressageTotal(teamCode, nameKey, startDate, endDate, hospital, state, dispensaryType, allocationType));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getCountExpressage", method = RequestMethod.GET)
    @ApiOperation(value = "获取指定团队未分配建管师订单数目")
    public String getCountExpressage

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

@ -335,6 +335,17 @@ public class DoctorSignController extends WeixinBaseController {
        }
    }
    @RequestMapping("/sign_info_count")
    @ApiOperation(value = "签约居民数目")
    public String getSignWebByDoctorCount(){
        try{
            //hxmD201703150222
            return write(200,"查询成功","data",signWebService.getSignWebByDoctorCount(getUID()));
        }catch (Exception e){
            return error(-1,"查询失败");
        }
    }
    /**
     * 查询今天是否全部提醒关注
     *