Kaynağa Gözat

Merge branch 'dev' of yeshijie/wlyy2.0 into dev

叶仕杰 3 yıl önce
ebeveyn
işleme
87714edad0

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/course/RecruitStudentsRecordService.java

@ -137,7 +137,7 @@ public class RecruitStudentsRecordService extends BaseJpaService<RecruitStudents
     */
    public synchronized String admission(String id){
        RecruitStudentsRecordDO recruitStudentsRecordDO = recruitStudentsRecordDao.findOne(id);
        if("1".equals(recruitStudentsRecordDO.getStatus())){
        if(!"1".equals(recruitStudentsRecordDO.getStatus())){
            return "只有待审核状态的人员才能录取";
        }
        if(isAdmissionFull(recruitStudentsRecordDO.getRecruitStudentsId())){
@ -154,7 +154,7 @@ public class RecruitStudentsRecordService extends BaseJpaService<RecruitStudents
     */
    public synchronized String refuse(String id){
        RecruitStudentsRecordDO recruitStudentsRecordDO = recruitStudentsRecordDao.findOne(id);
        if("1".equals(recruitStudentsRecordDO.getStatus())){
        if(!"1".equals(recruitStudentsRecordDO.getStatus())){
            return "只有待审核状态的人员才能拒绝";
        }
        recruitStudentsRecordDO.setStatus("4");

+ 2 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/RecruitStudentsRecordDao.java

@ -17,4 +17,6 @@ public interface RecruitStudentsRecordDao extends PagingAndSortingRepository<Rec
        JpaSpecificationExecutor<RecruitStudentsRecordDO> {
    List<RecruitStudentsRecordDO> findByRecruitStudentsIdAndStatus(String recruitStudentsId, String status);
    List<RecruitStudentsRecordDO> findByOrgCodeAndStatus(String orgCode, String status);
}

+ 110 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/RecruitStudentsEndpoint.java

@ -0,0 +1,110 @@
package com.yihu.jw.care.endpoint.course;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.course.RecruitStudentService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/6/8
 * @Description:
 */
@RestController
@RequestMapping("recruitStudent" )
@Api(tags = "招生-在线报名", description = "招生-在线报名")
public class RecruitStudentsEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private RecruitStudentService recruitStudentService;
    @GetMapping(value = "onlineRegisterCount")
    @ApiOperation("在线报名-已报名数量")
    public ObjEnvelop onlineRegisterCount(@ApiParam(name = "doctorId", value = "doctorId")
                                          @RequestParam(value = "doctorId", required = true) String doctorId){
        try {
            return ObjEnvelop.getSuccess("查询成功",recruitStudentService.onlineRegisterCount(doctorId));
        }catch (Exception e){
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = "queryInfoList")
    @ApiOperation(value = "查询在线报名记录")
    public PageEnvelop queryInfoList(
            @ApiParam(name = "doctorId", value = "教师id") @RequestParam(value = "doctorId", required = true) String doctorId,
            @ApiParam(name = "status", value = "工单状态,状态为全部时不传") @RequestParam(value = "status", required = false) Integer status,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15") @RequestParam(value = "size") int size) {
        try {
            JSONObject result = recruitStudentService.queryInfoList(doctorId, status, page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return PageEnvelop.getError(result.getString(ResponseContant.resultMsg), -1);
            }
            int count = result.getIntValue(ResponseContant.count);
            return success((List) result.get(ResponseContant.resultMsg), count, page, size);
        }catch (Exception e){
            return failedPageEnvelopException(e);
        }
    }
    @GetMapping(value = "onlineRegisterStatusCount")
    @ApiOperation(value = "统计在线报名各状态下的数量")
    public Envelop onlineRegisterStatusCount(
            @ApiParam(name = "doctorId", value = "教师id")
            @RequestParam(value = "doctorId", required = true) String doctorId) {
        try {
            JSONObject result = recruitStudentService.onlineRegisterStatusCount(doctorId);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return Envelop.getError(result.getString(ResponseContant.resultMsg),-1);
            }
            return success(result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = "admission")
    @ApiOperation(value = "录取")
    public Envelop admission(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try{
            String re =  recruitStudentService.admission(id);
            if(re == null){
                return success("录取成功");
            }else {
                return Envelop.getError(re,-1);
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = "refuse")
    @ApiOperation(value = "拒绝")
    public Envelop refuse(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try{
            recruitStudentService.refuse(id);
            return success("拒绝成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
}

+ 189 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/RecruitStudentService.java

@ -0,0 +1,189 @@
package com.yihu.jw.care.service.course;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.course.RecruitStudentsDao;
import com.yihu.jw.care.dao.course.RecruitStudentsRecordDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.care.course.RecruitStudentsDO;
import com.yihu.jw.entity.care.course.RecruitStudentsRecordDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/6/8
 * @Description:
 */
@Service
public class RecruitStudentService {
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private RecruitStudentsRecordDao recruitStudentsRecordDao;
    @Autowired
    private RecruitStudentsDao recruitStudentsDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    /**
     * 在线报名-已报名数量
     * @param doctorId
     * @return
     */
    public Integer onlineRegisterCount(String doctorId){
        List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctorId);
        List<RecruitStudentsRecordDO> list = recruitStudentsRecordDao.findByOrgCodeAndStatus(baseDoctorHospitalDO.get(0).getOrgCode(),"1");
        return list.size();
    }
    /**
     * 统计在线报名各状态下的数量
     *
     * @return
     */
    public JSONObject onlineRegisterStatusCount(String doctorId) {
        JSONObject result = new JSONObject();
        List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctorId);
        int total = 0;
        Map<String,Object> res = new HashedMap();
        //状态 已报名1  已录取2 未录取4 已退学8
        res.put("1",0);
        res.put("2",0);
        res.put("4",0);
        res.put("8",0);
        String countSql = "SELECT " +
                "  count(o.id) as count, " +
                "  o.status as status " +
                " FROM " +
                "  base_recruit_students_record o " +
                " WHERE " +
                "  o.org_code = '"+ baseDoctorHospitalDO.get(0).getOrgCode() + "' and o.del = 1 "+
                " GROUP BY o.`status`";
        List<Map<String,Object>> countMapList = jdbcTemplate.queryForList(countSql);
        for(Map<String,Object> map:countMapList){
            int c = Integer.valueOf(map.get("count").toString());
            total +=c;
            res.put(String.valueOf(map.get("status")),c);
        }
        res.put("total",total);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, res);
        return result;
    }
    /**
     * 在线报名列表
     *
     * @return
     */
    public JSONObject queryInfoList(String doctorId,Integer status, int page, int size) {
        JSONObject result = new JSONObject();
        List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctorId);
        String orgCode = baseDoctorHospitalDO.get(0).getOrgCode();
        status = null == status ? -100 : status;
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : size;
        String sql = "SELECT o.id,o.patient,o.patient_name patientName,o.status,o.create_time createTime,p.photo  " +
                " FROM  base_recruit_students_record o" +
                " left join base_patient p on o.patient = p.id " +
                " WHERE o.org_code = '{org_code}' and o.del =1 "+
                " AND (o.`status` = {status} or -100 = {status})" +
                " ORDER BY o.create_time desc" +
                " LIMIT {start},{end} ";
        String finalSql = sql.replace("{org_code}", orgCode)
                .replace("{status}", String.valueOf(status))
                .replace("{start}", String.valueOf(start))
                .replace("{end}", String.valueOf(end));
        String countSql = "SELECT count(DISTINCT o.id) FROM base_recruit_students_record o " +
                " WHERE o.org_code = '{org_code}' and o.del =1 " +
                " AND (o.`status` = {status} or -100 = {status})";
        String finqlCountSql = countSql.replace("{org_code}", orgCode)
                .replace("{status}", String.valueOf(status));
        List<Map<String,Object>> sqlResultlist= jdbcTemplate.queryForList(finalSql);
        Integer count = jdbcTemplate.queryForObject(finqlCountSql, Integer.class);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, sqlResultlist);
        JSONObject countItem = new JSONObject();
        countItem.put("count", count);
        result.putAll(countItem);
        return result;
    }
    /**
     * 录取单个
     * @param id
     * @return
     */
    public synchronized String admission(String id){
        RecruitStudentsRecordDO recruitStudentsRecordDO = recruitStudentsRecordDao.findOne(id);
        if(!"1".equals(recruitStudentsRecordDO.getStatus())){
            return "只有已报名状态的人员才能录取";
        }
        if(isAdmissionFull(recruitStudentsRecordDO.getRecruitStudentsId())){
            return "超过录取名额,无法录取";
        }
        recruitStudentsRecordDO.setStatus("2");
        recruitStudentsRecordDao.save(recruitStudentsRecordDO);
        return null;
    }
    /**
     * 是否录取满 true录取满了
     * @param id
     * @return
     */
    public synchronized boolean isAdmissionFull(String id){
        List<RecruitStudentsRecordDO> list = findListById(id);
        RecruitStudentsDO recruitStudentsDO = recruitStudentsDao.findOne(id);
        if(recruitStudentsDO.getNum()<=list.size()){
            return true;
        }
        return false;
    }
    public List<RecruitStudentsRecordDO> findListById(String id){
        String sql = "select * from base_recruit_students_record where recruit_students_id = '"+id+"' and status in ('2','3','6') and del =1 ";
        List<RecruitStudentsRecordDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RecruitStudentsRecordDO.class));
        return list;
    }
    /**
     * 拒绝单个
     * @param id
     */
    public synchronized String refuse(String id){
        RecruitStudentsRecordDO recruitStudentsRecordDO = recruitStudentsRecordDao.findOne(id);
        if(!"1".equals(recruitStudentsRecordDO.getStatus())){
            return "只有已报名状态的人员才能拒绝";
        }
        recruitStudentsRecordDO.setStatus("4");
        recruitStudentsRecordDao.save(recruitStudentsRecordDO);
        return null;
    }
}

+ 3 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java

@ -352,6 +352,7 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        //状态 待服务 1、已完成 2 、已取消 -1
        res.put("1",0);
        res.put("2",0);
        res.put("3",0);
        res.put("-1",0);
        String countSql = "SELECT " +
                "  count(o.id) as count, " +
@ -499,6 +500,7 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        }
        orderDO.setNumber(orderNoService.getOrderNo(1));
        orderDO.setCreateTime(new Date());
        orderDO.setStatus(1);
        this.save(orderDO);
        result.put("orderId",orderDO.getId());
@ -618,7 +620,7 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
    public LifeCareOrderDO signIn(String orderId, String signTime, Integer signWay, String signLocation,
                             String signImg, String twoDimensionalCode,String doctorId) throws Exception {
        LifeCareOrderDO lifeCareOrderDO = this.lifeCareOrderDao.findOne(orderId);
        if(!"1".equals(lifeCareOrderDO.getStatus())){
        if(!LifeCareOrderDO.Status.waitForAccept.getType().equals(lifeCareOrderDO.getStatus())){
            //待服务状态才能签到
            logger.info("签到失败"+lifeCareOrderDO.getId()+":"+lifeCareOrderDO.getStatus());
            return null;