Browse Source

Merge branch '2.0' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into 2.0

wangzhinan 11 months ago
parent
commit
4972d52bde
24 changed files with 449 additions and 389 deletions
  1. 1 0
      business/base-service/src/main/java/com/yihu/jw/article/service/KnowledgeArticleDictService.java
  2. 69 77
      business/base-service/src/main/java/com/yihu/jw/complaint/BaseComplaintService.java
  3. 16 3
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  4. 4 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/SystemMessageDao.java
  5. 43 13
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/UserMsgContentService.java
  6. 36 40
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  7. 0 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/WorkTimeService.java
  8. 5 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/DsyyEntranceService.java
  9. 1 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/service/SurveyService.java
  10. 74 133
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  11. 1 1
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  12. 1 1
      common/common-entity/src/db/2024.sql
  13. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDictDO.java
  14. 3 3
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  15. 7 7
      starter/elasticsearch-starter/src/main/java/com/yihu/jw/elasticsearch/ElasticSearch7Helper.java
  16. 27 26
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java
  17. 32 23
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/DsyyPrescriptionCotroller.java
  18. 31 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  19. 20 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java
  20. 3 3
      svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/config/DataSourceConfig.java
  21. 9 8
      svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/job/business/EsToEsQuotaJob.java
  22. 3 6
      svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/job/business/MysqlToEsQuotaJob.java
  23. 52 34
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/door/service/WlyyDoorServiceOrderService.java
  24. 2 3
      svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/service/DeviceService.java

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/article/service/KnowledgeArticleDictService.java

@ -212,6 +212,7 @@ public class KnowledgeArticleDictService extends BaseJpaService<KnowledgeArticle
            one.setCategorySecond(knowledgeArticleDO.getCategorySecond());
            one.setCategorySecondName(knowledgeArticleDO.getCategorySecondName());
            one.setReleaseTime(knowledgeArticleDO.getReleaseTime());
            one.setHomePage(knowledgeArticleDO.getHomePage());
            if (knowledgeArticleDO.getReleaseTime() == null) {
                knowledgeArticleDO.setReleaseTime(new Date());
            }

+ 69 - 77
business/base-service/src/main/java/com/yihu/jw/complaint/BaseComplaintService.java

@ -282,10 +282,19 @@ public class BaseComplaintService {
            throw new Exception("投诉通道已关闭");
        }
        BaseComplaintDO baseComplaintDO = objectMapper.readValue(json, BaseComplaintDO.class);
        BaseComplaintDictDO baseComplaintDictDO = baseComplaintDictDao.findByIdAndIsDel(baseComplaintDO.getComplaintId());
        if (baseComplaintDictDO != null) {
            baseComplaintDO.setComplaintName(baseComplaintDictDO.getName());
        if(StringUtils.isBlank(baseComplaintDO.getComplaintId())){
            //其他
            List<BaseComplaintDictDO> dictDOList =  baseComplaintDictDao.findByName(baseComplaintDO.getComplaintName());
            if(dictDOList.size()>0){
                baseComplaintDO.setComplaintId(dictDOList.get(0).getId());
            }
        }else {
            BaseComplaintDictDO baseComplaintDictDO = baseComplaintDictDao.findByIdAndIsDel(baseComplaintDO.getComplaintId());
            if (baseComplaintDictDO != null) {
                baseComplaintDO.setComplaintName(baseComplaintDictDO.getName());
            }
        }
        if (StringUtils.isNoneBlank(baseComplaintDO.getVisitDept())) {
            DictHospitalDeptDO dictHospitalDeptDO = dictHospitalDeptDao.findByCode(baseComplaintDO.getVisitDept());
            if (dictHospitalDeptDO != null) {
@ -446,9 +455,6 @@ public class BaseComplaintService {
                                        String startTime, String endTime, Integer page, Integer pageSize, String pcAdmin) {
        MixEnvelop mixEnvelop = new MixEnvelop();
        Boolean queryAll = false;
        if ("admin".equalsIgnoreCase(role)) {
            queryAll = true;
        }
        String sql = "select DISTINCT t.id as \"id\"," +
                " t.complaint_id as \"complaintId\"," +
                " t.complaint_name as \"complaintName\"," +
@ -484,11 +490,11 @@ public class BaseComplaintService {
                " left join base_patient b on t.patient=b.id ";
        sql += " left join base_complaint_operate_log g on t.id=g.relation_code where t.is_del='1' ";
        if (StringUtils.isBlank(pcAdmin)) {
        if (!"1".equals(pcAdmin)) {
            //排除撤销的
            sql += " and t.status<>'-1' ";
        } else {
            System.out.println("pc管理员不用排除撤销的");
            queryAll = true;
        }
        if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
@ -496,7 +502,7 @@ public class BaseComplaintService {
        }
        boolean flag = false;
        if (!queryAll) {
            boolean isOther = false;
            String isOther = "";
            String complaint = "";
            String sql1 = "SELECT distinct di.id,di.`name` from base_complaint_doctor d,base_complaint_dict di " +
                    "WHERE di.id=d.complaint_id and d.is_del=1 and di.is_del=1 and d.doctor='"+doctor+"'";
@ -512,7 +518,7 @@ public class BaseComplaintService {
                String id = map.get("id")+"";
                String name = map.get("name")+"";
                if("其他".equals(name)){
                    isOther = true;
                    isOther = id;
                }else {
                    complaint += id+",";
                }
@ -521,22 +527,29 @@ public class BaseComplaintService {
                complaint = complaint.substring(0,complaint.length()-1);
                complaint = complaint.replaceAll(",","','");
            }
            if (isOther) {
                if (StringUtils.isNoneBlank(status)) {
                    sql += " and t.status ='" + status + "'";
            if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
                sql += " and g.operate_from='" + doctor;
            } else if (StringUtils.isNoneBlank(status) && "0".equalsIgnoreCase(status)) {
                if(StringUtils.isNotBlank(isOther)){
                    //其他权限医生可以看到所有已投诉的工单
                    sql += " and t.status='0' and ((t.passto='" + doctor + "' and t.complaint_id in ('"+complaint+"')) or t.complaint_id='"+isOther+"' ) ";
                }else {
                    sql += " and t.status='0' and t.passto='" + doctor + "' and t.complaint_id in ('"+complaint+"') ";
                }
            } else if (StringUtils.isNoneBlank(status) && "1".equalsIgnoreCase(status)) {
                sql += "  and t.status='1' and t.acceptor='" + doctor + "' ";
            } else if (StringUtils.isNoneBlank(status) && "2".equalsIgnoreCase(status)) {
                sql += " and t.status='2' and t.operator='" + doctor + "' ";
            } else {
                if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
                    sql += " and g.operate_from='" + doctor;
                } else if (StringUtils.isNoneBlank(status) && "0".equalsIgnoreCase(status)) {
                    sql += " and t.status='0' and t.passto='" + doctor + "'"+ "' and t.complaint_id='"+complaint+"' ";
                } else if (StringUtils.isNoneBlank(status) && "1".equalsIgnoreCase(status)) {
                    sql += "  and t.status='1' and t.acceptor='" + doctor + "' ";
                } else if (StringUtils.isNoneBlank(status) && "2".equalsIgnoreCase(status)) {
                    sql += " and t.status='2' and t.operator='" + doctor + "' ";
                } else {
                    sql += " and t.id IN (select col.relation_code from base_complaint_operate_log col where col.operate_to = '" + doctor + "'  )";
                String statusSql = "";
                if(StringUtils.isNotBlank(isOther)){
                    //其他权限医生可以看到所有已投诉的工单
                    statusSql += " t.status='0' and ((t.passto='" + doctor + "' and t.complaint_id in ('"+complaint+"')) or t.complaint_id='"+isOther+"' ) ";
                }else {
                    statusSql += " t.status='0' and t.passto='" + doctor + "' and t.complaint_id in ('"+complaint+"') ";
                }
                sql += " and ((t.status='2' and t.operator='" + doctor + "') or (t.status='1' and t.acceptor='" + doctor + "') " +
                        " or (" + statusSql + " )) ";
            }
        } else {
@ -711,13 +724,12 @@ public class BaseComplaintService {
        Integer passto = 0;
        Integer total = 0;
        Boolean queryAll = false;
        if ("admin".equalsIgnoreCase(role)) {
        if ("1".equalsIgnoreCase(pcAdmin)) {
            queryAll = true;
        }
        if (!queryAll) {
            boolean isOther = false;
            String complaint = "";
            String isOther = "";
            String sql1 = "SELECT distinct di.id,di.`name` from base_complaint_doctor d,base_complaint_dict di " +
                    "WHERE di.id=d.complaint_id and d.is_del=1 and di.is_del=1 and d.doctor='"+doctor+"'";
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql1);
@ -734,8 +746,9 @@ public class BaseComplaintService {
            for (Map<String, Object> map:list){
                String id = map.get("id")+"";
                String name = map.get("name")+"";
                complaint += id+",";
                if("其他".equals(name)){
                    isOther = true;
                    isOther = id;
                }else {
                    complaint += id+",";
                }
@ -744,34 +757,19 @@ public class BaseComplaintService {
                complaint = complaint.substring(0,complaint.length()-1);
                complaint = complaint.replaceAll(",","','");
            }
            if (isOther) {
                complaints = getCountByStatus(doctor, "0",complaint, isOther);
                recieve = getCountByStatus(doctor, "1",complaint, isOther);
                deal = getCountByStatus(doctor, "2",complaint, isOther);
                passto = getCountByPassto(doctor);
                total = getCountByStatus(doctor, "",complaint, isOther);
                //撤销
                cacel = getCountByStatus(doctor, "-1",complaint, isOther);
                if (StringUtils.isNotBlank(pcAdmin)) {
                    System.out.println("是pc管理员");
                } else {
                    total = total - cacel;
                }
            } else {
                complaints = getCountByStatus(doctor, "0",complaint, isOther);
                recieve = getCountByStatus(doctor, "1",complaint, isOther);
                deal = getCountByStatus(doctor, "2",complaint, isOther);
                passto = getCountByPassto(doctor);
                total = getCountByStatus(doctor, "",complaint, isOther);
                //撤销
                cacel = getCountByStatus(doctor, "-1",complaint, isOther);
                if (StringUtils.isNotBlank(pcAdmin)) {
                    System.out.println("是pc管理员");
                } else {
                    total = total - cacel;
                }
            complaints = getCountByStatus(doctor, "0",complaint,isOther);
            recieve = getCountByStatus(doctor, "1",complaint,"");
            deal = getCountByStatus(doctor, "2",complaint,"");
//                passto = getCountByPassto(doctor);
//                total = getCountByStatus(doctor, "",complaint);
            //撤销
            cacel = getCountByStatus(doctor, "-1",complaint,"");
            if (StringUtils.isNotBlank(pcAdmin)) {
                total = complaints + recieve+deal+cacel;
                System.out.println("是pc管理员");
            } else {
                total = complaints + recieve+deal;
            }
            //cacel=baseComplaintDao.getCountByStatusAndComplaintId("-1",baseComplaintDoctorDO.getComplaintId());
        } else {
@ -779,11 +777,8 @@ public class BaseComplaintService {
            recieve = baseComplaintDao.getCountByStatus("1");
            deal = baseComplaintDao.getCountByStatus("2");
            cacel = baseComplaintDao.getCountByStatus("-1");
            total = complaints + recieve + deal;
            if (StringUtils.isNotBlank(pcAdmin)) {
                //是管理员加上撤销的
                total = +cacel;
            }
//            passto = getCountByPassto("");
            total = complaints + recieve + deal+cacel;
        }
        Map map = new HashMap();
        map.put("complaints", complaints);
@ -797,7 +792,7 @@ public class BaseComplaintService {
    public Integer getCountByPassto(String doctor) {
        String sql = "select count(1) as \"total\" from (select  DISTINCT t.id   from base_complaint t left join base_complaint_operate_log b" +
                " on t.id=b.relation_code where t.is_del='1' and b.status='3'";
                " on t.id=b.relation_code where t.is_del='1' and t.passto is not null ";
        if (StringUtils.isNoneBlank(doctor)) {
            sql += " and b.operate_from='" + doctor + "'";
        }
@ -810,7 +805,7 @@ public class BaseComplaintService {
        return count;
    }
    public Integer getCountByStatus(String doctor, String status,String complaint, boolean isOther) {
    public Integer getCountByStatus(String doctor, String status,String complaint,String isOther) {
        String sql = "select count(1)  as \"count\" from (select DISTINCT t.id  " +
                "  from base_complaint t  " +
                " left join base_patient b on t.patient=b.id ";
@ -819,22 +814,19 @@ public class BaseComplaintService {
        if ("3".equalsIgnoreCase(status)) {
            sql += "  and g.status='3' ";
        }
        if (isOther) {
            if (StringUtils.isNoneBlank(status)) {
                sql += " and t.status ='" + status + "'";
            }
        } else {
            if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
                sql += " and g.operate_from='" + doctor + "'";
            } else if (StringUtils.isNoneBlank(status) && "0".equalsIgnoreCase(status)) {
                sql += " and t.status='0' and t.passto='" + doctor + "'"+ "' and t.complaint_id='"+complaint+"' ";
            } else if (StringUtils.isNoneBlank(status) && "1".equalsIgnoreCase(status)) {
                sql += "  and t.status='1' and t.acceptor='" + doctor + "' ";
            } else if (StringUtils.isNoneBlank(status) && "2".equalsIgnoreCase(status)) {
                sql += " and t.status='2' and t.operator='" + doctor + "' ";
            } else {
                sql += " and t.id IN (select col.relation_code from base_complaint_operate_log col where col.operate_to = '" + doctor + "'  )";
            }
        if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
            sql += " and g.operate_from='" + doctor + "'";
        } else if (StringUtils.isNoneBlank(status) && "0".equalsIgnoreCase(status)) {
            if(StringUtils.isNotBlank(isOther)){
                //其他权限医生可以看到所有已投诉的工单
                sql += " and t.status='0' and ((t.passto='" + doctor + "' and t.complaint_id in ('"+complaint+"')) or t.complaint_id='"+isOther+"' ) ";
            }else {
                sql += " and t.status='0' and t.passto='" + doctor + "' and t.complaint_id in ('"+complaint+"') ";
            }
        } else if (StringUtils.isNoneBlank(status) && "1".equalsIgnoreCase(status)) {
            sql += "  and t.status='1' and t.acceptor='" + doctor + "' ";
        } else if (StringUtils.isNoneBlank(status) && "2".equalsIgnoreCase(status)) {
            sql += " and t.status='2' and t.operator='" + doctor + "' ";
        }
        if (!StringUtils.isNoneBlank(status)) {
            sql += " and t.status !='-1'";

+ 16 - 3
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java

@ -111,12 +111,25 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                if(basePatientDO==null){
                    basePatientDO = new BasePatientDO();
                }
                basePatientDO.setMobile(phoneNum);
                //判断手机号是否已经存在
                List<BasePatientDO> pList = basePatientDao.findByMobileAndDel(phoneNum,"1");
                if(pList.size()==0){
                    //手机号未被绑定
                    basePatientDO.setMobile(phoneNum);
                }
                basePatientDO.setMobileRemarks(phoneNum);
            }
        }else{
            if(basePatientDO==null){
                basePatientDO = new BasePatientDO();
            }
            //判断手机号是否已经存在
            List<BasePatientDO> pList = basePatientDao.findByMobileAndDel(phoneNum,"1");
            if(pList.size()==0){
                //手机号未被绑定
                basePatientDO.setMobile(phoneNum);
            }
            basePatientDO.setMobileRemarks(phoneNum);
        }
        Map<String,Object> resultMap = new HashMap<>();
        PatientMappingDO patientMappingDO = patientMappingDao.findByIdcard(idCard);
@ -284,7 +297,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                            mixEnvelop.setMessage("您所添加的家属的名称有误,无法发送验证码");
                            return mixEnvelop;
                        }
                        basePatientDO.setMobile(Next_Of_Kin_Phone);
//                        basePatientDO.setMobile(Next_Of_Kin_Phone);
                        basePatientDO.setPhone(Next_Of_Kin_Phone);
                        basePatientDO.setName(Pat_name);
                        basePatientDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
@ -1017,7 +1030,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        }else {
            String sql = "select t.id as \"id\",t.card_type as \"cardType\", " +
                    "t.patient as \"patient\",b.name as \"name\",b.sex as \"sex\","+
                    "b.birthday as\"birthday\",b.idcard as \"idcard\",b.mobile as \"mobile\"," +
                    "b.birthday as\"birthday\",b.idcard as \"idcard\",if(b.mobile is null,b.mobile_remarks,b.mobile) as \"mobile\"," +
                    "t.family_member as \"familyMember\",c.relation_name as \"relationName\",t.medicare as \"medicare\" "+
                    " from wlyy_patient_family_member t left join base_patient b" +
                    " on t.family_member = b.id left join base_patient_member_dict c on t.family_relation=c.id where 1=1 and t.is_del=1 ";

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/SystemMessageDao.java

@ -42,6 +42,10 @@ public interface SystemMessageDao extends JpaRepository<SystemMessageDO, String>
    List<SystemMessageDO> queryByRelationCodeAndTypeIn(String relationCode,String[] type);
    List<SystemMessageDO> queryByRelationCodeAndDelAndTypeIn(String relationCode,String del,String[] type);
    //获取资质申请审核有效的未结束已发送的消息
    @Query("select a from SystemMessageDO a where a.type in ('401','408') and a.del='1' and a.over='1' and a.relationCode = ?1  ")
    List<SystemMessageDO> findMessageByRelationCode(String relationCode);

+ 43 - 13
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/UserMsgContentService.java

@ -6,10 +6,12 @@ import com.yihu.jw.entity.hospital.message.BaseUserMsgContentDO;
import com.yihu.jw.hospital.message.dao.BaseUserMessageDao;
import com.yihu.jw.hospital.message.dao.BaseUserMsgContentDao;
import com.yihu.jw.hospital.message.dao.MsgContentDao;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -22,6 +24,9 @@ import java.util.Map;
@Service
public class UserMsgContentService extends BaseJpaService<BaseUserMsgContentDO, BaseUserMsgContentDao> {
    private Logger logger = LoggerFactory.getLogger(UserMsgContentService.class);
    @Autowired
    private BaseUserMsgContentDao baseUserMsgContentDao;
    @Autowired
@ -44,7 +49,7 @@ public class UserMsgContentService extends BaseJpaService<BaseUserMsgContentDO,
        }
        return  list;
    }
    //好评率计算
    //好评率计算 修改成好评率 = 好评数量 / (总评价数量 - 未评价数量)
    public List<Map<String, Object>> countPoint(String doctor){
        Map<String,Object> params = new HashedMap();
        /*sqlForExpert.append("select * from wlyy_consult a left join wlyy_consult_team b" +
@ -58,19 +63,22 @@ public class UserMsgContentService extends BaseJpaService<BaseUserMsgContentDO,
        String countsqlForExpert = "SELECT COUNT(1) AS \"total\" FROM ("+sqlForExpert+") t";
        //专家咨询业务数总量
        Long count = 1L;
        long countTmp = 0L;
        //专家咨询业务数满意数量
        Long expertFix = 0L;
        System.out.println(countsqlForExpert);
        logger.info("count="+countsqlForExpert);
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(countsqlForExpert,params);
        if(total!=null){
            if (!"0".equals(total.get(0).get("total").toString())) {
                count = hibenateUtils.objTransformLong(total.get(0).get("total"));
            countTmp = Long.parseLong(total.get(0).get("total").toString());
            if (countTmp!=0) {
                count = countTmp;
            }
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
        }
        String sqlExpertFix = sqlForExpert+" and c.score >= 80";
        String countForExpert = "SELECT COUNT(1) AS \"total\" FROM ("+sqlExpertFix+") t";
        logger.info("expertFix="+countForExpert);
        List<Map<String,Object>> expert = hibenateUtils.createSQLQuery(countForExpert,params);
        if (expert!=null){
            expertFix = hibenateUtils.objTransformLong(expert.get(0).get("total"));
@ -79,34 +87,56 @@ public class UserMsgContentService extends BaseJpaService<BaseUserMsgContentDO,
        String countsqlForOnline= "SELECT COUNT(1) AS \"total\" FROM ("+sql+") t";
        //在线复诊业务数总量
        Long countOnlineTotal = 1L;
        Long countOnlineTotalTmp = 1L;
        //在线复诊业务数满意数量
        Long onlineFix = 0L;
        logger.info("countOnlineTotal="+countsqlForOnline);
        List<Map<String,Object>> totalOnline = hibenateUtils.createSQLQuery(countsqlForOnline,params);
        if(totalOnline!=null){
            if (!"0".equals(totalOnline.get(0).get("total").toString())){
                countOnlineTotal = hibenateUtils.objTransformLong(totalOnline.get(0).get("total"));
            countOnlineTotalTmp = Long.parseLong(totalOnline.get(0).get("total").toString());
            if (countOnlineTotalTmp!=0){
                countOnlineTotal = countOnlineTotalTmp;
            }
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
        }
        String sqlOlineFix = sql+" and c.score >= 80";
        String countForFix = "SELECT COUNT(1) AS \"total\" FROM ("+sqlOlineFix+") t";
        System.out.println(countForFix
        );
        logger.info("onlineFix="+countForFix);
        List<Map<String,Object>> onlineFixList = hibenateUtils.createSQLQuery(countForFix,params);
        if (onlineFixList!=null){
            onlineFix = hibenateUtils.objTransformLong(onlineFixList.get(0).get("total"));
        }
        float expertMY=(float) expertFix/count;
        float inlineMY = (float)onlineFix/countOnlineTotal;
        float totalCountTmp = countTmp + countOnlineTotalTmp;
        float totalConunt = (float)(expertFix+onlineFix)/(count+countOnlineTotal);
        if(totalCountTmp>0){
            totalConunt = (float)(expertFix+onlineFix)/totalCountTmp;
        }
        DecimalFormat df = new DecimalFormat("0.00");
        List<Map<String,Object>> resultList= new ArrayList<>();
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("zjzx",df.format(expertMY * 100)+"%");
        resultMap.put("zxfz",df.format(inlineMY * 100)+"%");
        resultMap.put("totalCount",df.format(totalConunt * 100)+"%");
        if(countTmp==0){
            resultMap.put("zjzx","100%");
        }else {
            resultMap.put("zjzx",df.format(expertMY * 100)+"%");
        }
        if(countOnlineTotalTmp==0){
            resultMap.put("zxfz","100%");
        }else {
            resultMap.put("zxfz",df.format(inlineMY * 100)+"%");
        }
        if(totalCountTmp==0){
            resultMap.put("totalCount","100%");
        }else {
            resultMap.put("totalCount",df.format(totalConunt * 100)+"%");
        }
        resultMap.put("doctor",doctor);
        resultMap.put("expertMY",expertFix+"/"+countTmp);
        resultMap.put("inlineMY",onlineFix+"/"+countOnlineTotalTmp);
        resultList.add(resultMap);
        return resultList;
@ -114,7 +144,7 @@ public class UserMsgContentService extends BaseJpaService<BaseUserMsgContentDO,
    private String dealSql(String doctor,Boolean countExpert){
        StringBuffer sqlForExpert = new StringBuffer();
        sqlForExpert.append("select b.consult AS \"consult\" ,c.id AS \"id\" from  wlyy_consult_team b \n" +
                "left join base_evaluate_score c on b.consult = c.relation_code  \n" +
                "inner join base_evaluate_score c on b.consult = c.relation_code  \n" +
                "where 1=1");
        if(StringUtils.isNotEmpty(doctor)){
            sqlForExpert.append(" and b.doctor = '"+doctor+"'");

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

@ -4887,25 +4887,25 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public com.alibaba.fastjson.JSONObject doctorIndexStatis(String doctor){
        com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
        WlyyHospitalSysDictDO dictDO = hospitalSysDictDao.findOneByDictNameAndDictCode("HOSPITAL_INTEGRATE_VALIDITY_DICT","HOSPITAL_INTEGRATE_VALIDITY_DICT");
        com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(dictDO.getDictValue());
        //[{"type":0,"flag":0,"dateTime":"2023-07-06T16:00:00.000Z","days":"","description":"<p>1111</p>"},
        //{"type":1,"flag":1,"dateTime":"","days":"2","description":"<p>5555</p>"}]
        int flag = 0;
        String dateTime = "";
        String days = "";
        for (int i=0;i<jsonArray.size();i++){
            com.alibaba.fastjson.JSONObject jsonObject = jsonArray.getJSONObject(i);
            if(jsonObject.getInteger("type")==1){
                flag = jsonObject.getInteger("flag");
                dateTime = jsonObject.getString("dateTime");
                days = jsonObject.getString("days");
            }
        }
        if(StringUtils.isNotBlank(dateTime)){
            dateTime = dateTime.substring(0,19);
            dateTime = dateTime.replaceAll("T"," ");
        }
//        WlyyHospitalSysDictDO dictDO = hospitalSysDictDao.findOneByDictNameAndDictCode("HOSPITAL_INTEGRATE_VALIDITY_DICT","HOSPITAL_INTEGRATE_VALIDITY_DICT");
//        com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(dictDO.getDictValue());
//        //[{"type":0,"flag":0,"dateTime":"2023-07-06T16:00:00.000Z","days":"","description":"<p>1111</p>"},
//        //{"type":1,"flag":1,"dateTime":"","days":"2","description":"<p>5555</p>"}]
//        int flag = 0;
//        String dateTime = "";
//        String days = "";
//        for (int i=0;i<jsonArray.size();i++){
//            com.alibaba.fastjson.JSONObject jsonObject = jsonArray.getJSONObject(i);
//            if(jsonObject.get("type") instanceof Integer && jsonObject.getInteger("type")==1){
//                flag = jsonObject.getInteger("flag");
//                dateTime = jsonObject.getString("dateTime");
//                days = jsonObject.getString("days");
//            }
//        }
//        if(StringUtils.isNotBlank(dateTime)){
//            dateTime = dateTime.substring(0,19);
//            dateTime = dateTime.replaceAll("T"," ");
//        }
        //医生获取积分数据
        String integrateSql ="SELECT\n" +
                "\tIFNULL(SUM(integrate), 0) AS \"total\"\n" +
@ -4913,11 +4913,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "\tbase_hospital_user_integrate\n" +
                "WHERE\n" +
                "\tuser = '"+doctor+"' and status=1 ";
        if(flag==0){
            integrateSql += " and create_time>'"+dateTime+"' ";
        }else {
            integrateSql += " and (integrate_type=2 or (integrate_type=1 and DATEDIFF(NOW(),create_time)<'"+days+"')) ";
        }
//        if(flag==0){
//            integrateSql += " and create_time>'"+dateTime+"' ";
//        }else {
//            integrateSql += " and (integrate_type=2 or (integrate_type=1 and DATEDIFF(NOW(),create_time)<'"+days+"')) ";
//        }
        List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(integrateSql);
        Double integrateTotal = 0.0;
        if (rstotal != null && rstotal.size() > 0) {
@ -5149,7 +5149,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " and m.doctor_code='"+doctor+"') a ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list.size()>0){
            return list.get(0).get("doctorLable")+"";
            Object doctorLable = list.get(0).get("doctorLable");
            if(doctorLable==null){
                return "";
            }
            return doctorLable+"";
        }
        return "";
    }
@ -7196,13 +7200,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                                            String diseaseKey, String doctorNameKey,
                                                            String jobTitleNameKey, String outpatientType,
                                                            String keyName, String workingTime, String consultStatus, String chargType, String consutlSort, String isAttention, Integer page, Integer pagesize) {
      /*  if(page >=1){
            page --;
        if (pagesize <= 0) {
            pagesize = 10;
        }*/
        long statr = new Date().getTime();
        String sql = "SELECT " +
                " d.id AS \"id\", " +
@ -7214,16 +7211,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " d.job_title_name AS \"jobTitleName\"," +
                " d.charge_type AS \"chargeType\"," +
                " h.dept_name AS \"deptName\"," +
                " dw.workTotal AS \"workTotal\","+
                " d.consult_status AS \"consultStatus\"," +
                " IFNULL(dw.workTotal,0) AS \"workTotal\","+
                " IFNULL(d.consult_status,0) AS \"consultStatus\"," +
                " d.outpatient_type AS \"outpatientType\"," +
                " a.total AS \"consultTotal\"," +
                " IFNULL(a.total,0) AS \"consultTotal\","+
                " h.org_name AS \"orgName\"," +
                " h.org_code AS \"orgCode\" " ;
        if(StringUtils.isNoneBlank(patientid)){
            sql+=" , follow.id AS \"followid\" " ;
        }
        sql += ",evaluate.score as \"score\",a.total as \"total\"";
        sql += ",IFNULL(evaluate.score,0) as \"score\",IFNULL(a.total,0) as \"total\"";
        sql+=" FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
@ -7299,8 +7296,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "  t.doctor = d.id " +
                    " AND t.start_time <=:startTime" +
                    " AND t.end_time >=:endTime" +
                    " ) OR " +
                    " d.consult_status = '1') ";
                    " ) ) ";
            params.put("startTime", date);
            params.put("endTime", date);
        }
@ -7380,7 +7376,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            "\tD.id DESC,dw.workTotal DESC NULLS LAST";
                }
            }else {
                sql += " and d.del='1' "+groupBy+" order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+"";
                sql += " and d.del='1' "+groupBy+" order by workTotal DESC,consultStatus DESC ,score desc," +
                        "total " + consutlSort+", d.job_title_code desc";
            }
        }
@ -9296,7 +9293,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            wlyyHttpLogDO.setCreateTime(new Date());
            wlyyHttpLogDao.save(wlyyHttpLogDO);
        }
        return outpatient;
    }

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

@ -137,7 +137,6 @@ public class WorkTimeService {
                                "  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);
@ -181,7 +180,6 @@ public class WorkTimeService {
                            "  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);

+ 5 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/DsyyEntranceService.java

@ -348,6 +348,7 @@ public class DsyyEntranceService {
                        DictHospitalDeptDO deptDO = list.get(0);
                        deptDO.setName(deptjson.getString("name"));
                        deptDO.setDeptType(deptjson.getString("deptAttr"));
                        deptDO.setConsultDeptFlag(deptjson.getString("consultDeptFlag"));
                        dictHospitalDeptDao.save(deptDO);
                    }else {
                        //新增
@ -361,9 +362,7 @@ public class DsyyEntranceService {
                        deptDO.setDeptType(deptjson.getString("deptAttr"));
                        dictHospitalDeptDao.save(deptDO);
                    }
                }
            }
        }
        return "success";
@ -1262,9 +1261,13 @@ public class DsyyEntranceService {
                "\tzhiydba.v_internet_patient_card_info \n" +
                "WHERE\n" +
                " 1=1 ";
        logger.info("idcard=="+idcard);
        JSONArray array = new JSONArray();
        if (StringUtils.isNoneBlank(idcard)){
            sql +=" and ZJHM = '"+idcard+"' ";
        }else {
            //没有身份证不查询,否则内存溢出
            return new JSONArray();
        }
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/survey/service/SurveyService.java

@ -961,6 +961,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        String sql = "SELECT " +
                " t.id as \"id\", " +
                " t.code as \"code\", " +
                " t.survey_temp_code AS \"surveyTempCode\", " +
                " t.survey_temp_title AS \"surveyTempTitle\", " +
                " t.patient as \"patient\"," +

+ 74 - 133
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -7141,15 +7141,14 @@ public class StatisticsEsService {
        //查询人数
        String patientCountSql = "SELECT count(DISTINCT p.patient) 'count' FROM  wlyy_outpatient p  WHERE `p`.`pay_status` in (1,2) AND p.`create_time`>='" + qvo.getStartDate() + "' AND p.`create_time`<='" + qvo.getEndDate() + " 23:59:59' ";
        //全部问诊量
        String indexSql = "SELECT count(ct.id) FROM wlyy_consult_outpatient_info ct WHERE " +
                " ct.type IN (1, 9, 12, 15, 16,17) AND ct.create_time <'"+qvo.getEndDate()+" 23:59:59' AND ct.create_time >='"+qvo.getStartDate()+"' ";
        CompletableFuture<Void> future01 = CompletableFuture.runAsync(() -> {
            try {
                //全部问诊量
                SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(qvo.getEndDate(), qvo.getEndDate(), qvo.getArea(), qvo.getLevel(), qvo.getIndex(), SaveModel.timeLevel_DDL);
                if (saveModel != null) {
                    map.put("allConsultCount", saveModel.getResult2().longValue());
                } else {
                    map.put("allConsultCount", 0);
                }
                Integer allConsultCount = jdbcTemplate.queryForObject(indexSql, Integer.class);
                map.put("allConsultCount", allConsultCount);
            } catch (Exception e) {
                e.printStackTrace();
            }
@ -7268,58 +7267,23 @@ public class StatisticsEsService {
        // 服务评分
        String scoreSql = "SELECT ROUND(AVG(score),2) 'score' FROM base_evaluate_score ";
        String index2Sql = "SELECT COUNT(a.id) FROM wlyy_prescription a where a.status>=30  AND a.create_time <'"+qvo.getEndDate()+" 23:59:59' AND a.create_time >='"+qvo.getStartDate()+"' ";
        //开方量
        Integer num = jdbcTemplate.queryForObject(index2Sql, Integer.class);
        resultMap.put("kfl", num);
        CompletableFuture<Void> future01 = CompletableFuture.runAsync(() -> {
            //开方量
            try {
                SaveModel model = elasticsearchUtil.findOneDateQuotaLevel0(qvo.getEndDate(), qvo.getEndDate(), qvo.getArea(), qvo.getLevel(), "2", SaveModel.timeLevel_DDL);
                if (model != null) {
                    resultMap.put("kfl", model.getResult2().longValue());//赋值开发量
                } else {
                    resultMap.put("kfl", 0);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }, execute);
        CompletableFuture<List<SaveModel>> future02 = CompletableFuture.supplyAsync(() -> {
            //接诊量
            List<SaveModel> model = null;
            try {
                model = elasticsearchUtil.findListDateQuotaLevel2(qvo.getStartDate(), qvo.getEndDate(), qvo.getArea(), qvo.getLevel(), "12,14,16", SaveModel.timeLevel_ZL, null, "9,16,12,1,17", "1");
            } catch (Exception e) {
                e.printStackTrace();
            }
            return model;
        }, execute);
        CompletableFuture<SaveModel> future03 = CompletableFuture.supplyAsync(() -> {
            SaveModel model = null;
            try {
                //接诊量
                model = elasticsearchUtil.findOneDateQuotaLevel0(qvo.getEndDate(), qvo.getEndDate(), qvo.getArea(), qvo.getLevel(), "5", SaveModel.timeLevel_DDL);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return model;
        }, execute);
        //指标12,14,16
        //接诊量
        String indexSql = "SELECT COUNT(ct.id)  FROM wlyy_consult_outpatient_info ct " +
                "WHERE  ct.type IN(1,9,12,15,16,17) and ct.visite_status=1 AND ct.create_time <'"+qvo.getEndDate()+" 23:59:59' AND ct.create_time >='"+qvo.getStartDate()+"' ";
        CompletableFuture<Void> future04 = CompletableFuture.runAsync(() -> {
            String score = jdbcTemplate.queryForObject(scoreSql, String.class);
            resultMap.put("score", score);//赋值评分
        }, execute);
        CompletableFuture.allOf(future01, future02, future03, future04).get();
        List<SaveModel> jzModelList = future02.get();
        SaveModel model = future03.get();
        String index5Sql = "SELECT COUNT(ct.id)  FROM wlyy_consult_outpatient_info ct " +
                "WHERE  ct.type IN(1,9,12,15,16,17) AND ct.create_time <'"+qvo.getEndDate()+" 23:59:59' AND ct.create_time >='"+qvo.getStartDate()+"' ";
        int patientVolume = countListTotal(jzModelList);
        int allConsultCount = 0;
        if (model != null) {
            allConsultCount = model.getResult2().intValue();
        }
        String score = jdbcTemplate.queryForObject(scoreSql, String.class);
        resultMap.put("score", score);//赋值评分
        int patientVolume = jdbcTemplate.queryForObject(indexSql, Integer.class);
        int allConsultCount = jdbcTemplate.queryForObject(index5Sql, Integer.class);
        resultMap.put("jzCount", patientVolume);//赋值接诊量
        resultMap.put("wzAllCount", allConsultCount);//赋值问诊量
@ -7328,13 +7292,13 @@ public class StatisticsEsService {
        return resultMap;
    }
    /**
     * 【总收入】= 诊查费(21) + 处方费(3)
     * 查询诊查费、药品费、平均门诊费用 、总收入
     * 今日新增、本月新增
     */
    public HashMap<String, Object> getFreeDetailCount(ScreenQvo qvo) throws Exception {
        DecimalFormat df = new DecimalFormat("#.00");
        HashMap<String, Object> resultMap = new HashMap<>();
        String[] dateList = getFirstAndEndDay(qvo.getEndDate());
        //今天的
@ -7360,86 +7324,63 @@ public class StatisticsEsService {
                "		AND bop.pay_price IS NOT NULL AND bop.pay_price>0\n" +
                "		AND o.create_time  >='" + qvo.getEndDate() + "'  AND o.create_time <='" + qvo.getEndDate() + " 23:59:59' \n" +
                ") q ";
        CompletableFuture<SaveModel> future01 = CompletableFuture.supplyAsync(() -> {
            SaveModel model = null;
            try {
                //处方费
                model = elasticsearchUtil.findOneDateQuotaLevel0(qvo.getEndDate(), qvo.getEndDate(), qvo.getArea(), qvo.getLevel(), "3", SaveModel.timeLevel_DDL);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return model;
        }, execute);
        CompletableFuture<SaveModel> future02 = CompletableFuture.supplyAsync(() -> {
            SaveModel model = null;
            try {
                //检查费
                model = elasticsearchUtil.findOneDateQuotaLevel0(qvo.getEndDate(), qvo.getEndDate(), qvo.getArea(), qvo.getLevel(), "21", SaveModel.timeLevel_DDL);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return model;
        }, execute);
        CompletableFuture<SaveModel> future03 = CompletableFuture.supplyAsync(() -> {
            SaveModel model = null;
            try {
                //本月新增[处方费+检查费]
                model = elasticsearchUtil.findOneDateQuotaLevel0(dateList[0], dateList[1], qvo.getArea(), qvo.getLevel(), "3,21", SaveModel.timeLevel_ZL);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return model;
        }, execute);
        CompletableFuture<String> future04 = CompletableFuture.supplyAsync(() -> {
            String todayFree = jdbcTemplate.queryForObject(sql, String.class);
            return todayFree;
        }, execute);
        CompletableFuture.allOf(future01, future02, future03, future04).get();
        SaveModel model01 = future01.get();//处方费
        SaveModel model02 = future02.get(); //检查费
        SaveModel monthModel = future03.get();
        String todayFree = future04.get();
        long checkFree = 0;
        long prescriptionFee = 0;
        long allCount;
        if (model01 != null) {
            prescriptionFee = model01.getResult2().longValue();
        }
        if (model02 != null) {
            checkFree = model02.getResult2().longValue();
        }
        allCount = prescriptionFee + checkFree;
        if (checkFree == 0) {
            resultMap.put("checkFree", "0.00");//检查费
        } else {
            resultMap.put("checkFree", checkFree);//检查费
        }
        if (prescriptionFee == 0) {
            resultMap.put("prescriptionFee", "0.00");//处方费
        } else {
            resultMap.put("prescriptionFee", prescriptionFee);//处方费
        }
        if (allCount == 0) {
            resultMap.put("allCount", "0.00");//总费用
        } else {
            resultMap.put("allCount", allCount);//总费用
        }
        if (allCount == 0) {
        Double checkFree = 0.00D;
        Double prescriptionFee = 0.00D;
        Double allCount = 0.00D;
        Double monthAdd = 0.00D;//本月新增
        //处方费
        String index3Sql = "SELECT SUM(p.drug_fee) as num " +
                "FROM wlyy_prescription p, wlyy_outpatient o " +
                "WHERE p.outpatient_id = o.id AND p.status >=30 AND p.create_time <'"+qvo.getEndDate()+" 23:59:59'  AND p.create_time  >='"+qvo.getStartDate()+"' ";
        List<Map<String,Object>> index3SqlList = jdbcTemplate.queryForList(index3Sql);
        if(index3SqlList.size()>0){
            String num = index3SqlList.get(0).get("num")+"";
            if(!"null".equals(num)){
                prescriptionFee = Double.valueOf(num);
            }
        }
        //检查费
        String index21Sql = "SELECT sum(bop.pay_price) as num FROM wlyy_outpatient o " +
                "LEFT JOIN base_business_order_pay bop ON o.id = bop.relation_code " +
                "WHERE o.pay_status=1 and o.`status` IN(1,2,3) AND o.create_time <'"+qvo.getEndDate()+" 23:59:59'  AND o.create_time  >='"+qvo.getStartDate()+"' ";
        List<Map<String,Object>> index21SqlList = jdbcTemplate.queryForList(index21Sql);
        if(index21SqlList.size()>0){
            String num = index21SqlList.get(0).get("num")+"";
            if(!"null".equals(num)){
                checkFree = Double.valueOf(num);
            }
        }
        //本月新增[处方费+检查费]
        String index321Sql = "SELECT SUM(num) num from( SELECT " +
                " SUM(p.drug_fee) as num FROM  wlyy_prescription p, wlyy_outpatient o " +
                "WHERE p.outpatient_id = o.id AND p.status >=30 AND p.create_time <'"+dateList[1]+" 23:59:59'  AND p.create_time  >='"+dateList[0]+"' "+
                "UNION all " +
                "SELECT sum(bop.pay_price) as num FROM wlyy_outpatient o " +
                "LEFT JOIN base_business_order_pay bop ON o.id = bop.relation_code " +
                "WHERE o.pay_status=1 and o.`status` IN(1,2,3)  AND o.create_time <'"+dateList[1]+" 23:59:59'  AND o.create_time  >='"+dateList[0]+"' "+
                " ) t ";
        List<Map<String,Object>> index321SqlList = jdbcTemplate.queryForList(index321Sql);
        if(index321SqlList.size()>0){
            String num = index321SqlList.get(0).get("num")+"";
            if(!"null".equals(num)){
                monthAdd = Double.valueOf(num);
            }
        }
        String todayFree = jdbcTemplate.queryForObject(sql, String.class);
        allCount = checkFree+prescriptionFee;
        resultMap.put("checkFree", df.format(checkFree));//检查费
        resultMap.put("prescriptionFee", df.format(prescriptionFee));//处方费
        resultMap.put("allCount", df.format(allCount));//总费用
        resultMap.put("todayFree", todayFree);//今日新增
        if (allCount==0) {
            resultMap.put("avgFree", "0.00");
        } else {
            resultMap.put("avgFree", allCount / 2.0);//平均费用
        }
        if (monthModel != null && monthModel.getResult2().longValue() != 0) {
            resultMap.put("monthFree", monthModel.getResult2().longValue());//本月新增
        } else {
            resultMap.put("monthFree", "0.00");
        }
        if ("0".equals(todayFree)) {
            resultMap.put("todayFree", "0.00");
        } else {
            resultMap.put("todayFree", todayFree);//今日新增
            resultMap.put("avgFree", df.format( (allCount / 2.0))+"");//平均费用
        }
        resultMap.put("monthFree", df.format(monthAdd));//本月新增
        System.out.println("结果===>" + JSON.toJSONString(resultMap));
        return resultMap;
    }

+ 1 - 1
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -4238,7 +4238,7 @@ public class ImService {
                "op.card_no as \"cardNo\"  ," +
                "op.medical_state as \"medicalState\"  ," +
                "bop.status as \"payStatus1\" ," +
                "op.patient_cancel_value as \"patientCancelValue\" ," +
                "IFNULL(op.patient_cancel_value,op.doctor_cancel_value) as \"patientCancelValue\" ," +
                "op.plan_doctor as \"planDoctor\" ," +
                "oh.id as \"hospitalizationId\"," +
                "op.patient_cancel_remark as \"patient_cancel_remark\"  " +

+ 1 - 1
common/common-entity/src/db/2024.sql

@ -99,7 +99,7 @@ CREATE TABLE `wlyy_doctor_switch` (
  `alert_patient_switch` varchar(2) DEFAULT '0' COMMENT '0不自动跟踪居民,1自动跟踪预警居民',
  `dispatch_order_switch` varchar(2) DEFAULT '0' COMMENT '0关闭分派订单功能,1开启分派订单功能',
  `create_time` timestamp NULL DEFAULT NULL,
  `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `update_time` timestamp NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=870 DEFAULT CHARSET=utf8;

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDictDO.java

@ -51,6 +51,7 @@ public class KnowledgeArticleDictDO extends UuidIdentityEntity {
	@Column(name = "is_share")
	private Integer share;//分享 数量
	private String intro;//简介
	private String homePage;//是否主业展示 1是 其他否
	@Transient
	private Integer isUsed;//是否已设置常用
@ -427,4 +428,12 @@ public class KnowledgeArticleDictDO extends UuidIdentityEntity {
	public void setComment(Integer comment) {
		this.comment = comment;
	}
	public String getHomePage() {
		return homePage;
	}
	public void setHomePage(String homePage) {
		this.homePage = homePage;
	}
}

+ 3 - 3
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java

@ -245,14 +245,14 @@ public class BasicZuulFilter extends ZuulFilter {
        String accessToken = this.extractToken(request);
        System.out.println("获取token"+accessToken);
        if (null == accessToken) {
            return this.forbidden(ctx, ResultStatus.NULL_TOKEN, "token can not be null");
            return this.forbidden(ctx, ResultStatus.NULL_TOKEN, "当前状态未登入,请重新登入");
        }
        OAuth2AccessToken oAuth2AccessToken = tokenStore.readAccessToken(accessToken);
        if (null == oAuth2AccessToken) {
            return this.forbidden(ctx, ResultStatus.INVALID_TOKEN, "invalid token");
            return this.forbidden(ctx, ResultStatus.INVALID_TOKEN, "当前状态未登入,请重新登入");
        }
        if (oAuth2AccessToken.isExpired()) {
            return this.forbidden(ctx, ResultStatus.EXPIRE, "expired token");
            return this.forbidden(ctx, ResultStatus.EXPIRE, "登录已过期,请重新登入");
        }
        //将token的认证信息附加到请求中,转发给下游微服务
        OAuth2Authentication auth = tokenStore.readAuthentication(accessToken);

+ 7 - 7
starter/elasticsearch-starter/src/main/java/com/yihu/jw/elasticsearch/ElasticSearch7Helper.java

@ -50,7 +50,7 @@ public class ElasticSearch7Helper {
    public <T> Boolean saveOne(String index, T t) throws IOException {
        BulkRequest bulkRequest = new BulkRequest();
        bulkRequest.timeout(TimeValue.timeValueSeconds(10));
        bulkRequest.timeout(TimeValue.timeValueSeconds(60));
        bulkRequest.add(new IndexRequest(index)
                        // 不指定ID的话,新增时ID是随机的
//                    .id(items.get(i).getId().toString())
@ -64,7 +64,7 @@ public class ElasticSearch7Helper {
    public <T> Boolean save(String index, List<T> sources) throws IOException {
        BulkRequest bulkRequest = new BulkRequest();
        bulkRequest.timeout(TimeValue.timeValueSeconds(10));
        bulkRequest.timeout(TimeValue.timeValueSeconds(60));//超时时间
        for (int i = 0; i < sources.size(); i++) {
            bulkRequest.add(new IndexRequest(index)
                            // 不指定ID的话,新增时ID是随机的
@ -82,7 +82,7 @@ public class ElasticSearch7Helper {
    public RestStatus save (String index, String source) throws IOException {
        IndexRequest indexRequest = new IndexRequest(index);
        indexRequest.timeout(TimeValue.timeValueSeconds(1));
        indexRequest.timeout(TimeValue.timeValueSeconds(10));
        indexRequest.source(source, XContentType.JSON);
        IndexResponse indexResponse = restHighLevelClient.index(indexRequest, RequestOptions.DEFAULT);
        return indexResponse.status();
@ -97,7 +97,7 @@ public class ElasticSearch7Helper {
     */
    public RestStatus saveWithCustomId (String index, String source, String idFieldString) throws IOException {
        IndexRequest indexRequest = new IndexRequest(index);
        indexRequest.timeout(TimeValue.timeValueSeconds(1));
        indexRequest.timeout(TimeValue.timeValueSeconds(10));
        indexRequest.id(idFieldString).source(source, XContentType.JSON);
        IndexResponse indexResponse = restHighLevelClient.index(indexRequest, RequestOptions.DEFAULT);
        return indexResponse.status();
@ -134,7 +134,7 @@ public class ElasticSearch7Helper {
     */
    public <T> Boolean update (String index, List<T> sources) throws IOException {
        BulkRequest bulkRequest = new BulkRequest();
        bulkRequest.timeout(TimeValue.timeValueSeconds(10));
        bulkRequest.timeout(TimeValue.timeValueSeconds(60));
        for (int i = 0; i < sources.size(); i++) {
            bulkRequest.add(new UpdateRequest(index,((ESIDEntity) sources.get(i)).getId())
                            .doc(JSON.toJSONString(sources.get(i)), XContentType.JSON)
@ -176,7 +176,7 @@ public class ElasticSearch7Helper {
     */
    public boolean update(String index, String _id, JSONObject source) throws IOException {
        UpdateRequest updateRequest = new UpdateRequest(index, _id);
        updateRequest.timeout(TimeValue.timeValueSeconds(1));
        updateRequest.timeout(TimeValue.timeValueSeconds(10));
        updateRequest.doc(source.toJSONString(), XContentType.JSON);
        UpdateResponse updateResponse = restHighLevelClient.update(updateRequest, RequestOptions.DEFAULT);
        logger.debug("update info: " + updateResponse.status());
@ -188,7 +188,7 @@ public class ElasticSearch7Helper {
     */
    public boolean delete(String index, List<Map<String, Object>> datas) throws IOException {
        BulkRequest bulkRequest = new BulkRequest();
        bulkRequest.timeout(TimeValue.timeValueSeconds(10));
        bulkRequest.timeout(TimeValue.timeValueSeconds(60));
        for (Map map : datas) {
            bulkRequest.add(new DeleteRequest(index)
                    .id(map.get("_id").toString()));

+ 27 - 26
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java

@ -169,27 +169,27 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
                return  mixEnvelop;
            }
        }else if ("xm_dsyy_wx".equalsIgnoreCase(wxId)){
            JSONObject object = dsyyPrescriptionService.queryCardListToHospital("",idCard);
            if (object!=null){
                if (object.getString("retCode").equalsIgnoreCase("00")){
                    jsonArrayDsyy = object.getJSONArray("cardlist");
                    if(jsonArrayDsyy!=null&&jsonArrayDsyy.size()>0){
                        JSONObject jsonObject= jsonArrayDsyy.getJSONObject(0);
                        String Pat_name = jsonObject.getString("userName");
                        String Next_Of_Kin_Phone = jsonObject.getString("phone");
                        if(!Next_Of_Kin_Phone.equalsIgnoreCase(phoneNum)){
                            mixEnvelop.setStatus(408);
                            mixEnvelop.setMessage("您所添加的家属的电话有误,无法发送验证码");
                            return mixEnvelop;
                        }
                        if(!Pat_name.equalsIgnoreCase(familyName)){
                            mixEnvelop.setStatus(408);
                            mixEnvelop.setMessage("您所添加的家属的名称有误,无法发送验证码");
                            return mixEnvelop;
                        }
                    }
                }
            }
//            JSONObject object = dsyyPrescriptionService.queryCardListToHospital("",idCard);
//            if (object!=null){
//                if (object.getString("retCode").equalsIgnoreCase("00")){
//                    jsonArrayDsyy = object.getJSONArray("cardlist");
//                    if(jsonArrayDsyy!=null&&jsonArrayDsyy.size()>0){
//                        JSONObject jsonObject= jsonArrayDsyy.getJSONObject(0);
//                        String Pat_name = jsonObject.getString("userName");
//                        String Next_Of_Kin_Phone = jsonObject.getString("phone");
//                        if(!Next_Of_Kin_Phone.equalsIgnoreCase(phoneNum)){
//                            mixEnvelop.setStatus(408);
//                            mixEnvelop.setMessage("您所添加的家属的电话有误,无法发送验证码");
//                            return mixEnvelop;
//                        }
//                        if(!Pat_name.equalsIgnoreCase(familyName)){
//                            mixEnvelop.setStatus(408);
//                            mixEnvelop.setMessage("您所添加的家属的名称有误,无法发送验证码");
//                            return mixEnvelop;
//                        }
//                    }
//                }
//            }
        }else if ("sd_tnzyy_wx".equalsIgnoreCase(wxId)){
            com.alibaba.fastjson.JSONArray jsonArray1 = tnyyEntranceService.selectPatientMappingCode(idCard);
@ -261,11 +261,12 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
            }else if("xm_dsyy_wx".equalsIgnoreCase(wxId)){
                System.out.println("发送第三医院验证码开始");
                int result = 1;
                if (null!=jsonArrayDsyy&&jsonArrayDsyy.size() > 0) {
                    result = dsyyPrescriptionService.SendSms(phoneNum, "您好,您当前操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                } else {
                    result = 2;
                }
//                if (null!=jsonArrayDsyy&&jsonArrayDsyy.size() > 0) {
//                    result = dsyyPrescriptionService.SendSms(phoneNum, "您好,您当前操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
//                } else {
//                    result = 2;
//                }
                result = dsyyPrescriptionService.SendSms(phoneNum, "您好,您当前操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                if (0 == result) {
                    this.store(client_id, phoneNum, captcha, 120);
                    mixEnvelop.setMessage("验证码发送成功");

+ 32 - 23
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/DsyyPrescriptionCotroller.java

@ -1,20 +1,11 @@
package com.yihu.jw.hospital.endpoint.prescription;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.elasticsearch.ElasticSearch7Util;
import com.yihu.jw.es.util.ElasticsearchUtil;
import com.yihu.jw.hospital.prescription.service.DsyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.HcyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.HcyyEntranceService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
@ -24,7 +15,7 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.net.URLDecoder;
import java.util.List;
import java.util.Map;
@ -36,21 +27,39 @@ import java.util.Map;
@Api(value = "第三医院平台服务", description = "第三医院平台服务", tags = {"第三医院平台服务"})
public class DsyyPrescriptionCotroller extends EnvelopRestEndpoint {
    @Autowired
    private HcyyEntranceService hcyyEntranceService;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private ImService imService;
    @Autowired
    private DsyyEntranceService dsyyEntranceService;
    @Autowired
    private DsyyPrescriptionService dsyyPrescriptionService;
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
    @Autowired
    private ElasticSearch7Util elasticSearch7Util;
    @PostMapping(value = "open/exportExcel/executeSQLStream")
    @ApiOperation(value = "sql查询es", notes = "sql查询es")
    public ListEnvelop executeSQLStream(String content){
        try {
            content = URLDecoder.decode(content, "UTF-8");
            List<Map<String, Object>> list = elasticSearch7Util.executeSQLStream(content);
            return ListEnvelop.getSuccess("ok",list);
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "/findDateQuotaLevel0")
    @ApiOperation(value = "查询es", notes = "查询es")
    public ListEnvelop findDateQuotaLevel0(String startDate, String endDate, String area, int level, String index, String timeLevel, String interval, String lowLevel){
        try {
            List list = elasticsearchUtil.findDateQuotaLevel0(startDate, endDate, area, level, index, timeLevel, interval, lowLevel);
            return ListEnvelop.getSuccess("ok",list);
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "/updateDept")
    @ApiOperation(value = "同步科室信息", notes = "同步科室信息")

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

@ -24,6 +24,7 @@ import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.httplog.service.BaseOperateLogService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
@ -172,6 +173,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    private QrcodeService qrcodeService;
    @Autowired
    private MlwyyPrescriptionService mlwyyPrescriptionService;
    @Autowired
    private SystemMessageDao systemMessageDao;
    @GetMapping(value = "visitedDoctorPage")
    @ApiOperation(value = "已就诊医生列表")
@ -1661,7 +1664,23 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                           @ApiParam(name = "chargeType", value = "号别")
                                           @RequestParam(value = "chargeType", required = false) String chargeType) throws Exception {
        try {
            return success(prescriptionService.saveOutpatientDoctor(outpatientJson, registerJson, chargeType));
            WlyyOutpatientDO one = prescriptionService.saveOutpatientDoctor(outpatientJson, registerJson, chargeType);
            List<SystemMessageDO> systemMessageDOS = systemMessageDao.queryByRelationCodeAndDelAndTypeIn(one.getId(),"1",new String[]{"1","2","3","15","17","18"});
            if(systemMessageDOS.size()>0){
                for (SystemMessageDO messageDO:systemMessageDOS){
                    messageDO.setDel("0");
                }
                systemMessageDao.saveAll(systemMessageDOS);
            }
            if (one.getPayStatus() != null && one.getPayStatus() == 1) {
                //发送系统消息
                SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(one, payFlag);
                //发送IM消息
                hospitalSystemMessageService.sendImMessage(systemMessageDO);
            }
            return success(one);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
@ -2362,7 +2381,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
     * 易联众统一订单查询
     *
     * @param tradeType
     * @param orderNo
     * @param relationCode
     * @return
     * @throws Exception
     */
@ -2972,10 +2991,18 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "无需支付时调用")
    public ObjEnvelop updatePayStatus(
            @ApiParam(name = "relationCode", value = "业务code")
            @RequestParam(value = "relationCode", required = false) String relationCode) throws Exception {
            @RequestParam(value = "relationCode", required = false) String relationCode){
        try {
            BusinessOrderDO businessOrderDO = businessOrderService.updatePayStatusByRelation(relationCode, wxId);
            if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")) {
            if("1".equals(businessOrderDO.getOrderCategory())){
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(relationCode).orElse(null);
                if (wlyyOutpatientDO.getPayStatus() != null && wlyyOutpatientDO.getPayStatus() == 1) {
                    //发送系统消息
                    SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO, payFlag);
                    //发送IM消息
                    hospitalSystemMessageService.sendImMessage(systemMessageDO);
                }
            }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")) {
                SystemMessageDO systemMessageDO = new SystemMessageDO();
                systemMessageDO.setType("1");
                systemMessageDO.setReceiver(businessOrderDO.getDoctor());

+ 20 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java

@ -22,6 +22,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.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
@ -51,6 +52,25 @@ class EsStatisticsEndpoint extends EnvelopRestEndpoint {
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @GetMapping(value = "findDeptWorkList")
    @ApiOperation(value = "科室排班统计")
    public ListEnvelop findDeptWorkList(@RequestParam(required = true) String queryDate){
        try {
            String sql = "SELECT d.dept_name,COUNT(w.id) total,sum(if(w.time_type=1,1,0)) time_type1, " +
                    "sum(if(w.time_type=2,1,0)) time_type2,sum(if(w.time_type=3,1,0)) time_type3 " +
                    " from wlyy_doctor_work_time w,base_doctor_hospital d " +
                    "WHERE w.doctor = d.doctor_code and w.work_date='"+queryDate+"' and d.del='1' " +
                    "GROUP BY d.dept_name order by total desc";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            return ListEnvelop.getSuccess("查询成功",list);
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    /**

+ 3 - 3
svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/config/DataSourceConfig.java

@ -75,7 +75,7 @@ public class DataSourceConfig {
    @Bean(name = "primaryReadWrite")
    @Primary//主库 默认不写名字用这个
    public DataSource primaryReadWriteDataSource(StatFilter statFilter) throws SQLException {
        System.out.println("主数据库配置==>"+primaryReadWriteUrl+"  账号==>"+primaryReadWriteUsername+"  密码==>"+primaryReadWritePassword);
//        System.out.println("主数据库配置==>"+primaryReadWriteUrl+"  账号==>"+primaryReadWriteUsername+"  密码==>"+primaryReadWritePassword);
        DruidDataSource datasource = new DruidDataSource();
        datasource.setUrl(primaryReadWriteUrl);
        datasource.setUsername(primaryReadWriteUsername);
@ -118,7 +118,7 @@ public class DataSourceConfig {
    @Bean(name = "primaryRead")
    public DataSource primaryReadDataSource(StatFilter statFilter) throws SQLException {
        System.out.println("从数据库配置==>"+primaryReadUrl+"  账号==>"+pprimaryReadUsername+"  密码==>"+primaryReadPassword);
//        System.out.println("从数据库配置==>"+primaryReadUrl+"  账号==>"+pprimaryReadUsername+"  密码==>"+primaryReadPassword);
        DruidDataSource datasource = new DruidDataSource();
        datasource.setUrl(primaryReadUrl);
@ -162,7 +162,7 @@ public class DataSourceConfig {
    @Bean(name = "imData")
    public DataSource imDataSource(StatFilter statFilter) throws SQLException {
        System.out.println("imData数据库配置==>"+imUrl+"  账号==>"+imUsername+"  密码==>"+imPassword);
//        System.out.println("imData数据库配置==>"+imUrl+"  账号==>"+imUsername+"  密码==>"+imPassword);
        DruidDataSource datasource = new DruidDataSource();
        datasource.setUrl(imUrl);

+ 9 - 8
svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/job/business/EsToEsQuotaJob.java

@ -1,7 +1,6 @@
package com.yihu.jw.statistics.job.business;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.elasticsearch.ElasticSearch7Helper;
import com.yihu.jw.entity.quota.job.QuartzJobConfig;
import com.yihu.jw.entity.quota.job.QuartzJobLog;
@ -14,15 +13,15 @@ import com.yihu.jw.statistics.etl.extract.db.Data2Save;
import com.yihu.jw.statistics.etl.filter.FilterHelper;
import com.yihu.jw.statistics.util.DateUtil;
import com.yihu.jw.statistics.util.SpringUtil;
import com.yihu.jw.statistics.vo.*;
import io.searchbox.client.JestClient;
import io.searchbox.core.*;
import com.yihu.jw.statistics.vo.BaseDimensionQuota;
import com.yihu.jw.statistics.vo.DataModel;
import com.yihu.jw.statistics.vo.FilterModel;
import com.yihu.jw.statistics.vo.SaveModel;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
@ -41,7 +40,9 @@ import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * Created by chenweida on 2017/7/10.
@ -200,7 +201,7 @@ public class EsToEsQuotaJob implements Job {
            }
            //根据id批量删除
            BulkRequest bulkRequest = new BulkRequest();
            bulkRequest.timeout(TimeValue.timeValueSeconds(10));
//            bulkRequest.timeout(TimeValue.timeValueSeconds(60));
            for (SaveModel obj : saveModels) {
                bulkRequest.add(new DeleteRequest(esIndex)
                        .id(obj.getId()));
@ -210,7 +211,7 @@ public class EsToEsQuotaJob implements Job {
            logger.info("delete data count:" + saveModels.size());
            logger.info("delete flag:" +!bulkResponse.hasFailures());
        } catch (Exception e) {
            e.printStackTrace();
            logger.info("delete error:"+e.getMessage());
        }
    }

+ 3 - 6
svr/svr-statistics-hlw/src/main/java/com/yihu/jw/statistics/job/business/MysqlToEsQuotaJob.java

@ -19,15 +19,12 @@ import com.yihu.jw.statistics.vo.BaseDimensionQuota;
import com.yihu.jw.statistics.vo.DataModel;
import com.yihu.jw.statistics.vo.FilterModel;
import com.yihu.jw.statistics.vo.SaveModel;
import io.searchbox.client.JestClient;
import io.searchbox.core.*;
import net.sf.json.JSONArray;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
@ -214,11 +211,12 @@ public class MysqlToEsQuotaJob implements Job {
            }
            //根据id批量删除
            BulkRequest bulkRequest = new BulkRequest();
            bulkRequest.timeout(TimeValue.timeValueSeconds(10));
//            bulkRequest.timeout(TimeValue.timeValueSeconds(60));
            for (SaveModel obj : saveModels) {
                bulkRequest.add(new DeleteRequest(esIndex)
                        .id(obj.getId()));
            }
            logger.info("delete size:"+result.size());
            if (saveModels!=null&&saveModels.size()!=0){
                BulkResponse bulkResponse = restHighLevelClient.bulk(bulkRequest, RequestOptions.DEFAULT);
                logger.info(bulkResponse.buildFailureMessage());
@ -226,8 +224,7 @@ public class MysqlToEsQuotaJob implements Job {
                logger.info("delete flag:" + !bulkResponse.hasFailures());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            logger.info("delete error:"+e.getMessage());
        }
    }

+ 52 - 34
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/door/service/WlyyDoorServiceOrderService.java

@ -2316,26 +2316,35 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        if (CollectionUtils.isEmpty(messages)) {
            logger.error("当前工单没有 居民新增预约 消息!!orderId:" + orderId);
        } else {
            // 设置消息处理完毕
            messages.forEach(
                    message -> {
                        String title = "调度员派单(派给本社区医生)";
                        if ("system".equals(dispatcher)) {
                            title = "系统派单(派给服务医生)";
                        }
                        if (message.getType().equals("430")) {
                            message.setTitle(title);
                            message.setContent(doorServiceOrderDO.getDispatcherName() + "已将服务工单" + doorServiceOrderDO.getNumber() + "指派给" + doctorName + "医生");
                            message.setType("431");
                            message.setReceiver(dispatcher);
                            message.setSender(dispatcher);
                            message.setCreateTime(new Date());
                        } else {
                            message.setOver("0");
                        }
                        systemMessageDao.save(message);
            String dispatcherName = "";
            if(doorServiceOrderDO.getDispatcherName()==null){
                if("system".equals(dispatcher)){
                    dispatcherName = "系统";
                }else {
                    BaseDoctorDO baseDoctorDO = doctorDao.findById(dispatcher).orElse(null);
                    if(baseDoctorDO!=null){
                        dispatcherName = baseDoctorDO.getName();
                    }
            );
                }
            }
            // 设置消息处理完毕
            for(SystemMessageDO message:messages){
                String title = "调度员派单(派给本社区医生)";
                if ("system".equals(dispatcher)) {
                    title = "系统派单(派给服务医生)";
                }
                if (message.getType().equals("430")) {
                    message.setTitle(title);
                    message.setContent(dispatcherName + "已将服务工单" + doorServiceOrderDO.getNumber() + "指派给" + doctorName + "医生");
                    message.setType("431");
                    message.setReceiver(dispatcher);
                    message.setSender(dispatcher);
                    message.setCreateTime(new Date());
                } else {
                    message.setOver("0");
                }
                systemMessageDao.save(message);
            }
        }
        // 工单状态变更记录
@ -2417,22 +2426,31 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        if (CollectionUtils.isEmpty(messages)) {
            logger.error("当前工单没有 居民新增预约 消息!!orderId:" + orderId);
        } else {
            // 设置消息处理完毕
            messages.forEach(
                    message -> {
                        if (message.getType().equals("430")) {
                            message.setTitle("医生转派单(派给本社区医生)");
                            message.setContent(doorServiceOrderDO.getDispatcherName() + "已将服务工单" + doorServiceOrderDO.getNumber() + "转派给" + doctorName + "医生");
                            message.setType("431");
                            message.setReceiver(dispatcher);
                            message.setSender(dispatcher);
                            message.setCreateTime(new Date());
                        } else {
                            message.setOver("0");
                        }
                        systemMessageDao.save(message);
            String dispatcherName = "";
            if(doorServiceOrderDO.getDispatcherName()==null){
                if("system".equals(dispatcher)){
                    dispatcherName = "系统";
                }else {
                    BaseDoctorDO baseDoctorDO = doctorDao.findById(dispatcher).orElse(null);
                    if(baseDoctorDO!=null){
                        dispatcherName = baseDoctorDO.getName();
                    }
            );
                }
            }
            // 设置消息处理完毕
            for (SystemMessageDO message:messages){
                if (message.getType().equals("430")) {
                    message.setTitle("医生转派单(派给本社区医生)");
                    message.setContent(dispatcherName + "已将服务工单" + doorServiceOrderDO.getNumber() + "转派给" + doctorName + "医生");
                    message.setType("431");
                    message.setReceiver(dispatcher);
                    message.setSender(dispatcher);
                    message.setCreateTime(new Date());
                } else {
                    message.setOver("0");
                }
                systemMessageDao.save(message);
            }
        }
        // 工单状态变更记录

+ 2 - 3
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/service/DeviceService.java

@ -432,9 +432,8 @@ public class DeviceService {
			indexVO.setHealthStandard(gethealthStandard(indexVO.getType(),indexVO.getUser()).toString());
		}
		long count = jdbcTemplate.queryForObject(countSql+filter.toString(),Long.class);
		String regex = "(\\w{3})(\\w+)(\\w{3})";
		return PageEnvelop.getSuccessListWithPage("",resultList,page,pageSize,count);
		long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
		return PageEnvelop.getSuccessListWithPage("查询成功",resultList,page,pageSize,count);
	}
	public JSONObject gethealthStandard(Integer type, String patientCode) {
		//血糖校验