Просмотр исходного кода

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

yeshijie 4 лет назад
Родитель
Сommit
0f3b5aea8a
43 измененных файлов с 1176 добавлено и 142 удалено
  1. 42 12
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  2. 3 0
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  3. 2 2
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  4. 5 0
      business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java
  5. 3 3
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  6. 8 5
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  7. 4 0
      common/common-entity/sql记录
  8. 105 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseExceptionDictDO.java
  9. 76 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseExceptionLogDO.java
  10. 60 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseExceptionServerDictDO.java
  11. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java
  12. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringOrderDO.java
  13. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java
  14. 14 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionDictDao.java
  15. 8 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionLogDao.java
  16. 11 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionServerDictDao.java
  17. 62 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/endpoint/EnvelopRestEndpoint.java
  18. 61 1
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/DidiFilterProcessor.java
  19. 33 45
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java
  20. 83 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseExceptionService.java
  21. 0 3
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseLoginLogService.java
  22. 14 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionDictDao.java
  23. 8 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionLogDao.java
  24. 11 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionServerDictDao.java
  25. 38 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/security/BeanUtil.java
  26. 5 1
      svr/svr-cloud-care/pom.xml
  27. 30 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/TencentSmsConfig.java
  28. 3 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java
  29. 38 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/DoctorDoorCoachOrderController.java
  30. 7 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/exam/ChildrenExaminationEndpoint.java
  31. 4 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java
  32. 4 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/securrity/SecuMonOrderEndpoint.java
  33. 5 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java
  34. 108 43
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java
  35. 6 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientHealthIndexService.java
  36. 56 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java
  37. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java
  38. 69 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java
  39. 142 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/TencentSmsUtil.java
  40. 1 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/RemindDoctorService.java
  41. 6 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  42. 8 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  43. 12 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

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

@ -3792,6 +3792,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    " LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" +
                    "WHERE t.id = '"+doctorDO.getId()+"' ";
            chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge);
            //System.out.println(chargeDictDOLists.get(1));
            rs.put("chargeTypeList",chargeDictDOLists);
            //机构科室信息
            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
@ -5096,7 +5097,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @query_status 0:图文复诊候诊 1:图文复诊抢单列表
     * @dept 部门
     */
    public List<Map<String, Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type, Integer query_status, String dept,String sex,String keyword,String ageGroup) {
    public List<Map<String, Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type, Integer query_status, String dept,String sex,String keyword,String ageGroup,String patient) {
        String sql = "SELECT " +
                "room.outpatient_id AS \"id\"," +
@ -5177,6 +5178,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }if(StringUtils.isNoneBlank(keyword)){
            sql += " AND outpatient.patient_name like '%" + keyword + "%' ";
        }
        if(StringUtils.isNoneBlank(patient)){
            sql += " AND (outpatient.patient= '" + patient + "' or outpatient.consumer ='"+patient+"') ";
        }
        if(StringUtils.isNoneBlank(ageGroup)){
            String[] age = ageGroup.split(",");
            Calendar nowBegin = Calendar.getInstance();
@ -9864,13 +9868,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param size
     * @return
     */
    public PageEnvelop findPatientAllPrescription(String keyName, String status, Integer page, Integer size,String patient,String isSelectDrug) {
    public PageEnvelop findPatientAllPrescription(String keyName, String status, Integer page, Integer size,String patient,String isSelectDrug,boolean consumerflag) {
        BasePatientDO patientDO = basePatientDao.findById(patient);
        if (patientDO==null){
            return PageEnvelop.getError("找不到该患者",-1);
        }
        StringBuffer sql = new StringBuffer(" SELECT DISTINCT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name  FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        StringBuffer countSql = new StringBuffer("select COUNT(DISTINCT b.id) count FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        /*if (consumerflag){
            sql.append(" WHERE o.consumer = '");
            countSql.append(" WHERE o.consumer = '");
        }else{
            sql.append(" WHERE o.patient = '");
            countSql.append(" WHERE o.patient = '");
        }*/
        sql.append(patient).append("') b  LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        countSql.append(patient).append("') b  LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        if (StringUtils.isNoneBlank(isSelectDrug)){
@ -9917,14 +9928,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    " b.doctor_name LIKE '%" + keyName + "%' " +
                    " OR b.dept_name LIKE'%" + keyName + "%' " +
                    " OR b.hospital_name LIKE '%" + keyName + "%' " +
                    " OR d.drug_name LIKE '%" + keyName + "%' " +
                    " OR m.drug_name LIKE '%" + keyName + "%' " +
                    " OR b.real_order LIKE '%" + keyName + "%' " +
                    ")");
            countSql.append(" and (" +
                    " b.doctor_name LIKE '%" + keyName + "%' " +
                    " OR b.dept_name LIKE'%" + keyName + "%' " +
                    " OR b.hospital_name LIKE '%" + keyName + "%' " +
                    " OR d.drug_name LIKE '%" + keyName + "%' " +
                    " OR m.drug_name LIKE '%" + keyName + "%' " +
                    " OR b.real_order LIKE '%" + keyName + "%' " +
                    ")");
        }
@ -10308,13 +10319,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
       return envelop;
    }
    //应声开具处方管理
    public MixEnvelop prescriptionManage(String keyWord,String doctorId,String startTime,String endTime,String checkStatus,Integer page,Integer pageSize){
    public MixEnvelop prescriptionManage(String keyWord,String doctorId,String startTime,String endTime,String checkStatus,String status,Integer page,Integer pageSize){
        String sql = " select p.create_time as \"createTime\"," +
                " p.patient_name as \"patientName\"," +
                " o.idcard as \"idcard\"," +
                " o.card_no as \"cardNo\"," +
                " p.check_status as \"checkStatus\"," +
                " p.id as \"id\"," +
                " p.status as \"status\"," +
                " p.check_reason as \"checkReason\" " +
                " from wlyy_prescription p left join wlyy_outpatient o on p.outpatient_id  = o.id" +
                " where  1=1 ";
@ -10327,6 +10339,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else {
            sql+=" and p.check_status != 4";
        }
        if(StringUtils.isNotBlank(status)){
            if ("0".equalsIgnoreCase(status)){
                sql+=" and p.status = 20";
            }else if ("-4".equalsIgnoreCase(status)){
                sql+=" and p.status = -4";
            } else {
                sql+=" and p.status > 20";
            }
        }
        if(StringUtils.isNotBlank(doctorId)){
            sql+=" and p.doctor = '"+doctorId+"'";
        }
@ -10425,6 +10447,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                /*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/
                logger.info("作废处方开始" + prescriptionDO.getCheckStatus());
                WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
                WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
@ -10456,19 +10479,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
                try {
                    net.sf.json.JSONObject jsonObject = entranceService.BS10112(jsonData.toJSONString(), demoFlag);
                    wlyyHttpLogDO.setResponse(jsonObject.toString());
                }catch (Exception e){
                    e.printStackTrace();
                    return "删除失败";
                    return "作废失败";
                }
                wlyyHttpLogDO.setRequest(jsonData.toJSONString());
                wlyyHttpLogDO.setName("作废处方");
                wlyyHttpLogDO.setCreateTime(new Date());
                wlyyHttpLogDO.setCode(outpatientDO.getId());
                wlyyHttpLogDao.save(wlyyHttpLogDO);
            }
            prescriptionDO.setStatus(-1);
            prescriptionDO.setCheckStatus(4);
            prescriptionDO.setCheckReason("已删除");
            prescriptionDO.setStatus(-4);
            prescriptionDO.setDisableTime(new Date());
            prescriptionDO.setCheckStatus(5);
            prescriptionDO.setCheckReason("已作废");
            prescriptionDao.save(prescriptionDO);
            return "删除成功";
            return "已作废";
        }else {
            return "删除失败";
            return "作废失败";
        }
    }

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -752,6 +752,9 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            orderRefundDao.save(orderRefundDO);
            updatePayStatusByRefund(orderNo);
        }
        if (businessOrderDO!=null){
            ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"2");
        }
        return map;
    }

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -547,14 +547,14 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
                    " b.doctor_name LIKE '%" + keyName + "%' " +
                    " OR b.dept_name LIKE'%" + keyName + "%' " +
                    " OR b.hospital_name LIKE '%" + keyName + "%' " +
                    " OR d.drug_name LIKE '%" + keyName + "%' " +
                    " OR m.drug_name LIKE '%" + keyName + "%' " +
                    " OR b.real_order LIKE '%" + keyName + "%' " +
                    ")");
            countSql.append(" and (" +
                    " b.doctor_name LIKE '%" + keyName + "%' " +
                    " OR b.dept_name LIKE'%" + keyName + "%' " +
                    " OR b.hospital_name LIKE '%" + keyName + "%' " +
                    " OR d.drug_name LIKE '%" + keyName + "%' " +
                    " OR m.drug_name LIKE '%" + keyName + "%' " +
                    " OR b.real_order LIKE '%" + keyName + "%' " +
                    ")");
        }

+ 5 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java

@ -182,16 +182,21 @@ public class EnterpriseService {
            WxEnterpriseUserDO user = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(enterpriseId,baseDoctorDO.getMobile());
            if(user!=null){
                res =sendTWMes(enterpriseId,user.getUserid(),title,description,url);
                logger.info("开始保存日志");
                logger.info("url==="+url);
                try {
                    if (StringUtils.isNoneBlank(url)){
                        logger.info("进入保存接口");
                        String outPatientId = url.substring(url.lastIndexOf("=")+1,url.length());
                        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
                        wlyyHttpLogDO.setDoctor(doctor);
                        wlyyHttpLogDO.setRequest(url);
                        wlyyHttpLogDO.setName(title);
                        wlyyHttpLogDO.setCode(outPatientId);
                        wlyyHttpLogDO.setCreateTime(new Date());
                        wlyyHttpLogDO.setRequest("enterpriseId:"+enterpriseId+",doctor:"+doctor+",url:"+url);
                        wlyyHttpLogDO.setResponse(res);
                        logger.info(res);
                        wlyyHttpLogDao.save(wlyyHttpLogDO);
                    }
                }catch (Exception e){

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

@ -4044,7 +4044,7 @@ public class StatisticsEsService {
            }else {
                JSONArray array = dateTotalStatistics2(startDate,endDate,area,level,index1,lowCode,SaveModel.timeLevel_ZL,null);
                object.put("totalData",array);//新增量
                JSONArray array1 = dateTotalStatistics2(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"0");//未接诊
                JSONArray array1 = dateTotalStatistics2(startDate,endDate,area,level,index1,lowCode,SaveModel.timeLevel_ZL,"0");//未接诊
                object.put("noReceiveData",array1);//未接诊
                JSONArray array2 = dateTotalStatistics2(startDate,endDate,area,level,index1,lowCode,SaveModel.timeLevel_ZL,"1");//已接诊
                object.put("haveReceiveData",array2);//已接诊
@ -4069,7 +4069,7 @@ public class StatisticsEsService {
            }else {
                JSONArray array = weekTotalStatistics8(startDate,endDate,area,level,index1,lowCode,SaveModel.timeLevel_ZL,null);
                object.put("totalData",array);//新增量
                JSONArray array1 = weekTotalStatistics8(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"0");//未接诊
                JSONArray array1 = weekTotalStatistics8(startDate,endDate,area,level,index1,lowCode,SaveModel.timeLevel_ZL,"0");//未接诊
                object.put("noReceiveData",array1);;//未接诊
                JSONArray array2 = weekTotalStatistics8(startDate,endDate,area,level,index1,lowCode,SaveModel.timeLevel_ZL,"1");//已接诊
                object.put("haveReceiveData",array2);//已接诊
@ -4094,7 +4094,7 @@ public class StatisticsEsService {
            }else {
                JSONArray array = monthTotalStatistics2(startDate,endDate,area,level,index1,lowCode,SaveModel.timeLevel_ZL,null);
                object.put("totalData",array);
                JSONArray array1 = monthTotalStatistics2(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"0");
                JSONArray array1 = monthTotalStatistics2(startDate,endDate,area,level,index1,lowCode,SaveModel.timeLevel_ZL,"0");
                object.put("noReceiveData",array1);
                JSONArray array2 = monthTotalStatistics2(startDate,endDate,area,level,index1,lowCode,SaveModel.timeLevel_ZL,"1");
                object.put("haveReceiveData",array2);

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

@ -4012,7 +4012,7 @@ public class ImService {
	public List<Map<String,Object>>  findConsultRecordByDoctorNew(String doctor, String id,
															   String type, Integer status,
															   int page,int pagesize,
															   String title,String start_time,String end_time) {
															   String title,String start_time,String end_time,String patient) {
		String  sql = "";
		sql = "SELECT " +
				"a.id AS \"id\"," +
@ -4063,6 +4063,9 @@ public class ImService {
		if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)) {
			sql += " AND op.doctor='" + doctor + "' ";
		}
        if (org.apache.commons.lang.StringUtils.isNotBlank(patient)) {
            sql += " AND (op.consumer='" + patient + "' or op.patient ='"+patient + "')";
        }
		if (!StringUtils.isEmpty(title)) {
			title = "%" + title + "%";
@ -4506,8 +4509,8 @@ public class ImService {
				"  t.idcard as \"idcard\"," +
				"  t.mobile as \"mobile\"," +
				"  op.doctor as \"doctor\"" +
				" from wlyy_outpatient op left join base_patient t " +
				" on t.id = op.patient where t.del ='1' and op.status!= -1";
				" from base_patient t  left join  wlyy_outpatient op " +
				" on (t.id = op.consumer or t.id = op.patient) where t.del ='1' and op.status!= -1";
		if (org.apache.commons.lang3.StringUtils.isNoneBlank(doctor)){
			sql+=" and op.doctor = '"+doctor+"'";
		}
@ -4529,7 +4532,7 @@ public class ImService {
				sql +=" AND op.outpatient_type in (1,2,3) ";
			}
		}
		sql+=" order by op.create_time  ";
		sql+=" order by op.create_time  desc ";
		logger.info("findRecordByDoctorSQL==="+sql);
		List<Map<String,Object>>  list = hibenateUtils.createSQLQuery(sql,page,pagesize);
		for (Map<String,Object> map:list){
@ -4555,7 +4558,7 @@ public class ImService {
					"  t.mobile as \"mobile\"," +
					"  op.doctor as \"doctor\"" +
					" from wlyy_outpatient op left join  base_patient t " +
					" on t.id = op.patient where t.del ='1' and op.status!= -1";
					" on (t.id = op.consumer or t.id = op.patient) where t.del ='1' and op.status!= -1";
			if (org.apache.commons.lang3.StringUtils.isNoneBlank(doctor)){
				sql+=" and op.doctor = '"+doctor+"'";
			}

+ 4 - 0
common/common-entity/sql记录

@ -884,3 +884,7 @@ create table base_org_notice(
ALTER table base_org_notice add column create_user varchar(50) DEFAULT NULL
-- 2021-05-20 lb
ALTER table base.base_security_monitoring_order add column `order_source` tinyint(4) DEFAULT '1' COMMENT '工单发起来源状态 1APP 2手环3居家报警'

+ 105 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseExceptionDictDO.java

@ -0,0 +1,105 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "base_exception_dict")
public class BaseExceptionDictDO extends UuidIdentityEntity {
    private String code;
    private String exceptionMessage;
    private Date createTime;
    private String isDel;
    private String modelName;
    private String exceptionType;
    private String exceptionTypeName;
    private String remindContent;
    private String exceptionInfo;
    @Column(name = "exception_info")
    public String getExceptionInfo() {
        return exceptionInfo;
    }
    public void setExceptionInfo(String exceptionInfo) {
        this.exceptionInfo = exceptionInfo;
    }
    @Column(name = "remind_content")
    public String getRemindContent() {
        return remindContent;
    }
    public void setRemindContent(String remindContent) {
        this.remindContent = remindContent;
    }
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "exception_message")
    public String getExceptionMessage() {
        return exceptionMessage;
    }
    public void setExceptionMessage(String exceptionMessage) {
        this.exceptionMessage = exceptionMessage;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "is_del")
    public String getIsDel() {
        return isDel;
    }
    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }
    @Column(name = "model_name")
    public String getModelName() {
        return modelName;
    }
    public void setModelName(String modelName) {
        this.modelName = modelName;
    }
    @Column(name = "exception_type")
    public String getExceptionType() {
        return exceptionType;
    }
    public void setExceptionType(String exceptionType) {
        this.exceptionType = exceptionType;
    }
    @Column(name = "exception_type_name")
    public String getExceptionTypeName() {
        return exceptionTypeName;
    }
    public void setExceptionTypeName(String exceptionTypeName) {
        this.exceptionTypeName = exceptionTypeName;
    }
}

+ 76 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseExceptionLogDO.java

@ -0,0 +1,76 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "base_exception_log")
public class BaseExceptionLogDO extends UuidIdentityEntity {
    private String serviceCode;
    private String exceptionCode;
    private String exceptionType;
    private Date createTime;
    private String request;
    private String response;
    @Column(name = "service_code")
    public String getServiceCode() {
        return serviceCode;
    }
    public void setServiceCode(String serviceCode) {
        this.serviceCode = serviceCode;
    }
    @Column(name = "exception_code")
    public String getExceptionCode() {
        return exceptionCode;
    }
    public void setExceptionCode(String exceptionCode) {
        this.exceptionCode = exceptionCode;
    }
    @Column(name = "exception_type")
    public String getExceptionType() {
        return exceptionType;
    }
    public void setExceptionType(String exceptionType) {
        this.exceptionType = exceptionType;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "request")
    public String getRequest() {
        return request;
    }
    public void setRequest(String request) {
        this.request = request;
    }
    @Column(name = "response")
    public String getResponse() {
        return response;
    }
    public void setResponse(String response) {
        this.response = response;
    }
}

+ 60 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseExceptionServerDictDO.java

@ -0,0 +1,60 @@
package com.yihu.jw.entity.base.dict;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "base_exception_server_dict")
public class BaseExceptionServerDictDO extends UuidIdentityEntity {
    private String name;
    private Date createTime;
    private Date updateTime;
    private String isDel;
    private String path;
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "update_time")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    @Column(name = "is_del")
    public String getIsDel() {
        return isDel;
    }
    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }
    @Column(name = "path_url")
    public String getPath() {
        return path;
    }
    public void setPath(String path) {
        this.path = path;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java

@ -23,7 +23,7 @@ public class ConsultTeamDo extends UuidIdentityEntity {
	private Integer type;           //  1、15三师咨询,2、家庭医生咨询,
	// 6、患者名医咨询 7医生名医咨询 8续方咨询 9、16在线复诊咨询(居民直接咨询专家)
	// 10医生发起的求助 11思明区上门服务在线咨询
	// 13、互联网医院专家咨询, 20紧急救助咨询, 21上门辅导咨询
	// 13、互联网医院专家咨询, 20紧急救助咨询, 21上门辅导咨询, 22安防警报咨询
	private String patient;         // 提问者标识
	private String name;            // 患者姓名
	private Integer sex;            // 患者性别

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringOrderDO.java

@ -319,6 +319,7 @@ public class SecurityMonitoringOrderDO extends UuidIdentityEntityWithOperator {
    private String serviceStatus;//服务类型 1-预约项目 2-即时项目
    private String orderInfo;//工单详情 0-未推送 1-未确认 2-已确认
    private String doctorConfirmFinishImg;
    private Integer orderSource;//工单发起来源状态 1APP 2手环 3居家报警
    /**
     * 医生确认医生结束服务时间
     */
@ -691,4 +692,12 @@ public class SecurityMonitoringOrderDO extends UuidIdentityEntityWithOperator {
    public void setDoctorConfirmFinishTime(Date doctorConfirmFinishTime) {
        this.doctorConfirmFinishTime = doctorConfirmFinishTime;
    }
    public Integer getOrderSource() {
        return orderSource;
    }
    public void setOrderSource(Integer orderSource) {
        this.orderSource = orderSource;
    }
}

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java

@ -277,6 +277,16 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
    private String diagnosisName;
    private String diagnosisSubName;
    private Date disableTime;
    @Column(name = "disable_time")
    public Date getDisableTime() {
        return disableTime;
    }
    public void setDisableTime(Date disableTime) {
        this.disableTime = disableTime;
    }
    /**
     * 处方审方唯一标识
     */

+ 14 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionDictDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.restmodel.exception.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
public interface BaseExceptionDictDao  extends PagingAndSortingRepository<BaseExceptionDictDO, String>, JpaSpecificationExecutor<BaseExceptionDictDO> {
    @Query("from BaseExceptionDictDO  t where t.isDel='1' and t.exceptionInfo=?1")
    BaseExceptionDictDO findByExceptionInfo(String exceptionInfo);
}

+ 8 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionLogDao.java

@ -0,0 +1,8 @@
package com.yihu.jw.restmodel.exception.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseExceptionLogDao extends PagingAndSortingRepository<BaseExceptionLogDO, String>, JpaSpecificationExecutor<BaseExceptionLogDO> {
}

+ 11 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionServerDictDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.restmodel.exception.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionServerDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseExceptionServerDictDao extends PagingAndSortingRepository<BaseExceptionServerDictDO, String>, JpaSpecificationExecutor<BaseExceptionServerDictDO> {
    @Query("from BaseExceptionServerDictDO t where t.isDel='1' and t.path=?1")
    BaseExceptionServerDictDO findServiceByPath(String path);
}

+ 62 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/endpoint/EnvelopRestEndpoint.java

@ -4,9 +4,12 @@ package com.yihu.jw.restmodel.web.endpoint;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.dict.BaseExceptionDictDO;
import com.yihu.jw.restmodel.exception.dao.BaseExceptionDictDao;
import com.yihu.jw.restmodel.web.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@ -16,6 +19,7 @@ import javax.servlet.http.HttpServletResponse;
import java.beans.PropertyDescriptor;
import java.io.IOException;
import java.lang.reflect.Method;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -28,10 +32,12 @@ import java.util.*;
 *
 * @author Progr1mmer
 */
public abstract class EnvelopRestEndpoint {
public abstract class EnvelopRestEndpoint extends Exception {
    @Autowired
    protected ObjectMapper objectMapper;
    @Autowired
    protected BaseExceptionDictDao baseExceptionDictDao;
    protected Envelop success() {
        return success("success");
@ -196,6 +202,61 @@ public abstract class EnvelopRestEndpoint {
        return failed(message, -10000);
    }
    protected Envelop failedException(Exception e){
        BaseExceptionDictDO baseExceptionDictDO =baseExceptionDictDao.findByExceptionInfo(DataAccessException.class.toString());
        if (baseExceptionDictDO!=null){
            e.printStackTrace();
            return failed(baseExceptionDictDO.getRemindContent(),Integer.parseInt(baseExceptionDictDO.getCode()));
        }else {
            return failed(e.getMessage(),-10000);
        }
       /* if (e.getClass().equals(DataAccessException.class)) {
            e.printStackTrace();//数据库操作失败
            return null;
        } else if (e.getClass().toString().equals(
                NullPointerException.class.toString())) {
            e.printStackTrace();
            //调用了未经初始化的对象或者是不存在的对象!
            return failed("空指针",170004);
        } else if (e.getClass().equals(IOException.class)) {
            e.printStackTrace();
            //IO异常!
            return null;
        } else if (e.getClass().equals(ClassNotFoundException.class)) {
            e.printStackTrace();//指定的类不存在!
            return null;
        } else if (e.getClass().equals(ArithmeticException.class)) {
            e.printStackTrace();//数学运算异常!
            return null;
        } else if (e.getClass().equals(ArrayIndexOutOfBoundsException.class)) {
            e.printStackTrace();
            //数组下标越界!
            return null;
        } else if (e.getClass().equals(IllegalArgumentException.class)) {
            e.printStackTrace();
            //方法的参数错误!
            return null;
        } else if (e.getClass().equals(ClassCastException.class)) {
            e.printStackTrace();//类型强制转换错误!
            return null;
        } else if (e.getClass().equals(SecurityException.class)) {
            e.printStackTrace();//违背安全原则异常!
            return null;
        } else if (e.getClass().equals(SQLException.class)) {
            e.printStackTrace();//操作数据库异常!
            return null;
        } else if (e.getClass().equals(NoSuchMethodError.class)) {
            e.printStackTrace();//方法末找到异常!
            return null;
        } else if (e.getClass().equals(InternalError.class)) {
            e.printStackTrace();//Java虚拟机发生了内部错误
            return null;
        } else {
            e.printStackTrace();//程序内部错误,操作失败!
            return null;
        }*/
    }
    protected Envelop failed (String message, int status) {
        Envelop envelop = new Envelop();
        envelop.setMessage(message);

+ 61 - 1
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/DidiFilterProcessor.java

@ -4,6 +4,26 @@ import com.netflix.zuul.FilterProcessor;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import com.yihu.jw.entity.base.dict.BaseExceptionLogDO;
import com.yihu.jw.gateway.AesEncryptUtils;
import com.yihu.jw.gateway.methlog.BaseExceptionService;
import com.yihu.jw.gateway.methlog.dao.BaseExceptionDictDao;
import com.yihu.jw.gateway.methlog.dao.BaseExceptionLogDao;
import com.yihu.jw.gateway.methlog.dao.BaseExceptionServerDictDao;
import com.yihu.jw.gateway.security.BeanUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.util.StreamUtils;
import org.springframework.util.StringUtils;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created with IntelliJ IDEA.
@ -12,6 +32,7 @@ import com.netflix.zuul.exception.ZuulException;
 * @Date: 2021/5/19
 * @Description:
 */
@Component
public class DidiFilterProcessor extends FilterProcessor {
    @Override
    public Object processZuulFilter(ZuulFilter filter) throws ZuulException {
@ -19,8 +40,47 @@ public class DidiFilterProcessor extends FilterProcessor {
            return super.processZuulFilter(filter);
        } catch (ZuulException e) {
            if (e.nStatusCode==500){
                String message="";
                String cause="";
                String serviceId="";
                String responseCode="";
                String exceptionType="";
                BaseExceptionLogDao baseExceptionLogDao = BeanUtil.getBean(BaseExceptionLogDao.class);
                //BaseExceptionDictDao baseExceptionDictDao = BeanUtil.getBean(BaseExceptionDictDao.class);
                BaseExceptionService baseExceptionService = BeanUtil.getBean(BaseExceptionService.class);
                List<Map<String,Object>> list = baseExceptionService.findExceptionDict("","110001","","1");
                RequestContext ctx = RequestContext.getCurrentContext();
                ZuulException e1 = new ZuulException("123456",10085,"10000");
                List<Map<String,Object>> serviceList=baseExceptionService.findExceptionService("","","1","");
                for (Map<String,Object> map:serviceList){
                    if (ctx.getRequest().getServletPath().contains(map.get("pathUrl").toString())){
                        serviceId=map.get("id").toString();
                        break;
                    }
                }
                if (list!=null&&list.size()>0){
                    message = list.get(0).get("remindContent").toString();
                    cause=list.get(0).get("exceptionMessage").toString();
                    responseCode=serviceId+list.get(0).get("code").toString();
                    exceptionType = list.get(0).get("exceptionType").toString();
                }
                ZuulException e1 = new ZuulException(message, StringUtils.isEmpty(responseCode)?99999999:Integer.parseInt(responseCode),cause);
                BaseExceptionLogDO baseExceptionLogDO = new BaseExceptionLogDO();
                baseExceptionLogDO.setCreateTime(new Date());
                baseExceptionLogDO.setExceptionType(exceptionType);
                baseExceptionLogDO.setServiceCode(serviceId);
                baseExceptionLogDO.setExceptionCode(responseCode);
                try {
                    String  in = ctx.getRequest().getParameter("object");
                    String jsonobject = AesEncryptUtils.decrypt(in);
                    baseExceptionLogDO.setRequest(jsonobject);
                    InputStream stream = RequestContext.getCurrentContext().getResponseDataStream();
                    byte[] bytes = StreamUtils.copyToByteArray(stream);
                    String resp = new String(bytes,"UTF8");
                    baseExceptionLogDO.setResponse(resp);
                }catch (Exception s){
                    s.printStackTrace();
                }
                baseExceptionLogDao.save(baseExceptionLogDO);
                ctx.set("failed.exception", e1);
                ctx.set("failed.filter", filter);
                throw e1 ;

+ 33 - 45
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java

@ -39,52 +39,40 @@ public class PostFilter extends ZuulFilter {
    @Override
    public Object run() {
        RequestContext ctx = RequestContext.getCurrentContext();
        logger.info("进入post过滤器"+ctx.getResponseStatusCode()+"==="+ctx.getRequest().getServletPath()+"==="+ctx.getResponse().getStatus()+"==");
        if (ctx.getRequest().getServletPath().contains("/hospital/")){
            if (ctx.getResponse().getStatus()==500){
                ctx.setSendZuulResponse(false);
                ctx.setThrowable(null);
                ctx.setResponseStatusCode(10111);
            }
        logger.info("进入post过滤器");
        HttpServletRequest request = ctx.getRequest();
        String url = request.getRequestURI();
        if (url.contains("/excelControl")){
            return true;
        }
        InputStream stream = RequestContext.getCurrentContext().getResponseDataStream();
        try {
        byte[] bytes;
        if(RequestContext.getCurrentContext().getResponseGZipped()){
            GZIPInputStream gzipInputStream = null;
            gzipInputStream = new GZIPInputStream(stream);
            bytes = StreamUtils.copyToByteArray(gzipInputStream);
        }else {
            bytes = StreamUtils.copyToByteArray(stream);
        }
        String body = new String(bytes,"UTF8");
        JSONObject object = new JSONObject();
        object.put("status","200");
        object.put("data", AesEncryptUtils.encrypt(body));
        if (!(url.contains("/open/noLogin/notify")||
            url.contains("/open/noLogin/ylzReceiveNotify")||
            url.contains("/open/noLogin/receiveNotify")||
            url.contains("/open/noLogin/getSFExpressInfoNew")||
            url.contains("/open/noLogin/sfroutepushservice")||
            url.contains("/open/noLogin/ylzSettleRecord")||
                url.contains("/weixin")||url.contains("/oauth/getSsoPublicKey"))){
            RequestContext.getCurrentContext().setResponseBody(object.toJSONString());
        }else {
            RequestContext.getCurrentContext().setResponseBody(body);
        }
        if (ctx.getResponse().getStatus()!=500){
            HttpServletRequest request = ctx.getRequest();
            String url = request.getRequestURI();
            if (url.contains("/excelControl")){
                return true;
            }
            InputStream stream = RequestContext.getCurrentContext().getResponseDataStream();
            try {
                byte[] bytes;
                if(RequestContext.getCurrentContext().getResponseGZipped()){
                    GZIPInputStream gzipInputStream = null;
                    gzipInputStream = new GZIPInputStream(stream);
                    bytes = StreamUtils.copyToByteArray(gzipInputStream);
                }else {
                    bytes = StreamUtils.copyToByteArray(stream);
                }
                String body = new String(bytes,"UTF8");
                logger.info("body"+body);
                JSONObject object = new JSONObject();
                object.put("status","200");
                object.put("data", AesEncryptUtils.encrypt(body));
                if (!(url.contains("/open/noLogin/notify")||
                        url.contains("/open/noLogin/ylzReceiveNotify")||
                        url.contains("/open/noLogin/receiveNotify")||
                        url.contains("/open/noLogin/getSFExpressInfoNew")||
                        url.contains("/open/noLogin/sfroutepushservice")||
                        url.contains("/open/noLogin/ylzSettleRecord")||
                        url.contains("/weixin")||url.contains("/oauth/getSsoPublicKey"))){
                    RequestContext.getCurrentContext().setResponseBody(object.toJSONString());
                }else {
                    RequestContext.getCurrentContext().setResponseBody(body);
                }
                logger.info(ctx.getResponseBody()+"");
            } catch (Exception e) {
                logger.info("");
                e.printStackTrace();
            }
        logger.info(ctx.getResponseBody()+"");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
 

+ 83 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseExceptionService.java

@ -0,0 +1,83 @@
package com.yihu.jw.gateway.methlog;
import com.yihu.jw.entity.base.dict.BaseExceptionServerDictDO;
import com.yihu.jw.gateway.methlog.dao.BaseExceptionDictDao;
import com.yihu.jw.gateway.methlog.dao.BaseExceptionLogDao;
import com.yihu.jw.gateway.methlog.dao.BaseExceptionServerDictDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
@Component
public class BaseExceptionService {
    @Autowired
    private BaseExceptionDictDao baseExceptionDictDao;
    @Autowired
    private BaseExceptionLogDao baseExceptionLogDao;
    @Autowired
    private BaseExceptionServerDictDao baseExceptionServerDictDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public String findServiceByPath(String path){
        BaseExceptionServerDictDO baseExceptionServerDictDO = baseExceptionServerDictDao.findServiceByPath(path);
        String id ="";
        if (baseExceptionServerDictDO !=null){
            id = baseExceptionServerDictDO.getId();
        }
        return id;
    }
    public List<Map<String,Object>> findExceptionDict(String id,String code,String exceptionType,String isDel){
        String sql = "select t.id as \"id\"," +
                " t.code as \"code\"," +
                " t.exception_message as \"exceptionMessage\"," +
                " t.create_time as \"createTime\"," +
                " t.is_del \"isDel\"," +
                " t.model_name as \"modelName\"," +
                " t.exception_type as \"exceptionType\"," +
                " t.exception_type_name as \"exceptionTypeName\"," +
                " t.remind_content as \"remindContent\"" +
                " from base_exception_dict t where 1=1";
        if (!StringUtils.isEmpty(id)){
            sql+=" and t.id ='"+id+"'";
        }
        if (!StringUtils.isEmpty(code)){
            sql+=" and t.code ='"+code+"'";
        }
        if (!StringUtils.isEmpty(exceptionType)){
            sql+=" and t.exception_type ='"+exceptionType+"'";
        }
        if (!StringUtils.isEmpty(isDel)){
            sql+=" and t.is_del ='"+isDel+"'";
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public List<Map<String,Object>> findExceptionService(String id,String name,String isDel,String pathUrl){
        String sql = "select t.id as \"id\"," +
                " t.name as \"name\"," +
                " t.create_time as \"createTime\"," +
                " t.update_time as \"updateTime\"," +
                " t.is_del as \"isDel\"," +
                " t.path_url as \"pathUrl\"" +
                " from base_exception_server_dict t where 1=1 ";
        if (!StringUtils.isEmpty(id)){
            sql+=" and t.id ='"+id+"'";
        }
        if (!StringUtils.isEmpty(name)){
            sql+=" and t.name ='"+name+"'";
        }
        if (!StringUtils.isEmpty(isDel)){
            sql+=" and t.is_del ='"+isDel+"'";
        }
        if (!StringUtils.isEmpty(pathUrl)){
            sql+=" and t.path_url ='"+pathUrl+"'";
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return  list;
    }
}

+ 0 - 3
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseLoginLogService.java

@ -3,11 +3,9 @@ package com.yihu.jw.gateway.methlog;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
@ -19,7 +17,6 @@ public class BaseLoginLogService {
    private BaseLoginLogDao baseLoginLogDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    /**
     * 根据openid 获取最新的一条数据
     * @param openid

+ 14 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionDictDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.gateway.methlog.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
public interface BaseExceptionDictDao  extends PagingAndSortingRepository<BaseExceptionDictDO, String>, JpaSpecificationExecutor<BaseExceptionDictDO> {
    @Query("from BaseExceptionDictDO  t where t.isDel='1' and t.code=?1")
    List<Map<String,Object>> findByCode(String code);
}

+ 8 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionLogDao.java

@ -0,0 +1,8 @@
package com.yihu.jw.gateway.methlog.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseExceptionLogDao extends PagingAndSortingRepository<BaseExceptionLogDO, String>, JpaSpecificationExecutor<BaseExceptionLogDO> {
}

+ 11 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionServerDictDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.gateway.methlog.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionServerDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseExceptionServerDictDao extends PagingAndSortingRepository<BaseExceptionServerDictDO, String>, JpaSpecificationExecutor<BaseExceptionServerDictDO> {
    @Query("from BaseExceptionServerDictDO t where t.isDel='1' and t.path=?1")
    BaseExceptionServerDictDO findServiceByPath(String path);
}

+ 38 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/security/BeanUtil.java

@ -0,0 +1,38 @@
package com.yihu.jw.gateway.security;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class BeanUtil implements ApplicationContextAware {
    private static ApplicationContext applicationContext;
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        if (BeanUtil.applicationContext == null) {
            BeanUtil.applicationContext = applicationContext;
        }
    }
    // 获取applicationContext
    public static ApplicationContext getApplicationContext() {
        return applicationContext;
    }
    // 通过name获取 Bean.
    public static Object getBean(String name) {
        return getApplicationContext().getBean(name);
    }
    // 通过class获取Bean.
    public static <T> T getBean(Class<T> clazz) {
        return getApplicationContext().getBean(clazz);
    }
    // 通过name,以及Clazz返回指定的Bean
    public static <T> T getBean(String name, Class<T> clazz) {
        return getApplicationContext().getBean(name, clazz);
    }
}

+ 5 - 1
svr/svr-cloud-care/pom.xml

@ -268,7 +268,11 @@
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.tencentcloudapi</groupId>
            <artifactId>tencentcloud-sdk-java</artifactId>
            <version>3.1.265</version><!-- 注:这里只是示例版本号,请获取并替换为 最新的版本号 -->
        </dependency>
        <!--oracle驱动-->
        <dependency>

+ 30 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/TencentSmsConfig.java

@ -0,0 +1,30 @@
package com.yihu.jw.care.config;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Handler;
/**
 * 腾讯云SMS配置
 * Created by Bing on 2021/5/19.
 */
public class TencentSmsConfig {
    public static final String SecretId= "AKIDjGXYIlyua080cy3rOfgRv96mBLDo8ByU";
    public static final String SecretKey= "GEwOZS5SYNvCCuLVO0LQFm21jAKCn7Bz";
    public static final String host = "sms.tencentcloudapi.com";//
    public static final Map<String,String> templateId= new HashMap<>();
    public static final Long overTime = 24L;
    {
        templateId.put("VerificationCode","验证码模板id");//验证码模板id
    }
    public static String getTemplateId(String key){
        return templateId.get(key);
    }
}

+ 3 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java

@ -156,14 +156,14 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "getTeacherChildrenCount")
    @ApiOperation(value = "教师通讯录-我的儿童数量获取")
    public Object getTeacherChildrenCount(
    public ObjEnvelop getTeacherChildrenCount(
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor",required = true) String doctor){
        try {
            return doctorService.getTeacherChildrenCount(doctor);
            return ObjEnvelop.getSuccess("查询成功",doctorService.getTeacherChildrenCount(doctor));
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
            return ObjEnvelop.getError("查询失败");
        }
    }
}

+ 38 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/DoctorDoorCoachOrderController.java

@ -1,5 +1,6 @@
package com.yihu.jw.care.endpoint.doorCoach;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.endpoint.BaseController;
@ -8,6 +9,7 @@ import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachConclusionDO;
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachOrderDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.restmodel.ResponseContant;
import io.swagger.annotations.Api;
@ -308,6 +310,42 @@ public class DoctorDoorCoachOrderController extends BaseController {
        }
    }
    @RequestMapping(value = "message/getWaitingMessages",method = RequestMethod.GET)
    @ApiOperation("调度员获取服务工单待接单列表")
    public String getWaitingMessages(
            @ApiParam(name = "message",value = "消息对象")
            @RequestParam(value = "message")String message,
            @ApiParam(name="types",value="消息类型")
            @RequestParam(value="types",required = true) String types,
            @ApiParam(name="page",value="第几页",defaultValue = "1")
            @RequestParam(value="page",required = true) String page,
            @ApiParam(name="pageSize",value="",defaultValue = "10")
            @RequestParam(value="pageSize",required = true) String pageSize){
        if (org.apache.commons.lang3.StringUtils.isBlank(pageSize)) {
            pageSize = "10";
        }
        if (page.equals("0")) {
            page = "1";
        }
        String[] split = org.apache.commons.lang3.StringUtils.split(types, ",");
        List<Integer> typeList = new ArrayList<>();
        for (String s : split) {
            typeList.add(Integer.valueOf(s));
        }
        SystemMessageDO message1 = new SystemMessageDO();
        com.alibaba.fastjson.JSONObject object = JSON.parseObject(message);
        message1.setOver(object.getString("over"));
        message1.setIsRead(object.get("read")+"");
        message1.setReceiver(getUID());
        try {
            org.json.JSONObject waitingMessages = doctorDoorCoachOrderService.getWaitingMessages(message1, types, Integer.valueOf(page), Integer.valueOf(pageSize));
            return write(200, "查询成功","data",waitingMessages);
        }catch (Exception e){
            error(e);
            return error( -1, "查询失败!");
        }
    }
    @GetMapping("/getDoorOrderList")
    @ApiOperation(value = "服务工单列表")
    public String getDoorOrderList(

+ 7 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/exam/ChildrenExaminationEndpoint.java

@ -1,6 +1,7 @@
package com.yihu.jw.care.endpoint.exam;
import com.yihu.jw.care.service.exam.ChildrenExaminationService;
import com.yihu.jw.care.util.TencentSmsUtil;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -10,6 +11,9 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by Bing on 2021/5/18.
 */
@ -19,6 +23,8 @@ import org.springframework.web.bind.annotation.*;
public class ChildrenExaminationEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ChildrenExaminationService examinationService;
    @Autowired
    private TencentSmsUtil tencentSmsUtil;
    @PostMapping("newRecord")
    @ApiOperation("居民居家自建记录添加")
@ -78,4 +84,5 @@ public class ChildrenExaminationEndpoint extends EnvelopRestEndpoint {
            return PageEnvelop.getError("查询失败");
        }
    }
    
}

+ 4 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java

@ -32,9 +32,11 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建安防服务工单")
    @ObserverRequired
    public ObjEnvelop createOrder(@ApiParam(name="jsonData",value = "json数据",required = true)
                               @RequestParam(value = "jsonData")String jsonData){
                               @RequestParam(value = "jsonData")String jsonData,
                               @ApiParam(name="orderSource",value = "工单来源工单发起来源状态 1APP 2手环 3居家报警")
                               @RequestParam(value = "orderSource",defaultValue = "1") Integer orderSource){
        try {
            JSONObject result = securityMonitoringOrderService.createOrder(jsonData);
            JSONObject result = securityMonitoringOrderService.createOrder(jsonData,orderSource);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }

+ 4 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/securrity/SecuMonOrderEndpoint.java

@ -29,9 +29,11 @@ public class SecuMonOrderEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建安防服务工单")
    @ObserverRequired
    public ObjEnvelop createOrder(@ApiParam(name="jsonData",value = "json数据",required = true)
                                  @RequestParam(value = "jsonData")String jsonData){
                                  @RequestParam(value = "jsonData")String jsonData,
                                  @ApiParam(name="orderSource",value = "工单来源工单发起来源状态 1APP 2手环 3居家报警")
                                  @RequestParam(value = "orderSource",defaultValue = "1") Integer orderSource){
        try {
            JSONObject result = securityMonitoringOrderService.createOrder(jsonData);
            JSONObject result = securityMonitoringOrderService.createOrder(jsonData,orderSource);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }

+ 5 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -181,7 +181,9 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            JSONObject message = new JSONObject();
            message.put("session_id",assistanceDO.getSessionId());
            message.put("sender_name",assistanceDO.getPatientName());
            message.put("content_notice",assistanceDO.getPatientName()+" 发起紧急救助!");
            message.put("sender_code",assistanceDO.getPatient());
            message.put("OrderType",20);
            message.put("order_id",assistanceDO.getId());
            message.put("content_type",40);
            try {
@ -493,7 +495,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        assistanceDO.setUpdateUserName(patientDO.getName());
        assistanceDO.setUpdateTime(new Date());
        //结束救助咨询
        if (!consultTeamService.finishEmergencyConsult(assistanceDO,patient,1)){
        if (!consultTeamService.finishConsult(assistanceDO.getId(),assistanceDO.getPatient(),patient,1)){
            String failMsg = "咨询结束失败 无法取消工单";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
@ -537,7 +539,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        assistanceDO.setUpdateUserName(assistanceDO.getDoctorName());
        assistanceDO.setUpdateTime(new Date());
        //结束会话
        if (!consultTeamService.finishEmergencyConsult(assistanceDO,doctor,2)){
        if (!consultTeamService.finishConsult(assistanceDO.getId(),assistanceDO.getPatient(),doctor,2)){
            String failMsg = "咨询结束失败 无法完成工单";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
@ -643,7 +645,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        List<String> ids = jdbcTemplate.queryForList(sql,String.class);
        for (String id:ids){
            EmergencyAssistanceDO assistanceDO = emergencyAssistanceDao.findOne(orderID);
            if (!consultTeamService.finishEmergencyConsult(assistanceDO,doctor,2)){
            if (!consultTeamService.finishConsult(assistanceDO.getId(),assistanceDO.getPatient(),doctor,2)){
                String failMsg = "咨询结束失败 无法完成工单";
                return failMsg;

+ 108 - 43
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java

@ -1,8 +1,10 @@
package com.yihu.jw.care.service.consult;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.doorCoach.BaseDoorCoachOrderDao;
import com.yihu.jw.care.dao.sign.ServicePackageSignRecordDao;
import com.yihu.jw.care.service.family.PatientFamilyMemberService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -12,12 +14,15 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.care.assistance.EmergencyAssistanceDO;
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachOrderDO;
import com.yihu.jw.entity.care.securitymonitoring.SecurityMonitoringOrderDO;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.utils.EntityUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -50,6 +55,8 @@ public class ConsultTeamService {
    private ServicePackageSignRecordDao servicePackageSignRecordDao;
    @Autowired
    private BaseDoorCoachOrderDao baseDoorCoachOrderDao;
    @Autowired
    private PatientFamilyMemberService familyMemberService;
    public JSONObject updateIMMsg(String sessionId,String sessionType,String msgId,String content){
@ -209,44 +216,6 @@ public class ConsultTeamService {
        return result;
    }
    /**
     *
     * @param assistanceDO
     * @param endOperator 操作者ID
     * @param endType 1居民 2医生
     * @return
     */
    public boolean finishEmergencyConsult(EmergencyAssistanceDO assistanceDO, String endOperator, int endType){
        ConsultTeamDo consultTeam = consultTeamDao.queryByRelationCode(assistanceDO.getId());
        ConsultDo consult = consultDao.findOne(consultTeam.getConsult());
        String sessionId = assistanceDO.getPatient() + "_" + consultTeam.getConsult() + "_" + consultTeam.getType();
        String operatorId = endOperator;
        String operatorName=null;
        if (endType==1){
            BasePatientDO patientDO = patientDao.findById(endOperator);
            operatorName = patientDO.getName();
        }else {
            BaseDoctorDO doctorDO = doctorDao.findById(endOperator);
            operatorName = doctorDO.getName();
        }
        try {
            JSONObject obj =  imUtill.endTopics(sessionId,operatorId,operatorName,consultTeam.getConsult());
            if (obj == null||obj.getInteger("status") == -1) {
                return false;
            }
            consultTeam.setEndMsgId(obj.getString("id"));
            consult.setEndTime(new Date());
            consultTeam.setEndTime(new Date());
            consultTeam.setStatus(1);
            consultDao.save(consult);
            consultTeamDao.save(consultTeam);
        }catch (Exception e){
            e.printStackTrace();
        }
        return true;
    }
    /**
     * 添加上门辅导服务咨询
     *
@ -327,21 +296,117 @@ public class ConsultTeamService {
        return result;
    }
    /**
     *
     * @param assistanceDO
     * 添加安防警报咨询
     * @param orderId
     * @return
     * @throws Exception
     */
    public JSONObject addSecurityMoConsult(String orderId,String patient,String proxyPatient,String symptoms) throws Exception {
        JSONObject result = new JSONObject();
        // 判断居民是否已经签约
        List<ServicePackageSignRecordDO> signRecordDOs = servicePackageSignRecordDao.findByStatusAndPatient(1,patient);
        if(signRecordDOs.size() == 0){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "当前居民未签约,无法进行安放救助咨询!";
            result.put(ResponseContant.resultMsg, failMsg);
            return result;
        }
        // 添加咨询记录
        BasePatientDO patientDO = patientDao.findById(patient);
        if(null == patientDO){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "当前咨询的居民不存在!";
            result.put(ResponseContant.resultMsg, failMsg);
            return result;
        }
        //咨询记录
        String title = patientDO.getName() + "疑似离开安全区域";
        ConsultDo consult = addConsult(patient,title,symptoms,patientDO.getPhone(),22);
        //咨询详细信息
        ConsultTeamDo consultTeam = new ConsultTeamDo();
        consultTeam.setType(22);  //安防警报咨询
//        consultTeam.setAdminTeamId(signFamily.getAdminTeamId());
        consultTeam.setRelationCode(orderId); //关联业务code
        consultTeam.setSymptoms(symptoms);
        consultTeam.setPatient(patient);
        consultTeam.setName(patientDO.getName());
        consultTeam.setBirthday(patientDO.getBirthday());
        consultTeam.setSex(patientDO.getSex());
        consultTeam.setPhoto(patientDO.getPhoto());
        consultTeam.setCzrq(new Date());
        consultTeam.setDel("1");
        consultTeam.setStatus(0);
        consultTeam.setEvaluate(0);
        consultTeam.setDoctorRead(1); // 医生未读数量为1
        consult.setRelationCode(orderId);//关联业务code
        consultTeam.setConsult(consult.getId()); // 设置咨询标识
        //(im创建咨询) 安防警报咨询的sessionid为居民code+咨询id+咨询类型
        String sessionId = patient + "_" + consult.getId() + "_" + consultTeam.getType();
        //4、安防警报咨询-参与者  提供服务的助老员 老人本人 家属
        JSONObject participants = new JSONObject();
        participants.put(patient, 0);
        if (StringUtils.isNotBlank(proxyPatient)&&(!proxyPatient.equals(patient))){
            participants.put(proxyPatient, 0);
        }
        //家属
        JSONArray familyArr =  familyMemberService.getPatientMembers(patient,null,null,null);
        for (int i=0;i<familyArr.size();i++){
            JSONObject tmp = familyArr.getJSONObject(0);
            String familyId = tmp.getString("id");
            participants.put(familyId, 0);
        }
        //加入团队医生
        List<Map<String,Object>> doctorList = servicePackageService.fingdDoctorByPaitenId(patient,"preventLost");
        for(Map<String,Object> map:doctorList){
            participants.put(String.valueOf(map.get("id")), 0);
        }
        String content = patientDO.getName() + "发起安防警报申请";
        JSONObject messages = imUtill.getCreateTopicMessage(patient, patientDO.getName(), consult.getTitle(), content, consult.getImages(), "");
        JSONObject imResponseJson = imUtill.createTopics(sessionId, consult.getId(), content, participants, messages, ImUtil.SESSION_TYPE_EMERGENCY_ASSISTANCE);
        if (imResponseJson == null || imResponseJson.getInteger("status") == -1) {
            String failMsg = "发起服务咨询时:IM" + imResponseJson.getString("message");
            result.put(ResponseContant.resultFlag, ResponseContant.success);
            result.put(ResponseContant.resultMsg, failMsg);
            return result;
        }
        consultTeam.setStartMsgId(imResponseJson.get("start_msg_id").toString());
        consultTeamDao.save(consultTeam);
        consultDao.save(consult);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, consultTeam);
        return result;
    }
    /**
     * 结束咨询
     * @param relationCode
     * @param patient sessionid 组成部分
     * @param endOperator 操作者ID
     * @param endType 1居民 2医生
     * @return
     */
    public boolean finishDoorCoachConsult(BaseDoorCoachOrderDO assistanceDO, String endOperator, int endType){
        ConsultTeamDo consultTeam = consultTeamDao.queryByRelationCode(assistanceDO.getId());
    public boolean finishConsult(String relationCode,String patient, String endOperator, int endType){
        ConsultTeamDo consultTeam = consultTeamDao.queryByRelationCode(relationCode);
        if (consultTeam==null){
            return true;
        }
        ConsultDo consult = consultDao.findOne(consultTeam.getConsult());
        String sessionId = assistanceDO.getPatient() + "_" + consultTeam.getConsult() + "_" + consultTeam.getType();
        String sessionId = patient+ "_" + consultTeam.getConsult() + "_" + consultTeam.getType();
        String operatorId = endOperator;
        String operatorName=null;
        if (endType==1){

+ 6 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientHealthIndexService.java

@ -639,6 +639,7 @@ public class PatientHealthIndexService extends BaseJpaService<DevicePatientHealt
     * 【血压】{"time":"2016-09-09 17:00:00","sys":"收缩压(mmHg)","dia":"舒张压(mmHg)","pul":"脉搏(次/分)","ano":"有无心率不齐0否 1是","user":"身份标识"}
     * 【体重/身高】{"time":"2016-09-09 17:00:00","weight":"体重值(kg)","height":"身高(cm)"}
     * 【腰围】{"time":"2016-09-09 17:00:00","waistline":"腰围值(cm)"}
     * 【体温】{"time":"2016-09-09 17:00:00","temperature":"温度(摄氏度)"}
     *
     * @return
     */
@ -754,6 +755,11 @@ public class PatientHealthIndexService extends BaseJpaService<DevicePatientHealt
                    obj.setValue2(map.get("hipline"));
                    break;
                }
                case "6": {
                    obj.setType(6);
                    obj.setValue1(map.get("temperature"));  //腰围
                    break;
                }
                default: {
                    throw new Exception("暂不支持该指标!");
                }

+ 56 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java

@ -167,6 +167,61 @@ public class DoctorDoorCoachOrderService {
        return doorServiceOrder;
    }
    /**
     * 获取待接单的接口
     *
     * @param message {"read":1,"over":0}
     * @param page 页码
     * @param size 分页大小
     * @return
     * @throws Exception
     */
    public org.json.JSONObject getWaitingMessages(SystemMessageDO message, String types, Integer page, Integer size) throws Exception{
        String sqlList = " SELECT a.* ";
        String sqlCount = " select count(*) as total ";
        String sql =  " FROM base_system_message a " ;
        sql+= " where a.del='1' AND a.over = 1  ";
        if(!org.apache.commons.lang3.StringUtils.isEmpty(message.getReceiver())){
            sql+=" AND a.receiver = '"+message.getReceiver()+"'";
        }
        if(!org.apache.commons.lang3.StringUtils.isEmpty(types)){
            sql+=" AND a.type IN ('"+types.replaceAll(",","','")+"')";
        }
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlCount+sql);
        sql+=" ORDER BY a.create_time DESC LIMIT "+(page-1)*size+","+size;
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sqlList+sql);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        JSONArray jsonArray = new JSONArray();
        for(Map<String,Object> one:mapList){
            org.json.JSONObject object = new org.json.JSONObject();
            object.put("over",one.get("over"));
            object.put("receiver",one.get("receiver"));
            object.put("del",one.get("del"));
            object.put("title",one.get("title"));
            object.put("type",one.get("type"));
            object.put("content",one.get("data"));
            object.put("sender",one.get("sender"));
            object.put("id",one.get("id"));
            object.put("relation_code",one.get("relation_code"));
            object.put("has_read",one.get("is_read"));
            object.put("appliStatus",one.get("appliStatus"));
            Date date = (Date)one.get("create_time");
            object.put("create_time", DateUtil.dateToStr(date,"yyyy-MM-dd HH:mm:ss"));
            Date date1 = (Date)one.get("czrq");
            object.put("czrq", DateUtil.dateToStr(date1,"yyyy-MM-dd HH:mm:ss"));
            jsonArray.add(object);
        }
        org.json.JSONObject object = new org.json.JSONObject();
        object.put("total",count);
        object.put("waitingMessages",jsonArray);
        object.put("currPage",page);
        object.put("pageSize",size);
        return object;
    }
    /**
     * 获取工单列表
     * @param orderId
@ -564,7 +619,7 @@ public class DoctorDoorCoachOrderService {
            logger.error(e.getMessage());
        }
        //如果是调度员取消,推送IM取消工单json消息,
        if (!consultTeamService.finishDoorCoachConsult(one,one.getPatient(),1)){
        if (!consultTeamService.finishConsult(one.getId(),one.getPatient(),one.getPatient(),1)){
            throw new Exception("咨询结束失败 无法取消工单");
        }
        return doorServiceOrderDO;

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java

@ -791,7 +791,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
            orderDO.setDispatcherName(dispatcherName);
        }
        //如果是调度员取消,推送IM取消工单json消息,
        if (!consultTeamService.finishDoorCoachConsult(orderDO,orderDO.getPatient(),1)){
        if (!consultTeamService.finishConsult(orderDO.getId(),orderDO.getPatient(),orderDO.getPatient(),1)){
            String failMsg = "咨询结束失败 无法取消工单";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);

+ 69 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -7,9 +7,14 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.security.*;
import com.yihu.jw.care.dao.team.BaseTeamMemberDao;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.care.util.CountDistance;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
@ -74,10 +79,18 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    private GpsUtil gpsUtil;
    @Autowired
    private CountDistance countDistance;
    @Autowired
    private ConsultTeamService consultTeamService;
    @Autowired
    private ConsultDao consultDao;
    @Autowired
    private BaseTeamMemberDao baseTeamMemberDao;
    @Autowired
    private ImUtil imUtil;
    private Logger logger = LoggerFactory.getLogger(SecurityMonitoringOrderService.class);
    public JSONObject createOrder(String jsonData){
    public JSONObject createOrder(String jsonData,Integer orderSource) throws Exception {
        logger.info("创建安防工单jsonData参数:" + jsonData);
        JSONObject result = new JSONObject();
@ -101,12 +114,14 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            logger.error(failMsg);
            return result;
        }
        orderDO.setStatus(1);
        orderDO.setNumber(getRandomIntStr());
        orderDO.setCreateTime(new Date());
        orderDO.setCreateUser(orderDO.getCreateUser());
        orderDO.setCreateUserName(orderDO.getCreateUserName());
        orderDO.setOrderInfo("0");
        orderDO.setOrderSource(orderSource);
        if(StringUtils.isEmpty(orderDO.getPatient())){
            result.put("resultFlag", 0);
@ -126,10 +141,10 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        }
        //签约防走失服务包
        String sql ="SELECT i.code from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i  \n" +
        String sql ="SELECT i.code,i.team_code,i.org_code,i.org_name from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i  \n" +
                "where  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id   and i.del = 1 and sr.`status`=1 \n" +
                "and  sr.patient  = '"+orderDO.getPatient()+"' and i.code='preventLost' ";
       List<String> items = jdbcTemplate.queryForList(sql,String.class);
        List<Map<String,Object>> items = jdbcTemplate.queryForList(sql);
        if (items.size()==0) {
            result.put("resultFlag", 0);
            String failMsg = "当前服务对象未签约防走失服务,请签约后再发起预警!";
@ -154,11 +169,40 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            logger.error(failMsg);
            return result;
        }
        Map<String,Object> mapTmp = items.get(0);
        List<BaseDoctorDO> doctorDOS = baseTeamMemberDao.findAllMembers(mapTmp.get("team_code").toString());
        if (doctorDOS.size()==0){
            String failMsg = "安防警报服务项服务医生为空,不可发起救助";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        orderDO.setCreateTime(new Date());
        //判断创建预警服务类型,发起类型(1本人发起 2家人待预约 3医生代预约)
        orderDO.setType(3);//发起类型
        orderDO.setServiceStatus("2");
        this.save(orderDO);
        //创建im会话  安防警报咨询的sessionid  为居民code+(wlyy_consult_team表consult)+20
        JSONObject IMObj = consultTeamService.addSecurityMoConsult(orderDO.getId(),orderDO.getPatient(),null,null);
        String sessionId=orderDO.getPatient()+"_"+ IMObj.getJSONObject("resultMsg").getString("consult") + "_22";
        //推送socket给医生  推送紧急预警
        for (BaseDoctorDO doctorDO:doctorDOS){
            JSONObject message = new JSONObject();
            message.put("session_id",sessionId);
            message.put("sender_name",orderDO.getPatientName());
            message.put("content_notice",orderDO.getPatientName()+" 疑似离开安全区域!");
            message.put("sender_code",orderDO.getPatient());
            message.put("OrderType",22);
            message.put("order_id",orderDO.getId());
            message.put("content_type",40);
            try {
                imUtil.sendMDTSocketMessageToDoctor(doctorDO.getId(),message.toString());
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        result.put("resultFlag", 1);
        result.put("resultMsg",orderDO);
@ -210,6 +254,15 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            jsonObject.put("patientAddress",null);
        }
        jsonObject.put("statusName",statusName);
        //获取咨询
        ConsultDo consult = consultDao.queryByRelationCode(orderID);
        if (null != consult) {
            String sessionId = orderDO.getPatient() + "_" + consult.getId() + "_" + consult.getType();
            jsonObject.put("sessionId",sessionId);
        }
        else {
            jsonObject.put("sessionId",null);
        }
        result.put("resultFlag", 1);
        result.put("resultMsg",jsonObject);
@ -536,6 +589,13 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            logger.error(failMsg);
            return result;
        }
        if (!consultTeamService.finishConsult(orderDO.getId(),orderDO.getPatient(),orderDO.getPatient(),1)){
            String failMsg = "咨询结束失败 无法取消工单";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        orderDO.setDoctor(doctor);
        orderDO.setDoctorName(doctorDO.getName());
        orderDO.setCancelType(type);
@ -782,11 +842,17 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        one.setCompleteTime(one.getDoctorConfirmFinishTime());
        // 更新记录
        this.setUpdateColumnInfo(one);
        if (!consultTeamService.finishConsult(one.getId(),one.getPatient(),one.getPatient(),1)){
            String failMsg = "咨询结束失败 无法结束工单";
            throw new Exception(failMsg);
        }
        securityMonitoringOrderDao.save(one);
        SecurityMonitoringOrderDO doorServiceOrderDO = this.getDoorServiceOrderById(orderId);
        // 发送微信通知  待付款
        BasePatientDO patient = basePatientDao.findById(one.getPatient());
        // 获取微信模板 smfwdwk-上门服务待付款
//        Consult consult = consultDao.queryByRelationCode(orderId);
        try {

+ 142 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/TencentSmsUtil.java

@ -0,0 +1,142 @@
package com.yihu.jw.care.util;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.sms.v20190711.SmsClient;
import com.tencentcloudapi.sms.v20190711.models.SendSmsRequest;
import com.tencentcloudapi.sms.v20190711.models.SendSmsResponse;
import com.yihu.jw.care.config.TencentSmsConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
 * Created by Bing on 2021/5/19.
 */
@Component
public class TencentSmsUtil {
    @Autowired
    private StringRedisTemplate redisTemplate;
    private TencentSmsConfig tencentSmsConfig = new TencentSmsConfig();
    /**
     *  获取短信验证码
     * @param phoneNumberList 手机列表
     * @param templateParamList 参数列表
     * @param type 模板key VerificationCode:手机验证码
     * @return
     */
    public String SendSms(List<String> phoneNumberList, List<String> templateParamList,String type) {
        try {
            Iterator<String> iterator = phoneNumberList.iterator();
            if ("VerificationCode".equals(type)){//超过10次无法再发送短信验证码
                while (iterator.hasNext()) {
                    String phone = iterator.next();
                    if (redisTemplate.hasKey("tencentSmsVFCode-" + phone)) {//验证码每天上限10次
                        Integer count = Integer.valueOf(redisTemplate.opsForValue().get("tencentSmsVFCode-" + phone));
                        if (count > 10) {
                            iterator.remove();
                        }else {
                            count++;
                            Long expire = redisTemplate.boundHashOps("tencentSmsVFCode-" + phone).getExpire();
                            redisTemplate.opsForValue().set("tencentSmsVFCode-" + phone,count+"",expire, TimeUnit.SECONDS);
                        }
                    }
                    else {
                        int count =1;
                        redisTemplate.opsForValue().set("tencentSmsVFCode-" + phone,count+"",tencentSmsConfig.overTime, TimeUnit.HOURS);
                    }
                }
            }
            String[] phoneNumbers = phoneNumberList.toArray(new String[0]);
            String[] templateParams = templateParamList!=null?templateParamList.toArray(new String[0]):null;
            Credential cred = new Credential(tencentSmsConfig.SecretId, tencentSmsConfig.SecretKey);
            HttpProfile httpProfile = new HttpProfile();
            // 设置代理
//            httpProfile.setProxyHost("host");
//            httpProfile.setProxyPort(port);
            httpProfile.setReqMethod("POST");
            httpProfile.setConnTimeout(60);
            httpProfile.setEndpoint("sms.tencentcloudapi.com");
            ClientProfile clientProfile = new ClientProfile();
            /** SDK默认用TC3-HMAC-SHA256进行签名
             * 非必要请不要修改这个字段 */
            clientProfile.setSignMethod("HmacSHA256");
            clientProfile.setHttpProfile(httpProfile);
            /** 实例化要请求产品(以sms为例)的client对象
             * 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量 */
            SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
            SendSmsRequest req = new SendSmsRequest();
            /* 短信应用ID: 短信SdkAppid在 [短信控制台] 添加应用后生成的实际SdkAppid,示例如1400006666 */
            String appid = "1400009099";
            req.setSmsSdkAppid(appid);
            /* 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名,签名信息可登录 [短信控制台] 查看 */
            String sign = "签名内容";
            req.setSign(sign);
            /* 模板 ID: 必须填写已审核通过的模板 ID。模板ID可登录 [短信控制台] 查看 */
            String templateID = tencentSmsConfig.getTemplateId(type);
            req.setTemplateID(templateID);
            /** 下发手机号码,采用 e.164 标准,+[国家或地区码][手机号]
             * 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号
             * */
            req.setPhoneNumberSet(phoneNumbers);
            /** 模板参数: 若无模板参数,则设置为空
             String[] templateParams = {"5678"};*/
            req.setTemplateParamSet(templateParams);
            /** 通过 client 对象调用 SendSms 方法发起请求。注意请求方法名与请求对象是对应的
             * 返回的 res 是一个 SendSmsResponse 类的实例,与请求对象对应 */
            SendSmsResponse res = client.SendSms(req);
            // 输出json格式的字符串回包
            System.out.println(SendSmsResponse.toJsonString(res));
            // 也可以取出单个值,你可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义
            System.out.println(res.getRequestId());
            return SendSmsResponse.toJsonString(null);
        } catch (TencentCloudSDKException e) {
            e.printStackTrace();
            return null;
        }
    }
}
/**        返回值
 *{
 *   "Response": {
 *     "SendStatusSet": [
 *       {
 *         "SerialNo": "5000:1045710669157053657849499619", 发送流水号。
 *         "PhoneNumber": "+8618511122233",
 *         "Fee": 1, 计费条数,计费规则请查询
 *         "SessionContext": "test",
 *         "Code": "Ok", 短信请求状态码
 *         "Message": "send success",
 *         "IsoCode": "CN"
 *       },
 *       {
 *         "SerialNo": "5000:104571066915705365784949619",
 *         "PhoneNumber": "+8618511122266",
 *         "Fee": 1,
 *         "SessionContext": "test",
 *         "Code": "Ok",
 *         "Message": "send success",
 *         "IsoCode": "CN"
 *       }
 *     ],
 *     "RequestId": "a0aabda6-cf91-4f3e-a81f-9198114a2279"
 *   }
 * }
 */

+ 1 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/RemindDoctorService.java

@ -39,7 +39,7 @@ public class RemindDoctorService {
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private EnterpriseService enterpriseService;
    @Value("${wechat.id}")
    @Value("${wechat.ids}")
    private String wechatId;
    @Autowired
    private PrescriptionService prescriptionService;

+ 6 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -134,9 +134,11 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "sex",required = false) String sex,
			@ApiParam(name = "keyWord", value = "姓名关键字")
			@RequestParam(value = "keyWord",required = false) String keyWord,
			@ApiParam(name = "patient", value = "患者id")
			@RequestParam(value = "patient",required = false) String patient,
			@ApiParam(name = "ageGroup", value = "年龄段")
			@RequestParam(value = "ageGroup",required = false) String ageGroup){
		return success("请求成功",prescriptionService.findWaitingRoomOutpatientByDoctor(doctor,type,query_status,dept,sex,keyWord,ageGroup));
		return success("请求成功",prescriptionService.findWaitingRoomOutpatientByDoctor(doctor,type,query_status,dept,sex,keyWord,ageGroup,patient));
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.findWaitingRoomPatient)
@ -713,6 +715,8 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "doctor",required = false) String doctor,
			@ApiParam(name = "title", value = "咨询标题关键字")
			@RequestParam(value = "title",required = false) String title,
			@ApiParam(name = "patient", value = "患者id")
			@RequestParam(value = "patient",required = false) String patient,
			@ApiParam(name = "id", value = "咨询ID")
			@RequestParam(value = "id",required = false) String id,
			@ApiParam(name = "type", value = "咨询类型")
@ -728,7 +732,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize
	)throws Exception{
		List<Map<String,Object>>  data = imService.findConsultRecordByDoctorNew(doctor, id,type,status, page,pagesize, title,start_time,end_time);
		List<Map<String,Object>>  data = imService.findConsultRecordByDoctorNew(doctor, id,type,status, page,pagesize, title,start_time,end_time,patient);
		if (data != null) {
			for(Map<String,Object> consult :data){

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

@ -344,13 +344,18 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorInfo)
    @ApiOperation(value = "获取医生信息", notes = "获取医生信息")
    public ObjEnvelop findDoctorInfo(@ApiParam(name = "doctor", value = "医生code")
    public Envelop findDoctorInfo(@ApiParam(name = "doctor", value = "医生code")
                                     @RequestParam(value = "doctor", required = true)String doctor,
                                     @ApiParam(name = "withWork", value = "传1带排班,其他不带")
                                     @RequestParam(value = "withWork", required = false)String withWork,
                                     @ApiParam(name = "patient", value = "患者code")
                                         @RequestParam(value = "patient", required = false)String patient){
        return success(prescriptionService.findDoctorInfo(doctor,withWork,patient));
                                         @RequestParam(value = "patient", required = false)String patient)throws Exception{
        try {
            return success(prescriptionService.findDoctorInfo(doctor,withWork,patient));
        }catch (Exception e){
            return  failedException(e);
        }
    }

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

@ -2102,13 +2102,19 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                  @RequestParam(value = "status[]", required = false)String status,
                                                  @ApiParam(name = "isSelectDrug", value = "1查询处方药品1是0查询检查")
                                                      @RequestParam(value = "isSelectDrug", required = false)String isSelectDrug,
                                                  @ApiParam(name = "patient", value = "患者id")
                                                      @RequestParam(value = "patient", required = false)String patient,
                                                  @ApiParam(name = "page", value = "第几页")
                                                  @RequestParam(value = "page",required = false,defaultValue = "1") Integer page,
                                                  @ApiParam(name = "size", value = "页面大小")
                                                  @RequestParam(value = "size",required = false,defaultValue = "10") Integer size)throws Exception {
        try {
            String patient = getUID();
            return prescriptionService.findPatientAllPrescription(keyName,status,page,size,patient,isSelectDrug);
            boolean consumerflag = false ;
            if (!StringUtils.isNoneBlank(patient)){
                patient=getUID();
                consumerflag=true;
            }
            return prescriptionService.findPatientAllPrescription(keyName,status,page,size,patient,isSelectDrug,consumerflag);
        } catch (Exception e) {
            return PageEnvelop.getError(e.getMessage(),-1);
        }
@ -2404,14 +2410,16 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "startTime",defaultValue = "",required = false) String startTime,
            @ApiParam(name = "endTime", value = "结束时间")
            @RequestParam(value = "endTime",defaultValue = "",required = false) String endTime,
            @ApiParam(name = "checkStatus", value = "处方状态")
            @ApiParam(name = "checkStatus", value = "处方审核状态")
            @RequestParam(value = "checkStatus",defaultValue = "",required = false) String checkStatus,
            @ApiParam(name = "status", value = "处方状态")
            @RequestParam(value = "status",defaultValue = "",required = false) String status,
            @ApiParam(name = "page", value = "页数")
            @RequestParam(value = "page",defaultValue = "",required = false) Integer page,
            @ApiParam(name = "pageSize",value = "页大小")
            @RequestParam(value = "pageSize",defaultValue = "",required = false) Integer pageSize) throws Exception {
        return prescriptionService.prescriptionManage(keyWord,doctorId,startTime,endTime,checkStatus,page,pageSize);
        return prescriptionService.prescriptionManage(keyWord,doctorId,startTime,endTime,checkStatus,status,page,pageSize);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.disablePrescription)
    @ApiOperation(value = "作废处方")