Explorar o código

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

wangzhinan %!s(int64=4) %!d(string=hai) anos
pai
achega
40b9895af3

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/dict/WlyyHospitalSysDictDao.java

@ -21,4 +21,6 @@ public interface WlyyHospitalSysDictDao extends PagingAndSortingRepository<WlyyH
    List<WlyyHospitalSysDictDO> findByDictName(String dictName);
    @Query("from WlyyHospitalSysDictDO where 1=1")
    List<WlyyHospitalSysDictDO> findAlldict();
    @Query("from WlyyHospitalSysDictDO where dictCode = ?1")
    List<WlyyHospitalSysDictDO> findByDictCode(String dictCode);
}

+ 34 - 10
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -1477,7 +1477,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param dept
     * @return
     */
    public MixEnvelop findDoctorWithWork(String orgCode, String dept, String chargeType, String doctorCode, String outpatientType, String startDate, String endDate, String key, String consultStatus, Integer page, Integer size) {
    public MixEnvelop findDoctorWithWork(String orgCode, String dept, String chargeType, String doctorCode, String outpatientType, String startDate, String endDate, String key, String consultStatus, Integer page, Integer size,String ywCode) {
        String totalSql = "SELECT " +
                " count(1) AS \"total\" " +
@ -1631,7 +1631,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //获取排班
            for (Map<String, Object> doctor : list) {
                String id = (String) doctor.get("id");
                List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(id, orgCode);
                List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(id, orgCode,ywCode);
                doctor.put("workTime", times);
                String deptTyepCode = "";
                if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
@ -1697,7 +1697,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
    }
    public List<WlyyDoctorWorkTimeVO> findDoctorWorkTime(String doctor, String hospital) {
    public List<WlyyDoctorWorkTimeVO> findDoctorWorkTime(String doctor, String hospital,String ywCode) {
        List<WlyyHospitalWorkRuleDO> list = wlyyHospitalWorkRuleDao.findByHospital(hospital);
@ -1718,12 +1718,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            Date endDate = DateUtil.stringToDate(maxDateString, "yyyy-MM-dd HH:mm:ss");
            List<WlyyDoctorWorkTimeVO> timeVOs = new ArrayList<>();
            List<WlyyDoctorWorkTimeDO> timeDOs = doctorWorkTimeDao.findDoctorWorkTime(doctor, new Date(), endDate);
            if (timeDOs != null && timeDOs.size() > 0) {
                convertToModels(timeDOs, timeVOs, WlyyDoctorWorkTimeVO.class);
                if (timeVOs != null && timeVOs.size() > 0) {
                    for (WlyyDoctorWorkTimeVO timeVO : timeVOs) {
                        timeVO.setCount(findWorkTimeInfoCout(timeVO.getId()));
            String isCheckWork = "1";//1需要判断医生在班0不需要
            if (StringUtils.isNoneBlank(ywCode)){
                WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById(ywCode);
                if (wlyyHospitalSysDictDO!=null){
                    isCheckWork = wlyyHospitalSysDictDO.getDictValue();
                }
            }
            if ("1".equalsIgnoreCase(isCheckWork)){
                List<WlyyDoctorWorkTimeDO> timeDOs = doctorWorkTimeDao.findDoctorWorkTime(doctor, new Date(), endDate);
                if (timeDOs != null && timeDOs.size() > 0) {
                    convertToModels(timeDOs, timeVOs, WlyyDoctorWorkTimeVO.class);
                    if (timeVOs != null && timeVOs.size() > 0) {
                        for (WlyyDoctorWorkTimeVO timeVO : timeVOs) {
                            timeVO.setCount(findWorkTimeInfoCout(timeVO.getId()));
                        }
                    }
                }
            }
@ -3626,7 +3636,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                rs.put("dept", hospitalDOs.get(0).getDeptCode());
                if (StringUtils.isNotBlank(withWork) && "1".equals(withWork)) {
                    List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor, hospitalDOs.get(0).getOrgCode());
                    List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor, hospitalDOs.get(0).getOrgCode(),"");
                    rs.put("workTime", times);
                }
            } else {
@ -9888,4 +9898,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        WlyyHospitalSysDictDO wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findById(dictId);
        return  wlyyHospitalSysDictDOS;
    }
    public WlyyHospitalSysDictDO updateDictById(String dictId,String dictValue){
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById(dictId);
        if(wlyyHospitalSysDictDO!=null){
            if (StringUtils.isNoneBlank(dictValue)){
                wlyyHospitalSysDictDO.setDictValue(dictValue);
                wlyyHospitalSysDictDao.save(wlyyHospitalSysDictDO);
            }
        }
        return  wlyyHospitalSysDictDO;
    }
    public List<WlyyHospitalSysDictDO> findSysByDictCode(String dictCode){
        List<WlyyHospitalSysDictDO> isWork=sysDictDao.findByDictCode(dictCode);
        return isWork;
    }
}

+ 97 - 37
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/WorkTimeService.java

@ -1,5 +1,7 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
@ -64,13 +66,26 @@ public class WorkTimeService {
     * @return
     * @throws Exception
     */
    public WlyyHospitalWorkRuleDO saveWorkTimeRule(String workTimeRuleJson)throws Exception{
    public WlyyHospitalWorkRuleDO saveWorkTimeRule(String workTimeRuleJson,String isDoctorWork) throws Exception{
        WlyyHospitalWorkRuleDO ruleDO = objectMapper.readValue(workTimeRuleJson,WlyyHospitalWorkRuleDO.class);
        List<WlyyHospitalWorkRuleDO> orgRules = wlyyHospitalWorkRuleDao.findByHospital(ruleDO.getHospital());
        if(orgRules!=null&&orgRules.size()>0){
            wlyyHospitalWorkRuleDao.delete(orgRules);
        }
        wlyyHospitalWorkRuleDao.save(ruleDO);
        if (StringUtils.isNoneBlank(isDoctorWork)){
            JSONArray jsonArray = JSONArray.parseArray(isDoctorWork);
            if (jsonArray!=null&&jsonArray.size()>0){
                for(int i=0;i<jsonArray.size();i++){
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById(jsonObject.getString("id"));
                    if (wlyyHospitalSysDictDO!=null&&StringUtils.isNoneBlank(jsonObject.get("value")==null?"":jsonObject.getString("value"))){
                        wlyyHospitalSysDictDO.setDictValue(jsonObject.getString("value"));
                        wlyyHospitalSysDictDao.save(wlyyHospitalSysDictDO);
                    }
                }
            }
        }
        return ruleDO;
    }
@ -95,44 +110,89 @@ public class WorkTimeService {
    public Boolean checkDoctorWork(String doctor,String ywCode){
        logger.info("当前判断的业务Code:"+ywCode);
        if (StringUtils.isNoneBlank(ywCode)){
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById(ywCode);
            String isCheckDoctorWork = "1";
            if (wlyyHospitalSysDictDO!=null){
                isCheckDoctorWork = wlyyHospitalSysDictDO.getDictValue();
            }
            if ("1".equalsIgnoreCase(isCheckDoctorWork)){
                String sql = "SELECT " +
                        " d.id " +
                        " FROM " +
                        " base_doctor d " +
                        " WHERE " +
                        " d.id =:doctor " +
                        " AND ( " +
                        " EXISTS ( " +
                        "  SELECT " +
                        "   t.id " +
                        "  FROM " +
                        "   wlyy_doctor_work_time t " +
                        "  WHERE " +
                        "   t.doctor = d.id " +
                        "  AND t.start_time <=:startTime " +
                        "  AND t.end_time >=:endTime" +
                        " ) " +
                        " OR d.consult_status = '1' " +
                        ")";
                Map<String,Object> params = new HashedMap();
                params.put("doctor",doctor);
                Date date = new Date();
                params.put("startTime",date);
                params.put("endTime",date);
                List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params);
                if(list!=null&&list.size()>0){
                    return true;
                }else {
                    return false;
            if (ywCode.contains(",")){
                String[] split = ywCode.split(",");
                for (int i = 0;i<split.length;i++){
                    WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById(split[i]);
                    String isCheckDoctorWork = "1";
                    if (wlyyHospitalSysDictDO!=null){
                        isCheckDoctorWork = wlyyHospitalSysDictDO.getDictValue();
                    }
                    if ("1".equalsIgnoreCase(isCheckDoctorWork)){
                        String sql = "SELECT " +
                                " d.id " +
                                " FROM " +
                                " base_doctor d " +
                                " WHERE " +
                                " d.id =:doctor " +
                                " AND ( " +
                                " EXISTS ( " +
                                "  SELECT " +
                                "   t.id " +
                                "  FROM " +
                                "   wlyy_doctor_work_time t " +
                                "  WHERE " +
                                "   t.doctor = d.id " +
                                "  AND t.start_time <=:startTime " +
                                "  AND t.end_time >=:endTime" +
                                " ) " +
                                " OR d.consult_status = '1' " +
                                ")";
                        Map<String,Object> params = new HashedMap();
                        params.put("doctor",doctor);
                        Date date = new Date();
                        params.put("startTime",date);
                        params.put("endTime",date);
                        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params);
                        if(list!=null&&list.size()>0){
                            return true;
                        }else {
                            return false;
                        }
                    }else {
                        return true;
                    }
                }
            }else {
                return true;
                WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById(ywCode);
                String isCheckDoctorWork = "1";
                if (wlyyHospitalSysDictDO!=null){
                    isCheckDoctorWork = wlyyHospitalSysDictDO.getDictValue();
                }
                if ("1".equalsIgnoreCase(isCheckDoctorWork)){
                    String sql = "SELECT " +
                            " d.id " +
                            " FROM " +
                            " base_doctor d " +
                            " WHERE " +
                            " d.id =:doctor " +
                            " AND ( " +
                            " EXISTS ( " +
                            "  SELECT " +
                            "   t.id " +
                            "  FROM " +
                            "   wlyy_doctor_work_time t " +
                            "  WHERE " +
                            "   t.doctor = d.id " +
                            "  AND t.start_time <=:startTime " +
                            "  AND t.end_time >=:endTime" +
                            " ) " +
                            " OR d.consult_status = '1' " +
                            ")";
                    Map<String,Object> params = new HashedMap();
                    params.put("doctor",doctor);
                    Date date = new Date();
                    params.put("startTime",date);
                    params.put("endTime",date);
                    List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params);
                    if(list!=null&&list.size()>0){
                        return true;
                    }else {
                        return false;
                    }
                }else {
                    return true;
                }
            }
        }else {
            String sql = "SELECT " +

+ 2 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -1419,6 +1419,8 @@ public class BaseHospitalRequestMapping {
        public static final String findWorkDoctorCount = "/findWorkDoctorCount";
        public static final String findAllDict = "/findAllDict";
        public static final String findDictById = "/findDictById";
        public static final String updateDictById = "/updateDictById";
        public static final String findDictByCode = "/findDictByCode";
    }
    /**

+ 3 - 3
server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java

@ -434,8 +434,8 @@ public class YkyyService {
                            String pw = idcard.substring(idcard.length() - 6);
                            doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                            doctor.setSalt(salt);
                            if(StringUtils.isNoneBlank(doctorJson.getString("jobtitlecode"))){
                                doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
                            if(StringUtils.isNoneBlank(doctorJson.getString("jobTitleCode"))){
                                doctor.setJobTitleCode(doctorJson.getString("jobTitleCode"));
                                doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
                            }
                            doctor.setVerifyCode(verifyCode);
@ -487,7 +487,7 @@ public class YkyyService {
                            doctor.setLocked(0);
                            doctor.setCreateTime(new Date());
                            doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
                            doctor.setJobTitleCode(doctorJson.getString("jobTitleCode"));
                            doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
                            BaseDoctorDO temp = baseDoctorDao.save(doctor);

+ 16 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -1248,4 +1248,20 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        return success(prescriptionService.findDictById(dictId));
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.updateDictById)
    @ApiOperation(value = "根据id修改配置字典", notes = "根据id修改配置字典")
    public Envelop updateDictById(@ApiParam(name = "dictId", value = "dictId")
                                @RequestParam(value = "dictId", required = true)String dictId,
                                  @ApiParam(name = "dictValue", value = "dictId")
                                  @RequestParam(value = "dictValue", required = true)String dictValue) throws Exception{
        return success(prescriptionService.updateDictById(dictId,dictValue));
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDictByCode)
    @ApiOperation(value = "根据id修改配置字典", notes = "根据id修改配置字典")
    public ListEnvelop findDictByCode(@ApiParam(name = "dictCode", value = "dictCode")
                                  @RequestParam(value = "dictCode", required = true, defaultValue = "isDoctorWork")String dictCode) throws Exception{
        return success(prescriptionService.findSysByDictCode(dictCode));
    }
}

+ 7 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -593,12 +593,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "key", required = false)String key,
                                         @ApiParam(name = "consultStatus", value = "是否在线")
                                         @RequestParam(value = "consultStatus", required = false)String consultStatus,
                                         @ApiParam(name = "ywCode", value = "业务Code")
                                             @RequestParam(value = "ywCode", required = false)String ywCode,
                                         @ApiParam(name = "page", value = "第几页")
                                         @RequestParam(value = "page", required = true)Integer page,
                                         @ApiParam(name = "size", value = "每页大小")
                                         @RequestParam(value = "size", required = true)Integer size) {
        
        return success(prescriptionService.findDoctorWithWork(orgCode,dept,chargeType,doctorCode,outpatientType,startDate,endDate,key,consultStatus,page,size));
        return success(prescriptionService.findDoctorWithWork(orgCode,dept,chargeType,doctorCode,outpatientType,startDate,endDate,key,consultStatus,page,size,ywCode));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorWithMouthWork)
@ -1337,8 +1339,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.saveWorkTimeRule)
    @ApiOperation(value = "保存排班规则")
    public ObjEnvelop saveWorkTimeRule(@ApiParam(name = "workTimeRuleJson", value = "保存排班规则")
                                       @RequestParam(value = "workTimeRuleJson",required = true)String workTimeRuleJson) throws Exception{
        return success(workTimeService.saveWorkTimeRule(workTimeRuleJson));
                                       @RequestParam(value = "workTimeRuleJson",required = true)String workTimeRuleJson,
                                       @ApiParam(name = "isDoctorWorkJson", value = "判断是否排班json数据")
                                       @RequestParam(value = "isDoctorWorkJson",required = false)String isDoctorWorkJson) throws Exception{
        return success(workTimeService.saveWorkTimeRule(workTimeRuleJson,isDoctorWorkJson));
    }