Browse Source

测试环境

Trick 5 years ago
parent
commit
ac3a76c5e0

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/DoctorWorkTimeDao.java

@ -16,7 +16,7 @@ public interface DoctorWorkTimeDao extends PagingAndSortingRepository<WlyyDoctor
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.endTime > ?2 and a.endTime < ?3 order by a.startTime asc")
    List<WlyyDoctorWorkTimeDO> findDoctorWorkTime(String doctor, Date startTime, Date endTime);
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.date like ?2 order by a.startTime asc")
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.workDate like ?2 order by a.startTime asc")
    List<WlyyDoctorWorkTimeDO> findDoctorWorkTimeByMonth(String doctor, String date);
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.startTime >= ?2 and a.startTime <= ?3 order by a.startTime asc")

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

@ -884,21 +884,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept,String chargeType,String doctorCode,String outpatientType,String startDate,String endDate,String key,String consultStatus){
        String sql ="SELECT " +
                " d.id, " +
                " d.photo, " +
                " d.`name`, " +
                " d.expertise," +
                " d.introduce," +
                " d.job_title_code AS jobTitleCode, " +
                " d.job_title_name AS jobTitleName," +
                " d.charge_type AS chargeType," +
                " d.outpatient_type AS outpatientType," +
                " d.consult_status AS consultStatus" +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
                " d.name AS \"name\", " +
                " d.expertise AS \"expertise\"," +
                " d.introduce AS \"introduce\"," +
                " d.job_title_code AS \"jobTitleCode\", " +
                " d.job_title_name AS \"jobTitleName\"," +
                " d.charge_type AS \"chargeType\"," +
                " d.outpatient_type AS \"outpatientType\"," +
                " d.consult_status AS \"consultStatus\"" +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " WHERE  " +
                " 1=1";
        Map<String,Object> params = new HashedMap();
        if (StringUtils.isNotBlank(dept)) {
            sql += " AND h.dept_code = '" + dept + "'";
        }
@ -937,14 +938,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "  wlyy_doctor_work_time t " +
                    " WHERE " +
                    "  t.doctor = d.id " +
                    " AND t.start_time >='" + startDate + "'" +
                    " AND t.start_time <='" + endDate + "'" +
                    " AND t.start_time >=:startDate" +
                    " AND t.start_time <=:endDate" +
                    " )";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-ss HH:mm:ss"));
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-ss HH:mm:ss"));
        }
        logger.info("findDoctorByHospitalAndDept sql:" + sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql,params);
        if (list != null && list.size() > 0 && StringUtils.isNotBlank(doctorCode)) {
            //排序
@ -969,12 +973,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    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 totalSql = "SELECT " +
                " count(1) AS total " +
                " count(1) AS \"total\" " +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " WHERE  " +
                " 1=1 ";
        Map<String,Object> params = new HashedMap();
        if (StringUtils.isNotBlank(dept)) {
            totalSql += " AND h.dept_code = '" + dept + "'";
        }
@ -1018,30 +1023,32 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "  wlyy_doctor_work_time t " +
                    " WHERE " +
                    "  t.doctor = d.id " +
                    " AND t.start_time >='" + startDate + "'" +
                    " AND t.start_time <='" + endDate + "'" +
                    " AND t.start_time >=:startDate" +
                    " AND t.start_time <=:endDate" +
                    " )";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-ss HH:mm:ss"));
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-ss HH:mm:ss"));
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql,params);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = hibenateUtils.objTransformLong(rstotal.get(0).get("total"));
        }
        String sql = "SELECT " +
                " d.id, " +
                " d.photo, " +
                " d.`name`, " +
                " d.expertise," +
                " d.introduce," +
                " d.job_title_code AS jobTitleCode, " +
                " d.job_title_name AS jobTitleName," +
                " d.charge_type AS chargeType," +
                " h.dept_code AS deptCode," +
                " h.dept_Name AS deptName," +
                " d.outpatient_type AS outpatientType," +
                " d.consult_status AS consultStatus" +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
                " d.name AS \"name\", " +
                " d.expertise AS \"expertise\"," +
                " d.introduce AS \"introduce\"," +
                " d.job_title_code AS \"jobTitleCode\", " +
                " d.job_title_name AS \"jobTitleName\"," +
                " d.charge_type AS \"chargeType\"," +
                " h.dept_code AS \"deptCode\"," +
                " h.dept_Name AS \"deptName\"," +
                " d.outpatient_type AS \"outpatientType\"," +
                " d.consult_status AS \"consultStatus\"" +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
@ -1093,13 +1100,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "  wlyy_doctor_work_time t " +
                    " WHERE " +
                    "  t.doctor = d.id " +
                    " AND t.start_time >='" + startDate + "'" +
                    " AND t.start_time <='" + endDate + "'" +
                    " AND t.start_time >= :startDate" +
                    " AND t.start_time <= :endDate" +
                    " )";
        }
        sql += " AND d.del='1' AND d.outpatient_type is not null LIMIT " + (page - 1) * size + "," + size + "";
        sql += " AND d.del='1' AND d.outpatient_type is not null ";
        logger.info("withwork sql:" +sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql,params,page,size);
        if (list != null && list.size() > 0) {
            //获取排班
            for (Map<String, Object> doctor : list) {
@ -1170,7 +1177,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public MixEnvelop findDoctorWithMouthWork(String orgCode, String dept, String chargeType, String date, String nameKey,String iswork, Integer page, Integer size) {
        String totalSql = "SELECT " +
                " count(1) AS total " +
                " count(1) AS \"total\" " +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
@ -1204,7 +1211,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        " FROM " +
                        "  wlyy_doctor_work_time t " +
                        " WHERE " +
                        "  t.date LIKE '%"+date+"%' " +
                        "  t.work_date LIKE '%"+date+"%' " +
                        " )";
            }else{
                totalSql +=" AND d.id NOT IN ( " +
@ -1213,29 +1220,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        " FROM " +
                        "  wlyy_doctor_work_time t " +
                        " WHERE " +
                        "  t.date LIKE '%"+date+"%' " +
                        "  t.work_date LIKE '%"+date+"%' " +
                        " )";
            }
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = hibenateUtils.objTransformLong(rstotal.get(0).get("total"));
        }
        String sql = "SELECT " +
                " d.id, " +
                " d.photo, " +
                " d.`name`, " +
                " d.expertise," +
                " d.introduce," +
                " d.job_title_code AS jobTitleCode, " +
                " d.job_title_name AS jobTitleName," +
                " d.charge_type AS chargeType," +
                " h.dept_code AS deptCode," +
                " h.dept_Name AS deptName" +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
                " d.name AS \"name\", " +
                " d.expertise AS  \"expertise\"," +
                " d.introduce AS \"introduce\"," +
                " d.job_title_code AS \"jobTitleCode\", " +
                " d.job_title_name AS \"jobTitleName\"," +
                " d.charge_type AS \"chargeType\"," +
                " h.dept_code AS \"deptCode\"," +
                " h.dept_Name AS \"deptName\"" +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
@ -1268,7 +1275,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        " FROM " +
                        "  wlyy_doctor_work_time t " +
                        " WHERE " +
                        "  t.date LIKE '%"+date+"%' " +
                        "  t.work_date LIKE '%"+date+"%' " +
                        " )";
            }else{
                sql +=" AND d.id NOT IN ( " +
@ -1277,13 +1284,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        " FROM " +
                        "  wlyy_doctor_work_time t " +
                        " WHERE " +
                        "  t.date LIKE '%"+date+"%' " +
                        "  t.work_date LIKE '%"+date+"%' " +
                        " )";
            }
        }
        sql += " LIMIT " + (page - 1) * size + "," + size + "";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql,page,size);
        if (list != null && list.size() > 0) {
            //获取排班
            for (Map<String, Object> doctor : list) {
@ -2736,8 +2743,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //医生角色
            String sql = "SELECT " +
                    " t. CODE AS roleCode, " +
                    " t. NAME AS roleName" +
                    " t. CODE AS \"roleCode\", " +
                    " t. NAME AS \"roleName\"" +
                    " FROM " +
                    " base_doctor_role r " +
                    " JOIN base_doctor_role_dict t ON t.`code` = r.role_code " +
@ -2772,7 +2779,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
            //专家咨询
            String zjCountsql = "SELECT id FROM wlyy_consult_team WHERE doctor='"+doctor+"' AND (type=1 OR type=15)";
            String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='"+doctor+"' AND (type=1 OR type=15)";
            List<Map<String,Object>> zjList = jdbcTemplate.queryForList(zjCountsql);
    
            if(zjList!=null&&zjList.size()>0){
@ -2783,8 +2790,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
            //查询医生各项评价平均分
            String sqlscore = "SELECT " +
                    "AVG(a.score) AS score," +
                    "a.score_type AS score_type " +
                    "AVG(a.score) AS \"score\"," +
                    "a.score_type AS \"score_type\" " +
                    "FROM base_evaluate a,base_evaluate_score b " +
                    "WHERE " +
                    "a.relation_code=b.id " +
@ -2810,16 +2817,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
            //查询评价明细
            String sqlScoreList = "SELECT " +
                    "a.score as score," +
                    "b.score as doctorscore," +
                    "a.score_type as score_type," +
                    "a.content as content," +
                    "b.create_time as create_time," +
                    "c.type as type," +
                    "c.name as patientname," +
                    "b.id as id," +
                    "c.photo as patientphoto," +
                    "b.type as niming " +
                    "a.score as \"score\"," +
                    "b.score as \"doctorscore\"," +
                    "a.score_type as \"score_type\"," +
                    "a.content as \"content\"," +
                    "b.create_time as \"create_time\"," +
                    "c.type as \"type\"," +
                    "c.name as \"patientname\"," +
                    "b.id as \"id\"," +
                    "c.photo as \"patientphoto\"," +
                    "b.type as \"niming\" " +
                    "FROM " +
                    "base_evaluate a " +
                    "LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " +
@ -3587,10 +3594,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if("1".equals(type)){
            String sql ="SELECT " +
                    " DISTINCT " +
                    " d.id, " +
                    " d.`name`, " +
                    " h.org_code, " +
                    " h.org_name " +
                    " d.id AS \"id\", " +
                    " d.name AS \"name\", " +
                    " h.org_code AS \"org_code\", " +
                    " h.org_name AS \"org_name\"" +
                    " FROM " +
                    " base_doctor d " +
                    " JOIN base_doctor_hospital h ON d.id= h.doctor_code " +
@ -3604,10 +3611,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            String sql ="SELECT " +
                    " DISTINCT " +
                    " d.id, " +
                    " d.`name`, " +
                    " h.org_code, " +
                    " h.org_name " +
                    " d.id AS \"id\", " +
                    " d.name AS \"name\", " +
                    " h.org_code AS \"org_code\", " +
                    " h.org_name AS \"org_name\"" +
                    " FROM " +
                    " base_doctor d " +
                    " JOIN base_doctor_hospital h ON d.id= h.doctor_code " +
@ -3620,10 +3627,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else if("3".equals(type)){
            String sql ="SELECT " +
                    " DISTINCT " +
                    " d.id, " +
                    " d.`name`, " +
                    " h.org_code, " +
                    " h.org_name " +
                    " d.id AS \"id\", " +
                    " d.name AS \"name\", " +
                    " h.org_code AS \"org_code\", " +
                    " h.org_name AS \"org_name\"" +
                    " FROM " +
                    " base_doctor d " +
                    " JOIN base_doctor_hospital h ON d.id= h.doctor_code " +
@ -3666,7 +3673,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    t.setTimeType(time.getTimeType());
                    t.setStartTime(time.getStartTime());
                    t.setEndTime(time.getEndTime());
                    t.setDate(time.getDate());
                    t.setWorkDate(time.getWorkDate());
                    t.setTimeInterval(time.getTimeInterval());
                    t.setSourceNumber(time.getSourceNumber());
                    rs.add(t);
@ -3690,11 +3697,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            for(WlyyDoctorWorkTimeDO time : workTimeDOs){
                //医生工作月份
                String workMonth = time.getDoctor()+","+time.getDate().substring(0,7);
                String workMonth = time.getDoctor()+","+time.getWorkDate().substring(0,7);
                //判断是否是首次插入医生月份数据,如果是首次,则删除该医生当前月份排班数据数据
                if(!workMonths.contains(workMonth)){
                    workMonths.add(workMonth);
                    List<WlyyDoctorWorkTimeDO> oldTimes = doctorWorkTimeDao.findDoctorWorkTimeByMonth(time.getDoctor(),"%"+time.getDate().substring(0,7)+"%");
                    List<WlyyDoctorWorkTimeDO> oldTimes = doctorWorkTimeDao.findDoctorWorkTimeByMonth(time.getDoctor(),"%"+time.getWorkDate().substring(0,7)+"%");
                    doctorWorkTimeDao.delete(oldTimes);
                }
            }
@ -4889,19 +4896,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
    public List<Map<String,Object>> findDeptByKeyWord(String keyWord,Integer page,Integer pagesize) {
    
        if(page >=1){
            page --;
        }
    
        if (pagesize <= 0) {
            pagesize = 10;
        }
    
        String sql ="SELECT " +
                "dept.`code` AS deptCode," +
                "dept.`name` AS deptName," +
                "org.CODE AS orgCode, " +
                "org.NAME AS orgName " +
                "dept.code AS \"deptCode\"," +
                "dept.name AS \"deptName\"," +
                "org.CODE AS \"orgCode\", " +
                "org.NAME AS \"orgName\" " +
                "FROM " +
                "dict_hospital_dept dept," +
                "base_org org " +
@ -4911,9 +4910,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(StringUtils.isNoneBlank(keyWord)){
            sql = sql + "AND dept.NAME LIKE '%"+keyWord+"%' ";
        }
        sql = sql + " limit "+page * pagesize +","+pagesize ;
    
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pagesize);
        logger.info("sql:"+sql);
        return list;
    }

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

@ -242,7 +242,7 @@ public class WorkTimeService {
        String workDate = date+"-"+day;
        logger.info("workDate:"+workDate);
        workTimeDO.setDate(workDate);
        workTimeDO.setWorkDate(workDate);
        workTimeDO.setCreateTime(new Date());
        //上午

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateDemo.java

@ -57,7 +57,7 @@ public class HibenateDemo {
        }
        Long count = 0L;
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlTotal,params);
        if(count!=null){
        if(total!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        }

+ 5 - 5
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyDoctorWorkTimeDO.java

@ -27,7 +27,7 @@ public class WlyyDoctorWorkTimeDO extends UuidIdentityEntity {
    private String timeType;//1.上午00:00~12:00之前;2.下午12:00~00:00;',
    private Date startTime;//开始时间',
    private Date endTime;//结束时间',
    private String date;//排班日期',
    private String workDate;//排班日期',
    private Integer timeInterval;//号源间隔
    private Integer sourceNumber;//号源数目
    private Date createTime;//创建时间',
@ -139,12 +139,12 @@ public class WlyyDoctorWorkTimeDO extends UuidIdentityEntity {
        this.endTime = endTime;
    }
    public String getDate() {
        return date;
    public String getWorkDate() {
        return workDate;
    }
    public void setDate(String date) {
        this.date = date;
    public void setWorkDate(String workDate) {
        this.workDate = workDate;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")