Переглянути джерело

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

wangzhinan 4 роки тому
батько
коміт
aea0496eeb
14 змінених файлів з 377 додано та 82 видалено
  1. 87 3
      business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java
  2. 19 8
      business/base-service/src/main/java/com/yihu/jw/evaluate/score/service/BaseEvaluateScoreService.java
  3. 3 0
      business/base-service/src/main/java/com/yihu/jw/hospital/dict/WlyyHospitalSysDictDao.java
  4. 58 14
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  5. 76 28
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/WorkTimeService.java
  6. 11 3
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  7. 4 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  8. 12 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  9. 4 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  10. 9 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/dao/patient/WlyyHospitalSysDictDao.java
  11. 51 16
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  12. 4 3
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java
  13. 35 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  14. 4 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

+ 87 - 3
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java

@ -140,7 +140,8 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
                "\tn.req_fee as \"spfzFee\",\n" +
                "\tp.req_fee as \"spzxFee\",\n" +
                "\tv.req_fee as \"twzxFee\",\n" +
                "\td.req_fee as \"xtzxFee\"\n" +
                "\td.req_fee as \"xtzxFee\",\n" +
                "\tg.req_fee as \"jyzxFee\"\n" +
                " FROM " +
                " base_doctor a " +
                " JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
@ -150,6 +151,7 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
                " LEFT JOIN wlyy_charge_dict p ON a.spzx_charge_type = p.charge_type\n" +
                " LEFT JOIN wlyy_charge_dict v ON a.twzx_charge_type = v.charge_type\n" +
                " LEFT JOIN wlyy_charge_dict d ON a.xtfz_charge_type = d.charge_type\n" +
                " LEFT JOIN wlyy_charge_dict g ON a.jyzx_charge_type = g.charge_type\n" +
                " LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
                " WHERE 1=1";
        if (StringUtils.isNotBlank(city)){
@ -204,7 +206,8 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
                "\tn.req_fee as \"spfzFee\",\n" +
                "\tp.req_fee as \"spzxFee\",\n" +
                "\tv.req_fee as \"twzxFee\",\n" +
                "\tq.req_fee as \"xtzxFee\"\n" +
                "\tq.req_fee as \"xtzxFee\",\n" +
                "\tg.req_fee as \"jyzxFee\"\n" +
                " FROM " +
                " base_doctor a " +
                " LEFT JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
@ -216,6 +219,7 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
                " LEFT JOIN wlyy_charge_dict p ON a.spzx_charge_type = p.charge_type\n" +
                " LEFT JOIN wlyy_charge_dict v ON a.twzx_charge_type = v.charge_type\n" +
                " LEFT JOIN wlyy_charge_dict q ON a.xtfz_charge_type = q.charge_type\n" +
                " LEFT JOIN wlyy_charge_dict g ON a.jyzx_charge_type = g.charge_type\n" +
                " WHERE 1=1 ";
        if(StringUtils.isNotBlank(doctorId)){
            sql+=" AND a.id =:id";
@ -285,7 +289,64 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
        String outpatientType = jsonObject.get("outpatientType").toString();
        String newSpecialDisease = jsonObject.get("specialDisease").toString();
        String newSpecialDiseaseCode = jsonObject.get("specialDiseaseCode").toString();
        baseDoctorDao.update(doctorId,introduce,expertise,photo,outpatientType);
        BaseDoctorDO doctorDO = baseDoctorDao.findOne(doctorId);
        if (doctorDO!=null){
            doctorDO.setIntroduce(introduce);
            doctorDO.setExpertise(expertise);
            doctorDO.setPhoto(photo);
            doctorDO.setOutpatientType(outpatientType);
            if (StringUtils.isNoneBlank(jsonObject.get("TWZXFee")==null?"":jsonObject.get("TWZXFee").toString())){
                String chargeType = findOrCreateChargeType(jsonObject.get("TWZXFee").toString(),doctorDO.getName());
                doctorDO.setTwzxChargeType(chargeType);
            }else {
                if (jsonObject.get("TWZXType")!=null) {
                    doctorDO.setTwzxChargeType(jsonObject.get("TWZXType").toString());
                }
            }
            if (StringUtils.isNoneBlank(jsonObject.get("SPZXFee")==null?"":jsonObject.get("SPZXFee").toString())){
                String chargeType = findOrCreateChargeType(jsonObject.get("SPZXFee").toString(),doctorDO.getName());
                doctorDO.setSpzxChargeType(chargeType);
            }else {
                if (jsonObject.get("SPZXType")!=null) {
                    doctorDO.setSpzxChargeType(jsonObject.get("SPZXType").toString());
                }
            }
            if (StringUtils.isNoneBlank(jsonObject.get("TWFZFee")==null?"":jsonObject.get("TWFZFee").toString())){
                String chargeType = findOrCreateChargeType(jsonObject.get("TWFZFee").toString(),doctorDO.getName());
                doctorDO.setTwfzChargeType(chargeType);
            }else {
                if (jsonObject.get("TWFZType")!=null){
                    doctorDO.setTwfzChargeType(jsonObject.get("TWFZType").toString());
                }
            }
            if (StringUtils.isNoneBlank(jsonObject.get("SPFZFee")==null?"":jsonObject.get("SPFZFee").toString())){
                String chargeType = findOrCreateChargeType(jsonObject.get("SPFZFee").toString(),doctorDO.getName());
                doctorDO.setSpfzChargeType(chargeType);
            }else {
                if (jsonObject.get("SPFZType")!=null){
                    doctorDO.setSpfzChargeType(jsonObject.get("SPFZType").toString());
                }
            }
            if (StringUtils.isNoneBlank(jsonObject.get("JYZXFee")==null?"":jsonObject.get("JYZXFee").toString())){
                String chargeType = findOrCreateChargeType(jsonObject.get("JYZXFee").toString(),doctorDO.getName());
                doctorDO.setJyzxChargeType(chargeType);
            }else {
                if (jsonObject.get("JYZXType")!=null){
                    doctorDO.setJyzxChargeType(jsonObject.get("JYZXType").toString());
                }
            }
            if (StringUtils.isNoneBlank(jsonObject.get("XTFZFee")==null?"":jsonObject.get("XTFZFee").toString())){
                String chargeType = findOrCreateChargeType(jsonObject.get("XTFZFee").toString(),doctorDO.getName());
                doctorDO.setXtfzChargeType(chargeType);
            }else {
                if (jsonObject.get("XTFZType")!=null){
                    doctorDO.setXtfzChargeType(jsonObject.get("XTFZType").toString());
                }
            }
        }
        //baseDoctorDao.update(doctorId,introduce,expertise,photo,outpatientType);
        baseDoctorDao.save(doctorDO);
        //删除医生旧专病门诊,保存新专病门诊
        Map<String,Object> params = new HashedMap();
        String sqlTotal ="SELECT " +
@ -487,4 +548,27 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public String findOrCreateChargeType(String fee,String doctorName){
        if (StringUtils.isNoneBlank(fee)){
            double chargeFee = Double.parseDouble(fee);
            WlyyChargeDictDO wlyyChargeDictDO = wlyyChargeDictDao.findByReqFee(chargeFee);
            if (null!=wlyyChargeDictDO){
                return wlyyChargeDictDO.getChargeType();
            }else {
                wlyyChargeDictDO = new WlyyChargeDictDO();
                wlyyChargeDictDO.setCreateTime(new Date());
                wlyyChargeDictDO.setReqFee(chargeFee);
                wlyyChargeDictDO.setChargeType(fee+"");
                wlyyChargeDictDO.setChargeName(doctorName+"创建的号别");
                wlyyChargeDictDO = wlyyChargeDictDao.save(wlyyChargeDictDO);
                return  wlyyChargeDictDO.getChargeType();
            }
        }else {
            return "";
        }
    }
    public List<WlyyChargeDictDO> findChargeDicts(){
        List<WlyyChargeDictDO> wlyyChargeDictDOS =  wlyyChargeDictDao.findByDeptTypeCode("6");
        return wlyyChargeDictDOS;
    }
}

+ 19 - 8
business/base-service/src/main/java/com/yihu/jw/evaluate/score/service/BaseEvaluateScoreService.java

@ -6,6 +6,7 @@ import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -30,7 +31,8 @@ public class BaseEvaluateScoreService extends BaseJpaService<BaseEvaluateScoreDO
    private BaseEvaluateScoreDao baseEvaluateScoreDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Value("${wechat.id}")
    private String wxId;
    /**
     * 计算总评分,周同比,日环比
@ -70,7 +72,7 @@ public class BaseEvaluateScoreService extends BaseJpaService<BaseEvaluateScoreDO
     * @return
     */
    private Double getAvgScore(String startTime,String endTime,String area,int level){
        String sql = "select count(*) as total, sum(score) as score from base.base_evaluate_score o where ";
        String sql = "select count(*) as total, sum(score) as score from base_evaluate_score o where ";
        if (level == 4){
            sql += " o.doctor IN (SELECT doctor_code FROM `base_doctor_hospital` dh where dh.org_code ='"+area+"' and dh.del=1)";
@ -81,13 +83,22 @@ public class BaseEvaluateScoreService extends BaseJpaService<BaseEvaluateScoreDO
        }else if (level == 6){
            sql += " o.doctor ='"+area+"'";
        }
        if (startTime != null){
            sql += " and o.create_time >='" + startTime + "'";
        }
        if(endTime != null){
            sql += " and o.create_time <='" + endTime + "'";
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            if (startTime != null){
                sql += " and o.create_time >= to_date('" + startTime + "','yyyy-mm-dd hh24:mi:ss')";
            }
            if(endTime != null){
                sql += " and o.create_time <=to_date('" + endTime + "','yyyy-mm-dd hh24:mi:ss')";
            }
        }else {
            if (startTime != null){
                sql += " and o.create_time >='" + startTime + "'";
            }
            if(endTime != null){
                sql += " and o.create_time <='" + endTime + "'";
            }
        }
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        double total = 0d;
        double score = 0d;

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

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.dict;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -18,4 +19,6 @@ public interface WlyyHospitalSysDictDao extends PagingAndSortingRepository<WlyyH
    WlyyHospitalSysDictDO findById(String id);
    List<WlyyHospitalSysDictDO> findByDictName(String dictName);
    @Query("from WlyyHospitalSysDictDO where 1=1")
    List<WlyyHospitalSysDictDO> findAlldict();
}

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

@ -1631,6 +1631,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        "\ta.req_fee as \"spfzFee\",\n" +
                        "\tb.req_fee as \"spzxFee\",\n" +
                        "\tv.req_fee as \"twzxFee\",\n" +
                        "\tg.req_fee as \"jyzxFee\",\n" +
                        "\td.req_fee as \"xtzxFee\"\n" +
                        "FROM\n" +
                        "\tbase_doctor t\n" +
@ -1638,7 +1639,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        "LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type\n" +
                        "LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" +
                        "LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" +
                        "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" +
                        "LEFT JOIN wlyy_charge_dict d ON t.twzx_charge_type = d.charge_type\n" +
                        " LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" +
                        "WHERE t.id = '"+doctor.get("id")+"' ";
                chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge);
                /*if (null!=doctor.get("chargeType")){
@ -3577,6 +3579,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "\ta.req_fee as \"spfzFee\",\n" +
                    "\tb.req_fee as \"spzxFee\",\n" +
                    "\tv.req_fee as \"twzxFee\",\n" +
                    "\tg.req_fee as \"jyzxFee\",\n" +
                    "\td.req_fee as \"xtzxFee\"\n" +
                    "FROM\n" +
                    "\tbase_doctor t\n" +
@ -3585,6 +3588,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" +
                    "LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" +
                    "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" +
                    " LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" +
                    "WHERE t.id = '"+doctorDO.getId()+"' ";
            chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge);
            rs.put("chargeTypeList",chargeDictDOLists);
@ -3861,6 +3865,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "\ta.req_fee as \"spfzFee\",\n" +
                    "\tb.req_fee as \"spzxFee\",\n" +
                    "\tv.req_fee as \"twzxFee\",\n" +
                    "\tg.req_fee as \"jyzxFee\",\n" +
                    "\td.req_fee as \"xtzxFee\"\n" +
                    "FROM\n" +
                    "\tbase_doctor t\n" +
@ -3869,6 +3874,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" +
                    "LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" +
                    "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" +
                    " LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" +
                    "WHERE t.id = '"+doctorDO.getId()+"' ";
            chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge);
            rs.put("chargeTypeList",chargeDictDOLists);
@ -4676,7 +4682,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else {
            sql += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS timedate_format,";
        }
        sql += "outpatient.disease_img AS \"disease_img\"," +
        sql += " outpatient.disease_img AS \"disease_img\"," +
                "outpatient.description AS \"description\"," +
                "room.reservation_type AS \"reservation_type\"," +
                "outpatient.origin_con_no AS \"origin_con_no\" " +
@ -4716,7 +4722,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //在线复诊
            sql += " AND room.reservation_type !=3 AND room.consult_type =2";
        } else {
            sql += " AND room.reservation_type !=2";
        }
        if (StringUtils.isNoneBlank(dept)) {
@ -5442,6 +5448,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "\ta.req_fee as \"spfzFee\",\n" +
                    "\tb.req_fee as \"spzxFee\",\n" +
                    "\tv.req_fee as \"twzxFee\",\n" +
                    "\tg.req_fee as \"jyzxFee\",\n" +
                    "\td.req_fee as \"xtzxFee\"\n" +
                    "FROM\n" +
                    "\tbase_doctor t\n" +
@ -5450,6 +5457,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" +
                    "LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" +
                    "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" +
                    " LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" +
                    "WHERE t.id = '"+map.get("id")+"' ";
            chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge);
            map.put("chargeTypeList",chargeDictDOLists);
@ -9655,19 +9663,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                }
                                doctorDO.setSpzxChargeType(chargeDictDO.getChargeType());
                                if (StringUtils.isNoneBlank(doctorDO.getOutpatientType())){
                                    if (!doctorDO.getOutpatientType().contains("zj")){
                                        doctorDO.setOutpatientType(doctorDO.getOutpatientType()+",zj");
                                    if (!doctorDO.getOutpatientType().contains("zjsp")){
                                        doctorDO.setOutpatientType(doctorDO.getOutpatientType()+",zjsp");
                                    }
                                }else {
                                    doctorDO.setOutpatientType("zj");
                                    doctorDO.setOutpatientType("zjsp");
                                }
                            }else {
                                if (StringUtils.isNoneBlank(doctorDO.getOutpatientType())){
                                    if (doctorDO.getOutpatientType().contains("zj")){
                                        doctorDO.getOutpatientType().replace(",zj","");
                                    if (doctorDO.getOutpatientType().contains("zjsp")){
                                        doctorDO.getOutpatientType().replace(",zjsp","");
                                    }
                                }else{
                                    doctorDO.setOutpatientType("zj");
                                    doctorDO.setOutpatientType("zjsp");
                                }
                            }
@ -9753,11 +9761,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        }
                        doctorDO.setSpzxChargeType(chargeDictDO.getChargeType());
                        if (StringUtils.isNoneBlank(doctorDO.getOutpatientType())) {
                            if (!doctorDO.getOutpatientType().contains("zj")) {
                                doctorDO.setOutpatientType(doctorDO.getOutpatientType() + ",zj");
                            if (!doctorDO.getOutpatientType().contains("zjsp")) {
                                doctorDO.setOutpatientType(doctorDO.getOutpatientType() + ",zjsp");
                            }
                        }else {
                            doctorDO.setOutpatientType("zj");
                            doctorDO.setOutpatientType("zjsp");
                        }
                    }
                    baseDoctorDao.save(doctorDO);
@ -9775,10 +9783,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "\tt.source as \"source\",\n" +
                "\tt.outpatient_type as \"outpatientType\",\n" +
                "\tt.create_time as \"createTime\",\n" +
                "\th.org_code as \"orgCode\",\n" +
                "\tb.idcard as \"idCard\" \n" +
                "FROM\n" +
                "\twlyy_outpatient t\n" +
                "\tLEFT JOIN base_patient b ON t.patient = b.id where 1=1 ";
                "\tLEFT JOIN base_patient b ON t.patient = b.id " +
                " left join base_doctor_hospital h on t.doctor = h.doctor_code where 1=1 ";
        if (StringUtils.isNoneBlank(startTime)){
            if("xm_ykyy_wx".equals(wechatId)){
                if (flag){
@ -9805,11 +9815,45 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        for (Map<String,Object> map:list){
            if (map.get("createTime")!=null){
                map.put("createTime",DateUtil.dateToStrLong(DateUtil.strToDateLong(map.get("createTime").toString())));
                map.put("orgCode",wechatId);
            }
        }
        return list;
    }
    public com.alibaba.fastjson.JSONObject getWorkDoctorCount(String nowTime,String orgCode){
        String sql = "select count(*) as \"total\",t.doctor as \"doctor\" from wlyy_doctor_work_time t " +
                " left join base_doctor_hospital b on t.doctor = b.doctor_code where 1=1 ";
        if(StringUtils.isNoneBlank(nowTime)){
            if("xm_ykyy_wx".equals(wechatId)){
                if (flag){
                    sql+=" and t.start_time >= '" + nowTime + " 00:00:00' and t.end_time <='"+nowTime+" 23:59:59' ";
                }else {
                    sql+=" and t.start_time >= to_date('" + nowTime + " 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and t.end_time <=to_date('"+nowTime+" 23:59:59', 'yyyy-mm-dd hh24:mi:ss') ";
                }
            }else{
                sql+=" and t.start_time >= '" + nowTime + " 00:00:00' and t.end_time <='"+nowTime+" 23:59:59' ";
            }
        }
        if(StringUtils.isNoneBlank(orgCode)){
            sql+=" and b.org_code ='"+orgCode+"'";
        }
        sql+=" group by t.doctor";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        long count =0;
        if(list!=null){
            count = list.size();
        }
        com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
        jsonObject.put("workDoctorCount",count);
        return  jsonObject;
    }
    public List<WlyyHospitalSysDictDO> findAllDict(){
        List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findAlldict();
        return  wlyyHospitalSysDictDOS;
    }
    public WlyyHospitalSysDictDO findDictById(String dictId){
        WlyyHospitalSysDictDO wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findById(dictId);
        return  wlyyHospitalSysDictDOS;
    }
}

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

@ -7,14 +7,17 @@ import com.yihu.jw.doctor.service.excel.DoctorWorkTimeExcelDO;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeMainExcelDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.prescription.WlyyHospitalWorkRuleDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.doctor.dao.DoctorWorkTimeDao;
import com.yihu.jw.hospital.prescription.dao.WlyyHospitalWorkRuleDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -52,6 +55,8 @@ public class WorkTimeService {
    @Autowired
    private BaseOrgDao baseOrgDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    /**
     * 保存排班规则
@ -87,34 +92,77 @@ public class WorkTimeService {
     * @param doctor
     * @return
     */
    public Boolean checkDoctorWork(String doctor){
        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;
    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;
                }
            }else {
                return true;
            }
        }else {
            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;
            }
        }
        return false;
    }

+ 11 - 3
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -20,6 +20,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -54,6 +55,8 @@ public class StatisticsEsService {
    private BaseCityDao cityDao;
    @Autowired
    private BaseEvaluateScoreService baseEvaluateScoreService;
    @Value("${wechat.id}")
    private String wxId;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@ -116,7 +119,12 @@ public class StatisticsEsService {
        object.put("prescriptionRate",prescriptionRate);//开方率
        String startTime = DateUtil.getStringDateShort()+" 00:00:00";
        String endTime = DateUtil.getStringDateShort() +" 23:59:59";
        String sql = "select count(*) as \"total\" from wlyy_consult_oupatient_info o where  o.create_time >='"+startTime+"' and o.create_time <='"+endTime+"'";
        String sql = "";
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            sql = "select count(*) as \"total\" from wlyy_consult_outpatient_info o where  o.create_time >= to_date('"+startTime+"','yyyy-mm-dd hh24:mi:ss') and o.create_time <= to_date('"+endTime+"','yyyy-mm-dd hh24:mi:ss')";
        }else {
            sql = "select count(*) as \"total\" from wlyy_consult_outpatient_info o where  o.create_time >='"+startTime+"' and o.create_time <='"+endTime+"'";
        }
        if (level==4){
            sql += " and o.doctor IN (SELECT doctor_code as \"doctor_code\" FROM `base_doctor_hospital` dh where dh.org_code ='"+area+"' and dh.del=1)";
        }if (level==2){
@ -129,7 +137,7 @@ public class StatisticsEsService {
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
            count =Long.parseLong(rstotal.get(0).get("total").toString()) ;
        }
        object.put("todayOutPatientCount",count);//今日问诊量
        Map<String, Object> scoreAndPercentage = baseEvaluateScoreService.getScoreAndPercentage(area, level);
@ -1091,7 +1099,7 @@ public class StatisticsEsService {
            List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlCount);//总人数
            Long total = 0L;
            if(rstotal!=null&&rstotal.size()>0){
                total = (Long) rstotal.get(0).get("total");
                total = Long.parseLong(rstotal.get(0).get("total").toString()) ;
            }
            for (Map<String,Object> map:mapList){
                Integer count = Integer.parseInt(map.get("count").toString());

+ 4 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -1,5 +1,6 @@
package com.yihu.jw.entity;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
@ -18,13 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
//==========mysql 环境 id策略======================================================
/*    @GeneratedValue(generator = "generator")
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)*/
    @Column(name = "id", unique = true, nullable = false)
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
 /*  @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 12 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -276,6 +276,18 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
     * 协同复诊号别
     */
    private String xtfzChargeType;
    /**
     * 家医咨询号别
     */
    private String jyzxChargeType;
    @Column(name = "jyzx_charge_type")
    public String getJyzxChargeType() {
        return jyzxChargeType;
    }
    public void setJyzxChargeType(String jyzxChargeType) {
        this.jyzxChargeType = jyzxChargeType;
    }
    @Column(name = "YKT_DOCTOR_ID")
    public String getYktDoctorId() {

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

@ -1415,6 +1415,10 @@ public class BaseHospitalRequestMapping {
        public static final String findHospitalInfo = "/findHospitalInfo";
        public static final String synYktZxPrice = "/synYktZxPrice";
        public static final String findHospitalConsultInfo = "/findHospitalConsultInfo";
        public static final String findDictLists = "/findDictLists";
        public static final String findWorkDoctorCount = "/findWorkDoctorCount";
        public static final String findAllDict = "/findAllDict";
        public static final String findDictById = "/findDictById";
    }
    /**

+ 9 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/dao/patient/WlyyHospitalSysDictDao.java

@ -0,0 +1,9 @@
package com.yihu.jw.security.dao.patient;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface WlyyHospitalSysDictDao  extends PagingAndSortingRepository<WlyyHospitalSysDictDO, String>, JpaSpecificationExecutor<WlyyHospitalSysDictDO> {
    WlyyHospitalSysDictDO findDictById(String id);
}

+ 51 - 16
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -4,10 +4,12 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import com.netflix.discovery.converters.Auto;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.restmodel.ResultStatus;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -16,6 +18,7 @@ import com.yihu.jw.security.dao.OauthKeypairDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.dao.patient.WechatDao;
import com.yihu.jw.security.dao.patient.WlyyHospitalSysDictDao;
import com.yihu.jw.security.exception.ImgCaptchaException;
import com.yihu.jw.security.login.service.BaseLoginLogService;
import com.yihu.jw.security.model.*;
@ -149,6 +152,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    private XzzxService xzzxService;
    @Autowired
    private WechatDao wechatDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyhospitalSysdictDao;
    @PostConstruct
    private void init() {
@ -174,12 +179,20 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    public ResponseEntity<Oauth2Envelop<WlyyUserSimple>> login(@RequestParam Map<String, String> parameters, HttpSession httpSession) throws Exception {
        logger.info("login:登录进入1");
        //图形验证码验证
        String key = parameters.get("key");
        String text = parameters.get("text");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
                throw new ImgCaptchaException("img_captcha error");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedPictureCode");
        String isNeedPictureCode = "1";
        if (wlyyHospitalSysDictDO!=null){
            isNeedPictureCode = wlyyHospitalSysDictDO.getDictValue();
        }
        logger.info("isNeedPictureCode:"+isNeedPictureCode);
        if ("1".equalsIgnoreCase(isNeedPictureCode)){
            //图形验证码验证
            String key = parameters.get("key");
            String text = parameters.get("text");
            if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
                if(!verifyCaptcha(key,text)){
                    throw new ImgCaptchaException("img_captcha error");
                }
            }
        }
        logger.info("login:登录进入2");
@ -1720,14 +1733,25 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    public ResponseEntity<Oauth2Envelop<WlyyUserSimple>> ykLogin(@RequestParam Map<String, String> parameters, HttpSession httpSession) throws Exception {
        //图形验证码验证
        String key = parameters.get("key");
        String text = parameters.get("text");
        /*String key = parameters.get("key");
        String text = parameters.get("text");*/
        String captcha = parameters.get("captcha");
        String loginType = parameters.get("login_type");
        String appletCode = parameters.get("appletCode");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
                throw new ImgCaptchaException("img_captcha error");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedPictureCode");
        String isNeedPictureCode = "1";
        if (wlyyHospitalSysDictDO!=null){
            isNeedPictureCode = wlyyHospitalSysDictDO.getDictValue();
        }
        logger.info("isNeedPictureCode:"+isNeedPictureCode);
        if ("1".equalsIgnoreCase(isNeedPictureCode)){
            //图形验证码验证
            String key = parameters.get("key");
            String text = parameters.get("text");
            if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
                if(!verifyCaptcha(key,text)){
                    throw new ImgCaptchaException("img_captcha error");
                }
            }
        }
        String username = parameters.get("username");
@ -2025,12 +2049,23 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    @RequestMapping(value = "/oauth/ykDoctorlogin", method = RequestMethod.POST)
    public ResponseEntity<Oauth2Envelop<WlyyUserSimple>> ykDoctorlogin(@RequestParam Map<String, String> parameters, HttpSession httpSession) throws Exception {
        logger.info("login:登录进入1");
        //图形验证码验证
        /*//图形验证码验证
        String key = parameters.get("key");
        String text = parameters.get("text");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
                throw new ImgCaptchaException("img_captcha error");
        String text = parameters.get("text");*/
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedPictureCode");
        String isNeedPictureCode = "1";
        if (wlyyHospitalSysDictDO!=null){
            isNeedPictureCode = wlyyHospitalSysDictDO.getDictValue();
        }
        logger.info("isNeedPictureCode:"+isNeedPictureCode);
        if ("1".equalsIgnoreCase(isNeedPictureCode)){
            //图形验证码验证
            String key = parameters.get("key");
            String text = parameters.get("text");
            if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
                if(!verifyCaptcha(key,text)){
                    throw new ImgCaptchaException("img_captcha error");
                }
            }
        }
        logger.info("login:登录进入2");

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

@ -435,9 +435,10 @@ public class YkyyService {
                            String pw = idcard.substring(idcard.length() - 6);
                            doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                            doctor.setSalt(salt);
                            doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
                            doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
                            if(StringUtils.isNoneBlank(doctorJson.getString("jobtitlecode"))){
                                doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
                                doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
                            }
                            doctor.setVerifyCode(verifyCode);
                            doctor.setYktDoctorId(yktDoctorId);
//                            doctor.setExpertise(doctorJson.getString("expertise"));

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

@ -14,6 +14,7 @@ import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
@ -674,8 +675,10 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.checkDoctorWork)
    @ApiOperation(value = "判断医生是否在班")
    public ObjEnvelop checkDoctorWork(@ApiParam(name = "doctor", value = "判断医生是否在班")
                                      @RequestParam(value = "doctor",required = true)String doctor) throws Exception{
        return success(workTimeService.checkDoctorWork(doctor));
                                      @RequestParam(value = "doctor",required = true)String doctor,
                                      @ApiParam(name = "ywCode", value = "业务code")
                                      @RequestParam(value = "ywCode",required = false)String ywCode) throws Exception{
        return success(workTimeService.checkDoctorWork(doctor,ywCode));
    }
@ -1215,4 +1218,34 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDictLists)
    @ApiOperation(value = "查询基础号别字典", notes = "查询基础号别字典")
    public ListEnvelop findDictLists() throws Exception{
        return success(baseDoctorService.findChargeDicts());
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findWorkDoctorCount)
    @ApiOperation(value = "查询医生排版数量", notes = "查询医生排版数量")
    public ObjEnvelop<JSONObject> findWorkDoctorCount(
            @ApiParam(name = "nowTime", value = "当前时间 yyyy-MM-dd hh:mm:ss")
            @RequestParam(value = "nowTime", required = false)String nowTime,
            @ApiParam(name = "orgCode", value = "医院code")
            @RequestParam(value = "orgCode", required = false)String orgCode) throws Exception{
        return success(prescriptionService.getWorkDoctorCount(nowTime,orgCode));
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findAllDict)
    @ApiOperation(value = "查询配置字典所有项", notes = "查询配置字典所有项")
    public ListEnvelop<WlyyHospitalSysDictDO> findAllDict() throws Exception{
        return success(prescriptionService.findAllDict());
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDictById)
    @ApiOperation(value = "根据id查询配置字典", notes = "根据id查询配置字典")
        public Envelop findDictById(@ApiParam(name = "dictId", value = "dictId")
                                                                      @RequestParam(value = "dictId", required = true)String dictId) throws Exception{
        return success(prescriptionService.findDictById(dictId));
    }
}

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

@ -1343,8 +1343,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.checkDoctorWork)
    @ApiOperation(value = "判断医生是否在班")
    public ObjEnvelop checkDoctorWork(@ApiParam(name = "doctor", value = "判断医生是否在班")
                                      @RequestParam(value = "doctor",required = true)String doctor) throws Exception{
        return success(workTimeService.checkDoctorWork(doctor));
                                      @RequestParam(value = "doctor",required = true)String doctor,
                                      @ApiParam(name = "ywCode", value = "业务code")
                                      @RequestParam(value = "ywCode",required = false) String ywCode) throws Exception{
        return success(workTimeService.checkDoctorWork(doctor,ywCode));
    }
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.importDoctorWork)