chenweida 7 سال پیش
والد
کامیت
6b5b5a5789

+ 89 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignFamilyServiceService.java

@ -158,7 +158,7 @@ public class SignFamilyServiceService {
     */
    public List<ServiceItem> getPatientServiceItem(String patient, String serviceCode) throws Exception {
        StringBuffer sql = new StringBuffer(" SELECT " +
                " DISTINCT s.code,"+
                " DISTINCT s.code," +
                "   s.* " +
                " FROM " +
                "   wlyy_service_item s, " +
@ -214,18 +214,102 @@ public class SignFamilyServiceService {
    public boolean patientsDeleteService(String patientCode, String serviceCode) {
        try {
            //判断患者是否有签约
            SignFamily signFamily=signFamilyDao.findByPatient(patientCode);
            if(signFamily==null){
            SignFamily signFamily = signFamilyDao.findByPatient(patientCode);
            if (signFamily == null) {
                return false;
            }
            //修改患者的服务状态为删除
            signFamilyServiceDao.deletePatientService(patientCode,serviceCode,signFamily.getCode());
            signFamilyServiceDao.deletePatientService(patientCode, serviceCode, signFamily.getCode());
            //修改患者的服务项状态为删除
            signFamilyServiceItemDao.deletePatiengServiceItem(patientCode,serviceCode,signFamily.getCode());
            signFamilyServiceItemDao.deletePatiengServiceItem(patientCode, serviceCode, signFamily.getCode());
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }
    /**
     * 按区给患者添加服务
     *
     * @param townCode
     * @param serviceCode
     * @return
     * @throws Exception
     */
    @Transactional
    public JSONObject patientAddServiceByTown(String townCode, String serviceCode) throws Exception {
        String sql = "select patient from wlyy_sign_family s where s.`status`>0 and s.expenses_status=1  and left(s.hospital,6)='" + townCode + "'";
        List<String> patients = jdbcTemplate.queryForList(sql, String.class);
        return patientsAddService(patients, serviceCode);
    }
    /**
     * 按区给患者删除服务
     *
     * @param townCode
     * @param serviceCode
     * @return
     * @throws Exception
     */
    @Transactional
    public JSONObject patientDeleteServiceByTown(String townCode, String serviceCode) throws Exception {
        String sql = "select patient from wlyy_sign_family s where s.`status`>0 and s.expenses_status=1  and left(s.hospital,6)='" + townCode + "'";
        List<String> patients = jdbcTemplate.queryForList(sql, String.class);
        return patientsDeleteService(patients, serviceCode);
    }
    /**
     * 按机构给患者添加服务
     *
     * @param hospital
     * @param serviceCode
     * @return
     * @throws Exception
     */
    public JSONObject patientAddServiceByHospital(String hospital, String serviceCode) throws Exception {
        String sql = "select patient from wlyy_sign_family s where s.`status`>0 and s.expenses_status=1  and  s.hospita='" + hospital + "'";
        List<String> patients = jdbcTemplate.queryForList(sql, String.class);
        return patientsAddService(patients, serviceCode);
    }
    /**
     * 按机构给患者删除服务
     *
     * @param hospital
     * @param serviceCode
     * @return
     * @throws Exception
     */
    public JSONObject patientDeleteServiceByHospital(String hospital, String serviceCode) throws Exception {
        String sql = "select patient from wlyy_sign_family s where s.`status`>0 and s.expenses_status=1  and s.hospital='" + hospital + "'";
        List<String> patients = jdbcTemplate.queryForList(sql, String.class);
        return patientsDeleteService(patients, serviceCode);
    }
    /**
     * 按团队给患者添加服务
     *
     * @param adminTemId
     * @param serviceCode
     * @return
     */
    public JSONObject patientAddServiceByAdminTeam(String adminTemId, String serviceCode) throws Exception {
        String sql = "select patient from wlyy_sign_family s where s.`status`>0 and s.expenses_status=1  and  s.admin_team_code='" + adminTemId + "'";
        List<String> patients = jdbcTemplate.queryForList(sql, String.class);
        return patientsAddService(patients, serviceCode);
    }
    /**
     * 按团队给患者删除服务
     *
     * @param adminTemId
     * @param serviceCode
     * @return
     */
    public JSONObject patientDeleteServiceByAdminTeam(String adminTemId, String serviceCode) throws Exception {
        String sql = "select patient from wlyy_sign_family s where s.`status`>0 and s.expenses_status=1  and s.admin_team_code='" + adminTemId + "'";
        List<String> patients = jdbcTemplate.queryForList(sql, String.class);
        return patientsDeleteService(patients, serviceCode);
    }
}

+ 84 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignFamilyServiceNoFilterController.java

@ -70,4 +70,88 @@ public class PatientSignFamilyServiceNoFilterController extends BaseController {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/patientAddServiceByTown", method = RequestMethod.POST)
    @ApiOperation("按区给患者添加服务")
    public String patientAddServiceByTown(
            @RequestParam(required = true, value = "townCode") @ApiParam(required = true, value = "town区code(集美区350211)", name = "townCode") String townCode,
            @RequestParam(required = true, value = "serviceCode") @ApiParam(required = true, value = "服务code", name = "serviceCode") String serviceCode
    ) {
        try {
            JSONObject jsonObject = signFamilyServiceService.patientAddServiceByTown(townCode, serviceCode);
            return write(200, "请求成功", "data", jsonObject);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/patientDeleteServiceByTown", method = RequestMethod.POST)
    @ApiOperation("按区给患者删除服务")
    public String patientDeleteServiceByTown(
            @RequestParam(required = true, value = "townCode") @ApiParam(required = true, value = "town区code(集美区350211)", name = "townCode") String townCode,
            @RequestParam(required = true, value = "serviceCode") @ApiParam(required = true, value = "服务code", name = "serviceCode") String serviceCode
    ) {
        try {
            JSONObject jsonObject = signFamilyServiceService.patientDeleteServiceByTown(townCode, serviceCode);
            return write(200, "请求成功", "data", jsonObject);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/patientAddServiceByHospital", method = RequestMethod.POST)
    @ApiOperation("按机构给患者添加服务")
    public String patientAddServiceByHospital(
            @RequestParam(required = true, value = "hospital") @ApiParam(required = true, value = "机构code", name = "hospital") String hospital,
            @RequestParam(required = true, value = "serviceCode") @ApiParam(required = true, value = "服务code", name = "serviceCode") String serviceCode
    ) {
        try {
            JSONObject jsonObject = signFamilyServiceService.patientAddServiceByHospital(hospital, serviceCode);
            return write(200, "请求成功", "data", jsonObject);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/patientDeleteServiceByHospital", method = RequestMethod.POST)
    @ApiOperation("按机构给患者删除服务")
    public String patientDeleteServiceByHospital(
            @RequestParam(required = true, value = "hospital") @ApiParam(required = true, value = "机构code", name = "hospital") String hospital,
            @RequestParam(required = true, value = "serviceCode") @ApiParam(required = true, value = "服务code", name = "serviceCode") String serviceCode
    ) {
        try {
            JSONObject jsonObject = signFamilyServiceService.patientDeleteServiceByHospital(hospital, serviceCode);
            return write(200, "请求成功", "data", jsonObject);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/patientAddServiceByAdminTeam", method = RequestMethod.POST)
    @ApiOperation("按团队给患者添加服务")
    public String patientAddServiceByAdminTeam(
            @RequestParam(required = true, value = "adminTemId") @ApiParam(required = true, value = "行政团队ID", name = "adminTemId") String adminTemId,
            @RequestParam(required = true, value = "serviceCode") @ApiParam(required = true, value = "服务code", name = "serviceCode") String serviceCode
    ) {
        try {
            JSONObject jsonObject = signFamilyServiceService.patientAddServiceByAdminTeam(adminTemId, serviceCode);
            return write(200, "请求成功", "data", jsonObject);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/patientDeleteServiceByAdminTeam", method = RequestMethod.POST)
    @ApiOperation("按团队给患者删除服务")
    public String patientDeleteServiceByAdminTeam(
            @RequestParam(required = true, value = "adminTemId") @ApiParam(required = true, value = "行政团队ID", name = "adminTemId") String adminTemId,
            @RequestParam(required = true, value = "serviceCode") @ApiParam(required = true, value = "服务code", name = "serviceCode") String serviceCode
    ) {
        try {
            JSONObject jsonObject = signFamilyServiceService.patientDeleteServiceByAdminTeam(adminTemId, serviceCode);
            return write(200, "请求成功", "data", jsonObject);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
}