Ver código fonte

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

 Conflicts:
	common/common-entity/sql记录
	svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java
Shi Kejing 4 anos atrás
pai
commit
f2e437b3a0
73 arquivos alterados com 2904 adições e 351 exclusões
  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. 21 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. 12 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseCatalogueDO.java
  13. 15 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseDO.java
  14. 107 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/NurseryLogDO.java
  15. 59 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientCourseRecordDO.java
  16. 98 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientDietRecordDO.java
  17. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientOrderRefundDO.java
  18. 100 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/message/OrgNoticeDO.java
  19. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringOrderDO.java
  20. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java
  21. 14 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionDictDao.java
  22. 8 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionLogDao.java
  23. 11 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionServerDictDao.java
  24. 62 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/endpoint/EnvelopRestEndpoint.java
  25. 3 0
      gateway/ag-basic/src/main/java/com/yihu/AgBasicServer.java
  26. 92 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/DidiFilterProcessor.java
  27. 34 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/ErrorExtFilter.java
  28. 83 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseExceptionService.java
  29. 0 3
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseLoginLogService.java
  30. 14 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionDictDao.java
  31. 8 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionLogDao.java
  32. 11 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionServerDictDao.java
  33. 38 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/security/BeanUtil.java
  34. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/DictDietEndpoint.java
  35. 5 1
      svr/svr-cloud-care/pom.xml
  36. 30 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/TencentSmsConfig.java
  37. 3 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/CourseCatalogueDao.java
  38. 16 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/NurseryLogDao.java
  39. 20 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/PatientCourseRecordDao.java
  40. 19 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/PatientDietRecordDao.java
  41. 11 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/message/OrgNoticeDao.java
  42. 14 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/message/UserNoticeDao.java
  43. 108 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/DoctorCourseEndpoint.java
  44. 143 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/NurseryLogEndpoint.java
  45. 33 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java
  46. 38 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/DoctorDoorCoachOrderController.java
  47. 20 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/PatientDoorCoachOrderController.java
  48. 10 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/ChildrenExaminationEndpoint.java
  49. 81 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/exam/DoctorChildrenExaminationEndpoint.java
  50. 56 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/DoctorMessageEndpoint.java
  51. 60 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java
  52. 4 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java
  53. 4 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/securrity/SecuMonOrderEndpoint.java
  54. 5 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java
  55. 112 44
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java
  56. 138 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java
  57. 285 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/NurseryLogService.java
  58. 6 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientHealthIndexService.java
  59. 76 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java
  60. 64 7
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java
  61. 43 14
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java
  62. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/exam/ChildrenExaminationService.java
  63. 71 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java
  64. 67 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java
  65. 69 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java
  66. 142 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/TencentSmsUtil.java
  67. 4 0
      svr/svr-cloud-care/src/main/resources/application.yml
  68. 1 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/RemindDoctorService.java
  69. 6 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  70. 8 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  71. 12 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  72. 0 105
      web-gateway/src/main/java/com/yihu/jw/controller/base/login/LoginContorller.java
  73. 0 110
      web-gateway/src/main/resources/application.yml

+ 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+"'";
			}

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

@ -867,6 +867,27 @@ CREATE TABLE `base_course_sales_order_record` (
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='课程销售订单记录表';
-- 2021-05-18
create table base_org_notice(
	id varchar(50) not null,
	org_code varchar(50) default null COMMENT '机构code',
	org_name varchar(50) default null COMMENT '机构名称',
	status tinyint(1) DEFAULT NULL COMMENT '状态(1待发布,2已发布)',
	del tinyint(1) DEFAULT '1' COMMENT '删除标志(1正常,0删除)',
	title VARCHAR(50) default null comment '通知标题',
	content text default null comment '通知内容',
	img VARCHAR(1000) default null COMMENT '附件',
	notice_time datetime default null COMMENT '通知时间',
	create_time datetime default null,
	PRIMARY KEY(id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='机构通知表';
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居家报警'
-- 2021-05-19
CREATE TABLE `base_course_catalogue_read_time` (
  `id` varchar(50) NOT NULL,

+ 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;            // 患者性别

+ 12 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseCatalogueDO.java

@ -39,6 +39,10 @@ public class CourseCatalogueDO extends UuidIdentityEntityWithTime {
     * 视频url
     */
    private String videoUrl;
    /**
     * 排序字段
     */
    private Integer sort;
    @Column(name = "course_id")
    public String getCourserId() {
@ -89,4 +93,12 @@ public class CourseCatalogueDO extends UuidIdentityEntityWithTime {
        this.videoUrl = videoUrl;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
}

+ 15 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseDO.java

@ -8,6 +8,7 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
@ -83,6 +84,11 @@ public class CourseDO extends UuidIdentityEntityWithOperator {
     */
    private Integer del;
    /**
     * 小节
     */
    List<CourseCatalogueDO> catalogueDOList;
    @Column(name = "type")
    public String getType() {
        return type;
@ -236,4 +242,13 @@ public class CourseDO extends UuidIdentityEntityWithOperator {
    public void setLiveDuration(String liveDuration) {
        this.liveDuration = liveDuration;
    }
    @Transient
    public List<CourseCatalogueDO> getCatalogueDOList() {
        return catalogueDOList;
    }
    public void setCatalogueDOList(List<CourseCatalogueDO> catalogueDOList) {
        this.catalogueDOList = catalogueDOList;
    }
}

+ 107 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/NurseryLogDO.java

@ -0,0 +1,107 @@
package com.yihu.jw.entity.care.course;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
@Entity
@Table(name="base_nursery_log")
public class NurseryLogDO extends UuidIdentityEntityWithCreateTime{
    private String patient;
    private String patientName;
    private String doctor;
    private String doctorName;
    private String orgCode;
    private String orgName;
    /**
     * '记录日期'
     */
    private String recordDate;
    /**
     * 状态 暂时没用
     */
    private String status;
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    @Column(name = "org_name")
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    @Column(name = "record_date")
    public String getRecordDate() {
        return recordDate;
    }
    public void setRecordDate(String recordDate) {
        this.recordDate = recordDate;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
}

+ 59 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientCourseRecordDO.java

@ -0,0 +1,59 @@
package com.yihu.jw.entity.care.course;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description: '居民课程记录
 */
@Entity
@Table(name="base_patient_course_record")
public class PatientCourseRecordDO extends UuidIdentityEntityWithCreateTime{
    /**
     * '托育日志id'
     */
    private String nurseryLogId;
    /**
     * '课程记录内容'
     */
    private String content;
    /**
     * '附件'
     */
    private String enclosure;
    @Column(name = "nursery_log_id")
    public String getNurseryLogId() {
        return nurseryLogId;
    }
    public void setNurseryLogId(String nurseryLogId) {
        this.nurseryLogId = nurseryLogId;
    }
    @Column(name = "content")
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    @Column(name = "enclosure")
    public String getEnclosure() {
        return enclosure;
    }
    public void setEnclosure(String enclosure) {
        this.enclosure = enclosure;
    }
}

+ 98 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientDietRecordDO.java

@ -0,0 +1,98 @@
package com.yihu.jw.entity.care.course;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description: 居民饮食记录
 */
@Entity
@Table(name="base_patient_diet_record")
public class PatientDietRecordDO extends UuidIdentityEntityWithCreateTime{
    /**
     * '托育日志id'
     */
    private String nurseryLogId;
    /**
     * '食用食物json格式'
     */
    private String eatFood;
    /**
     * '食用方式 1喂食 2自主进食
     */
    private String eatType;
    /**
     *'摄入量 全部吃完 吃了1/3 吃了1/2 几乎没吃'
     */
    private String intake;
    /**
     *'附加说明'
     */
    private String additionalNotes;
    /**
     *'附件'
     */
    private String enclosure;
    @Column(name = "nursery_log_id")
    public String getNurseryLogId() {
        return nurseryLogId;
    }
    public void setNurseryLogId(String nurseryLogId) {
        this.nurseryLogId = nurseryLogId;
    }
    @Column(name = "eat_food")
    public String getEatFood() {
        return eatFood;
    }
    public void setEatFood(String eatFood) {
        this.eatFood = eatFood;
    }
    @Column(name = "eat_type")
    public String getEatType() {
        return eatType;
    }
    public void setEatType(String eatType) {
        this.eatType = eatType;
    }
    @Column(name = "intake")
    public String getIntake() {
        return intake;
    }
    public void setIntake(String intake) {
        this.intake = intake;
    }
    @Column(name = "additional_notes")
    public String getAdditionalNotes() {
        return additionalNotes;
    }
    public void setAdditionalNotes(String additionalNotes) {
        this.additionalNotes = additionalNotes;
    }
    @Column(name = "enclosure")
    public String getEnclosure() {
        return enclosure;
    }
    public void setEnclosure(String enclosure) {
        this.enclosure = enclosure;
    }
}

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientOrderRefundDO.java

@ -154,8 +154,8 @@ public class PatientOrderRefundDO extends UuidIdentityEntity{
        this.refundTime = refundTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
@ -164,8 +164,8 @@ public class PatientOrderRefundDO extends UuidIdentityEntity{
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "buy_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getBuyTime() {
        return buyTime;
    }

+ 100 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/message/OrgNoticeDO.java

@ -0,0 +1,100 @@
package com.yihu.jw.entity.care.message;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Bing on 2021/5/18.
 * 通知实体
 */
@Entity
@Table(name="base_org_notice")
public class OrgNoticeDO extends UuidIdentityEntityWithCreateTime {
    private String orgCode ;
    private String orgName ;
    private Integer status ;//
    private Integer del ;
    private String title ;//通知标题
    private String content;//通知内容
    private String img ; //附件
    private Date noticeTime ;//通知时间
    private String createUser;
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getNoticeTime() {
        return noticeTime;
    }
    public void setNoticeTime(Date noticeTime) {
        this.noticeTime = noticeTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
}

+ 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);

+ 3 - 0
gateway/ag-basic/src/main/java/com/yihu/AgBasicServer.java

@ -1,5 +1,7 @@
package com.yihu;
import com.netflix.zuul.FilterProcessor;
import com.yihu.jw.gateway.filter.DidiFilterProcessor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@ -16,6 +18,7 @@ import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
public class AgBasicServer extends SpringBootServletInitializer {
    public static void main(String [] args) {
        FilterProcessor.setProcessor(new DidiFilterProcessor());
        SpringApplication.run(AgBasicServer.class, args);
    }

+ 92 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/DidiFilterProcessor.java

@ -0,0 +1,92 @@
package com.yihu.jw.gateway.filter;
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.
 *
 * @Author: yeshijie
 * @Date: 2021/5/19
 * @Description:
 */
@Component
public class DidiFilterProcessor extends FilterProcessor {
    @Override
    public Object processZuulFilter(ZuulFilter filter) throws ZuulException {
        try {
            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();
                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 ;
            }else {
                throw e;
            }
        }
    }
}

+ 34 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/ErrorExtFilter.java

@ -0,0 +1,34 @@
package com.yihu.jw.gateway.filter;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import org.springframework.cloud.netflix.zuul.filters.post.SendErrorFilter;
import org.springframework.stereotype.Component;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/19
 * @Description:
 */
@Component
public class ErrorExtFilter extends SendErrorFilter{
    @Override
    public String filterType() {
        return "error";
    }
    @Override
    public int filterOrder() {
        return 30;
    }
    @Override
    public boolean shouldFilter() {
        RequestContext ctx = RequestContext.getCurrentContext();
        ZuulFilter failedFilter = (ZuulFilter) ctx.get("failed.filter");
        if(failedFilter != null && failedFilter.filterType().equals("post")) {
            return true;
        }
        return false;
    }
}

+ 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);
    }
}

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/DictDietEndpoint.java

@ -41,7 +41,7 @@ public class DictDietEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建")
    public ObjEnvelop<DictDietDO> create (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        DictDietDO dictDiet = toEntity(jsonData, DictDietDO.class);
        dictDiet = dictDietService.save(dictDiet);
        return success(dictDiet);
@ -60,7 +60,7 @@ public class DictDietEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "更新")
    public ObjEnvelop<DictDietDO> update (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        DictDietDO dictDiet = toEntity(jsonData, DictDietDO.class);
        if (null == dictDiet.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);

+ 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 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/CourseCatalogueDao.java

@ -4,6 +4,8 @@ import com.yihu.jw.entity.care.course.CourseCatalogueDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
@ -14,5 +16,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface CourseCatalogueDao extends PagingAndSortingRepository<CourseCatalogueDO, String>, JpaSpecificationExecutor<CourseCatalogueDO> {
    List<CourseCatalogueDO> findByCourserId(String courserId);
}

+ 16 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/NurseryLogDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.care.dao.course;
import com.yihu.jw.entity.care.course.NurseryLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
public interface NurseryLogDao extends PagingAndSortingRepository<NurseryLogDO, String>, JpaSpecificationExecutor<NurseryLogDO> {
}

+ 20 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/PatientCourseRecordDao.java

@ -0,0 +1,20 @@
package com.yihu.jw.care.dao.course;
import com.yihu.jw.entity.care.course.PatientCourseRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
public interface PatientCourseRecordDao extends PagingAndSortingRepository<PatientCourseRecordDO, String>,
        JpaSpecificationExecutor<PatientCourseRecordDO> {
    List<PatientCourseRecordDO> findByNurseryLogId(String nurseryLogId);
}

+ 19 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/PatientDietRecordDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.care.dao.course;
import com.yihu.jw.entity.care.course.PatientDietRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
public interface PatientDietRecordDao extends PagingAndSortingRepository<PatientDietRecordDO, String>, JpaSpecificationExecutor<PatientDietRecordDO> {
    List<PatientDietRecordDO> findByNurseryLogId(String nurseryLogId);
}

+ 11 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/message/OrgNoticeDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.care.dao.message;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/5/18.
 */
public interface OrgNoticeDao extends PagingAndSortingRepository<OrgNoticeDO,String>, JpaSpecificationExecutor<OrgNoticeDO> {
}

+ 14 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/message/UserNoticeDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.care.dao.message;
import com.yihu.jw.entity.base.notice.UserNoticeDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 用户公告通知
 * @author yeshijie on 2018/9/30.
 */
public interface UserNoticeDao extends PagingAndSortingRepository<UserNoticeDO, String>, JpaSpecificationExecutor<UserNoticeDO> {
    UserNoticeDO findByNoticeIdAndUserIdAndDel(String noticeId,String userId,Integer del);
}

+ 108 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/DoctorCourseEndpoint.java

@ -1,9 +1,22 @@
package com.yihu.jw.care.endpoint.course;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.course.CourseService;
import com.yihu.jw.entity.care.course.CourseDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.tencent.TencentVODUtil;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
@ -17,4 +30,97 @@ import org.springframework.web.bind.annotation.RestController;
@Api(tags = "医生课程信息", description = "医生课程信息")
public class DoctorCourseEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private CourseService courseService;
    @Value("${tencent.secretId}")
    private String secretId;
    @Value("${tencent.secretKey}")
    private String secretKey;
    @GetMapping(value = "myCourseList")
    @ApiOperation(value = "我的课程列表")
    public PageEnvelop myCourseList(
            @ApiParam(name = "doctor", value = "doctor") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "type", value = "课程类型 1直播 2视频 3文本") @RequestParam(value = "type", required = false) String type,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "3") @RequestParam(value = "size") int size) {
        try{
            JSONObject result = courseService.myCourseList(doctor, type, page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return PageEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            Long count = result.getLongValue(ResponseContant.count);
            return PageEnvelop.getSuccessListWithPage("查询成功",(List<CourseDO>)result.get(ResponseContant.resultMsg),page,size,count);
        }catch (Exception e){
            e.printStackTrace();
        }
        return PageEnvelop.getError("查询失败");
    }
    @GetMapping(value = "courseDetail")
    @ApiOperation(value = "课程详情")
    public ObjEnvelop courseDetail(
            @ApiParam(name = "id", value = "id") @RequestParam(value = "id", required = true) String id) {
        try{
            JSONObject result = courseService.courseDetail(id);
            return ObjEnvelop.getSuccess("查询成功",result);
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError("查询失败");
    }
    @PostMapping(value = "addCourse")
    @ApiOperation(value = "新增课程")
    public ObjEnvelop addCourse(
            @ApiParam(name = "doctorId", value = "doctorId") @RequestParam(value = "doctorId", required = true) String doctorId,
            @ApiParam(name = "jsonData", value = "jsonData") @RequestParam(value = "jsonData", required = true) String jsonData) {
        try{
            JSONObject result = courseService.addCourse(doctorId, jsonData);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("新增成功",result);
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError("新增失败");
    }
    @PostMapping(value = "startLiveCourse")
    @ApiOperation(value = "开启直播课程")
    public Envelop startLiveCourse(
            @ApiParam(name = "id", value = "id")
            @RequestParam(value = "id", required = true) String id) {
        try{
            courseService.startLiveCourse(id);
            return ObjEnvelop.getSuccess("开启成功");
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError("开启失败");
    }
    @PostMapping(value = "endLiveCourse")
    @ApiOperation(value = "结束直播课程")
    public Envelop endLiveCourse(
            @ApiParam(name = "id", value = "id")
            @RequestParam(value = "id", required = true) String id) {
        try{
            courseService.endLiveCourse(id);
            return ObjEnvelop.getSuccess("结束成功");
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError("结束失败");
    }
    @GetMapping(value = "getTXUploadSignature")
    @ApiOperation(value = "获取腾讯视频上传签名")
    public Envelop getTXUploadSignature() throws Exception {
        TencentVODUtil tencentVODUtil = new TencentVODUtil();
        tencentVODUtil.setSecretId(secretId);
        tencentVODUtil.setSecretKey(secretKey);
        return success(tencentVODUtil.getUploadSignature());
    }
}

+ 143 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/NurseryLogEndpoint.java

@ -0,0 +1,143 @@
package com.yihu.jw.care.endpoint.course;
import com.yihu.jw.care.service.course.NurseryLogService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
@RestController
@RequestMapping("nursery" )
@Api(tags = "托育日志", description = "托育日志")
public class NurseryLogEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private NurseryLogService nurseryLogService;
    @GetMapping(value = "findNurseryLogByMonth")
    @ApiOperation("获取托育日志按月日历形式")
    public Envelop findNurseryLogByMonth(@ApiParam(name = "orgCode", value = "机构id")
                                      @RequestParam(value = "orgCode", required = true) String orgCode,
                                          @ApiParam(name = "patient", value = "居民")
                                      @RequestParam(value = "patient", required = false) String patient,
                                          @ApiParam(name = "patientName", value = "居民姓名")
                                      @RequestParam(value = "patientName", required = false) String patientName,
                                          @ApiParam(value = "开始时间,格式(yyyy-MM-dd)", name = "startDate",required = false)
                                      @RequestParam(value = "startDate", required = false) String startDate,
                                          @ApiParam(value = "结束时间,格式(yyyy-MM-dd)", name = "endDate",required = false)
                                      @RequestParam(value = "endDate", required = false) String endDate){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.findNurseryLogByMonth(orgCode,patient,patientName,startDate,endDate));
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "findNurseryLogList")
    @ApiOperation("获取托育日志列表-已填写")
    public Envelop findNurseryLogList(@ApiParam(name = "orgCode", value = "机构id")
                                            @RequestParam(value = "orgCode", required = true) String orgCode,
                                            @ApiParam(name = "recordDate", value = "时间")
                                            @RequestParam(value = "recordDate", required = false) String recordDate){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.findNurseryLogList(orgCode,recordDate));
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "nuseryLogUnFilledIn")
    @ApiOperation("获取未填写日志列表")
    public Envelop nuseryLogUnFilledIn(@ApiParam(name = "orgCode", value = "机构id")
                                         @RequestParam(value = "orgCode", required = true) String orgCode,
                                         @ApiParam(name = "recordDate", value = "时间")
                                         @RequestParam(value = "recordDate", required = false) String recordDate){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.nuseryLogUnFilledIn(orgCode,recordDate));
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @PostMapping("addNurseryLog")
    @ApiOperation(value = "新增托育日志")
    public Envelop addNurseryLog(
            @ApiParam(name = "patient", value = "居民id") @RequestParam(value = "patient", required = true) String patient,
            @ApiParam(name = "patientName", value = "居民姓名") @RequestParam(value = "patientName", required = true) String patientName,
            @ApiParam(name = "doctor", value = "医生id") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "orgCode", value = "机构id") @RequestParam(value = "orgCode", required = true) String orgCode,
            @ApiParam(name = "orgName", value = "机构名称") @RequestParam(value = "orgName", required = true) String orgName,
            @ApiParam(name = "recordDate", value = "记录日期 格式 yyyy-MM-dd") @RequestParam(value = "recordDate", required = true) String recordDate) {
        try {
            return success("新增成功",nurseryLogService.addNurseryLog(patient, patientName, doctor, doctorName, orgCode, orgName, recordDate));
        } catch (Exception e) {
            return  failedException(e);
        }
    }
    @PostMapping("addCourseRecord")
    @ApiOperation(value = "新增课程记录")
    public Envelop addCourseRecord(
            @ApiParam(name = "id", value = "托育日志id") @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "content", value = "课程记录内容") @RequestParam(value = "content", required = true) String content,
            @ApiParam(name = "enclosure", value = "附件") @RequestParam(value = "enclosure", required = false) String enclosure) {
        try {
            return success("新增成功",nurseryLogService.addCourseRecord(id, content, enclosure));
        } catch (Exception e) {
            return  failedException(e);
        }
    }
    @PostMapping("addDietRecord")
    @ApiOperation(value = "新增饮食记录")
    public Envelop addDietRecord(
            @ApiParam(name = "id", value = "托育日志id") @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "eatFood", value = "食用食物") @RequestParam(value = "eatFood", required = true) String eatFood,
            @ApiParam(name = "eatType", value = "进食方式") @RequestParam(value = "eatType", required = true) String eatType,
            @ApiParam(name = "enclosure", value = "附件") @RequestParam(value = "enclosure", required = true) String enclosure,
            @ApiParam(name = "intake", value = "摄入量") @RequestParam(value = "intake", required = false) String intake,
            @ApiParam(name = "additionalNotes", value = "附加说明") @RequestParam(value = "additionalNotes", required = false) String additionalNotes) {
        try {
            return success("新增成功",nurseryLogService.addDietRecord(id, eatFood, eatType, enclosure, intake, additionalNotes));
        } catch (Exception e) {
            return  failedException(e);
        }
    }
    @GetMapping(value = "nurseryDetail")
    @ApiOperation("获取课程记录详情")
    public Envelop nurseryDetail(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.nurseryDetail(id));
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "findRecordByNurseryLogId")
    @ApiOperation("根据托育日志id查找")
    public Envelop findRecordByNurseryLogId(@ApiParam(name = "id", value = "id")
                                                   @RequestParam(value = "id", required = true) String id,
                                               @ApiParam(name = "type", value = "类型 diet饮食记录 course课程记录")
                                               @RequestParam(value = "type", required = true) String type){
        try {
            return nurseryLogService.findRecordByNurseryLogId(id,type);
        }catch (Exception e){
            return  failedException(e);
        }
    }
}

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

@ -133,4 +133,37 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "getTeacherChildren")
    @ApiOperation(value = "教师通讯录-我的儿童")
    public PageEnvelop getTeacherChildren(
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor",required = true) String doctor,
            @ApiParam(name = "searchType", value = "0未入学 1已入学")
            @RequestParam(value = "searchType",defaultValue = "0") int searchType,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size
    ){
        try {
            return doctorService.getTeacherChildren(doctor,searchType,page,size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "getTeacherChildrenCount")
    @ApiOperation(value = "教师通讯录-我的儿童数量获取")
    public ObjEnvelop getTeacherChildrenCount(
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor",required = true) String doctor){
        try {
            return ObjEnvelop.getSuccess("查询成功",doctorService.getTeacherChildrenCount(doctor));
        }catch (Exception e){
            e.printStackTrace();
            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(

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

@ -206,6 +206,26 @@ public class PatientDoorCoachOrderController extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "dispatcherIntoTopic")
    @ApiOperation(value = "调度员进入会话")
    public ObjEnvelop dispatcherIntoTopic(
            @ApiParam(name = "orderId", value = "工单id", required = true) @RequestParam String orderId,
            @ApiParam(name = "hospitalName", value = "机构名称", required = true) @RequestParam String hospitalName,
            @ApiParam(name = "dispatcher", value = "调度员code", required = true) @RequestParam String dispatcher,
            @ApiParam(name = "dispatcherName", value = "调度员姓名", required = true) @RequestParam  String dispatcherName
    ) {
        try{
            JSONObject result = patientDoorCoachOrderService.dispatcherIntoTopic(orderId,hospitalName,dispatcher,dispatcherName);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("转接成功",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError("转接失败");
    }
    /**
     * 获取服务项目
     *

+ 10 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/ChildrenExaminationEndpoint.java

@ -1,6 +1,7 @@
package com.yihu.jw.care.endpoint.patient;
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,15 +11,20 @@ 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.
 */
@RestController
@RequestMapping("patient/examationRecord")
@Api(description = "儿童体检")
@RequestMapping("patient/examinationRecord")
@Api(description = "居民端儿童体检")
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("查询失败");
        }
    }
    
}

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

@ -0,0 +1,81 @@
package com.yihu.jw.care.endpoint.exam;
import com.yihu.jw.care.service.exam.ChildrenExaminationService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Bing on 2021/5/19.
 */
@RestController
@RequestMapping("doctor/examinationRecord")
@Api(description = "医生端-儿童体检")
public class DoctorChildrenExaminationEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ChildrenExaminationService examinationService;
    @PostMapping("newRecord")
    @ApiOperation("居民居家自建记录添加")
    public ObjEnvelop newRecord(@ApiParam(name="patient",value ="儿童id")
                                @RequestParam(value = "patient",required = true)String patient,
                                @ApiParam(name="examTime",value ="体检日期 yyyy-mm-dd")
                                @RequestParam(value = "examTime",required = false)String examTime,
                                @ApiParam(name="monthAge",value ="月龄")
                                @RequestParam(value = "monthAge",required = false)String monthAge,
                                @ApiParam(name="height",value ="身高")
                                @RequestParam(value = "height",required = false)String height,
                                @ApiParam(name="weight",value ="体重")
                                @RequestParam(value = "weight",required = false)String weight,
                                @ApiParam(name="headCircumference",value ="头围")
                                @RequestParam(value = "headCircumference",required = false)String headCircumference){
        try {
            return ObjEnvelop.getSuccess("新建成功",examinationService.newRecord(patient,examTime,monthAge,height,weight,headCircumference)) ;
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("新建记录失败");
        }
    }
    @GetMapping("getRecordDetailById")
    @ApiOperation("获取居民体检详情")
    public ObjEnvelop getRecordDetailById(@ApiParam(name="recordId",value ="体检id")
                                          @RequestParam(value = "recordId",required = true)String recordId){
        try {
            return ObjEnvelop.getSuccess("查询成功",examinationService.getRecordDetailById(recordId));
        }catch (Exception e){
            e.printStackTrace();;
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping("getRecordList")
    @ApiOperation("获取居民体检记录")
    public PageEnvelop getRecordList(@ApiParam(name="patient",value ="儿童id")
                                     @RequestParam(value = "patient",required = true)String patient,
                                     @ApiParam(name="type",value = "体检类型 1机构体检 2居家自检")
                                     @RequestParam(value = "type",required = false)String type,
                                     @ApiParam(name="orgCode",value = "体检机构")
                                     @RequestParam(value = "orgCode",required = false)String orgCode,
                                     @ApiParam(name="startTime",value = "yyyy-MM-dd hh:mm:ss")
                                     @RequestParam(value = "startTime",required = false)String startTime,
                                     @ApiParam(name="endTime",value = "yyyy-MM-dd hh:mm:ss")
                                     @RequestParam(value = "endTime",required = false)String endTime,
                                     @ApiParam(name = "page")
                                     @RequestParam(value = "page",defaultValue = "1")int page,
                                     @ApiParam(name = "size")
                                     @RequestParam(value = "size",defaultValue = "15")int size){
        try {
            return examinationService.getRecordList(patient,type,orgCode,startTime,endTime,page,size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
}

+ 56 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/DoctorMessageEndpoint.java

@ -1,18 +1,16 @@
package com.yihu.jw.care.endpoint.message;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.message.DoctorMessageService;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Bing on 2021/4/10.
@ -38,4 +36,56 @@ public class DoctorMessageEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "newOrgNotice")
    @ApiOperation("创建机构通知消息")
    public ObjEnvelop newOrgNotice(@ApiParam(name = "jsonDate", value = "消息通知json")
                               @RequestParam(value = "jsonDate", required = false) String jsonDate,
                               @ApiParam(name = "patients", value = "通知居民列表")
                               @RequestParam(value = "patients", required = false) String[] patients){
        try {
            JSONObject result = doctorMessageService.newOrgNotice(jsonDate,patients);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("查询成功",result.getJSONObject(ResponseContant.resultMsg));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败"+e.getMessage());
        }
    }
    @PostMapping(value = "getOrgNoticeList")
    @ApiOperation("获取机构通知消息")
    public PageEnvelop getOrgNoticeList(@ApiParam(name = "orgCode", value = "机构code")
                                       @RequestParam(value = "orgCode", required = true) String orgCode,
                                        @ApiParam(name = "createUser", value = "通知创建者")
                                       @RequestParam(value = "createUser", required = false) String createUser,
                                        @ApiParam(name = "beginTime", value = "提醒开始时间")
                                       @RequestParam(value = "beginTime", required = false) String beginTime,
                                        @ApiParam(name = "endTime", value = "提醒结束时间")
                                       @RequestParam(value = "endTime", required = false) String endTime,
                                        @ApiParam(name = "page", value = "page")
                                       @RequestParam(value = "page", required = true,defaultValue = "1") int page,
                                        @ApiParam(name = "size", value = "size")
                                       @RequestParam(value = "size", required = true,defaultValue = "15") int size){
        try {
            return doctorMessageService.getOrgNoticeList(orgCode,createUser,beginTime,endTime,page,size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败"+e.getMessage());
        }
    }
    @PostMapping(value = "orgNoticeDetail")
    @ApiOperation("获取机构通知消息详情")
    public ObjEnvelop orgNoticeDetail(@ApiParam(name = "noticeId", value = "通知id")
                                   @RequestParam(value = "noticeId", required = false) String noticeId){
        try {
            return ObjEnvelop.getSuccess("查询成功",doctorMessageService.orgNoticeDetail(noticeId));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败"+e.getMessage());
        }
    }
}

+ 60 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java

@ -0,0 +1,60 @@
package com.yihu.jw.care.endpoint.message;
import com.yihu.jw.care.service.message.PatientMessageService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by Bing on 2021/5/19.
 */
@RestController
@RequestMapping("patient/message")
@Api(description = "居民端消息")
public class PatientMessageEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private PatientMessageService patientMessageService;
    @PostMapping(value = "getNoticeList")
    @ApiOperation("获取患者机构通知消息")
    public PageEnvelop getNoticeList(@ApiParam(name = "patient", value = "患者id")
                                        @RequestParam(value = "patient", required = true) String patient,
                                        @ApiParam(name = "beginTime", value = "提醒开始时间")
                                        @RequestParam(value = "beginTime", required = false) String beginTime,
                                        @ApiParam(name = "endTime", value = "提醒结束时间")
                                        @RequestParam(value = "endTime", required = false) String endTime,
                                        @ApiParam(name = "page", value = "page")
                                        @RequestParam(value = "page", required = true,defaultValue = "1") int page,
                                        @ApiParam(name = "size", value = "size")
                                        @RequestParam(value = "size", required = true,defaultValue = "15") int size){
        try {
            return patientMessageService.getNoticeList(patient,beginTime,endTime,page,size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败"+e.getMessage());
        }
    }
    @PostMapping(value = "orgNoticeDetail")
    @ApiOperation("获取机构通知消息详情")
    public ObjEnvelop orgNoticeDetail(@ApiParam(name = "noticeId", value = "通知id")
                                      @RequestParam(value = "noticeId", required = false) String noticeId,
                                      @ApiParam(name = "patient", value = "patient")
                                      @RequestParam(value = "patient", required = false) String patient){
        try {
            return ObjEnvelop.getSuccess("查询成功",patientMessageService.orgNoticeDetail(noticeId,patient));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败"+e.getMessage());
        }
    }
}

+ 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;

+ 112 - 44
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;
    }
    /**
     * 添加上门辅导服务咨询
     *
@ -279,7 +248,7 @@ public class ConsultTeamService {
        //咨询详细信息
        ConsultTeamDo consultTeam = new ConsultTeamDo();
        consultTeam.setType(21);  //上门服务咨询
        consultTeam.setType(21);  //上门辅导咨询
        consultTeam.setRelationCode(doorServiceOrderDO.getId()); //关联业务code
        consultTeam.setSymptoms(doorServiceOrderDO.getServeDesc());
        consultTeam.setPatient(patient);
@ -327,18 +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){

+ 138 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java

@ -1,7 +1,9 @@
package com.yihu.jw.care.service.course;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.course.*;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
@ -10,19 +12,30 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.care.course.CourseSalesOrderRecordDO;
import com.yihu.jw.entity.care.course.PatientOrderRefundDO;
import com.yihu.jw.entity.care.course.RecruitStudentsRecordDO;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.care.course.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created with IntelliJ IDEA.
@ -56,6 +69,10 @@ public class CourseService {
    private BaseOrgDao orgDao;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    public String getOrderNo(String type){
        return type + System.currentTimeMillis()+(int)(Math.random() * 900)+100 +"";
@ -176,6 +193,127 @@ public class CourseService {
        return map;
    }
    /**
     * 课程详情
     * @param id
     * @return
     */
    public JSONObject courseDetail(String id){
        JSONObject result = new JSONObject();
        CourseDO courseDO = courseDao.findOne(id);
        if(!"1".equals(courseDO.getType())){
            List<CourseCatalogueDO> catalogueDOList = courseCatalogueDao.findByCourserId(id);
            courseDO.setCatalogueDOList(catalogueDOList);
        }
        result.put("courseDO",courseDO);
        return result;
    }
    /**
     * 开启直播课程
     * @param id
     */
    public void startLiveCourse(String id){
        CourseDO courseDO = courseDao.findOne(id);
        courseDO.setLiveStatus("2");
        courseDao.save(courseDO);
    }
    /**
     * 结束直播课程
     * @param id
     */
    public void endLiveCourse(String id){
        CourseDO courseDO = courseDao.findOne(id);
        courseDO.setLiveStatus("3");
        courseDao.save(courseDO);
    }
    /**
     * 新增课程
     * @param doctorId
     * @param jsonData
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public JSONObject addCourse(String doctorId,String jsonData){
        JSONObject result = new JSONObject();
        JSONObject json = JSON.parseObject(jsonData);
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctorId);
        CourseDO courseDO = null;
        try{
            courseDO = objectMapper.readValue(json.getJSONObject("course").toString(), CourseDO.class);
        }catch (Exception e){
            e.printStackTrace();
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "传参有误");
        }
        courseDO.setStatus("1");
        courseDO.setDel(1);
        courseDO.setDoctor(doctorId);
        courseDO.setDoctorName(doctorDO.getName());
        courseDO.setOrgCode(baseDoctorHospitalDO.get(0).getOrgCode());
        courseDO.setOrgName(baseDoctorHospitalDO.get(0).getOrgName());
        courseDO.setCreateTime(new Date());
        courseDO.setCreateUser(doctorId);
        courseDO.setCreateUserName(doctorDO.getName());
        if("1".equals(courseDO.getType())){
            //直播课程
            courseDO.setLiveStatus("1");
        }
        List<CourseCatalogueDO> catalogueDOList = courseDO.getCatalogueDOList();
        courseDao.save(courseDO);
        if(catalogueDOList!=null&&catalogueDOList.size()>0){
            for (CourseCatalogueDO catalogueDO : catalogueDOList){
                catalogueDO.setCourserId(catalogueDO.getId());
                catalogueDO.setType(courseDO.getType());
                catalogueDO.setCreateTime(new Date());
            }
            courseCatalogueDao.save(catalogueDOList);
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        return result;
    }
    /**
     * 教师我的课程
     * @param doctor
     * @param page
     * @param size
     * @return
     */
    public JSONObject myCourseList(String doctor,String type, int page, int size) {
        JSONObject result = new JSONObject();
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 3 : size;
        String filter = " where a.doctor = '"+doctor+"' ";
        if(!StringUtil.isBlank(type)){
            filter += " and a.type = '"+type+"' ";
        }
        String sql = "SELECT * from base_course a " +filter +
                " ORDER BY a.create_time desc " +
                " LIMIT {start},{end};";
        String finalSql = sql.replace("{start}", String.valueOf(start))
                .replace("{end}", String.valueOf(end));
        String countSql = "SELECT count(a.id) FROM base_course a " +filter ;
        List<CourseDO> sqlResultlist = jdbcTemplate.query(finalSql,new BeanPropertyRowMapper<>(CourseDO.class));
        Long count = jdbcTemplate.queryForObject(countSql, Long.class);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, sqlResultlist);
        JSONObject countItem = new JSONObject();
        countItem.put("count", count);
        result.putAll(countItem);
        return result;
    }
    /**
     * 居民我的订单列表

+ 285 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/NurseryLogService.java

@ -0,0 +1,285 @@
package com.yihu.jw.care.service.course;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.course.NurseryLogDao;
import com.yihu.jw.care.dao.course.PatientCourseRecordDao;
import com.yihu.jw.care.dao.course.PatientDietRecordDao;
import com.yihu.jw.entity.care.course.NurseryLogDO;
import com.yihu.jw.entity.care.course.PatientCourseRecordDO;
import com.yihu.jw.entity.care.course.PatientDietRecordDO;
import com.yihu.jw.entity.care.course.RecruitStudentsRecordDO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
@Service
public class NurseryLogService {
    @Autowired
    private NurseryLogDao nurseryLogDao;
    @Autowired
    private PatientDietRecordDao patientDietRecordDao;
    @Autowired
    private PatientCourseRecordDao patientCourseRecordDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 根据托育日志id查找
     * @param id
     * @return
     */
    public ObjEnvelop findRecordByNurseryLogId(String id,String type){
        if("diet".equals(type)){
            List<PatientDietRecordDO> dietRecordDOs = patientDietRecordDao.findByNurseryLogId(id);
            if(dietRecordDOs.size()>0){
                return ObjEnvelop.getSuccess("",dietRecordDOs.get(0));
            }
        }else if("course".equals(type)){
            List<PatientCourseRecordDO> courseRecordDOs = patientCourseRecordDao.findByNurseryLogId(id);
            if(courseRecordDOs.size()>0){
                return ObjEnvelop.getSuccess("",courseRecordDOs.get(0));
            }
        }
        return ObjEnvelop.getError("未找到记录");
    }
    /**
     * 获取课程记录详情
     * @param id
     * @return
     */
    public JSONObject nurseryDetail(String id){
        JSONObject json = new JSONObject();
        NurseryLogDO nurseryLogDO = nurseryLogDao.findOne(id);
        json.put("nurseryLog",nurseryLogDO);
        List<PatientDietRecordDO> dietRecordDOs = patientDietRecordDao.findByNurseryLogId(id);
        List<PatientCourseRecordDO> courseRecordDOs = patientCourseRecordDao.findByNurseryLogId(id);
        json.put("diet",dietRecordDOs.size());
        json.put("course",courseRecordDOs.size());
        return json;
    }
    /**
     * 新增托育日志
     * @param patient
     * @param patientName
     * @param doctor
     * @param doctorName
     * @param orgCode
     * @param orgName
     * @param recordDate
     * @return
     */
    public NurseryLogDO addNurseryLog(String patient,String patientName, String doctor,String doctorName,String orgCode,String orgName,String recordDate) {
        NurseryLogDO nurseryLogDO = new NurseryLogDO();
        nurseryLogDO.setPatient(patient);
        nurseryLogDO.setPatientName(patientName);
        nurseryLogDO.setDoctorName(doctorName);
        nurseryLogDO.setDoctor(doctor);
        nurseryLogDO.setOrgName(orgName);
        nurseryLogDO.setOrgCode(orgCode);
        nurseryLogDO.setRecordDate(recordDate);
        nurseryLogDO.setStatus("0");
        nurseryLogDO.setCreateTime(new Date());
        nurseryLogDao.save(nurseryLogDO);
        return nurseryLogDO;
    }
    /**
     * 新增课程记录
     * @return
     */
    public PatientCourseRecordDO addCourseRecord(String id,String content, String enclosure) {
        PatientCourseRecordDO recordDO = new PatientCourseRecordDO();
        recordDO.setCreateTime(new Date());
        recordDO.setContent(content);
        recordDO.setEnclosure(enclosure);
        recordDO.setNurseryLogId(id);
        patientCourseRecordDao.save(recordDO);
        return recordDO;
    }
    /**
     * 新增饮食记录
     * @return
     */
    public PatientDietRecordDO addDietRecord(String id,String eatFood,String eatType, String enclosure,String intake,String additionalNotes) {
        PatientDietRecordDO recordDO = new PatientDietRecordDO();
        recordDO.setCreateTime(new Date());
        recordDO.setEnclosure(enclosure);
        recordDO.setNurseryLogId(id);
        recordDO.setEatFood(eatFood);
        recordDO.setEatType(eatType);
        recordDO.setIntake(intake);
        recordDO.setAdditionalNotes(additionalNotes);
        patientDietRecordDao.save(recordDO);
        return recordDO;
    }
    /**
     *获取托育日志列表
     * @param orgCode
     * @return
     * @throws Exception
     */
    public List<NurseryLogDO> findNurseryLogList(String orgCode, String recordDate){
        String sql = "select * from base_nursery_log wf ";
        sql+= " where wf.org_code = '"+orgCode+"'";
        if(!StringUtil.isEmpty(recordDate)){
            sql+=" and wf.record_date ='"+recordDate+"'";
        }
        sql+=" order by wf.create_time desc";
        List<NurseryLogDO> nurseryLogDOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(NurseryLogDO.class));
        return nurseryLogDOs;
    }
    /**
     * 获取未填写日志列表
     * @param orgCode
     */
    public JSONArray nuseryLogUnFilledIn(String orgCode,String recordDate){
        JSONArray jsonArray = new JSONArray();
        String sql ="SELECT * from base_recruit_students_record " +
                "where org_code = '"+orgCode+"' and `status` in ('3','6') and del =1";
        List<RecruitStudentsRecordDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RecruitStudentsRecordDO.class));
        List<NurseryLogDO> nurseryLogDOs = findNurseryLogList(orgCode, recordDate);
        List<String> nurseryList = nurseryLogDOs.stream().map(NurseryLogDO::getPatient).collect(Collectors.toList());
        for(RecruitStudentsRecordDO recordDO:list){
            if(nurseryList.contains(recordDO.getPatient())){
                continue;
            }
            JSONObject json = new JSONObject();
            json.put("patient",recordDO.getPatient());
            json.put("patientName",recordDO.getPatientName());
            jsonArray.add(json);
        }
        return jsonArray;
    }
    /**
     *获取托育日志按月日历形式
     * @param orgCode
     * @param startTime
     * @param endTime
     * @return
     * @throws Exception
     */
    public Map<String,Object> findNurseryLogByMonth(String orgCode, String patient,  String patientName, String startTime, String endTime)throws Exception{
        String sql = "select * from base_nursery_log wf ";
        sql+= " where wf.org_code = '"+orgCode+"'";
        if(!StringUtil.isEmpty(patient)){
            sql+=" and wf.patient_code = '"+patient+"'";
        }
        if(!StringUtil.isEmpty(patientName)){
            sql+=" and wf.patient_name like '%"+patientName+"%'";
        }
        if(!StringUtil.isEmpty(startTime)){
            sql+=" and wf.record_date >='"+startTime+"'";
        }
        if(!org.apache.commons.lang.StringUtils.isEmpty(endTime)){
            Date currentTime = DateUtil.strToDate(endTime + " 23:59:59");
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String dateString = formatter.format(currentTime);
            sql+=" and wf.record_date <='"+dateString+"'";
        }
        sql+=" order by wf.create_time desc";
        List<NurseryLogDO> nurseryLogDOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(NurseryLogDO.class));
        //按时间分组
        Map<String,Object> date = sortNurseryLogByDate(nurseryLogDOs);
        //统计每一天完成数与计划数目
        if(date!=null&&date.size()>0){
            for(String key : date.keySet()){
                //获取一天的数据
                Map<String,Object> d = (Map<String,Object>)date.get(key);
                // 获取一天随访数据
                List<NurseryLogDO> dateFollowups = (List<NurseryLogDO>)d.get("nurserys");
                //统计一天各项纬度指标
                List<Map<String,Object>> statistics = new ArrayList<>();
                //统计单条
                Map<String,Object> fs = sortNurseryLogList(dateFollowups);
                Integer count = (Integer)fs.get("count");
                if(count!=0){
                    statistics.add(fs);
                }
                d.put("statistics",statistics);
            }
        }
        return date;
    }
    public Map<String,Object> sortNurseryLogByDate(List<NurseryLogDO> nurseryLogDOs){
        //按时间分组
        Map<String,Object> date = new HashedMap();
        if(nurseryLogDOs!=null&&nurseryLogDOs.size()>0){
            Iterator it = nurseryLogDOs.iterator();
            while (it.hasNext()){
                NurseryLogDO nurseryLogDO = (NurseryLogDO)it.next();
                //1.获取日期分组
                Map<String,Object> dateNurserys = (Map<String,Object>)date.get(nurseryLogDO.getRecordDate());
                //判断随访时间是否已经创建分组
                if(dateNurserys!=null&&dateNurserys.size()>0){
                    //同一天时间已经有分组则加入list
                    List<NurseryLogDO> list = (List<NurseryLogDO>)dateNurserys.get("nurserys");
                    list.add(nurseryLogDO);
                }else{
                    //同一天的时间没有该分组则创建这天的随访计划List
                    Map<String,Object> newdateNursery = new HashedMap();
                    List<NurseryLogDO> dateNurseryLogs = new ArrayList<>();
                    dateNurseryLogs.add(nurseryLogDO);
                    newdateNursery.put("nurserys",dateNurseryLogs);
                    date.put(nurseryLogDO.getRecordDate(),newdateNursery);
                }
            }
        }
        return date;
    }
    public Map<String,Object> sortNurseryLogList(List<NurseryLogDO> nurseryLogDOs){
        //统计完成数
        Integer compeleCount = 0;
        //总数
        Integer count = 0;
        //迭代数组
        List<NurseryLogDO> rs = new ArrayList<>();
        if(nurseryLogDOs!=null&&nurseryLogDOs.size()>0){
            Iterator it = nurseryLogDOs.iterator();
            while (it.hasNext()){
                NurseryLogDO nurseryLogDO = (NurseryLogDO)it.next();
                rs.add(nurseryLogDO);
                if("1".equals(nurseryLogDO.getStatus())){
                    compeleCount++;
                }
            }
            //设置总数
            count = rs.size();
        }
        Map<String,Object> mapFollow =new HashedMap();
        mapFollow.put("compeleCount",compeleCount);
        mapFollow.put("count",count);
        return mapFollow;
    }
}

+ 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("暂不支持该指标!");
                }

+ 76 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java

@ -1,7 +1,6 @@
package com.yihu.jw.care.service.doctor;
import com.alibaba.fastjson.JSONObject;
import com.sun.xml.internal.rngom.parse.host.Base;
import com.yihu.jw.care.service.role.RoleService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
@ -22,6 +21,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -171,7 +171,11 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
           sql+=" and org.type in(1,2) ";
        }
        else {
            sql+=" and org.type='"+orgType+"' ";
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){
                sql += " and org.code = '"+doctorOrg.get(0)+"' and org.type='"+orgType+"'  ";
            }else {
                sql+=" and org.type='"+orgType+"' ";
            }
        }
        sql+=" ORDER BY org.`code` asc";
@ -219,4 +223,74 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        return result;
    }
    public PageEnvelop getTeacherChildren(String doctor,int searchType,int page,int size){
        page = page>0?page-1:0;
        List<Map<String,Object>> list = new ArrayList<>();
        //未入学
        String sql0 = "select Distinct sor.patient from base_course_sales_order_record sor INNER JOIN base_course bc on sor.course_id = bc.id " +
                " and bc.del=1 where bc.doctor ='"+doctor+"'  and sor.`status` =5 and not EXISTS (select DISTINCT rsr.patient " +
                " from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` and org.del=1 " +
                " INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where rsr.patient=sor.patient and " +
                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 3  )";
        //已入学
        String sql1=" select DISTINCT rsr.patient from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " +
                "and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where dh.doctor_code='"+doctor+"' " +
                "and rsr.del<>0  and rsr.`status` = 3 GROUP BY dh.doctor_code  ";
        String sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 GROUP BY p.id ";
        String sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  ";
        Long count = 0L;
        if (0==searchType){
            list = jdbcTemplate.queryForList(sql.replace("{sqlReplace}",sql0));
            count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql0),Long.class);
        }
        if (1==searchType){//
            list = jdbcTemplate.queryForList(sql.replace("{sqlReplace}",sql1));
            count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql1),Long.class);
        }
        for (Map<String,Object>map:list){
            if (map.get("idcard")!=null){
                String idcard = map.get("idcard").toString();
                map.put("age", IdCardUtil.getAgeForIdcard(idcard));
            }else {
                map.put("age", null);
            }
            if (map.get("deviceType")!=null){
                if ("1,2".equals(map.get("deviceType").toString())){
                    map.put("deviceType",3);//deviceType 设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                }
                else {
                    map.put("deviceType",Integer.valueOf(map.get("deviceType").toString()));
                }
            }
            else {
                map.put("deviceType",0);
            }
        }
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
    }
    public Map<String,Long> getTeacherChildrenCount(String doctor){
        Map<String,Long> result = new HashMap<>();
        //未入学
        String sql0 = "select Distinct sor.patient from base_course_sales_order_record sor INNER JOIN base_course bc on sor.course_id = bc.id " +
                " and bc.del=1 where bc.doctor ='"+doctor+"'  and sor.`status` =5 and not EXISTS (select DISTINCT rsr.patient " +
                " from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` and org.del=1 " +
                " INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where rsr.patient=sor.patient and " +
                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 3  )";
        //已入学
        String sql1=" select DISTINCT rsr.patient from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " +
                "and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where dh.doctor_code='"+doctor+"' " +
                "and rsr.del<>0  and rsr.`status` = 3 GROUP BY dh.doctor_code  ";
        String sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  ";
        Long count = 0L;
        count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql0),Long.class);
        result.put("notEnrol",count);
        count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql1),Long.class);
        result.put("enrol",count);
        return result;
    }
}

+ 64 - 7
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;
@ -652,9 +707,10 @@ public class DoctorDoorCoachOrderService {
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Map<String, Integer> map = new HashMap<>();
        Integer all = list.size();
        Integer waitForServe = 0;
        Integer served = 0;
        Integer cancel = 0;
        Integer waitForAccept = 0;//待接单
        Integer waitForServe = 0;//待服务
        Integer served = 0;//已完成
        Integer cancel = 0;//已取消
        // -1已取消 [1,4]待服务 [5,6]已服务
       for (Map<String, Object> tmp:list){
           switch (String.valueOf(tmp.get("status"))){
@ -662,10 +718,10 @@ public class DoctorDoorCoachOrderService {
                   cancel += Integer.valueOf(tmp.get("num").toString()) ;
                   break;
               case "1":
                   waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                   waitForAccept += Integer.valueOf(tmp.get("num").toString()) ;
                   break;
               case "2":
                   waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                   waitForAccept += Integer.valueOf(tmp.get("num").toString()) ;
                   break;
               case "3":
                   waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
@ -674,7 +730,7 @@ public class DoctorDoorCoachOrderService {
                   waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                   break;
               case "5":
                   served += Integer.valueOf(tmp.get("num").toString()) ;
                   waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                   break;
               case "6":
                   served += Integer.valueOf(tmp.get("num").toString()) ;
@ -685,6 +741,7 @@ public class DoctorDoorCoachOrderService {
           }
       }
       map.put("all",all);
       map.put("waitForAccept",waitForAccept);
       map.put("waitForServe",waitForServe);
       map.put("served",served);
       map.put("cancel",cancel);

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

@ -12,8 +12,6 @@ import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.care.doorCoach.*;
import com.yihu.jw.entity.door.WlyyDoorFeeDetailDO;
import com.yihu.jw.entity.door.WlyyDoorOrderItemDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.dao.ConsultDao;
@ -793,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);
@ -961,6 +959,40 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
    }
    /**
     * 调度员进入聊天室
     * @param dispatcher
     * @param orderId
     */
    public JSONObject dispatcherIntoTopic(String orderId, String hospitalName, String dispatcher, String dispatcherName) {
        JSONObject result = new JSONObject();
        BaseDoorCoachOrderDO orderDO = baseDoorCoachOrderDao.findOne(orderId);
        if (null == orderDO) {
            String failMsg = "调度员进入聊天室时,找不到对应工单,工单id=" + orderId;
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        }
        ConsultDo consult = consultDao.queryByRelationCode(orderId);
        String sessionId = orderDO.getPatient() + "_" + consult.getId() + "_"  + orderDO.getNumber() +  "_" +  consult.getType();
        // 把调度员拉入会话,作为其中一个成员,第一个进入会话的调度员,系统发送欢迎语和居民的预约卡片信息
        if (org.apache.commons.lang3.StringUtils.isEmpty(orderDO.getDispatcher())) {
            orderDO.setDispatcher(dispatcher);
            orderDO.setDispatcherName(dispatcherName);
            this.save(orderDO);
            // 先进入会话,再聊天
            imUtill.updateParticipantNew(sessionId,dispatcher,null);
            String noticeContent = hospitalName + dispatcherName + "为您服务";
            this.qucikSendIM(orderId, dispatcher, "智能助手", "1", noticeContent);
        }
        // 把调度员拉入会话,作为其中一个成员
        imUtill.updateParticipantNew(sessionId,dispatcher,null);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, "调度员["+dispatcherName+"]进入会话成功");
        return result;
    }
    /**
     * 工单与服务项费用关联关系
     *
@ -1002,11 +1034,6 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
                JSONObject oneJson = (JSONObject)one;
                try {
                    feeDetailDO = EntityUtils.jsonToEntity(one.toString(), BaseDoorCoachFeeDetailDO.class);
                    WlyyDoorOrderItemDO orderItemDO = new WlyyDoorOrderItemDO();
                    orderItemDO.setDoctor(order.getDoctor());
                    orderItemDO.setCode(feeDetailDO.getCode());
                    orderItemDO.setCreateTime(new Date());
                    orderItemDO.setPatient(order.getPatient());
                } catch (Exception e) {
                    result.put(ResponseContant.resultFlag, ResponseContant.fail);
                    String failMsg = "工单与服务费用关联关系时," + e.getMessage();
@ -1112,9 +1139,10 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Map<String, Integer> map = new HashMap<>();
        Integer all = list.size();
        Integer waitForServe = 0;
        Integer served = 0;
        Integer cancel = 0;
        Integer waitForAccept = 0;//待接单
        Integer waitForServe = 0;//待服务
        Integer served = 0;//已完成
        Integer cancel = 0;//已取消
        // -1已取消 [1,4]待服务 [5,6]已服务
        for (Map<String, Object> tmp:list){
            switch (String.valueOf(tmp.get("status"))){
@ -1122,10 +1150,10 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
                    cancel += Integer.valueOf(tmp.get("num").toString()) ;
                    break;
                case "1":
                    waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                    waitForAccept += Integer.valueOf(tmp.get("num").toString()) ;
                    break;
                case "2":
                    waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                    waitForAccept += Integer.valueOf(tmp.get("num").toString()) ;
                    break;
                case "3":
                    waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
@ -1134,7 +1162,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
                    waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                    break;
                case "5":
                    served += Integer.valueOf(tmp.get("num").toString()) ;
                    waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                    break;
                case "6":
                    served += Integer.valueOf(tmp.get("num").toString()) ;
@ -1145,6 +1173,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
            }
        }
        map.put("all",all);
        map.put("waitForAccept",waitForAccept);
        map.put("waitForServe",waitForServe);
        map.put("served",served);
        map.put("cancel",cancel);

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/exam/ChildrenExaminationService.java

@ -45,8 +45,8 @@ public class ChildrenExaminationService extends BaseJpaService<ChildrenExaminati
    public PageEnvelop getRecordList(String patient,String type,String orgCode,String startTime,String endTime,int page,int size){
        page=page>0?page-1:0;
        String sql = "select id,patient,type,exam_time examTime,org_code orgCode,org_name orgName,month_age monthAge,height,weight, " +
                "head_circumference headCircumference,create_time createTime from base_children_examination_record where patient ='"+patient+"' ";
        String sql = "select id,patient,type,DATE_FORMAT(exam_time,'%Y-%m-%d %H:%i:%S') examTime,org_code orgCode,org_name orgName,month_age monthAge,height,weight, " +
                "head_circumference headCircumference,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') createTime from base_children_examination_record where patient ='"+patient+"' ";
        String sqlCount = "select count(id) from base_children_examination_record where patient ='"+patient+"' ";
        String sqlCondition=" ";
        if (StringUtils.isNotBlank(type)){

+ 71 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java

@ -2,19 +2,25 @@ package com.yihu.jw.care.service.message;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.dao.apply.PatientBedApplyDao;
import com.yihu.jw.care.dao.message.OrgNoticeDao;
import com.yihu.jw.care.dao.message.UserNoticeDao;
import com.yihu.jw.care.dao.security.SecurityMonitoringOrderDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.notice.UserNoticeDO;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.entity.EntityUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.persistence.criteria.CriteriaBuilder;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@ -35,6 +41,10 @@ public class DoctorMessageService {
    private PatientBedApplyDao patientBedApplyDao;
    @Autowired
    private SecurityMonitoringOrderDao securityMonitoringOrderDao;
    @Autowired
    private OrgNoticeDao orgNoticeDao;
    @Autowired
    private UserNoticeDao userNoticeDao;
    /**
     *
@ -150,7 +160,7 @@ public class DoctorMessageService {
                        "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,\n" +
                        "base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and \n" +
                        "r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' \n" +
                        "and m.doctor_code = '13' and m.del = '1') ";
                        "and m.doctor_code = '"+doctor+"' and m.del = '1') ";
            }
            List<Map<String,Object>> sqlResult  = jdbcTemplate.queryForList(sql);
@ -177,7 +187,7 @@ public class DoctorMessageService {
                        "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,\n" +
                        "base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and \n" +
                        "r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' \n" +
                        "and m.doctor_code = '13' and m.del = '1')";
                        "and m.doctor_code = '"+doctor+"' and m.del = '1')";
            }
            List<Map<String,Object>> sqlResult  = jdbcTemplate.queryForList(sql);
@ -211,4 +221,61 @@ public class DoctorMessageService {
        return result;
    }
    public JSONObject newOrgNotice(String jsonDate, String[] patients){
        JSONObject result = new JSONObject();
        OrgNoticeDO orgNoticeDO = new OrgNoticeDO();
        try{
            orgNoticeDO  = EntityUtils.jsonToEntity(jsonDate, OrgNoticeDO.class);
        }catch (Exception e){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "参数转换成JSON对象异常:" + e.getMessage();
            result.put(ResponseContant.resultMsg, failMsg);
            return result;
        }
        orgNoticeDao.save(orgNoticeDO);
        for(String user:patients){
            UserNoticeDO userNoticeDO = new UserNoticeDO();
            userNoticeDO.setUserId(user);
            userNoticeDO.setDel(1);
            userNoticeDO.setIsRead(0);
            userNoticeDO.setNoticeId(orgNoticeDO.getId());
            userNoticeDao.save(userNoticeDO);
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        JSONObject Msg = JSONObject.parseObject(JSON.toJSONStringWithDateFormat(orgNoticeDO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
        result.put(ResponseContant.resultMsg, Msg);
        return result;
    }
    public PageEnvelop getOrgNoticeList(String orgCode,String createUser,String beginTime,String endTime,int page,int size){
        page = page>0?page-1:0;
        String sqlCount = "select count(id) from base_org_notice where del=1 ";
        String sql = "select id,title,org_code orgCode,org_name orgName,DATE_FORMAT(notice_time,'%Y-%m-%d %H:%i:%S') noticeTime,content,img from base_org_notice where del=1 ";
        String sqlCondition ="";
        if (StringUtils.isNotBlank(orgCode)){
            sqlCondition += " and org_code = '"+orgCode+"' ";
        }
        if (StringUtils.isNotBlank(createUser)){
            sqlCondition += " and create_user = '"+createUser+"' ";
        }
        if (StringUtils.isNotBlank(beginTime)){
            sqlCondition += " and notice_time >= '"+beginTime+"' ";
        }
        if (StringUtils.isNotBlank(endTime)){
            sqlCondition += " and notice_time <= '"+endTime+"' ";
        }
        if (StringUtils.isBlank(beginTime)&&StringUtils.isBlank(endTime)){
            String time = DateUtil.getStringDate();
            sqlCondition += " and notice_time <= '"+time+"' ";
        }
        Long count = jdbcTemplate.queryForObject(sqlCount+sqlCondition,Long.class);
        sqlCondition += " order by notice_time desc limit "+page*size+","+size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+sqlCondition);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
    }
    public OrgNoticeDO orgNoticeDetail(String noticeId){
        return orgNoticeDao.findOne(noticeId);
    }
}

+ 67 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java

@ -0,0 +1,67 @@
package com.yihu.jw.care.service.message;
import com.yihu.jw.care.dao.message.OrgNoticeDao;
import com.yihu.jw.care.dao.message.UserNoticeDao;
import com.yihu.jw.entity.base.notice.UserNoticeDO;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * Created by Bing on 2021/5/19.
 */
@Service
public class PatientMessageService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private OrgNoticeDao orgNoticeDao;
    @Autowired
    private UserNoticeDao userNoticeDao;
    public PageEnvelop getNoticeList(String patient,String beginTime, String endTime, int page, int size){
        page = page>0?page-1:0;
        String sqlCount = "select count(t.id) from base_org_notice t INNER JOIN base_user_notice usno on t.id = CONVERT(usno.notice_id USING utf8) and usno.del=1 " +
                "where t.del=1 ";
        String sql = "select t.id,t.title,t.org_code orgCode,t.org_name orgName,DATE_FORMAT(t.notice_time,'%Y-%m-%d %H:%i:%S') noticeTime, " +
                "t.content,t.img,usno.is_read isRead from base_org_notice t INNER JOIN base_user_notice usno on t.id = CONVERT(usno.notice_id USING utf8) " +
                "and usno.del=1 where t.del=1 ";
        String sqlCondition ="";
        if (StringUtils.isNotBlank(patient)){
            sqlCondition += " and usno.user_id = '"+patient+"' ";
        }
        if (StringUtils.isNotBlank(beginTime)){
            sqlCondition += " and t.notice_time >= '"+beginTime+"' ";
        }
        if (StringUtils.isNotBlank(endTime)){
            sqlCondition += " and t.notice_time <= '"+endTime+"' ";
        }
        String time = DateUtil.getStringDate();
        sqlCondition += " and t.notice_time <= '"+time+"' ";
        Long count = jdbcTemplate.queryForObject(sqlCount+sqlCondition,Long.class);
        sqlCondition += " order by t.notice_time desc limit "+page*size+","+size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+sqlCondition);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
    }
    public OrgNoticeDO orgNoticeDetail(String noticeId,String patient){
        OrgNoticeDO orgNoticeDO =  orgNoticeDao.findOne(noticeId);
        if (orgNoticeDO!=null){
            UserNoticeDO userNoticeDO =  userNoticeDao.findByNoticeIdAndUserIdAndDel(orgNoticeDO.getId(),patient,1);
            if (userNoticeDO!=null){
                userNoticeDO.setIsRead(1);
                userNoticeDao.save(userNoticeDO);
            }
        }
        return orgNoticeDO;
    }
}

+ 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"
 *   }
 * }
 */

+ 4 - 0
svr/svr-cloud-care/src/main/resources/application.yml

@ -74,6 +74,10 @@ fast-dfs:
configDefault: # 默认配置
  saasId: xmjkzl_saasId
tencent:
  secretId: AKIDa1C6k7D2astd6JGvKRJvFJ6dsrZ1C5h2
  secretKey: 7xWpsd7KGC3f16vUq0ucARRAcnhKfjX4
---
spring:
  profiles: jwdev

+ 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 = "作废处方")

+ 0 - 105
web-gateway/src/main/java/com/yihu/jw/controller/base/login/LoginContorller.java

@ -1,105 +0,0 @@
package com.yihu.jw.controller.base.login;
import com.yihu.base.security.properties.SecurityProperties;
import com.yihu.base.security.sms.mobile.MobileCheck;
import com.yihu.base.security.sms.process.SmsValidateCodeProcessor;
import com.yihu.jw.common.base.base.BaseContants;
import com.yihu.jw.fegin.base.base.FunctionFeign;
import com.yihu.jw.fegin.base.login.LoginFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.base.BaseEnvelop;
import com.yihu.jw.rm.base.BaseLoginRequestMapping;
import com.yihu.jw.rm.base.BaseUserRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.request.ServletWebRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * Created by 刘文彬 on 2018/4/20.
 */
@RestController
@RequestMapping(BaseLoginRequestMapping.api_gateway_common)
@Api(value = "登录模块", description = "登录模块")
public class LoginContorller {
    @Autowired
    private LoginFeign loginFeign;
    @Autowired
    private MobileCheck mobileCheck;
    @Autowired
    private SmsValidateCodeProcessor smsValidateCodeProcessor;
    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_checkoutInfo, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "注册校验信息", notes = "注册校验姓名、身份证、医保卡号信息")
    public BaseEnvelop checkoutInfo(@ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc,
                                @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard){
        return loginFeign.checkoutInfo(ssc,idcard);
    }
    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_accountSub, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "注册账号", notes = "注册校验姓名、身份证、医保卡号信息")
    public Envelop register(
            @ApiParam(name = "mobilePhone", value = "电话号码(账号)", required = true) @RequestParam(value = "mobilePhone", required = true) String mobilePhone,
            @ApiParam(name = "saasId", value = "saasID", required = true) @RequestParam(value = "saasId", required = true) String saasId,
            @ApiParam(name = "type", value = "1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录", required = true) @RequestParam(value = "type", required = true) int type,
            @ApiParam(name = "captcha", value = "短信验证码", required = true) @RequestParam(value = "captcha", required = true) String captcha,
            @ApiParam(name = "name", value = "姓名", required = true) @RequestParam(value = "name", required = true) String name,
            @ApiParam(name = "password", value = "账户密码", required = true) @RequestParam(value = "password", required = true) String password,
            @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard,
            @ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc) {
        return loginFeign.register(mobilePhone,saasId,type,captcha,name,password,idcard,ssc);
    }
    @PostMapping(BaseLoginRequestMapping.BaseLoginAccount.mobileSendSms)
    @ApiOperation(value = "发送短信登录的验证码", notes = "不走校验框架")
    public BaseEnvelop createCode(@ApiParam(name = "mobile", value = "手机号", required = true) @RequestParam(value = "mobile", required = true) String mobile,
                                  HttpServletRequest request, HttpServletResponse response) throws Exception{
        //验证手机号是否正确
        String[] mobileSaas = mobile.split(",");
        if (!mobileCheck.checkMobile(mobileSaas[0])) {
            return BaseEnvelop.getError("手机格式错误!");
        } else {
            //发送短信验证码并且保存到redis中
            smsValidateCodeProcessor.create(new ServletWebRequest(request, response));
            return BaseEnvelop.getSuccess("发送成功!");
        }
    }
    @PostMapping(BaseLoginRequestMapping.BaseLoginAccount.api_login)
    public Envelop login(@ApiParam(name = "mobilePhone", value = "电话号码(账号)", required = false) @RequestParam(value = "mobilePhone", required = false) String mobilePhone,
                       @ApiParam(name = "password", value = "password", required = false) @RequestParam(value = "password", required = false) String password,
                       @ApiParam(name = "saasId", value = "saasID", required = true) @RequestParam(value = "saasId", required = true) String saasId,
                       @ApiParam(name = "captcha", value = "短信验证码", required = false) @RequestParam(value = "captcha", required = false) String captcha){
        //1 框架登录
        //2 base取用户信息
        return loginFeign.login(mobilePhone,password,saasId,captcha);
    }
//    @PostMapping("/logout")
//    public Envelop logout(){
//        HttpHeaders headers = new HttpHeaders();
//        headers.add("Accept", "*/*");
//        headers.add("Cache-Control", "no-cache");
//        RestTemplate restTemplate = new RestTemplate();
//        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
//        //设置http请求实体
//        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
//        restTemplate.postForObject("http://localhost:8088/logout", requestEntity, String.class);
//        return new Envelop();
//    }
}

+ 0 - 110
web-gateway/src/main/resources/application.yml

@ -1,110 +0,0 @@
##如果有配置服务的话,远程服务器和本地服务器配置不一致的情况下,优先远程的为主
server:
  port: 8088
spring:
  application:
    name:  web-gateway #注册到发现服务的id 如果id一样 eurika会自动做负载
  jmx:
    default-domain: web-gateway
  http:
    multipart:
      enabled: true
      max-file-size: 500MB
      max-request-size: 500MB
#  data:
#    elasticsearch: #ElasticsearchProperties
#      cluster-name: jkzl #默认即为elasticsearch  集群名
#      cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
#      local: false #是否本地连接
#      properties: # Additional properties used to configure the client.
#        enable: true
#    # JEST (Elasticsearch HTTP client) (JestProperties)
#  elasticsearch:
#    jest:
#      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
##      uris: http://172.19.103.68:9200
#      connection-timeout: 60000 # Connection timeout in milliseconds.
#      multi-threaded: true
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
    database: 0
##开启feign断路器
feign:
  hystrix:
    enabled: true
management:
  security:
    enabled: false  #关闭 refresh的权限认证
hystrix:
  threadpool:
    default:
      coreSize: 500  #并发执行的最大线程数,默认10
  command:
    paas-file:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 3600000
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 308000  #命令执行超时时间,默认1000ms
ribbon:
  ReadTimeout: 300000
  ConnectTimeout: 5000
#zuul 默认会代理所有的微服务  路径 /{appliction.name}/**
#zuul:
#  ignored-services: '*'  ##忽略全部的代理  忽略单个微服务   ignored-services: svr-base 多个逗号分割
#  routes:
#    svr-base: /v1/base/**  ##svr-base方向代理到/base下多层级的路径
#    svr-wlyy: /v1/wlyy/**
#    api-esb-url:
#      path: /job/**
#      url: http://192.168.131.131:10030/
#      stripPrefix: false ##如果是物理服务器要设置成false
#    svr-base:    这种方式和  svr-base: /base/**  一样  svr-base可以随便写 唯一即可
#      path: /base/**  path是代理后的路径
#      serviceId: svr-base  serviceId是微服务name
#   svr-base: 这种方式和 上面一样 就是serviceId改成具体的url 但是这种配置方法不能利用eurika的负载均衡
#     path: /base/**
#     url: http://localhost:10020/
#svr-base: 这边是微服务ID  配置负载均衡
#  ribbon:
#    listOfService: http://localhost:10020/,http://localhost:10021/
---
spring:
  profiles: jwdev
#  cloud:
#    stream:
#      kafka:
#        binder:
#          brokers: 172.17.110.201
#          defaultBrokerPort: 9092
#          zkNodes: 172.17.110.201
#          defaultZkPort: 2181
#          replicationFactor: 1
---
spring:
  profiles: jwtest
---
spring:
  profiles: jwprod