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

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

# Conflicts:
#	gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseExceptionService.java
wangjun 3 лет назад
Родитель
Сommit
b3440769a9
75 измененных файлов с 3231 добавлено и 1053 удалено
  1. 2 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/SystemMessageDao.java
  2. 18 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 18 0
      business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java
  4. 16 1
      business/sms-service/pom.xml
  5. 118 0
      business/sms-service/src/main/java/com/yihu/jw/sms/service/TXYSmsService.java
  6. 46 1
      common/common-entity/sql记录
  7. 54 1
      common/common-entity/src/main/java/com/yihu/jw/entity/care/assistance/EmergencyAssistanceDO.java
  8. 13 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/RecruitStudentsDO.java
  9. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringOrderCancelLog.java
  10. 119 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/EmergencyWarnConclusionDO.java
  11. 45 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/EmergencyWarnDoctorResponseDO.java
  12. 0 79
      common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringConclusionDO.java
  13. 23 14
      common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringOrderDO.java
  14. 0 81
      common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringOrderPatientConfirmLog.java
  15. 10 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java
  16. 243 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/emergency/EmergencyOrderVO.java
  17. 19 0
      common/common-util/src/main/java/com/yihu/jw/util/idcard/IdCardUtil.java
  18. 2 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseExceptionService.java
  19. 13 1
      gateway/ag-basic/src/main/resources/application.yml
  20. 8 0
      gateway/ag-basic/src/main/resources/bootstrap.yml
  21. 60 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  22. 31 1
      server/svr-authentication/src/main/resources/application.yml
  23. 9 1
      server/svr-authentication/src/main/resources/bootstrap.yml
  24. 14 1
      server/svr-configuration/src/main/resources/bootstrap.yml
  25. 37 0
      starter/swagger-starter/pom.xml
  26. 1 0
      starter/swagger-starter/readme.MD
  27. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SwaggerConfig.java
  28. 3 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/course/RecruitStudentsRecordService.java
  29. 533 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/util/YkyyService.java
  30. 47 1
      svr/svr-base/src/main/resources/application.yml
  31. 8 0
      svr/svr-base/src/main/resources/bootstrap.yml
  32. 3 24
      svr/svr-cloud-care/pom.xml
  33. 6 0
      svr/svr-cloud-care/sql/init.sql
  34. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/RedisLockAOP.java
  35. 4 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/AqgConfig.java
  36. 0 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SpringSecurityAuditorAware.java
  37. 0 44
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SwaggerDocs.java
  38. 0 30
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/TencentSmsConfig.java
  39. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/assistance/EmergencyAssistanceDao.java
  40. 15 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/EmergencyWarnCancelLogDao.java
  41. 18 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/EmergencyWarnConclusionDao.java
  42. 15 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/EmergencyWarnDoctorResponseDao.java
  43. 0 19
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/SecurityMonitoringConclusionDao.java
  44. 0 14
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/SecurityMonitoringOrderCancelLogDao.java
  45. 3 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/SecurityMonitoringOrderDao.java
  46. 0 12
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/SecurityMonitoringOrderPatientConfirmLogDao.java
  47. 53 12
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java
  48. 24 7
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/PatientCourseEndpoint.java
  49. 4 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/DoctorHealthController.java
  50. 36 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/DoctorDoorCoachOrderController.java
  51. 4 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/PatientDoorCoachOrderController.java
  52. 0 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/exam/ChildrenExaminationEndpoint.java
  53. 15 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/lifeCare/DoctorLifeCareEndpoint.java
  54. 30 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java
  55. 116 23
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java
  56. 3 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java
  57. 5 72
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/wechat/WechatCoreController.java
  58. 292 88
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java
  59. 72 14
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java
  60. 91 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java
  61. 25 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  62. 10 11
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java
  63. 32 21
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java
  64. 20 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java
  65. 3 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java
  66. 31 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java
  67. 392 281
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java
  68. 5 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java
  69. 26 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/ConstantUtil.java
  70. 0 142
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/TencentSmsUtil.java
  71. 106 1
      svr/svr-cloud-care/src/main/resources/application.yml
  72. 8 0
      svr/svr-cloud-care/src/main/resources/bootstrap.yml
  73. 1 1
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java
  74. 243 0
      wlyy-starter/pom.xml
  75. 2 0
      wlyy-starter/readme.MD

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

@ -34,4 +34,6 @@ public interface SystemMessageDao extends PagingAndSortingRepository<SystemMessa
    @Modifying
    @Query("delete from SystemMessageDO a  where a.receiver = ?1 and a.relationCode = ?2 and a.type =?3")
    int orderMessageDelByType(String doctor, String orderId,String type);
    SystemMessageDO findByRelationCodeAndReceiver(String relationCode,String receiver);
}

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

@ -338,7 +338,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            return null;
        }
        logger.info("findOutpatientList patNo " + patNo);
        return entranceService.BS30025(patNo, null, startTime, endTime, demoFlag,ksdm);
        List<WlyyOutpatientVO> wlyyOutpatientVOList  =  entranceService.BS30025(patNo, null, startTime, endTime, demoFlag,ksdm);
        if (!ksdm.equalsIgnoreCase("1500010")){
            List<WlyyOutpatientVO> wlyyOutpatientVOList1  =  entranceService.BS30025(patNo, null, startTime, endTime, demoFlag,"1500010");
            if (wlyyOutpatientVOList!=null&&wlyyOutpatientVOList.size()!=0){
                if(wlyyOutpatientVOList1!=null&&wlyyOutpatientVOList1.size()!=0){
                    for (WlyyOutpatientVO wlyyOutpatientVO:wlyyOutpatientVOList1){
                        logger.info("==="+wlyyOutpatientVO);
                        if (wlyyOutpatientVO!=null){
                            wlyyOutpatientVOList.add(wlyyOutpatientVO);
                        }
                    }
                }
            }else {
                wlyyOutpatientVOList = new ArrayList<>();
                wlyyOutpatientVOList = wlyyOutpatientVOList1;
            }
        }
        return wlyyOutpatientVOList;
    }
    /**

+ 18 - 0
business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java

@ -756,6 +756,8 @@ public class ImUtil {
	public static final String SESSION_STATUS_PROCEEDINGS = "0";
	public static final String SESSION_STATUS_END = "1";
	public static final String SESSION_TYPE_EMERGENCY_ASSISTANCE = "20";//紧急救助
	public static final String SESSION_TYPE_DOOR_COACH = "21";//上门辅导(上门预约)
	public static final String SESSION_TYPE_SECURITY_WARN = "22";//安防咨询
	
	public static final String CONTENT_TYPE_TEXT = "1";
	
@ -792,6 +794,22 @@ public class ImUtil {
		return obj.getInteger("count");
//		}else{
//			return 0;
//		}
	}
	/**
	 *获取某个会话某个对象的未读消息数。
	 * @param
	 * @return
	 */
	public Integer UserSessionsUnreadMessageCount(String session,String userid){
		String url = im_host + "api/v2/sessions/"+session+"/unread_message_count?user_id="+userid;
		String ret = HttpClientUtil.get(url,"utf-8");
		JSONObject obj = JSON.parseObject(ret);
//		if(obj.getInteger("count") ==200){
		return obj.getInteger("count");
//		}else{
//			return 0;
//		}
	}

+ 16 - 1
business/sms-service/pom.xml

@ -45,6 +45,21 @@
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <!--   poi xml导入导出工具 end -->
        <!-- Redis  -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
        </dependency>
        <!-- Redis  -->
        <!-- 腾讯云短信  -->
        <dependency>
            <groupId>com.tencentcloudapi</groupId>
            <artifactId>tencentcloud-sdk-java</artifactId>
            <version>3.1.272</version>
        </dependency>
    </dependencies>
</project>

+ 118 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/service/TXYSmsService.java

@ -0,0 +1,118 @@
package com.yihu.jw.sms.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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.v20210111.SmsClient;
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.sms.dao.HospitalSysDictDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/24
 * @Description:
 */
@Service
public class TXYSmsService {
    private Logger logger= LoggerFactory.getLogger(ZBSmsService.class);
    @Autowired
    private HospitalSysDictDao sysDictDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    private String SecretId;
    private String SecretKey;
    private String signName;
    private String smsSdkAppId;
    private String VerificationCode;
    /**
     * 初始化接口参数
     */
    private void init(){
        String key = "hz_yxyzh_wx_sms";
        if(redisTemplate.hasKey(key+ ":SecretId")){
            SecretId = redisTemplate.opsForValue().get(key + ":SecretId");
            SecretKey = redisTemplate.opsForValue().get(key + ":SecretKey");
            signName = redisTemplate.opsForValue().get(key + ":signName");
            smsSdkAppId = redisTemplate.opsForValue().get(key + ":smsSdkAppId");
            VerificationCode = redisTemplate.opsForValue().get(key + ":VerificationCode");
            return;
        }
        List<WlyyHospitalSysDictDO> dictDOList = sysDictDao.findByDictName("hz_yxyzh_wx_sms");
        for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:dictDOList){
            if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("SecretId")){
                SecretId=wlyyHospitalSysDictDO.getDictValue();
                redisTemplate.opsForValue().set(key + ":SecretId",SecretId);
            }else if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("SecretKey")){
                SecretKey=wlyyHospitalSysDictDO.getDictValue();
                redisTemplate.opsForValue().set(key + ":SecretKey",SecretKey);
            }else if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("signName")){
                signName=wlyyHospitalSysDictDO.getDictValue();
                redisTemplate.opsForValue().set(key + ":signName",signName);
            }else if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("smsSdkAppId")){
                smsSdkAppId=wlyyHospitalSysDictDO.getDictValue();
                redisTemplate.opsForValue().set(key + ":smsSdkAppId",smsSdkAppId);
            }else if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase("VerificationCode")){
                VerificationCode=wlyyHospitalSysDictDO.getDictValue();
                redisTemplate.opsForValue().set(key + ":VerificationCode",VerificationCode);
            }
        }
    }
    public String sendMessage(String mobile,String code){
        try{
            init();
            Credential cred = new Credential(SecretId, SecretKey);
            HttpProfile httpProfile = new HttpProfile();
            httpProfile.setEndpoint("sms.tencentcloudapi.com");
            ClientProfile clientProfile = new ClientProfile();
            clientProfile.setHttpProfile(httpProfile);
            SmsClient client = new SmsClient(cred, "ap-nanjing", clientProfile);
            SendSmsRequest req = new SendSmsRequest();
            String[] phoneNumberSet1 = {"+86"+mobile};
            req.setPhoneNumberSet(phoneNumberSet1);
            req.setSmsSdkAppId(smsSdkAppId);
            req.setSignName(signName);
            req.setTemplateId(VerificationCode);
            String[] templateParamSet1 = {code};
            req.setTemplateParamSet(templateParamSet1);
            SendSmsResponse resp = client.SendSms(req);
            JSONObject json = JSON.parseObject(SendSmsResponse.toJsonString(resp));
            String res = json.getJSONArray("SendStatusSet").getJSONObject(0).getString("Code");
            if(!"Ok".equals(res)){
                logger.info("腾讯短信发送失败:"+SendSmsResponse.toJsonString(resp));
            }
            return res;
        } catch (TencentCloudSDKException e) {
            e.printStackTrace();
            logger.info("腾讯短信报错:"+e.toString());
        }
        return "error";
    }
}

+ 46 - 1
common/common-entity/sql记录

@ -930,7 +930,6 @@ 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,
@ -940,3 +939,49 @@ CREATE TABLE `base_course_catalogue_read_time` (
  `read_time` varchar(20) DEFAULT NULL COMMENT '阅读时间,保留时间戳格式,单位s',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='记录用户阅读课程时长';
-- 2021 05-21 lb
CREATE TABLE `base_emergency_warn_conclusion` (
  `id` varchar(50) NOT NULL,
  `order_id` varchar(50) NOT NULL COMMENT '工单id',
  `patient` varchar(50) DEFAULT NULL COMMENT '工单服务的居民',
  `patient_name` varchar(50) DEFAULT NULL COMMENT '居民姓名',
  `doctor` varchar(50) DEFAULT NULL COMMENT '医生',
  `doctor_name` varchar(50) DEFAULT NULL COMMENT '医生姓名',
  `conclusion` varchar(2000) DEFAULT NULL COMMENT '处置小结',
   `conclusion_img` varchar(1000) DEFAULT NULL COMMENT '服务相关附件',
  `emergency_reason` tinyint(4) DEFAULT '4' COMMENT '紧急预警工单发起原因 字典emergency_reason',
  `emergency_treatment_status` tinyint(4) DEFAULT '4' COMMENT '紧急预警工单处理结果 字典emergency_treatment_status',
  `create_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `create_user` varchar(50) DEFAULT NULL COMMENT '创建者id',
  `create_user_name` varchar(50) DEFAULT NULL COMMENT '创建者称名',
  `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `update_user` varchar(50) DEFAULT NULL,
  `update_user_name` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `orderId` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='紧急预警工单服务小结';
CREATE TABLE `base_emergency_warn_cancel_log` (
  `id` varchar(50) NOT NULL,
  `order_id` varchar(50) NOT NULL COMMENT '工单id',
  `patient` varchar(50) DEFAULT NULL COMMENT '居民code',
  `cancel_type` int(1) DEFAULT NULL COMMENT '取消类型:1-调度员取消,2-居民取消 3 医生取消',
   `cancel_reason` varchar(50) DEFAULT NULL COMMENT '取消理由',
  `time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '取消时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='紧急预警工单取消记录';
alter table base_security_monitoring_order add column emergency_cancel tinyint(4) DEFAULT '4' COMMENT '紧急预警工单误报警原因 emergency_cancel';
alter table base_emergency_assistance_order add column emergency_cancel tinyint(4) DEFAULT '4' COMMENT '紧急预警工单误报警原因 emergency_cancel';
CREATE TABLE `base_emergency_warn_doctor_response` (
  `id` varchar(50) NOT NULL,
  `order_id` varchar(50) NOT NULL COMMENT '工单id',
  `doctor` varchar(50) NOT NULL COMMENT '医生code',
  `response_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP 	COMMENT '医生响应时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='紧急预警医生响应状态';
DROP TABLE IF EXISTS `base_security_monitoring_conclusion`;
DROP TABLE IF EXISTS `base_security_monitoring_order_cancel_log`;
DROP TABLE IF EXISTS `base_semoni_patient_confirm_log`;

+ 54 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/assistance/EmergencyAssistanceDO.java

@ -1,6 +1,7 @@
package com.yihu.jw.entity.care.assistance;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.care.securitymonitoring.EmergencyWarnConclusionDO;
import netscape.javascript.JSObject;
import javax.persistence.Entity;
@ -14,6 +15,34 @@ import java.util.Date;
@Entity
@Table(name="base_emergency_assistance_order")
public class EmergencyAssistanceDO extends UuidIdentityEntityWithOperator {
    /**
     * 工单状态:
     */
    public enum Status {
        ErrorWarning(-2, "误报警"),
        cancel(-1, "已取消"),
        complete(0, "已完成"),
        apply(1, "申请中");
        private Integer type;
        private String desc;
        Status(Integer type, String desc) {
            this.type = type;
            this.desc = desc;
        }
        public Integer getType() {
            return type;
        }
        public void setType(Integer type) {
            this.type = type;
        }
    }
    private String patient; //发起救助的居民id
    private String patientName; //发起救助的居民姓名
    private String patientPhone; //救助居民电话
@ -34,11 +63,13 @@ public class EmergencyAssistanceDO extends UuidIdentityEntityWithOperator {
    private String doctorLon; //医生当前定位地址经度
    private String conclusion; //服务完成笔记
    private String conclusionImg; //服务相关附件
    private Integer status; //工单状态 -1已取消 0已完成 1申请中
    private Integer status;
    private Date completeTime;//完成时间
    private String teamCode;
    private Integer type; //发起类型(1本人发起 2家人待预约 3医生代预约)
    private Integer orderSource;//工单发起来源状态 1APP 2手环 3居家报警
    private Integer emergencyCancel;// 紧急预警工单误报警原因 字典emergency_cancel
    private String sendMessage;//
    private Integer patientAge;
@ -47,6 +78,11 @@ public class EmergencyAssistanceDO extends UuidIdentityEntityWithOperator {
    private double distance;//医生与患者距离 单位km
    private String otherDoctorDistance;
    /**
     * 服务小结
     */
    private EmergencyWarnConclusionDO emergencyWarnConclusionDO;
    public String getPatient() {
        return patient;
    }
@ -299,4 +335,21 @@ public class EmergencyAssistanceDO extends UuidIdentityEntityWithOperator {
    public void setOrderSource(Integer orderSource) {
        this.orderSource = orderSource;
    }
    @Transient
    public EmergencyWarnConclusionDO getEmergencyWarnConclusionDO() {
        return emergencyWarnConclusionDO;
    }
    public void setEmergencyWarnConclusionDO(EmergencyWarnConclusionDO emergencyWarnConclusionDO) {
        this.emergencyWarnConclusionDO = emergencyWarnConclusionDO;
    }
    public Integer getEmergencyCancel() {
        return emergencyCancel;
    }
    public void setEmergencyCancel(Integer emergencyCancel) {
        this.emergencyCancel = emergencyCancel;
    }
}

+ 13 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/RecruitStudentsDO.java

@ -32,6 +32,10 @@ public class RecruitStudentsDO  extends UuidIdentityEntityWithTime {
     *'招生主题'
     */
    private String theme;
    /**
     * 招生名称
     */
    private String name;
    /**
     *'报名开始时间'
     */
@ -139,4 +143,13 @@ public class RecruitStudentsDO  extends UuidIdentityEntityWithTime {
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringOrderCancelLog.java

@ -13,8 +13,8 @@ import java.util.Date;
 * Created by Bing on 2021/4/7.
 */
@Entity
@Table(name="base_security_monitoring_order_cancel_log")
public class SecurityMonitoringOrderCancelLog extends UuidIdentityEntity {
@Table(name="base_emergency_warn_cancel_log")
public class EmergencyWarnCancelLogDO extends UuidIdentityEntity {
    /**
     * 工单id
@ -67,10 +67,10 @@ public class SecurityMonitoringOrderCancelLog extends UuidIdentityEntity {
        this.cancelType = cancelType;
    }
    @Column(name = "cancel_reason")
    public String getCancelReason() {
        return cancelReason;
    }
    public void setCancelReason(String cancelReason) {
        this.cancelReason = cancelReason;
    }

+ 119 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/EmergencyWarnConclusionDO.java

@ -0,0 +1,119 @@
package com.yihu.jw.entity.care.securitymonitoring;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * 紧急预警工单服务小结
 * Created by yeshijie on 2021/4/1.
 */
@Entity
@Table(name = "base_emergency_warn_conclusion")
public class EmergencyWarnConclusionDO extends UuidIdentityEntityWithOperator {
    private String orderId;//工单id
    private String patient;//工单服务的居民
    private String patientName;//居民姓名
    private String doctor;//医生
    private String doctorName;//医生姓名
    private String conclusion;//处置小结
    private String conclusionImg;//服务相关附件
    private Integer emergencyReason;//紧急预警工单发起原因 字典emergency_reason
    private Integer emergencyTreatmentStatus;//紧急预警工单处理结果 字典emergency_treatment_status
    private String ReasonName;
    private String TreatmentStatusName;
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getConclusion() {
        return conclusion;
    }
    public void setConclusion(String conclusion) {
        this.conclusion = conclusion;
    }
    public String getConclusionImg() {
        return conclusionImg;
    }
    public void setConclusionImg(String conclusionImg) {
        this.conclusionImg = conclusionImg;
    }
    public Integer getEmergencyReason() {
        return emergencyReason;
    }
    public void setEmergencyReason(Integer emergencyReason) {
        this.emergencyReason = emergencyReason;
    }
    public Integer getEmergencyTreatmentStatus() {
        return emergencyTreatmentStatus;
    }
    public void setEmergencyTreatmentStatus(Integer emergencyTreatmentStatus) {
        this.emergencyTreatmentStatus = emergencyTreatmentStatus;
    }
    @Transient
    public String getReasonName() {
        return ReasonName;
    }
    public void setReasonName(String reasonName) {
        ReasonName = reasonName;
    }
    @Transient
    public String getTreatmentStatusName() {
        return TreatmentStatusName;
    }
    public void setTreatmentStatusName(String treatmentStatusName) {
        TreatmentStatusName = treatmentStatusName;
    }
}

+ 45 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/EmergencyWarnDoctorResponseDO.java

@ -0,0 +1,45 @@
package com.yihu.jw.entity.care.securitymonitoring;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 紧急预警医生响应表
 * Created by Bing on 2021/5/21.
 */
@Entity
@Table(name="base_emergency_warn_doctor_response")
public class EmergencyWarnDoctorResponseDO extends UuidIdentityEntity {
    private String orderId;
    private String doctor;
    private Date responseTime;
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getResponseTime() {
        return responseTime;
    }
    public void setResponseTime(Date responseTime) {
        this.responseTime = responseTime;
    }
}

+ 0 - 79
common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringConclusionDO.java

@ -1,79 +0,0 @@
package com.yihu.jw.entity.care.securitymonitoring;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 工单服务小结
 * Created by yeshijie on 2021/4/1.
 */
@Entity
@Table(name = "base_security_monitoring_conclusion")
public class SecurityMonitoringConclusionDO extends UuidIdentityEntityWithOperator {
    private String orderId;//工单id
    private String patient;//工单服务的居民
    private String patientName;//居民姓名
    private String doctor;//医生
    private String doctorName;//医生姓名
    private Integer status;//处置状态 1已确认安全 2已转送医疗机构 3已处置完成
    private String conclusion;//处置小结
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getConclusion() {
        return conclusion;
    }
    public void setConclusion(String conclusion) {
        this.conclusion = conclusion;
    }
}

+ 23 - 14
common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringOrderDO.java

@ -17,18 +17,17 @@ import java.util.Date;
@Table(name = "base_security_monitoring_order")
public class SecurityMonitoringOrderDO extends UuidIdentityEntityWithOperator {
    /**
     * 工单状态:-1-已取消,1-待处置,2-前往居民定位,3-已签到,4-已登记小结,5-待补录,6-待评价,7-已完成
     * 工单状态:
     */
    /**
     * 工单状态:
     */
    public enum Status {
        ErrorWarning(-2, "误报警"),
        cancel(-1, "已取消"),
        waitForSend(1, "待处置"),
        waitForArrive(2, "前往居民定位"),
        signed(3, "已签到"),
        registerSummary(4, "已登记小结,"),
        waitForAdded(5, "待补录"),
        waitForCommnet(6, "待评价"),
        complete(7,"已完成");
        complete(0, "已完成"),
        apply(1, "申请中");
        private Integer type;
        private String desc;
@ -245,7 +244,7 @@ public class SecurityMonitoringOrderDO extends UuidIdentityEntityWithOperator {
    private Integer examPaperUploadWay;
    /**
     * 工单状态:-1-已取消,1-待处置,2-前往居民定位,3-已签到,4-已登记小结,5-待补录,6-待评价,7-已完成
     * 工单状态:
     */
    private Integer status;
@ -274,7 +273,7 @@ public class SecurityMonitoringOrderDO extends UuidIdentityEntityWithOperator {
    /**
     * 服务小结
     */
    private SecurityMonitoringConclusionDO monitoringConclusion;
    private EmergencyWarnConclusionDO emergencyWarnConclusionDO;
    /**
     * 服务医生响应时间(第一条咨询或者接单时间)
@ -320,6 +319,8 @@ public class SecurityMonitoringOrderDO extends UuidIdentityEntityWithOperator {
    private String orderInfo;//工单详情 0-未推送 1-未确认 2-已确认
    private String doctorConfirmFinishImg;
    private Integer orderSource;//工单发起来源状态 1APP 2手环 3居家报警
    private Integer emergencyCancel;// 紧急预警工单误报警原因 字典emergency_cancel
    /**
     * 医生确认医生结束服务时间
     */
@ -564,12 +565,12 @@ public class SecurityMonitoringOrderDO extends UuidIdentityEntityWithOperator {
    }
    @Transient
    public SecurityMonitoringConclusionDO getMonitoringConclusion() {
        return monitoringConclusion;
    public EmergencyWarnConclusionDO getEmergencyWarnConclusionDO() {
        return emergencyWarnConclusionDO;
    }
    public void setMonitoringConclusion(SecurityMonitoringConclusionDO monitoringConclusion) {
        this.monitoringConclusion = monitoringConclusion;
    public void setEmergencyWarnConclusionDO(EmergencyWarnConclusionDO emergencyWarnConclusionDO) {
        this.emergencyWarnConclusionDO = emergencyWarnConclusionDO;
    }
    @Column(name = "service_response_time")
@ -700,4 +701,12 @@ public class SecurityMonitoringOrderDO extends UuidIdentityEntityWithOperator {
    public void setOrderSource(Integer orderSource) {
        this.orderSource = orderSource;
    }
    public Integer getEmergencyCancel() {
        return emergencyCancel;
    }
    public void setEmergencyCancel(Integer emergencyCancel) {
        this.emergencyCancel = emergencyCancel;
    }
}

+ 0 - 81
common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/SecurityMonitoringOrderPatientConfirmLog.java

@ -1,81 +0,0 @@
package com.yihu.jw.entity.care.securitymonitoring;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2021/4/7.
 */
@Entity
@Table(name="base_semoni_patient_confirm_log")
public class SecurityMonitoringOrderPatientConfirmLog extends UuidIdentityEntityWithOperator {
    /**
     * 工单id
     */
    private String orderId;
    /**
     * 居民
     */
    private String patient;
    /**
     * 居民姓名
     */
    private String patientName;
    /**
     * 确认操作类型:1-确认基础信息无误或变更,2-确认上门医生变更上门信息,3-同意工单转接,4-同意取消工单
     */
    private Integer type;
    /**
     * 操作描述
     */
    private String description;
    @Column(name = "order_id")
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    @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 = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "description")
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
}

+ 10 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java

@ -18,7 +18,7 @@ import java.util.Date;
public class SystemMessageDO extends UuidIdentityEntity {
    /**
     *消息类型 上门服务400开头,生活照料500开头 ,安防监控600开头, 上门辅导700开头
     *消息类型 上门服务400开头,生活照料500开头 ,安防监控600开头, 上门辅导700开头,紧急救助800开头
     */
    private String type;
    /**
@ -58,6 +58,7 @@ public class SystemMessageDO extends UuidIdentityEntity {
     */
    private String del;
    private String over;//是否操作结束 是否操作结束 1否,0是
    private String code;
    /**
     *已读时间
     */
@ -173,4 +174,12 @@ public class SystemMessageDO extends UuidIdentityEntity {
    public void setOver(String over) {
        this.over = over;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
}

+ 243 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/emergency/EmergencyOrderVO.java

@ -0,0 +1,243 @@
package com.yihu.jw.restmodel.emergency;
import com.yihu.jw.entity.care.securitymonitoring.EmergencyWarnConclusionDO;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Bing on 2021/5/21.
 */
public class EmergencyOrderVO {
    //预警信息
    private String id;
    private String orderId;
    private Integer status;//工单状态
    private String statusName;//工单状态
    private Date createTime;//工单发起时间
    private String serveLat;
    private String serveLon;
    private String serveAddress;
    private String patient;
    private String patientName;
    private Integer sex;
    private String age;
    private String liveAddress;
    private Integer orderSource; //工单发起来源状态 1APP 2手环 3居家报警
    //误报警字段
    private String updateUserName;//操作时间
    private String updateUser;//操作时间
    private Integer emergencyCancel;//紧急预警工单误报警原因 字典emergency_cancel
    private String emergencyCancelName;
    private Date updateTime;
    //附加信息
    private Map<String,Object> information;//附加信息
    private String phone;
    //围栏状态 fences
    //小结
    private EmergencyWarnConclusionDO emergencyWarnConclusionDO;//工单小结
    //通知对象
    private List<Map<String,Object>> noticePersons;//通知对象
    private String otherDoctorDistance;//其他医生定位信息
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getStatusName() {
        return statusName;
    }
    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getServeLat() {
        return serveLat;
    }
    public void setServeLat(String serveLat) {
        this.serveLat = serveLat;
    }
    public String getServeLon() {
        return serveLon;
    }
    public void setServeLon(String serveLon) {
        this.serveLon = serveLon;
    }
    public String getServeAddress() {
        return serveAddress;
    }
    public void setServeAddress(String serveAddress) {
        this.serveAddress = serveAddress;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public Integer getSex() {
        return sex;
    }
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    public String getAge() {
        return age;
    }
    public void setAge(String age) {
        this.age = age;
    }
    public String getLiveAddress() {
        return liveAddress;
    }
    public void setLiveAddress(String liveAddress) {
        this.liveAddress = liveAddress;
    }
    public Integer getOrderSource() {
        return orderSource;
    }
    public void setOrderSource(Integer orderSource) {
        this.orderSource = orderSource;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public Integer getEmergencyCancel() {
        return emergencyCancel;
    }
    public void setEmergencyCancel(Integer emergencyCancel) {
        this.emergencyCancel = emergencyCancel;
    }
    public String getEmergencyCancelName() {
        return emergencyCancelName;
    }
    public void setEmergencyCancelName(String emergencyCancelName) {
        this.emergencyCancelName = emergencyCancelName;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Map<String, Object> getInformation() {
        return information;
    }
    public void setInformation(Map<String, Object> information) {
        this.information = information;
    }
    public EmergencyWarnConclusionDO getEmergencyWarnConclusionDO() {
        return emergencyWarnConclusionDO;
    }
    public void setEmergencyWarnConclusionDO(EmergencyWarnConclusionDO emergencyWarnConclusionDO) {
        this.emergencyWarnConclusionDO = emergencyWarnConclusionDO;
    }
    public List<Map<String, Object>> getNoticePersons() {
        return noticePersons;
    }
    public void setNoticePersons(List<Map<String, Object>> noticePersons) {
        this.noticePersons = noticePersons;
    }
    public String getOtherDoctorDistance() {
        return otherDoctorDistance;
    }
    public void setOtherDoctorDistance(String otherDoctorDistance) {
        this.otherDoctorDistance = otherDoctorDistance;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
}

+ 19 - 0
common/common-util/src/main/java/com/yihu/jw/util/idcard/IdCardUtil.java

@ -179,6 +179,25 @@ public class IdCardUtil {
        }
        return sex;
    }
    /**
     * 获取性别
     * @param sex
     * @param idcard
     * @return
     */
    public static String getSex(Integer sex,String idcard){
        if(sex != null){
            return String.valueOf(sex);
        }
        String res = level_sex_3;
        try{
            return getSexForIdcard_new(idcard);
        }catch (Exception e){
            e.printStackTrace();
        }
        return res;
    }
    
    /**
     * 根据身份证的号码算出当前身份证持有者的性别,返回性别文字

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

@ -12,8 +12,10 @@ import java.util.Map;
@Component
public class BaseExceptionService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    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\"," +

+ 13 - 1
gateway/ag-basic/src/main/resources/application.yml

@ -227,4 +227,16 @@ spring:
  redis:
     host: 10.9.1.247 # Redis server host.
     port: 6380  # Redis server port.
     password: Kb6wKDQP1W4
     password: Kb6wKDQP1W4
---
spring:
  profiles: hzprod
  datasource:
    url: jdbc:mysql://172.26.0.13:3306/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
    username: root
    password: '*ukOOSl&c0!y'
  redis:
    host: 172.26.0.13 # Redis server host.
    port: 6379  # Redis server port.
    password: Kb6wKDQP1W4

+ 8 - 0
gateway/ag-basic/src/main/resources/bootstrap.yml

@ -121,3 +121,11 @@ spring:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: hzprod
  cloud:
    config:
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy-spring.config.label:jwdev}

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

@ -27,6 +27,7 @@ import com.yihu.jw.security.oauth2.provider.WlyyTokenGranter;
import com.yihu.jw.security.oauth2.provider.error.WlyyOAuth2ExceptionTranslator;
import com.yihu.jw.security.service.*;
import com.yihu.jw.security.utils.*;
import com.yihu.jw.sms.service.TXYSmsService;
import com.yihu.jw.sms.service.YkyyINSMSService;
import com.yihu.jw.sms.service.ZBSmsService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
@ -131,6 +132,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    @Autowired
    private ZBSmsService zbSmsService;
    @Autowired
    private TXYSmsService txySmsService;
    @Autowired
    private OauthCaConfigSerivce oauthCaConfigSerivce;
    @Autowired
    private OauthWjwConfigService oauthWjwConfigService;
@ -689,7 +692,62 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    }
    /**
     * 腾讯云短信接口
     * @param parameters
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/oauth/sendTXYCaptcha", method = RequestMethod.GET)
    public ResponseEntity<Oauth2Envelop<Captcha>> sendTXYCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
        String client_id = parameters.get("client_id");
        String username = parameters.get("username");
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        if (StringUtils.isEmpty(username)) {
            throw new InvalidRequestException("username");
        }
        if (username.length()>12){
            throw new InvalidRequestException("请输入正确的手机号!");
        }
        //验证请求间隔超时,防止频繁获取验证码
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
        }
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            Captcha _captcha = new Captcha();
            _captcha.setCode(captcha);
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("success", 200);
            HttpHeaders headers = new HttpHeaders();
            headers.set("Cache-Control", "no-store");
            headers.set("Pragma", "no-cache");
            return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
        }else {
            //发送短信获取验证码
            String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
            //
            String result =  txySmsService.sendMessage(username,captcha);
            if ("ok".equals(result)) {
                Captcha _captcha = new Captcha();
                _captcha.setCode(captcha);
                _captcha.setExpiresIn(300);
                wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }
        }
        throw new IllegalStateException("验证码发送失败!");
    }
    @RequestMapping(value = "/oauth/sendCaptcha", method = RequestMethod.GET)
    public ResponseEntity<Oauth2Envelop<Captcha>> sendCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
@ -709,6 +767,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
            return sendXZCaptcha(parameters);
        }else if ("sd_tnzyy_wx".equals(wxId)){
            return sendZBCaptcha(parameters);
        }else if("hz_yyyzh_wx".equals(wxId)){
            return sendTXYCaptcha(parameters);
        }
        throw new IllegalStateException("验证码发送失败");
    }

+ 31 - 1
server/svr-authentication/src/main/resources/application.yml

@ -374,4 +374,34 @@ testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: sd_tnzyy_wx  # base库中,wx_wechat 的id字段
  id: sd_tnzyy_wx  # base库中,wx_wechat 的id字段
---
spring:
  profiles: hzprod
  datasource:
    url: jdbc:mysql://172.26.0.13:3306/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
    username: root
    password: '*ukOOSl&c0!y'
  redis:
    host: 172.26.0.13 # Redis server host.
    port: 6379  # Redis server port.
    password: Kb6wKDQP1W4
  ##发现服务
## i健康用户信息接口,开放出来给互联网医院登录同步用户信息用
iHealth:
  user-info-uri: 1
zhongshanHospital:
  user-info-uri: 1
fastDFS:
  fastdfs_file_url: http://172.26.0.13:8888/
wlyy:
  url: 1
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 1
wechat:
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段

+ 9 - 1
server/svr-authentication/src/main/resources/bootstrap.yml

@ -122,4 +122,12 @@ spring:
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: hzprod
  cloud:
    config:
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy-spring.config.label:jwdev}

+ 14 - 1
server/svr-configuration/src/main/resources/bootstrap.yml

@ -178,4 +178,17 @@ spring:
        git:
          uri: ${wlyy.spring.config.git.uri:http://127.0.0.1:3001/jkzl/wlyy2.0.config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:master}
        default-label: ${wlyy.spring.config.git.label:master}
---
spring:
  profiles: hzprod
##git配置
  cloud:
    config:
      failFast: true #启动快速失败 即链接不到配置服务就启动失败
      server:
        git:
          uri: ${wlyy.spring.config.git.uri:http://192.168.1.220:10080/Amoy2/wlyy2.0.config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:jwdev}

+ 37 - 0
starter/swagger-starter/pom.xml

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>wlyy-starter</artifactId>
        <groupId>com.yihu.jw</groupId>
        <version>2.0.0</version>
    </parent>
    <artifactId>swagger-starter</artifactId>
    <dependencies>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${version.swagger}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${version.swagger-ui}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-staticdocs</artifactId>
            <version>${version.springfox-staticdocs}</version>
        </dependency>
        <dependency>
            <groupId>io.github.swagger2markup</groupId>
            <artifactId>swagger2markup</artifactId>
            <version>${version.swagger2markup}</version>
        </dependency>
    </dependencies>
</project>

+ 1 - 0
starter/swagger-starter/readme.MD

@ -0,0 +1 @@
swagger 入参多一个userAgent 入参 方便开发排查接口

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SwaggerConfig.java

@ -1,4 +1,4 @@
package com.yihu.jw.care.config;
package com.yihu.jw;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

+ 3 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/course/RecruitStudentsRecordService.java

@ -8,6 +8,7 @@ import com.yihu.jw.entity.care.course.RecruitStudentsDO;
import com.yihu.jw.entity.care.course.RecruitStudentsRecordDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -106,7 +107,8 @@ public class RecruitStudentsRecordService extends BaseJpaService<RecruitStudents
     * @return
     */
    public synchronized boolean isAdmissionFull(String id){
        List<RecruitStudentsRecordDO> list = recruitStudentsRecordDao.findByRecruitStudentsIdAndStatus(id,"3");
        String sql = "select * from base_recruit_students_record where recruit_students_id = '"+id+"' and status in ('2','3','6') and del =1 ";
        List<RecruitStudentsRecordDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RecruitStudentsRecordDO.class));
        RecruitStudentsDO recruitStudentsDO = recruitStudentsDao.findOne(id);
        if(recruitStudentsDO.getNum()<=list.size()){
            return true;

+ 533 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/util/YkyyService.java

@ -0,0 +1,533 @@
package com.yihu.jw.security.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorHospitalDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorRoleDao;
import com.yihu.jw.security.dao.doctor.DoctorMappingDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.yihu.jw.util.common.PwdUtil.randomString;
/**
 * 眼科医院
 * Created by yeshijie on 2020/4/24.
 *
 * @author yeshijie.
 */
@Service
public class YkyyService {
    private Logger logger = LoggerFactory.getLogger(YkyyService.class);
    @Autowired
    private HttpClientUtil httpClientUtil;
    private static String yktUrl1 = "http://www.yanketong.com:90/";
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private BaseDoctorRoleDao baseDoctorRoleDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    private final static String orgCode ="350211A5004";
    private final static String orgName ="厦门大学附属厦门眼科中心";
    private final static String url="http://192.168.20.55:10023/ykyy/createSQLQuery";
    private static String yktUrl = "http://www.yanketong.com:133/api/";
    /**
     * 眼科医院单点登录接口
     * @return
     */
    public String getDoctorInfoByVerifycode(String verifyCode){
        String url = "api/Doctor/GetDoctorInfoByverifycode";
        return httpClientUtil.get(yktUrl1+url+"?verifyCode="+verifyCode,"GBK");
    }
    /**
     * 眼科医院单点登录接口
     * @return
     */
    public String getPatientInfoByVerifycode(String verifyCode){
        String url = "/api/patient/GetPatientInfoByVerifycode";
        return httpClientUtil.get(yktUrl1+url+"?verifyCode="+verifyCode,"GBK");
    }
    /**
     *获取家庭成员信息
     *
     * @param tel
     * @param userId
     * @return
     */
    public String getFamilyList(String tel,String userId){
        String response="";
        String url = yktUrl+"doc_jkzl/get_family_list?";
        if (StringUtils.isNoneBlank(tel)&&StringUtils.isNoneBlank(userId)){
            url+="tel="+tel;
            url+="&user_id="+userId;
        }else if (StringUtils.isNoneBlank(tel)&&!StringUtils.isNoneBlank(userId)){
            url+="tel="+tel;
        }else if (!StringUtils.isNoneBlank(tel)&&StringUtils.isNoneBlank(userId)){
            url+="user_id="+userId;
        }
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取家庭成员信息:"+response);
        return response;
    }
    /**
     * 眼科通登录接口
     * @param tel
     * @param password
     * @return
     */
    public String yktLogin(String tel,String password){
        String response="";
        String url = yktUrl+"user_center/patient_login?patient_account="+tel+"&patient_pwd="+password;
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取眼科通登录信息:"+response);
        return response;
    }
    /**
     * 眼科通验证码
     * @param type
     * @param phone
     * @return
     */
    public String getShortMessage(String type,String phone){
        String response="";
        String url = yktUrl+"verification_code/short_message?type="+type+"&telephone="+phone;
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通验证码:"+response);
        return response;
    }
    /**
     * 获取眼科通修改密码验证码
     * @param type
     * @param phone
     * @return
     */
    public String getResetCode(String type,String phone) throws  Exception{
        String response="";
        String codeResponse = getVerificationReal(phone,type,"");
        String veryCode = "";
        if (StringUtils.isNoneBlank(codeResponse)){
            JSONObject jsonObject = JSONObject.parseObject(codeResponse);
            if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
                veryCode =  jsonObject.getString("value");
            }
        }
        String url = yktUrl1+"api/Doctor/GetVerificationCode";
        Map param = new HashMap();
        param.put("loginid",phone);
        param.put("type",type);
        param.put("VerificationReal",veryCode);
        logger.info("请求参数:"+param.toString());
        response = httpClientUtil.httpPost(url,param);
        logger.info("眼科通验证码:"+response);
        return response;
    }
    /**获取图形验证码
     *
     * @param loginid
     * @param type
     * @param IPAddress
     * @return
     */
    public String getVerificationReal(String loginid,String type,String IPAddress) throws  Exception{
        String response="";
        Map map = new HashMap();
        map.put("loginid",loginid);
        map.put("type",type);
        map.put("IPAddress",IPAddress);
        String url = yktUrl1+"api/Share/GetVerificationReal";
        response = httpClientUtil.httpPost(url,map);
        logger.info("修改眼科同密码后的信息:"+response);
        return response;
    }
    /**
     * 忘记密码修改
     * @param loginid
     * @param password
     * @return
     */
    public String ResetPwd(String loginid,String password,String verCode) throws  Exception{
        String response="";
        String url = yktUrl1+"api/Doctor/ResetPassword";
        Map param = new HashMap();
        param.put("loginid",loginid);
        param.put("password",password);
        param.put("verCode",verCode);
        logger.info("请求参数:"+param.toString());
        response = httpClientUtil.httpPost(url,param);
        logger.info("眼科通验证码:"+response);
        return response;
    }
    /**
     * 增加家庭成员
     * @param userId
     * @param idcard
     * @param name
     * @param sex
     * @param birth
     * @param age
     * @param tel
     * @return
     */
    public String addFamily(String userId,String idcard,String name,String sex,String birth,String age,String tel){
        String response="";
        String url = yktUrl+"doc_jkzl/add_family?ass_user_id="+userId+"&id_card="+idcard+"&name="+name+"&sex="+sex
                +"&birth="+birth+"&age="+age+"&tel="+tel+"&medical_card=&illness=本人&clinic_id=";
        response = httpClientUtil.get(url,"GBK");
        logger.info("增加家庭成员:"+response);
        return response;
    }
    /**获取眼科通忘记密码信息
     *
     * @param tel
     * @param password
     * @param vercode
     * @return
     */
    public String   forgetPassword(String tel,String password,String vercode){
        String response="";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("loginid",tel);
        jsonObject.put("password",password);
        String url = "http://www.yanketong.com:90/api/Patient/ForgotPassword4Jkzl";
        response = httpClientUtil.sendPost(url,jsonObject.toJSONString());
        logger.info("获取眼科通忘记密码信息:"+response);
        return response;
    }
    /**
     * telephone=15578008051&patient_pwd=123456&code=513970&invite_code=a01522&equipment_type=ios&equipment_guid=12312321
     * 眼科通用户注册
     *
     * @param telephone
     * @param patientPwd
     * @param code
     * @return
     */
    public String getRegisterUser(String telephone,String patientPwd,String code,String inviteCode,String equipmentType,String equipmentGuid){
        String response="";
        String url = yktUrl+"user_center/patient_register01?telephone="+telephone+"&patient_pwd="+patientPwd+"&code="+code+"&invite_code="+inviteCode+"&equipment_type="+equipmentType+
                "&equipment_guid="+equipmentGuid;
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通用户注册:"+response);
        return response;
    }
    /**
     * 同步眼科通数据
     * @param patient
     * @return
     * @throws Exception
     */
    public void registerYkt(String patient,String pw,String code) throws Exception {
        BasePatientDO basePatientDO  = patientDao.findById(patient);
        if (basePatientDO!=null){
            String userId = basePatientDO.getUserId();
            if (StringUtils.isNoneBlank(userId)){
                String familyList =getFamilyList(null,userId);
                JSONObject object = JSONObject.parseObject(familyList);
                if (object.getString("code").equalsIgnoreCase("200")){
                    JSONObject object1 = object.getJSONObject("data");
                    JSONArray array = object1.getJSONArray("list");
                    if (array!=null&&array.size()!=0){
                        JSONObject jsonObject = array.getJSONObject(0);
                        if (jsonObject!=null){
                            String yktId = jsonObject.getString("ID");
                            basePatientDO.setYktId(yktId);
                            patientDao.save(basePatientDO);
                        }
                    }else {
                        String birdth = IdCardUtil.getBirthdayForIdcardStr(basePatientDO.getIdcard());
                        Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
                        Integer sex = basePatientDO.getSex()!=null?basePatientDO.getSex():0;
                        String family = addFamily(userId,basePatientDO.getIdcard(),basePatientDO.getName(),sex.toString(),birdth,age.toString(),basePatientDO.getMobile());
                        JSONObject object2 = JSONObject.parseObject(family);
                        if (object2.getString("code").equalsIgnoreCase("200")){
                            JSONObject object3 = object2.getJSONObject("data");
                            String yktId = object3.getString("ID");
                            basePatientDO.setYktId(yktId);
                            patientDao.save(basePatientDO);
                        }
                    }
                }else {
                    throw new Exception("查询家庭成员失败!");
                }
            }else {
                String r =getRegisterUser(basePatientDO.getMobile(),pw,code,"a01522","xmijk","xmijk");
                JSONObject object4 = JSONObject.parseObject(r);
                if (object4.getString("code").equalsIgnoreCase("200")){
                    JSONObject object5 = object4.getJSONObject("data");
                    if (object5!=null){
                        userId = object5.getString("ID");
                        basePatientDO.setUserId(userId);
                        patientDao.save(basePatientDO);
                        String familyList =getFamilyList(null,userId);
                        JSONObject object = JSONObject.parseObject(familyList);
                        if (object.getString("code").equalsIgnoreCase("200")){
                            JSONObject object1 = object.getJSONObject("data");
                            JSONArray array = object1.getJSONArray("list");
                            if (array!=null&&array.size()!=0){
                                JSONObject jsonObject1 = array.getJSONObject(0);
                                if (jsonObject1!=null){
                                    String yktId = jsonObject1.getString("ID");
                                    userId = jsonObject1.getString("ASSUSERID");
                                    basePatientDO.setYktId(yktId);
                                    basePatientDO.setUserId(userId);
                                    patientDao.save(basePatientDO);
                                }
                            }else {
                                String birdth = IdCardUtil.getBirthdayForIdcardStr(basePatientDO.getIdcard());
                                Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
                                Integer sex = basePatientDO.getSex()!=null?basePatientDO.getSex():0;
                                String family = addFamily(userId,basePatientDO.getIdcard(),basePatientDO.getName(),sex.toString(),birdth,age.toString(),basePatientDO.getMobile());
                                JSONObject object2 = JSONObject.parseObject(family);
                                if (object2.getString("code").equalsIgnoreCase("200")){
                                    JSONObject object3 = object2.getJSONObject("data");
                                    String yktId = object3.getString("ID");
                                    basePatientDO.setYktId(yktId);
                                    userId = object3.getString("ASSUSERID");
                                    basePatientDO.setUserId(userId);
                                    patientDao.save(basePatientDO);
                                }
                            }
                        }else {
                            throw new Exception("查询家庭成员失败!");
                        }
                    }
                }else {
                    String familyList =getFamilyList(basePatientDO.getMobile(),null);
                    JSONObject object = JSONObject.parseObject(familyList);
                    if (object.getString("code").equalsIgnoreCase("200")){
                        JSONObject object1 = object.getJSONObject("data");
                        JSONArray array = object1.getJSONArray("list");
                        if (array!=null&&array.size()!=0){
                            JSONObject jsonObject1 = array.getJSONObject(0);
                            if (jsonObject1!=null){
                                String yktId = jsonObject1.getString("ID");
                                userId = jsonObject1.getString("ASSUSERID");
                                basePatientDO.setYktId(yktId);
                                basePatientDO.setUserId(userId);
                                patientDao.save(basePatientDO);
                            }
                        }else {
                            userId=object1.getString("user_id");
                            String birdth = DateUtil.dateToStrShort(IdCardUtil.getBirthdayForIdcard(basePatientDO.getIdcard()));
                            Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
                            Integer sex = basePatientDO.getSex()!=null?basePatientDO.getSex():0;
                            String family = addFamily(userId,basePatientDO.getIdcard(),basePatientDO.getName(),sex.toString(),birdth,age.toString(),basePatientDO.getMobile());
                            JSONObject object2 = JSONObject.parseObject(family);
                            if (object2.getString("code").equalsIgnoreCase("200")){
                                JSONObject object3 = object2.getJSONObject("data");
                                String yktId = object3.getString("ID");
                                basePatientDO.setYktId(yktId);
                                userId = object3.getString("ASSUSERID");
                                basePatientDO.setUserId(userId);
                                patientDao.save(basePatientDO);
                            }
                        }
                    }else {
                        throw new Exception("查询家庭成员失败!");
                    }
                }
            }
        }
    }
    /**
     * 医生端眼科通登陆
     * @param loginId 账户
     * @param password 密码
     * @return
     */
    public String DoctorLogin(String loginId,String password){
        String response="";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("loginId",loginId);//账户
        jsonObject.put("password",password);//密码
        String url = "http://www.yanketong.com:90/api/Doctor/DoctorLogin";
        response = httpClientUtil.sendPost(url,jsonObject.toJSONString());
        logger.info("医生端登陆:"+response);
        return response;
    }
    public String updateYkyyDoctor(String idCard,String verifyCode,String yktDoctorId)throws Exception{
        String sql ="select y.code AS \"code\",y.name AS \"name\",y.expertise AS \"expertise\",y.introduce AS \"introduce\",y.mobile AS \"mobile\",y.idCard AS \"idcard\",y.JOBTITLECODE AS \"jobTitleCode\",y.JOBTITLENAME AS \"jobTitleName\",y.dept AS \"dept\",y.deptName AS \"deptName\" from v_Hlw_Ysxx y where y.idcard is not null";
        sql +=" and y.idcard ='"+idCard+"' ";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            JSONArray array = rs.getJSONArray("detailModelList");
            logger.info("doctor size:"+array.size());
            if(array!=null&&array.size()>0) {
                for (int i = 0; i < array.size(); i++) {
                    JSONObject doctorJson = array.getJSONObject(i);
                    String idcard = doctorJson.getString("idcard");
                    //过滤身份证脏数据
                    if(idcard.length()>=15){
                        BaseDoctorDO doctorDOs = baseDoctorDao.findByIdcard(idcard);
                        if(doctorDOs!=null){
                            BaseDoctorDO doctor = doctorDOs;
                            String salt = randomString(5);
                            String pw = idcard.substring(idcard.length() - 6);
                            doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                            doctor.setSalt(salt);
                            if(StringUtils.isNoneBlank(doctorJson.getString("jobTitleCode"))){
                                doctor.setJobTitleCode(doctorJson.getString("jobTitleCode"));
                                doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
                            }
                            doctor.setVerifyCode(verifyCode);
                            doctor.setYktDoctorId(yktDoctorId);
//                            doctor.setExpertise(doctorJson.getString("expertise"));
//                            doctor.setIntroduce(doctorJson.getString("introduce"));
//                            doctor.setMobile(doctorJson.getString("mobile"));
                            BaseDoctorDO temp = baseDoctorDao.save(doctor);
                            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByOrgCodeAndDeptCodeAndDoctorCode(orgCode,doctorJson.getString("dept"),doctor.getId());
                            if(hospitalDOs!=null&&hospitalDOs.size()>0){
                                //机构信息部门信息
                                BaseDoctorHospitalDO hospitalDO = hospitalDOs.get(0);
                                hospitalDO.setDeptCode(doctorJson.getString("dept"));
                                hospitalDO.setDeptName(doctorJson.getString("deptName"));
                                hospitalDO.setDel("1");
                                baseDoctorHospitalDao.save(hospitalDO);
                            }
                        }else{
                            //新增医生
                            BaseDoctorDO doctor = new BaseDoctorDO();
                            doctor.setName(doctorJson.getString("name"));
                            doctor.setIdcard(idcard);
                            doctor.setSex(Integer.parseInt(com.yihu.jw.util.common.IdCardUtil.getSexForIdcard_new(idcard)));
                            doctor.setBirthday(com.yihu.jw.util.common.IdCardUtil.getBirthdayForIdcard(idcard));
                            doctor.setProvinceCode("350000");
                            doctor.setProvinceName("福建省");
                            doctor.setTownCode("350203");
                            doctor.setTownName("思明区");
                            doctor.setCityCode("350200");
                            doctor.setCityName("厦门市");
                            doctor.setVerifyCode(verifyCode);
                            doctor.setYktDoctorId(yktDoctorId);
//                            doctor.setExpertise(doctorJson.getString("expertise"));
//                            doctor.setIntroduce(doctorJson.getString("introduce"));
//                            doctor.setMobile(doctorJson.getString("mobile"));
                            //认证信息设置
                            String salt = randomString(5);
                            String pw = idcard.substring(idcard.length() - 6);
                            doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                            doctor.setSalt(salt);
                            doctor.setDel("1");
                            doctor.setEnabled(1);
                            doctor.setLocked(0);
                            doctor.setCreateTime(new Date());
                            doctor.setJobTitleCode(doctorJson.getString("jobTitleCode"));
                            doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
                            BaseDoctorDO temp = baseDoctorDao.save(doctor);
                            //机构信息部门信息
                            BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
                            hospitalDO.setDoctorCode(temp.getId());
                            hospitalDO.setOrgCode(orgCode);
                            hospitalDO.setOrgName(orgName);
                            hospitalDO.setDeptCode(doctorJson.getString("dept"));
                            hospitalDO.setDeptName(doctorJson.getString("deptName"));
                            hospitalDO.setDel("1");
                            baseDoctorHospitalDao.save(hospitalDO);
                            //保存角色
                            BaseDoctorRoleDO role = new BaseDoctorRoleDO();
                            role.setDoctorCode(temp.getId());
                            role.setRoleCode("specialist");
                            baseDoctorRoleDao.save(role);
                            //保存mapping
                            DoctorMappingDO mappingDO = new DoctorMappingDO();
                            mappingDO.setIdcard(idcard);
                            mappingDO.setDoctor(temp.getId());
                            mappingDO.setDoctorName(temp.getName());
                            mappingDO.setOrgCode(orgCode);
                            mappingDO.setOrgName(orgName);
                            mappingDO.setMappingCode(doctorJson.getString("code"));
                            mappingDO.setMappingName(temp.getName());
                            mappingDO.setCreateTime(new Date());
                            doctorMappingDao.save(mappingDO);
                        }
                    }
                }
            }
        }
        return "success";
    }
}

+ 47 - 1
svr/svr-base/src/main/resources/application.yml

@ -592,4 +592,50 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://10.9.1.247:3000/
---
---
spring:
  profiles: hzprod
  datasource:
     url: jdbc:mysql://172.26.0.13:3306/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
     username: root
     password: '*ukOOSl&c0!y'
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 172.26.0.13:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://172.26.0.13:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://172.26.0.12:61616
    user: admin
    password: admin
  redis:
    host: 172.26.0.13 # Redis server host.
    port: 6379  # Redis server port.
    password: Kb6wKDQP1W4
fastDFS:
  fastdfs_file_url: http://172.26.0.13:80/
demo:
  flag: true
hospital:
  url: 1
  mqUser: 1
  mqPwd: 1
  SourceSysCode: S60
  TargetSysCode: S01
wlyy:
  url: 1
wechat:
  id: 1
  flag: false
pay:
  flag: false
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 1
im:
  im_list_get: http://172.26.0.12:3000/

+ 8 - 0
svr/svr-base/src/main/resources/bootstrap.yml

@ -102,3 +102,11 @@ spring:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: hzprod
  cloud:
    config:
      uri: ${wlyy-spring.config.uri:http://172.26.0.12:1221}
      label: ${wlyy-spring.config.label:jwdev}

+ 3 - 24
svr/svr-cloud-care/pom.xml

@ -123,24 +123,9 @@
        </dependency>
        <!-- Swagger-ui library -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${version.swagger}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${version.swagger-ui}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-staticdocs</artifactId>
            <version>${version.springfox-staticdocs}</version>
        </dependency>
        <dependency>
            <groupId>io.github.swagger2markup</groupId>
            <artifactId>swagger2markup</artifactId>
            <version>${version.swagger2markup}</version>
            <groupId>com.yihu.jw</groupId>
            <artifactId>swagger-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <!-- Jzkl Starter -->
        <dependency>
@ -268,12 +253,6 @@
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.tencentcloudapi</groupId>
            <artifactId>tencentcloud-sdk-java</artifactId>
            <version>3.1.265</version><!-- 注:这里只是示例版本号,请获取并替换为 最新的版本号 -->
        </dependency>
        <!--oracle驱动-->
        <dependency>
            <groupId>com.oracle</groupId>

+ 6 - 0
svr/svr-cloud-care/sql/init.sql

@ -0,0 +1,6 @@
-- 短信配置
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('hz_yxyzh_wx_sms_SecretId', NULL, 'hz_yxyzh_wx_sms', 'SecretId', 'AKIDwhBPN5WgYAVaO2QXNwEF0UieJhpgGZbN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('hz_yxyzh_wx_sms_SecretKey', NULL, 'hz_yxyzh_wx_sms', 'SecretKey', 'WliPpdBSXMuBBuNZU8VbQyFG0TfaEbhX', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('hz_yxyzh_wx_sms_signName', NULL, 'hz_yxyzh_wx_sms', 'signName', '朝晖云照护', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('hz_yxyzh_wx_sms_smsSdkAppId', NULL, 'hz_yxyzh_wx_sms', 'smsSdkAppId', '1400526119', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('hz_yxyzh_wx_sms_VerificationCode', NULL, 'hz_yxyzh_wx_sms', 'VerificationCode', '969545', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/RedisLockAOP.java

@ -33,9 +33,9 @@ import java.util.List;
/**
 * redis分布式锁AOP
 *
 * @author baichuan.wu
 * @author yeshijie
 * @version 1.0.0
 * @date 2019-12-26 14:16
 * @date 2021/4/23
 */
@Aspect
@Order(-1)

+ 4 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/AqgConfig.java

@ -26,16 +26,17 @@ public class AqgConfig {
     * 修改亲情号码
     */
    public static final String sos_numbers = baseUrl +"/api/device/{0}/sos_numbers/{1}";
    public static final String X1sos_numbers = baseUrl +"/api/device/{0}/4g/sos_numbers/{1}";
    /**
     * 获取设备最新位置数据
     */
    public static final String device_last_locationdata = baseUrl +"/api/device/{0}/data/locationdata/";
    public static final String device_last_locationData = baseUrl +"/api/device/{0}/data/locationdata/";
    /**
     * 设置智能手环安全区域
     */
    public static final String fence_area = baseUrl +"/api/device/{0}/fences/{1}";
    public static final String S3fence_area = baseUrl +"/api/device/{0}/fences/{1}";
    public static final String X1fence_area = baseUrl +"/api/device/{0}/4g/fences/{1}";
    public static final String username = "13559485270";

+ 0 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SpringSecurityAuditorAware.java

@ -7,12 +7,6 @@ import org.springframework.data.domain.AuditorAware;
public class SpringSecurityAuditorAware implements AuditorAware {
    @Override
    public Object getCurrentAuditor() {
//        return Optional.ofNullable(SecurityContextHolder.getContext())
//                .map(SecurityContext::getAuthentication)
//                .filter(Authentication::isAuthenticated)
//                .map(Authentication::getPrincipal);
////                .map(Authentication::getDetails);
        return "123";
    }
}

+ 0 - 44
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SwaggerDocs.java

@ -1,44 +0,0 @@
package com.yihu.jw.care.config;
import io.github.swagger2markup.GroupBy;
import io.github.swagger2markup.Language;
import io.github.swagger2markup.Swagger2MarkupConfig;
import io.github.swagger2markup.Swagger2MarkupConverter;
import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
import io.github.swagger2markup.markup.builder.MarkupLanguage;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
 * Created by lith on 2018/11/23
 */
public class SwaggerDocs {
    public static void main(String[] args) throws Exception {
        //1.请求 http://ip:port/swagger-resources获取group
        String group = "Default";
        //2.定义请求地址 new URL("http://ip:port/v2/api-docs?group=" + groupName)
        //项目的swagger-ui地址
        URL remoteSwaggerFile = new URL("http://127.0.0.1:10022/v2/api-docs?group=" + group);
        //3.定义文件输出路径
        String prefix = Thread.currentThread().getContextClassLoader().getResource("").getPath();
        //文档输出地址
        Path outputFile = Paths.get(prefix.substring(prefix.lastIndexOf(":") + 1, prefix.indexOf("target") - 1) + "/build/" + group);
        Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
                .withMarkupLanguage(MarkupLanguage.ASCIIDOC)
                .withOutputLanguage(Language.ZH)
                .withPathsGroupedBy(GroupBy.TAGS)
                .withGeneratedExamples()
                .withoutInlineSchema()
                //.withBasePathPrefix()
                .build();
        Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(remoteSwaggerFile)
                .withConfig(config)
                .build();
        converter.toFile(outputFile);
    }
}

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

@ -1,30 +0,0 @@
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);
    }
}

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/assistance/EmergencyAssistanceDao.java

@ -15,7 +15,7 @@ public interface EmergencyAssistanceDao extends PagingAndSortingRepository<Emerg
    List<EmergencyAssistanceDO> queryByPatientAndStatusIn(String patient, Integer[] status, Sort sort);
    EmergencyAssistanceDO findByPatientAndStatus(String patient,Integer status);
    List<EmergencyAssistanceDO> findByPatientAndStatus(String patient,Integer status);
    EmergencyAssistanceDO findByProxyPatientAndStatus(String proxyPatient,Integer status);
    List<EmergencyAssistanceDO> findByProxyPatientAndStatus(String proxyPatient,Integer status);
}

+ 15 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/EmergencyWarnCancelLogDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.care.dao.security;
import com.yihu.jw.entity.care.securitymonitoring.EmergencyWarnCancelLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/4/7.
 */
public interface EmergencyWarnCancelLogDao extends PagingAndSortingRepository<EmergencyWarnCancelLogDO,String>,
        JpaSpecificationExecutor<EmergencyWarnCancelLogDO> {
}

+ 18 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/EmergencyWarnConclusionDao.java

@ -0,0 +1,18 @@
package com.yihu.jw.care.dao.security;
import com.yihu.jw.entity.care.securitymonitoring.EmergencyWarnConclusionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/4/7.
 */
public interface EmergencyWarnConclusionDao extends PagingAndSortingRepository<EmergencyWarnConclusionDO,String>,
        JpaSpecificationExecutor<EmergencyWarnConclusionDO> {
    @Query("select c from EmergencyWarnConclusionDO c where c.orderId = ?1")
    EmergencyWarnConclusionDO findByOrderId(String orderId);
}

+ 15 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/EmergencyWarnDoctorResponseDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.care.dao.security;
import com.yihu.jw.entity.care.securitymonitoring.EmergencyWarnDoctorResponseDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/5/21.
 */
public interface EmergencyWarnDoctorResponseDao extends PagingAndSortingRepository<EmergencyWarnDoctorResponseDO,String>,
        JpaSpecificationExecutor<EmergencyWarnDoctorResponseDO> {
    EmergencyWarnDoctorResponseDO findByDoctorAndOrderId(String doctor,String orderId);
}

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

@ -1,19 +0,0 @@
package com.yihu.jw.care.dao.security;
import com.yihu.jw.entity.care.securitymonitoring.SecurityMonitoringConclusionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Bing on 2021/4/7.
 */
public interface SecurityMonitoringConclusionDao extends PagingAndSortingRepository<SecurityMonitoringConclusionDO,String>,
        JpaSpecificationExecutor<SecurityMonitoringConclusionDO> {
    @Query("select c from SecurityMonitoringConclusionDO c where c.orderId = ?1")
    SecurityMonitoringConclusionDO findByOrderId(String orderId);
}

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

@ -1,14 +0,0 @@
package com.yihu.jw.care.dao.security;
import com.yihu.jw.entity.care.securitymonitoring.SecurityMonitoringOrderCancelLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/4/7.
 */
public interface SecurityMonitoringOrderCancelLogDao extends PagingAndSortingRepository<SecurityMonitoringOrderCancelLog,String>,
        JpaSpecificationExecutor<SecurityMonitoringOrderCancelLog> {
}

+ 3 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/SecurityMonitoringOrderDao.java

@ -19,11 +19,13 @@ public interface SecurityMonitoringOrderDao extends PagingAndSortingRepository<S
    @Modifying
    @Transactional
    @Query("update SecurityMonitoringOrderDO o set o.conclusionStatus = 1,o.status='4' where o.id=?1")
    @Query("update SecurityMonitoringOrderDO o set o.conclusionStatus = 1,o.status='0' where o.id=?1")
    void updateConclusionStatus(String orderId);
    @Modifying
    @Transactional
    @Query("update SecurityMonitoringOrderDO o set o.conclusionStatus = 1 where o.id=?1")
    void updateConclusionStatus2(String orderId);
    List<SecurityMonitoringOrderDO> findByPatientAndStatus(String patient,Integer status);
}

+ 0 - 12
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/SecurityMonitoringOrderPatientConfirmLogDao.java

@ -1,12 +0,0 @@
package com.yihu.jw.care.dao.security;
import com.yihu.jw.entity.care.securitymonitoring.SecurityMonitoringOrderPatientConfirmLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/4/7.
 */
public interface SecurityMonitoringOrderPatientConfirmLogDao extends PagingAndSortingRepository<SecurityMonitoringOrderPatientConfirmLog,String>,
        JpaSpecificationExecutor<SecurityMonitoringOrderPatientConfirmLog> {
}

+ 53 - 12
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java

@ -49,7 +49,7 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "doctorGetOrderDetail")
    @ApiOperation(value = "医生查看救助详情")//不可查看已取消
    @ApiOperation(value = "医生查看救助详情")
    public ObjEnvelop doctorGetOrderDetail(@ApiParam(name="orderId",value = "工单id")
                                     @RequestParam(value = "orderId") String orderId,
                                     @ApiParam(name="doctor",value = "doctor")
@ -154,7 +154,7 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "getUnCompleteOrderList")
    @ApiOperation(value = "医生查看居民救助列表(不包括已取消与已完成)")
    @ApiOperation(value = "医生查看居民救助列表(申请中)")
    public ListEnvelop getUnCompleteOrderList(@ApiParam(name="patientId",value = "居民id")
                                    @RequestParam(value = "patientId",required = false) String patientId,
                                    @ApiParam(name="doctor",value = "查看医生")
@ -197,16 +197,18 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = "updateConclusion")
    @ApiOperation(value = "医生编辑救助服务小结")
    @ObserverRequired
    public ObjEnvelop updateConclusion(@ApiParam(name="doctor",value = "doctor")
                                  @RequestParam(value = "doctor") String doctor,
                                  @ApiParam(name="orderId",value = "工单id")
                                  @RequestParam(value = "orderId") String orderId,
                                  @ApiParam(name="conclusion",value = "服务小结")
                                  @RequestParam(value = "conclusion") String conclusion,
                                  @ApiParam(name="conclusionImg",value = "附件多张图片用逗号隔开,非必传")
                                  @RequestParam(value = "conclusionImg",required = false) String conclusionImg){
    public ObjEnvelop updateConclusion(@ApiParam(value = "字典emergency_reason值",name = "emergency_reason",required = true)
                                       @RequestParam(value = "emergency_reason") Integer emergency_reason,
                                       @ApiParam(value = "字典emergency_treatment_status值",name = "treatment_status",required = true)
                                       @RequestParam(value = "treatment_status") Integer treatment_status,
                                       @ApiParam(value = "工单id", name = "orderId")
                                       @RequestParam(value = "orderId") String orderId,
                                       @ApiParam(value = "服务小结", name = "conclusion")
                                       @RequestParam(value = "conclusion", required = false) String conclusion,
                                       @ApiParam(value = "服务小结", name = "conclusion_img")
                                       @RequestParam(value = "conclusion_img", required = false) String conclusion_img){
        try {
            JSONObject result = assistanceService.updateConclusion(doctor,orderId,conclusion,conclusionImg);
            JSONObject result = assistanceService.updateConclusion(emergency_reason,treatment_status, orderId,conclusion,conclusion_img,getUID());
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
@ -258,7 +260,7 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("定位更新成功",result.getJSONObject("resultMsg"));
            return ObjEnvelop.getSuccess("定位更新成功",result.getString("resultMsg"));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("定位更新失败"+e.getMessage());
@ -302,4 +304,43 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError("发送失败"+e.getMessage());
        }
    }
    @PostMapping("responseOrder")
    @ApiOperation(value = "医生响应紧急预警(点击立即前往)")
    @ObserverRequired
    public ObjEnvelop responseOrder(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "doctor", name = "doctor")
            @RequestParam(value = "doctor", required = false) String doctor) {
        try {
            JSONObject result = assistanceService.responseOrder(orderId, doctor);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
            return ObjEnvelop.getSuccess("操作成功",result.getString("resultMsg"));
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "操作失败!" + e.getMessage());
        }
    }
    @PostMapping("errorWarning")
    @ApiOperation(value = "误报警")
    public ObjEnvelop errorWarning(@ApiParam(value = "工单id", name = "orderId", required = true)
                                   @RequestParam(value = "orderId") String orderId,
                                   @ApiParam(value = "误报警类型 字典emergency_cancel的code", name = "emergencyCancel", required = true)
                                   @RequestParam(value = "emergencyCancel", defaultValue = "4") Integer emergencyCancel){
        try {
            JSONObject result = assistanceService.errorWarning(orderId,emergencyCancel,getUID());
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
            return ObjEnvelop.getSuccess("修改成功",result.getJSONObject("resultMsg"));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("修改失败");
        }
    }
}

+ 24 - 7
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/PatientCourseEndpoint.java

@ -122,7 +122,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
//            @ApiParam(name = "currentPage", value = "当前页面", defaultValue = "1") @RequestParam(value = "currentPage", required = true) int currentPage
    ) {
        try {
            JSONObject json = courseService.getCourseByOrg(longitude,latitude);//, pageSize, currentPage
            JSONObject json = courseService.getCourseByOrg(longitude,latitude);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -139,7 +139,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
//            @ApiParam(name = "currentPage", value = "当前页面", defaultValue = "1") @RequestParam(value = "currentPage", required = true) int currentPage
    ) {
        try {
            JSONObject json = courseService.getCourseByteacher(longitude,latitude);//, pageSize, currentPage
            JSONObject json = courseService.getCourseByteacher(longitude,latitude);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -153,7 +153,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "id", value = "课程id", defaultValue = "808080eb7861c327017861d18d070011") @RequestParam(value = "id", required = true) String id
    ) {
        try {
            JSONObject json = courseService.getCourseInfo(id);//, pageSize, currentPage
            JSONObject json = courseService.getCourseInfo(id);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -168,7 +168,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "patient", value = "居民code", defaultValue = "808080eb7955aa9301795b8bad3f0078") @RequestParam(value = "patient", required = true) String patient
    ) {
        try {
            JSONObject json = courseService.getCatalogue(id,patient);//, pageSize, currentPage
            JSONObject json = courseService.getCatalogue(id,patient);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -182,7 +182,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "id", value = "机构id", defaultValue = "808080eb7861c327017861d18d070011") @RequestParam(value = "id", required = true) String id
    ) {
        try {
            JSONObject json = courseService.getOrgInfoById(id);//, pageSize, currentPage
            JSONObject json = courseService.getOrgInfoById(id);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -199,7 +199,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "size", value = "size", defaultValue = "10") @RequestParam(value = "size", required = true) int size
    ) {
        try {
            JSONObject json = courseService.getTecInfoById(doctor,orgCode,page,size);//, pageSize, currentPage
            JSONObject json = courseService.getTecInfoById(doctor,orgCode,page,size);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -216,7 +216,7 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "size", value = "size", defaultValue = "10") @RequestParam(value = "size", required = true) int size
    ) {
        try {
            JSONObject json = courseService.getCoursrOrderStatusByPatient(patient,status,page,size);//, pageSize, currentPage
            JSONObject json = courseService.getCoursrOrderStatusByPatient(patient,status,page,size);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
@ -236,6 +236,23 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping("enrollment")
    @ApiOperation(value = "招生报名")
    public Envelop enrollment(@ApiParam(name = "patient", value = "居民id", defaultValue = "3ae2673512154d5280d1dcf5ffa5626d")
                              @RequestParam(value = "patient", required = true) String patient,
                              @ApiParam(name = "recruitStudentsId", value = "招生id", defaultValue = "1")
                              @RequestParam(value = "recruitStudentsId", required = true) String recruitStudentsId){
        try {
            JSONObject json = courseService.enrollment(patient,recruitStudentsId);
            if(json.getInteger(ResponseContant.resultFlag)==0){
                return failed(json.getString(ResponseContant.resultMsg),-1);
            }
            return success("报名成功",json.get("recordDO"));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    //购买课程
    @PostMapping("buyCourseOrder")
    @ApiOperation(value = "在线报名-购买课程")

+ 4 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/DoctorHealthController.java

@ -207,6 +207,10 @@ public class DoctorHealthController extends BaseController {
			if (xl != null) {
				map.put("xl", xl);
			}
			DevicePatientHealthIndex tw = healthIndexService.findLastByPatienIot(patient, 6);
			if (tw != null) {
				map.put("tw", tw);
			}
			return write(200, "查询成功", "data", map);
		} catch (Exception ex) {
			error(ex);

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

@ -4,13 +4,18 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.doorCoach.DoctorDoorCoachOrderService;
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.im.service.ImService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -40,9 +45,13 @@ public class DoctorDoorCoachOrderController extends BaseController {
    private PatientDoorCoachOrderService patientDoorCoachOrderService;
    @Autowired
    private DoctorDoorCoachOrderService doctorDoorCoachOrderService;
    @Autowired
    private ImService imService;
    @Autowired
    private ConsultTeamService consultTeamService;
    @PostMapping(value = "proxyCreate")
    @ApiOperation(value = "创建上门服务咨询--医生代预约")
    @ApiOperation(value = "创建上门预约咨询--医生代预约")
    public String create(@ApiParam(name = "jsonData", value = "Json数据", required = true) @RequestParam String jsonData) {
        try{
            JSONObject result = patientDoorCoachOrderService.proxyCreate(jsonData,getUID());
@ -191,7 +200,7 @@ public class DoctorDoorCoachOrderController extends BaseController {
    }
    @PostMapping("signIn")
    @ApiOperation(value = "上门服务签到")
    @ApiOperation(value = "上门预约签到")
    public String signIn(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
@ -508,6 +517,8 @@ public class DoctorDoorCoachOrderController extends BaseController {
        }
    }
    /**
     * 获取服务项目
     *
@ -589,4 +600,27 @@ public class DoctorDoorCoachOrderController extends BaseController {
            return error(-1, "操作失败!");
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.DodtorIM.getConsultInfoAndPatientInfo)
    @ApiOperation(value = "获取咨询问题,图片,居民信息", notes = "获取咨询问题,图片,居民信息")
    public ObjEnvelop getConsultInfoAndPatientInfo(
            @ApiParam(name = "consult", value = "咨询CODE")
            @RequestParam(value = "consult",required = false) String consult,
            @ApiParam(name = "patientCode", value = "居民COEE")
            @RequestParam(value = "patientCode",required = false) String patientCode)throws Exception {
        return ObjEnvelop.getSuccess("请求成功", imService.getConsultInfoAndPatientInfo(consult, patientCode));
    }
    @RequestMapping(value = "queryByConsultCode",method = RequestMethod.GET)
    @ApiOperation("根据咨询code查询关联业务项详情")
    public ObjEnvelop queryByConsultCode(@ApiParam(name = "code", value = "咨询code") @RequestParam(value = "code", required = true) String code,
                                     @ApiParam(name = "type", value = "咨询类型") @RequestParam(value = "type", required = true) Integer type){
        try{
            JSONObject detail = consultTeamService.queryByConsultCode(code,type);
            return ObjEnvelop.getSuccess("查询成功", detail.get("data"));
        }catch (Exception e){
            error(e);
            return ObjEnvelop.getError("查询失败");
        }
    }
}

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

@ -51,14 +51,13 @@ public class PatientDoorCoachOrderController extends EnvelopRestEndpoint {
    }
    @PostMapping(value = "create")
    @ApiOperation(value = "创建上门服务工单")
    @ApiOperation(value = "创建上门预约工单")
    public Envelop create(@ApiParam(name = "jsonData", value = "Json数据", required = true) @RequestParam String jsonData) {
        JSONObject result = new JSONObject();
        try{
            result = patientDoorCoachOrderService.create(jsonData);
        }catch (Exception e){
            e.printStackTrace();
            return failed(e.getMessage());
            return failedException(e);
        }
        if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
            return failed(result.getString(ResponseContant.resultMsg));
@ -96,8 +95,7 @@ public class PatientDoorCoachOrderController extends EnvelopRestEndpoint {
                return failed(result.getString(ResponseContant.resultMsg));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failed(e.getMessage());
            return failedException(e);
        }
        return success(result.get(ResponseContant.resultMsg));
@ -194,7 +192,7 @@ public class PatientDoorCoachOrderController extends EnvelopRestEndpoint {
                // 根据接单医生code获取最近一次服务orderId
                orderId = patientDoorCoachOrderService.getOrderIdByPatient(patientCode);
                if (StringUtils.isEmpty(orderId)) {
                    return ObjEnvelop.getError( "获取失败, 该医生暂无工单" );
                    return ObjEnvelop.getSuccess( "获取失败, 该医生暂无工单",null);
                }
            }
            // 根据orderId获取工单信息

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

@ -1,7 +1,6 @@
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;
@ -11,9 +10,6 @@ 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.
 */
@ -23,8 +19,6 @@ import java.util.List;
public class ChildrenExaminationEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ChildrenExaminationService examinationService;
    @Autowired
    private TencentSmsUtil tencentSmsUtil;
    @PostMapping("newRecord")
    @ApiOperation("居民居家自建记录添加")

+ 15 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/lifeCare/DoctorLifeCareEndpoint.java

@ -100,4 +100,19 @@ public class DoctorLifeCareEndpoint extends EnvelopRestEndpoint {
            return Envelop.getError( "记录失败" ,-1);
        }
    }
    @GetMapping(value = "getPatientOrderList")
    @ApiOperation(value = "医生查看居民工单列表")
    public PageEnvelop getPatientOrderList(
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = true) String patient,
            @ApiParam(name = "status", value = "工单状态") @RequestParam(value = "status", required = false) Integer status,
            @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 lifeCareOrderService.getPatientOrderList(patient, status, page, size);
        }catch (Exception e){
            e.printStackTrace();
        }
        return PageEnvelop.getError("查询失败");
    }
}

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

@ -1,6 +1,8 @@
package com.yihu.jw.care.endpoint.message;
import com.yihu.jw.care.service.message.PatientMessageService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -8,10 +10,9 @@ 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;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * Created by Bing on 2021/5/19.
@ -57,4 +58,29 @@ public class PatientMessageEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError("查询失败"+e.getMessage());
        }
    }
    @GetMapping(value = "getSystemMessage")
    @ApiOperation("居民获取系统消息父级列表")
    public ListEnvelop getSystemMessage(@ApiParam(name = "patient",required = true)
                                        @RequestParam(value = "patient")String patient){
        return ListEnvelop.getSuccess("查询成功",patientMessageService.getSystemMessage(patient));
    }
    @GetMapping(value = "getSystemMessageList")
    @ApiOperation("居民获取系统消息子级列表")
    public ListEnvelop getSystemMessageList(@ApiParam(name = "patient",required = true)
                                            @RequestParam(value = "patient")String patient,
                                            @ApiParam(name = "type",required = true)
                                            @RequestParam(value = "type")String type
                                            ){
        return ListEnvelop.getSuccess("查询成功",patientMessageService.getSystemMessageList(patient,type));
    }
    @PostMapping(value = "/updateMessageRead")
    @ApiOperation("已读消息")
    public Envelop updateMessageRead(@ApiParam(name = "messageId",required = true)
                                         @RequestParam(value = "messageId")String messageId){
        patientMessageService.updateMessageRead(messageId);
        return Envelop.getSuccess("修改成功");
    }
}

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

@ -3,11 +3,12 @@ package com.yihu.jw.care.endpoint.security;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.service.security.SecurityMonitoringOrderService;
import com.yihu.jw.entity.care.device.Device;
import com.yihu.jw.entity.care.securitymonitoring.SecurityMonitoringConclusionDO;
import com.yihu.jw.entity.care.securitymonitoring.EmergencyWarnConclusionDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -49,7 +50,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "getSecurityOrderList")
    @ApiOperation(value = "获取安防工单列表")
    public ListEnvelop getSecurityOrderList(@ApiParam(name="doctor",value = "医生ID,当前查看列表医生",required = false)
    public PageEnvelop getSecurityOrderList(@ApiParam(name="doctor",value = "医生ID,当前查看列表医生",required = false)
                                            @RequestParam(value = "doctor",required = false)String doctor,
                                            @ApiParam(name="serverDoctor",value = "处置医生di 即为患者提供服务的医生")
                                            @RequestParam(value = "serverDoctor",required = false)String serverDoctor,
@ -66,10 +67,10 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
        try {
            page = page>1?page-1:0;
            return ListEnvelop.getSuccess("查询成功",securityMonitoringOrderService.getSecurityOrderList(doctor,serverDoctor,patientName, patient, status, page, pageSize));
            return securityMonitoringOrderService.getSecurityOrderList(doctor,serverDoctor,patientName, patient, status, page, pageSize);
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
            return PageEnvelop.getError("查询失败");
        }
    }
@ -87,14 +88,15 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "getSecurityOrderDetail")
    @ApiOperation(value = "获取安防工单详情")//
    public ObjEnvelop getSecurityOrderDetail(@ApiParam(name="orderId",value = "orderId",required = true)
                                            @RequestParam(value = "orderId")String orderId){
                                            @RequestParam(value = "orderId")String orderId,
                                             @ApiParam(name="doctor",value = "doctor",required = false)
                                             @RequestParam(value = "doctor",required = false)String doctor){
        try {
            JSONObject result = securityMonitoringOrderService.getSecurityOrderDetail(orderId);
            JSONObject result = securityMonitoringOrderService.getSecurityOrderDetail(orderId,doctor);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
@ -105,7 +107,25 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping("acceptOrder")
    @PostMapping("errorWarning")
    @ApiOperation(value = "误报警")
    public ObjEnvelop errorWarning(@ApiParam(value = "工单id", name = "orderId", required = true)
                                   @RequestParam(value = "orderId") String orderId,
                                   @ApiParam(value = "误报警类型 字典emergency_cancel的code", name = "emergencyCancel", required = true)
                                   @RequestParam(value = "emergencyCancel", defaultValue = "4") Integer emergencyCancel){
        try {
            JSONObject result = securityMonitoringOrderService.errorWarning(orderId,emergencyCancel,getUID());
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
            return ObjEnvelop.getSuccess("修改成功",result.getJSONObject("resultMsg"));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("修改失败");
        }
    }
    @PostMapping("acceptOrder-- 未使用")
    @ApiOperation(value = "接单")
    @ObserverRequired
    public ObjEnvelop acceptOrder(
@ -128,11 +148,13 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    @ObserverRequired
    public Envelop cancelOrder(
            @ApiParam(name = "orderId", value = "工单id") @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(name = "reason", value = "取消理由") @RequestParam(value = "reason", required = true) String reason,
            @ApiParam(name = "doctor", value = "医生id") @RequestParam(value = "doctor", required = true) String doctor) {
            @ApiParam(name = "reason", value = "取消理由") @RequestParam(value = "reason", required = false) String reason,
            @ApiParam(name = "doctor", value = "doctor") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "cancel_type", value = "取消类型 1-调度员取消,2-居民取消 3 医生取消")
            @RequestParam(value = "cancel_type",required = false,defaultValue = "3") Integer cancel_type) {
        JSONObject result = new JSONObject();
        try{
            result = securityMonitoringOrderService.cancelOrder(orderId, 2, reason,doctor);
            result = securityMonitoringOrderService.cancelOrder(orderId, cancel_type, reason,doctor);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
@ -145,7 +167,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    }
    @PostMapping("signIn")
    @ApiOperation(value = "上门服务签到")
    @ApiOperation(value = "服务签到-未使用")
    @ObserverRequired
    public ObjEnvelop signIn(
            @ApiParam(value = "工单id", name = "orderId")
@ -176,16 +198,19 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    @ObserverRequired
    @ApiOperation("编辑保存服务工单小结")
    public ObjEnvelop updateDoorConclusion(
            @ApiParam(value = "处置状态",name = "manageStatus 1已确认安全 2已转送医疗机构 3已处置完成",required = true)
            @RequestParam Integer manageStatus,
            @ApiParam(value = "字典emergency_reason值",name = "emergency_reason",required = true)
            @RequestParam(value = "emergency_reason") Integer emergency_reason,
            @ApiParam(value = "字典emergency_treatment_status值",name = "treatment_status",required = true)
            @RequestParam(value = "treatment_status") Integer treatment_status,
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @RequestParam(value = "orderId") String orderId,
            @ApiParam(value = "服务小结", name = "conclusion")
            @RequestParam(value = "conclusion", required = true) String conclusion,
            @ApiParam(value = "补录状态", name = "examPapeStatus")
            @RequestParam(value = "examPapeStatus", required = false) Integer examPapeStatus) {
            @RequestParam(value = "conclusion", required = false) String conclusion,
            @ApiParam(value = "服务小结", name = "conclusion_img")
            @RequestParam(value = "conclusion_img", required = false) String conclusion_img
            ) {
        try {
            JSONObject result = securityMonitoringOrderService.updateDoorConclusion(manageStatus, orderId,conclusion,examPapeStatus);
            JSONObject result = securityMonitoringOrderService.updateDoorConclusion(emergency_reason,treatment_status, orderId,conclusion,conclusion_img);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
@ -231,7 +256,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
                }
            }
            // 根据orderId查询工单小结表
            SecurityMonitoringConclusionDO doorConclusion = securityMonitoringOrderService.getDoorConclusion(orderId);
            EmergencyWarnConclusionDO doorConclusion = securityMonitoringOrderService.getDoorConclusion(orderId);
            return ObjEnvelop.getSuccess("获取成功", doorConclusion);
        } catch (Exception e) {
            e.printStackTrace();
@ -239,7 +264,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping("saveOrderFinishBydoctor")
    @PostMapping("saveOrderFinishBydoctor--未使用")
    @ApiOperation(value = "医生确认完成工单")
    @ObserverRequired
    public ObjEnvelop saveOrderFinishBydoctor(
@ -273,7 +298,6 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
        }
    }
    @ApiOperation("获取居民监护信息")
    @RequestMapping(value = "patientMonitoringInfo", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
@ -286,4 +310,73 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError("查询失败");
        }
    }
    @PostMapping("responseOrder")
    @ApiOperation(value = "医生响应紧急预警(点击立即前往)")
    @ObserverRequired
    public ObjEnvelop responseOrder(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "doctor", name = "doctor")
            @RequestParam(value = "doctor", required = false) String doctor) {
        try {
            JSONObject result = securityMonitoringOrderService.responseOrder(orderId, doctor);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
            return ObjEnvelop.getSuccess("操作成功",result.getString("resultMsg"));
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "操作失败!" + e.getMessage());
        }
    }
    @PostMapping(value = "updateDoctorLocation")
    @ApiOperation(value = "更新医生定位信息")
    @ObserverRequired
    public ObjEnvelop updateDoctorLocation(@ApiParam(name="doctor",value = "doctor")
                                           @RequestParam(value = "doctor") String doctor,
                                           @ApiParam(name="orderId",value = "工单id",required =false )
                                           @RequestParam(value = "orderId",required = false) String orderId,
                                           @ApiParam(name="doctorAddress",value = "医生地址描述")
                                           @RequestParam(value = "doctorAddress") String doctorAddress,
                                           @ApiParam(name="doctorLat",value = "医生当前定位纬度")
                                           @RequestParam(value = "doctorLat") String doctorLat,
                                           @ApiParam(name="doctorLon",value = "医生当前定位经度")
                                           @RequestParam(value = "doctorLon") String doctorLon){
        try {
            JSONObject result = securityMonitoringOrderService.updateDoctorLocation(doctor,orderId,doctorAddress,doctorLat,doctorLon);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("定位更新成功",result.getJSONObject("resultMsg"));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("定位更新失败"+e.getMessage());
        }
    }
    @PostMapping(value = "updatePatientLocation")
    @ApiOperation(value = "更新患者定位信息")
    @ObserverRequired
    public ObjEnvelop updatePatientLocation(@ApiParam(name="patient",value = "patient")
                                            @RequestParam(value = "patient") String patient,
                                            @ApiParam(name="patientAddress",value = "患者地址描述")
                                            @RequestParam(value = "patientAddress") String patientAddress,
                                            @ApiParam(name="patientLat",value = "患者当前定位纬度")
                                            @RequestParam(value = "patientLat") String patientLat,
                                            @ApiParam(name="patientLon",value = "患者当前定位经度")
                                            @RequestParam(value = "patientLon") String patientLon){
        try {
            JSONObject result = securityMonitoringOrderService.updatePatientLocation(patient,patientAddress,patientLat,patientLon);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("定位更新成功",result.getJSONObject("resultMsg"));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("定位更新失败"+e.getMessage());
        }
    }
}

+ 3 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java

@ -253,12 +253,14 @@ public class SignEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "levelConclusion",required = false) Integer levelConclusion,
            @ApiParam(name = "servicePackageStatus", value = "服务包分配(0未分配,1已分配)", required = false)
            @RequestParam(value = "servicePackageStatus",required = false) Integer servicePackageStatus,
            @ApiParam(name = "type", value = "type 0当年 1全部", required = false)
            @RequestParam(value = "type",required = false,defaultValue = "0") Integer type,
            @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) throws Exception {
        try{
            return capacityAssessmentRecordService.assessmentPage(doctorId, name, page, size, status, levelConclusion, servicePackageStatus);
            return capacityAssessmentRecordService.assessmentPage(doctorId, name, type,page, size, status, levelConclusion, servicePackageStatus);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");

+ 5 - 72
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/wechat/WechatCoreController.java

@ -44,7 +44,8 @@ public class WechatCoreController extends EnvelopRestEndpoint {
    private WxAccessTokenService wxAccessTokenService;
    @Value("${wechat.id}")
    private String wechatId;
    private static String wechat_token ="xAeQrX7uOD0OusIZ5JUQzrLPYIQBlqbS" ;
    @Value("${wechat.wechat_token}")
    private String wechat_token ;
    @Autowired
    private WxPushLogDao wxPushLogDao;
@ -76,71 +77,6 @@ public class WechatCoreController extends EnvelopRestEndpoint {
        }
    }
  /* *//*
     * 接收居民微信回复的消息
     *
     * @return
    *//*
    @RequestMapping(method = RequestMethod.POST)
    @ResponseBody
    public void receiveMessages(HttpServletRequest request, HttpServletResponse response) {
        try {
            String signature = request.getParameter("signature").toString();
            String timestamp = request.getParameter("timestamp").toString();
            String nonce = request.getParameter("nonce").toString();
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            if (validate(signature, timestamp, nonce)) {
                String xmlStr = weiXinCoreService.messageProcess(request, wxAccessTokenDO.getAccessToken());
                // 判断返回值是xml、json格式(取关是空串)
                Boolean flag = weiXinCoreService.isXML(xmlStr);
                if (xmlStr == "error") {
                    // 服务器错误
                    response.setStatus(500);
                } else if (!flag && StringUtils.isNotEmpty(xmlStr)) {
                    JSONObject json = new JSONObject(xmlStr);
                    if (json.has("openId")) {
                        if (StringUtils.isNotEmpty(json.getString("openId")) && !("undefined".equals(json.getString("openId")))) {
                                try {
                                    logger.info("调用眼科微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+json.getString(""));
                                    weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), json.getString("openId"), json);
                                    logger.info("发送成功");
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    logger.info("发送失败,error="+e.getMessage());
                                }
                                //保存发送模板记录,
                                WxPushLogDO wxPushLogDO = new WxPushLogDO();
                                wxPushLogDO.setCreateTime(new Date());
                                wxPushLogDO.setOpenid(json.getString("openId"));
                                wxPushLogDO.setReceiver(null);
                                wxPushLogDO.setWechatId(wechatId);
                                wxPushLogDO.setReceiverName(null);
                                wxPushLogDO.setScene(null);
                                wxPushLogDao.save(wxPushLogDO);
                            }
                        }
                    }
                } else {
                    // 返回消息(图文消息)
                    response.setHeader("Content-type", "text/html;charset=UTF-8");
                    //这句话的意思,是告诉servlet用UTF-8转码,而不是用默认的ISO8859
                    response.setCharacterEncoding("UTF-8");
                    response.getWriter().print(null);
                }
            } else {
                // 验证失败
                response.setStatus(401);
            }
        } catch (Exception e) {
            e.printStackTrace();
            // 服务器错误
            response.setStatus(500);
        }
    }*/
    /**
     * 接收居民微信回复的消息
     *
@ -193,8 +129,7 @@ public class WechatCoreController extends EnvelopRestEndpoint {
            response.setStatus(500);
        }
    }
     /*
     * 微信推送消息验证
     /** 微信推送消息验证
     *
     * @param signature
     * @param timestamp
@ -227,8 +162,7 @@ public class WechatCoreController extends EnvelopRestEndpoint {
        }
    }
    /*
     * 将字节数组转换为字符串
    /** 将字节数组转换为字符串
     *
     * @param byteArray
     * @return
@ -243,8 +177,7 @@ public class WechatCoreController extends EnvelopRestEndpoint {
    /*
     * 将字节转换为字符
    /** 将字节转换为字符
     *
     * @param mByte
     * @return

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

@ -6,22 +6,35 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.dao.assistance.EmergencyAssistanceDao;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.security.EmergencyWarnConclusionDao;
import com.yihu.jw.care.dao.security.EmergencyWarnDoctorResponseDao;
import com.yihu.jw.care.dao.sign.ServicePackageItemDao;
import com.yihu.jw.care.dao.sign.ServicePackageSignRecordDao;
import com.yihu.jw.care.dao.team.BaseTeamMemberDao;
import com.yihu.jw.care.service.common.DictService;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.family.PatientFamilyMemberService;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.care.util.CountDistance;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.assistance.EmergencyAssistanceDO;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.care.securitymonitoring.EmergencyWarnConclusionDO;
import com.yihu.jw.entity.care.securitymonitoring.EmergencyWarnDoctorResponseDO;
import com.yihu.jw.entity.care.securitymonitoring.SecurityMonitoringOrderDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
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.restmodel.emergency.EmergencyOrderVO;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.mysql.query.BaseJpaService;
@ -68,10 +81,22 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
    private PatientDeviceService patientDeviceService;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private EmergencyWarnConclusionDao emergencyWarnConclusionDao;
    @Value("${baiduApi.AK}")
    private String baiduAk;
    @Value("${baiduApi.url}")
    private String baiduUrl;
    @Autowired
    private EmergencyWarnDoctorResponseDao emergencyWarnDoctorResponseDao;
    @Autowired
    private PatientFamilyMemberService familyMemberService;
    @Autowired
    private SystemMessageDao systemMessageDao;
    @Autowired
    private ConsultDao consultDao;
    @Autowired
    private DictService dictService;
    /**
     * 新建居民紧急救助
@ -116,12 +141,12 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            }
        }
        if (emergencyAssistanceDao.findByPatientAndStatus(patient,1)!=null){
            String failMsg = "当前居民存在申请中的救助,请完成后再申请";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
//        if (emergencyAssistanceDao.findByPatientAndStatus(patient,1)!=null){
//            String failMsg = "当前居民存在申请中的救助,请完成后再申请";
//            result.put(ResponseContant.resultFlag, ResponseContant.fail);
//            result.put(ResponseContant.resultMsg,failMsg);
//            return result;
//        }
        //签约防走失服务包
        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" +
@ -193,11 +218,12 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            }
        }
        emergencyAssistanceDao.save(assistanceDO);
        return getOrderDetail(assistanceDO.getId());
        return getOrderDetail(assistanceDO.getId(),null);
    }
    public JSONObject getOrderDetail(String orderID){
    public JSONObject getOrderDetail(String orderID,String doctor){
        JSONObject result = new JSONObject();
        EmergencyOrderVO emergencyOrderVO = new EmergencyOrderVO();
        EmergencyAssistanceDO assistanceDO = emergencyAssistanceDao.findOne(orderID);
        if (assistanceDO==null){
            String failMsg = "当前救助工单不存在";
@ -205,7 +231,8 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        if (assistanceDO.getOrderSource()==2){//手环发起的获取手环坐标
        emergencyOrderVO.setId(assistanceDO.getId());
        if (assistanceDO.getOrderSource()==2){//手环发起的紧急救助获取手环坐标
            try {
                List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(assistanceDO.getPatient(),"4");
                if (devicePatientDeviceDos.size()>0){
@ -221,7 +248,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
                                    Double lon = pointJsonObject.getDouble("lon");
                                    assistanceDO.setServeLat(lat+"");
                                    assistanceDO.setServeLon(lon+"");
                                    emergencyAssistanceDao.save(assistanceDO);
                                    assistanceDO = emergencyAssistanceDao.save(assistanceDO);
                                }
                            }
                        }
@ -231,61 +258,183 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            }catch (Exception e){
            }
        }
        BasePatientDO patientDO = patientDao.findById(assistanceDO.getPatient());
        Integer statustemp = Integer.valueOf(assistanceDO.getStatus()+"");
        String statusName = "";
        switch (statustemp){
            case -2:statusName="误警报";break;
            case -1:statusName="已取消";break;
            case 0:statusName="已完成";break;
            case 1:statusName="申请中";break;
        }
        emergencyOrderVO.setStatusName(statusName);
        emergencyOrderVO.setOrderId(orderID);
        emergencyOrderVO.setStatus(assistanceDO.getStatus());
        emergencyOrderVO.setCreateTime(assistanceDO.getCreateTime());
        emergencyOrderVO.setServeLat(assistanceDO.getServeLat());
        emergencyOrderVO.setServeLon(assistanceDO.getServeLon());
        emergencyOrderVO.setServeAddress(assistanceDO.getServeAddress());
        emergencyOrderVO.setPatient(assistanceDO.getPatient());
        emergencyOrderVO.setPatientName(assistanceDO.getPatientName());
        emergencyOrderVO.setSex(patientDO.getSex());
        emergencyOrderVO.setPhone(assistanceDO.getPatientPhone());
        if(StringUtils.isNotBlank(patientDO.getIdcard())){
            emergencyOrderVO.setAge((IdCardUtil.getAgeForIdcard(patientDO.getIdcard()))+"");
        }
        emergencyOrderVO.setLiveAddress(patientDO.getAddress());
        emergencyOrderVO.setOrderSource(assistanceDO.getOrderSource());
        if(assistanceDO.getStatus()==-2){//误报警
            emergencyOrderVO.setUpdateUserName(assistanceDO.getUpdateUserName());
            emergencyOrderVO.setUpdateUser(assistanceDO.getUpdateUser());
            emergencyOrderVO.setUpdateTime(assistanceDO.getUpdateTime());
            emergencyOrderVO.setEmergencyCancel(assistanceDO.getEmergencyCancel());
        }
        emergencyOrderVO.setUpdateTime(assistanceDO.getUpdateTime());
        if (assistanceDO.getStatus()==-1){//已取消
            emergencyOrderVO.setUpdateTime(assistanceDO.getUpdateTime());
        }
        //小结
        if (assistanceDO.getStatus()==0){
            EmergencyWarnConclusionDO conclusionDO = emergencyWarnConclusionDao.findByOrderId(assistanceDO.getId());
            if (conclusionDO!=null){
                conclusionDO.setReasonName(dictService.fingByNameAndCode(ConstantUtil.DICT_EMERGENCY_REASON,String.valueOf(conclusionDO.getEmergencyReason())));
                conclusionDO.setTreatmentStatusName(dictService.fingByNameAndCode(ConstantUtil.DICT_EMERGENCY_TREATMENT_STATUS,String.valueOf(conclusionDO.getEmergencyTreatmentStatus())));
                emergencyOrderVO.setEmergencyWarnConclusionDO(conclusionDO);
            }
        }
        //附加信息 紧急救助无
        //通知对象
        List<Map<String,Object>> noticePersons = new ArrayList<>();
        JSONArray familyArr =  familyMemberService.getPatientMembers(assistanceDO.getPatient(),null,null,null);
        for (int i=0;i<familyArr.size();i++){
            String patientId = familyArr.getJSONObject(i).getString("id");
            BasePatientDO patientDO1 = patientDao.findById(patientId);
            Map<String,Object> noticeObj = new HashMap<>();
            noticeObj.put("type","0");
            noticeObj.put("typeName","家属");
            noticeObj.put("id",patientDO1.getId());
            noticeObj.put("name",patientDO1.getName());
            noticeObj.put("photo",patientDO1.getPhoto());
            noticeObj.put("mobile",patientDO1.getMobile());
            List<Map<String,Object>> arr = new ArrayList<>();
            Map<String,Object> tmp = new HashMap<>();
            tmp.put("name","系统预警");
            tmp.put("status",0);
            tmp.put(statusName,"未读");
            if (assistanceDO.getOrderSource()==2){
                Map<String,Object> tmp2 = new HashMap<>();
                tmp2.put("name","电话通知");
                tmp2.put("status",0);
                tmp2.put(statusName,"未呼叫");
                arr.add(tmp2);
            }
            SystemMessageDO messageDO = systemMessageDao.findByRelationCodeAndReceiver(assistanceDO.getId(),patientId);
            if (messageDO != null){
                if (StringUtils.isNotBlank(messageDO.getIsRead())){
                    tmp.put("status",Integer.parseInt(messageDO.getIsRead()));
                    if (Integer.parseInt(messageDO.getIsRead())==1){
                        tmp.put(statusName,"已读");
                    }
                }
            }
            arr.add(tmp);
            noticeObj.put("response",arr);
            noticePersons.add(noticeObj);
        }
        List<BaseDoctorDO> doctorDOS = baseTeamMemberDao.findAllMembers(assistanceDO.getTeamCode());
        double distance = 0.0;
        JSONArray otherDoctorDistance = new JSONArray();
        JSONObject otherDoctorDistanceObj = new JSONObject();
        if (assistanceDO.getStatus()==1){
            StringBuilder origins = new StringBuilder("");
            for (BaseDoctorDO doctorDO:doctorDOS) {
                if (StringUtils.isBlank(doctorDO.getDoctorLat()) || StringUtils.isBlank(doctorDO.getDoctorLon())) {
                    continue;
                }
                double distanceTmp = countDistance.getDistance(Double.parseDouble(assistanceDO.getServeLat()),Double.parseDouble(assistanceDO.getServeLon()),Double.parseDouble(doctorDO.getDoctorLat()),Double.parseDouble(doctorDO.getDoctorLon()));
                otherDoctorDistanceObj = new JSONObject();
                otherDoctorDistanceObj.put("doctor",doctorDO.getId());
                otherDoctorDistanceObj.put("doctorName",doctorDO.getName());
                otherDoctorDistanceObj.put("doctorAddress",doctorDO.getDoctorLocateAddress());
                otherDoctorDistanceObj.put("doctorLon",doctorDO.getDoctorLon());
                otherDoctorDistanceObj.put("doctorLat",doctorDO.getDoctorLat());
                otherDoctorDistanceObj.put("distance",distanceTmp);//两点距离
                otherDoctorDistance.add(otherDoctorDistanceObj);
                origins.append(doctorDO.getDoctorLat()+","+doctorDO.getDoctorLon()+"|");
        StringBuilder origins = new StringBuilder("");
        for (BaseDoctorDO doctorDO:doctorDOS) {
            Map<String,Object> noticeObj = new HashMap<>();
            noticeObj.put("type","1");
            noticeObj.put("typeName","助老员");
            noticeObj.put("id",doctorDO.getId());
            noticeObj.put("name",doctorDO.getName());
            noticeObj.put("photo",doctorDO.getPhoto());
            noticeObj.put("mobile",doctorDO.getMobile());
            List<Map<String,Object>> arr = new ArrayList<>();
            Map<String,Object> tmp = new HashMap<>();
            tmp.put("name","系统预警");
            tmp.put("status",0);
            tmp.put("statusName","未响应");
            if (emergencyWarnDoctorResponseDao.findByDoctorAndOrderId(doctorDO.getId(),assistanceDO.getId())!=null){
                tmp.put("status",1);
                tmp.put("statusName","已响应");
            }
            if (StringUtils.isNotBlank(origins.toString())){
                origins.deleteCharAt(origins.length()-1);
            arr.add(tmp);
            noticeObj.put("response",arr);
            noticePersons.add(noticeObj);
            if (StringUtils.isBlank(doctorDO.getDoctorLat()) || StringUtils.isBlank(doctorDO.getDoctorLon())) {
                continue;
            }
            String destinations = assistanceDO.getServeLat()+","+assistanceDO.getServeLon();
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("origins", origins.toString()));
            params.add(new BasicNameValuePair("destinations", destinations));
            params.add(new BasicNameValuePair("output", "json"));
            params.add(new BasicNameValuePair("ak", baiduAk));
            //前端做距离计算
//            String url = baiduUrl+"routematrix/v2/driving";
//            String response = httpClientUtil.get(url,params,"UTF-8");
//            JSONObject responseObj = JSONObject.parseObject(response);
//            if (responseObj.getInteger("status")==0){
//                JSONArray resultArr = responseObj.getJSONArray("result");
//                int length = resultArr.size()>otherDoctorDistance.size()?resultArr.size():otherDoctorDistance.size();
//                for (int i=0;i<length;i++){
//                    JSONObject disTmp = resultArr.getJSONObject(i);
//                    JSONObject docTmp = otherDoctorDistance.getJSONObject(i);
//                    docTmp.put("time",disTmp.getJSONObject("duration").getString("text"));
//                    docTmp.put("distance",disTmp.getJSONObject("distance").getInteger("value")/1000.0);//实际路线距离
//                    docTmp.put("distanceMeter",disTmp.getJSONObject("distance").getInteger("value"));
//                }
//                otherDoctorDistance.sort(Comparator.comparing(obj -> ((JSONObject) obj).getInteger("distance")));
            double distanceTmp = countDistance.getDistance(Double.parseDouble(assistanceDO.getServeLat()),Double.parseDouble(assistanceDO.getServeLon()),Double.parseDouble(doctorDO.getDoctorLat()),Double.parseDouble(doctorDO.getDoctorLon()));
            otherDoctorDistanceObj = new JSONObject();
            otherDoctorDistanceObj.put("doctor",doctorDO.getId());
            otherDoctorDistanceObj.put("doctorName",doctorDO.getName());
            otherDoctorDistanceObj.put("doctorAddress",doctorDO.getDoctorLocateAddress());
            otherDoctorDistanceObj.put("doctorLon",doctorDO.getDoctorLon());
            otherDoctorDistanceObj.put("doctorLat",doctorDO.getDoctorLat());
            otherDoctorDistanceObj.put("distance",distanceTmp);//两点距离
            otherDoctorDistance.add(otherDoctorDistanceObj);
            origins.append(doctorDO.getDoctorLat()+","+doctorDO.getDoctorLon()+"|");
        }
        if (StringUtils.isNotBlank(origins.toString())){
            origins.deleteCharAt(origins.length()-1);
        }
        String destinations = assistanceDO.getServeLat()+","+assistanceDO.getServeLon();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("origins", origins.toString()));
        params.add(new BasicNameValuePair("destinations", destinations));
        params.add(new BasicNameValuePair("output", "json"));
        params.add(new BasicNameValuePair("ak", baiduAk));
        //前端做距离计算
//        String url = baiduUrl+"routematrix/v2/driving";
//        String response = httpClientUtil.get(url,params,"UTF-8");
//        JSONObject responseObj = JSONObject.parseObject(response);
//        if (responseObj.getInteger("status")==0){
//            JSONArray resultArr = responseObj.getJSONArray("result");
//            int length = resultArr.size()>otherDoctorDistance.size()?resultArr.size():otherDoctorDistance.size();
//            for (int i=0;i<length;i++){
//                JSONObject disTmp = resultArr.getJSONObject(i);
//                JSONObject docTmp = otherDoctorDistance.getJSONObject(i);
//                docTmp.put("time",disTmp.getJSONObject("duration").getString("text"));
//                docTmp.put("distance",disTmp.getJSONObject("distance").getInteger("value")/1000.0);//实际路线距离
//                docTmp.put("distanceMeter",disTmp.getJSONObject("distance").getInteger("value"));
//            }
//            otherDoctorDistance.sort(Comparator.comparing(obj -> ((JSONObject) obj).getInteger("distance")));
//        }
        emergencyOrderVO.setOtherDoctorDistance(otherDoctorDistanceObj.toJSONString());
        emergencyOrderVO.setNoticePersons(noticePersons);
        JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONStringWithDateFormat(emergencyOrderVO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
        //获取咨询
        ConsultDo consult = consultDao.queryByRelationCode(orderID);
        if (null != consult) {
            String sessionId = assistanceDO.getPatient() + "_" + consult.getId() + "_" + consult.getType();
            jsonObject.put("sessionId",sessionId);
            if (1==assistanceDO.getStatus()&&StringUtils.isNotBlank(doctor)){//查询未读数量
                try {
                    Integer count = imUtill.UserSessionsUnreadMessageCount(sessionId,doctor);
                    jsonObject.put("UnRead",count);
                }catch (Exception e){
                    jsonObject.put("sessionId",sessionId);
                    jsonObject.put("UnRead",0);
                }
            }
        }
        else {
            jsonObject.put("sessionId",null);
            jsonObject.put("UnRead",0);
        }
        assistanceDO.setOtherDoctorDistance(otherDoctorDistance.toJSONString());
        BasePatientDO patientDO = patientDao.findById(assistanceDO.getPatient());
        assistanceDO.setPatientPhoto(patientDO.getPhoto());
        assistanceDO.setPatientSex(patientDO.getSex());
        assistanceDO.setPatientAge(IdCardUtil.getAgeForIdcard(patientDO.getIdcard()));
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg,JSONObject.parseObject(JSON.toJSONStringWithDateFormat(assistanceDO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue)));
        result.put(ResponseContant.resultMsg,jsonObject);
        return result;
    }
@ -310,13 +459,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        if (assistanceDO.getStatus()==-1){
            String failMsg = "当前工单已取消 无法查看";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        return getOrderDetail(orderID);
        return getOrderDetail(orderID,doctor);
    }
    /**
@ -346,7 +489,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
//            result.put(ResponseContant.resultMsg,failMsg);
//            return result;
//        }
        return getOrderDetail(orderID);
        return getOrderDetail(orderID,null);
    }
    /**
@ -357,6 +500,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
    public JSONObject getTabStatusCounts(String patient,String doctor){
        JSONObject result = new JSONObject();
        JSONObject tmpObj = new JSONObject();
        tmpObj.put("status_-2",0);//误报警
        tmpObj.put("status_-1",0);//已取消
        tmpObj.put("status_0",0);//已完成
        tmpObj.put("status_1",0);//申请中
@ -389,15 +533,15 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
    public JSONObject existApplyStatus(String patient){
        JSONObject result = new JSONObject();
        JSONObject tmpObj = new JSONObject();
        EmergencyAssistanceDO assistanceDO = emergencyAssistanceDao.findByProxyPatientAndStatus(patient,1);
        if (assistanceDO==null){
        List<EmergencyAssistanceDO> assistanceDO = emergencyAssistanceDao.findByProxyPatientAndStatus(patient,1);
        if (assistanceDO.size()==0){
            tmpObj.put("exist","false");
            result.put(ResponseContant.resultFlag, ResponseContant.success);
            result.put(ResponseContant.resultMsg,tmpObj);
            return result;
        }
        else {
            JSONObject detail  = getOrderDetail(assistanceDO.getId());
            JSONObject detail  = getOrderDetail(assistanceDO.get(0).getId(),null);
            tmpObj.put("exist","true");
            tmpObj.put("assistanceDO",detail.getJSONObject("resultMsg"));
            result.put(ResponseContant.resultFlag, ResponseContant.success);
@ -504,19 +648,14 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        emergencyAssistanceDao.save(assistanceDO);
        String failMsg = "当前救助工单已取消";
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg,assistanceDO);
        result.put(ResponseContant.resultMsg,JSONObject.parseObject(JSON.toJSONStringWithDateFormat(assistanceDO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue)));
        return result;
    }
    /**
     *
     * @param doctor
     * @param orderId
     * @param conclusion 必传
     * @param conclusionImg 非必传
     * @return
     */
    public JSONObject updateConclusion(String doctor,String orderId,String conclusion,String conclusionImg){
    public JSONObject updateConclusion(Integer emergency_reason,Integer treatment_status,String orderId,String conclusion,String conclusion_img,String doctor){
        JSONObject result = new JSONObject();
        EmergencyAssistanceDO assistanceDO = emergencyAssistanceDao.findOne(orderId);
        if (assistanceDO==null){
@ -525,12 +664,29 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        assistanceDO.setConclusion(conclusion);
        if (StringUtils.isNotBlank(conclusionImg)){
            assistanceDO.setConclusionImg(conclusionImg);
        }
        //完成医生
        EmergencyWarnConclusionDO doorConclusion =  emergencyWarnConclusionDao.findByOrderId(orderId);
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        if (doctorDO==null){
            doctorDO = doctorDao.findById(assistanceDO.getDoctor());
        }
        if (doorConclusion==null){
            doorConclusion = new EmergencyWarnConclusionDO();
            doorConclusion.setOrderId(orderId);
            doorConclusion.setPatient(assistanceDO.getPatient());
            doorConclusion.setPatientName(assistanceDO.getPatientName());
            doorConclusion.setDoctor(doctorDO.getId());
            doorConclusion.setDoctorName(doctorDO.getName());
        }
        doorConclusion.setEmergencyReason(emergency_reason);
        doorConclusion.setEmergencyTreatmentStatus(treatment_status);
        doorConclusion.setConclusion(conclusion);
        doorConclusion.setConclusionImg(conclusion_img);
        emergencyWarnConclusionDao.save(doorConclusion);
//        assistanceDO.setConclusion(conclusion);
//        if (StringUtils.isNotBlank(conclusion_img)){
//            assistanceDO.setConclusionImg(conclusion_img);
//        }
        //完成医生
        assistanceDO.setDoctor(doctor);
        assistanceDO.setDoctorName(doctorDO.getName());
        assistanceDO.setCompleteTime(new Date());
@ -546,7 +702,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            return result;
        }
        emergencyAssistanceDao.save(assistanceDO);
        return getOrderDetail(orderId);
        return getOrderDetail(orderId,null);
    }
    public JSONObject updateDoctorLocation(String doctor,String orderId,String doctorAddress,String doctorLat,String doctorLon){
@ -572,7 +728,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
                assistanceDO.setDoctorLat(doctorLat);
                assistanceDO.setDoctorLon(doctorLon);
                emergencyAssistanceDao.save(assistanceDO);
                return getOrderDetail(orderId);
                return getOrderDetail(orderId,null);
            }
        }
        else {
@ -591,13 +747,17 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        EmergencyAssistanceDO assistanceDO = emergencyAssistanceDao.findByPatientAndStatus(patient,1);
        if (assistanceDO!=null){
            assistanceDO.setServeAddress(patientAddress);
            assistanceDO.setServeLat(patientLat);
            assistanceDO.setServeLon(patientLon);
            emergencyAssistanceDao.save(assistanceDO);
            return getOrderDetail(assistanceDO.getId());
        List<EmergencyAssistanceDO> assistanceDO = emergencyAssistanceDao.findByPatientAndStatus(patient,1);
        if (assistanceDO.size()>0){
            for (EmergencyAssistanceDO tmp:assistanceDO){
                tmp.setServeAddress(patientAddress);
                tmp.setServeLat(patientLat);
                tmp.setServeLon(patientLon);
                emergencyAssistanceDao.save(tmp);
            }
            result.put(ResponseContant.resultFlag, ResponseContant.success);
            result.put(ResponseContant.resultMsg,"查询成功");
        }
        else {
            result.put(ResponseContant.resultFlag, ResponseContant.success);
@ -606,6 +766,50 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        return result;
    }
    public JSONObject responseOrder(String orderId,String doctor){
        JSONObject result = new JSONObject();
        EmergencyAssistanceDO one = emergencyAssistanceDao.findOne(orderId);
        if (one==null){
            String failMsg = "工单不存在" ;
            result.put("resultFlag", 0);
            result.put("resultMsg", failMsg);
            return result;
        }
        if (emergencyWarnDoctorResponseDao.findByDoctorAndOrderId(doctor,orderId)==null){
            EmergencyWarnDoctorResponseDO responseDO = new EmergencyWarnDoctorResponseDO();
            responseDO.setOrderId(orderId);
            responseDO.setDoctor(doctor);
            responseDO.setResponseTime(new Date());
            emergencyWarnDoctorResponseDao.save(responseDO);
        }
        result.put("resultFlag", 1);
        result.put("resultMsg", "success");
        return result;
    }
    public JSONObject errorWarning(String orderId,Integer emergencyCancel,String doctor){
        JSONObject result = new JSONObject();
        EmergencyAssistanceDO assistanceDO = emergencyAssistanceDao.findOne(orderId);
        if (assistanceDO==null){
            String failMsg = "工单不存在!";
            result.put("resultFlag", 0);
            result.put("resultMsg", failMsg);
            return result;
        }
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        assistanceDO.setStatus(-2);
        assistanceDO.setUpdateTime(new Date());
        assistanceDO.setUpdateUserName(doctorDO.getName());
        assistanceDO.setUpdateUser(doctorDO.getId());
        assistanceDO.setEmergencyCancel(emergencyCancel);
        emergencyAssistanceDao.save(assistanceDO);
        result = getOrderDetail(orderId,null);
        return result;
    }
    public JSONObject sendQuickMessage(String orderId,String patient,String content){
        JSONObject result = new JSONObject();
        ConsultTeamDo consultTeam = consultTeamDao.queryByRelationCode(orderId);

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

@ -4,8 +4,10 @@ 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.doorCoach.PatientDoorCoachOrderService;
import com.yihu.jw.care.service.family.PatientFamilyMemberService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
@ -15,6 +17,8 @@ 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.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.im.util.ImUtil;
@ -57,6 +61,12 @@ public class ConsultTeamService {
    private BaseDoorCoachOrderDao baseDoorCoachOrderDao;
    @Autowired
    private PatientFamilyMemberService familyMemberService;
    @Autowired
    private SystemMessageDao systemMessageDao;
    @Autowired
    private PatientDoorCoachOrderService doorCoachOrderService;
    @Autowired
    private PatientDoorCoachOrderService patientDoorCoachOrderService;
    public JSONObject updateIMMsg(String sessionId,String sessionType,String msgId,String content){
@ -97,9 +107,9 @@ public class ConsultTeamService {
        }
        switch (type) {
            case 20:
//                WlyyDoorServiceOrderDO orderDO = wlyyDoorServiceOrderDao.findOne(consult.getRelationCode());
//                JSONObject patientInfo = wlyyDoorServiceOrderService.queryOrderCardInfo(orderDO);
            case 21:
                BaseDoorCoachOrderDO orderDO = baseDoorCoachOrderDao.findOne(consult.getRelationCode());
                JSONObject patientInfo = patientDoorCoachOrderService.queryOrderCardInfo(orderDO);
                result.put("data", patientInfo);
                break;
            default:
@ -187,9 +197,33 @@ public class ConsultTeamService {
        //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(i);
            String patientId = tmp.getString("id");
            if (patient.equals(patientId)){
                continue;
            }
            String name = tmp.getString("name");
            //创建家属系统消息
            SystemMessageDO messageDO = new SystemMessageDO();
            messageDO.setTitle("紧急救助");
            messageDO.setType("50");//50 紧急预警通知
            messageDO.setCode("20");//  20 relationCode为紧急救助工单id 22安防工单id
            messageDO.setSender(patientDO.getId());
            messageDO.setSenderName(patientDO.getName());
            messageDO.setRelationCode(orderId);
            messageDO.setReceiver(patientId);
            messageDO.setReceiverName(name);
            messageDO.setOver("0");
            messageDO.setData(patientDO.getName()+"发起紧急救助工单!");
            messageDO.setDel("1");
            messageDO.setIsRead("0");
            messageDO.setCreateTime(new Date());
            systemMessageDao.save(messageDO);
            participants.put(patientId, 0);
        }
        //加入团队医生
        List<Map<String,Object>> doctorList = servicePackageService.fingdDoctorByPaitenId(patient,"emergencyAssistance");
        for(Map<String,Object> map:doctorList){
@ -270,11 +304,16 @@ public class ConsultTeamService {
        //4、 上门服务咨询-参与者
        JSONObject participants = new JSONObject();
        participants.put(patient, 0);
        //调度员加入
        String orderHospital = doorServiceOrderDO.getHospital();
        List<Map<String,Object>> dispatcherInfoList =  doorCoachOrderService.queryDispatcherInfoByHospital(orderHospital);
        for (Map<String,Object> tmp:dispatcherInfoList){
            participants.put(tmp.get("code").toString(), 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_ONDOOR_NURSING);
        JSONObject imResponseJson = imUtill.createTopics(sessionId, consult.getId(), content, participants, messages, ImUtil.SESSION_TYPE_DOOR_COACH);
        if (imResponseJson == null || imResponseJson.getInteger("status") == -1) {
            String failMsg = "发起服务咨询时:IM" + imResponseJson.getString("message");
            result.put(ResponseContant.resultFlag, ResponseContant.success);
@ -353,15 +392,32 @@ public class ConsultTeamService {
        //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);
            JSONObject tmp = familyArr.getJSONObject(i);
            String patientId = tmp.getString("id");
            if (patient.equals(patientId)){
                continue;
            }
            String name = tmp.getString("name");
            //创建家属系统消息
            SystemMessageDO messageDO = new SystemMessageDO();
            messageDO.setTitle("安防监护");
            messageDO.setType("50");
            messageDO.setCode("22");
            messageDO.setSender(patientDO.getId());
            messageDO.setSenderName(patientDO.getName());
            messageDO.setRelationCode(orderId);
            messageDO.setReceiver(patientId);
            messageDO.setReceiverName(name);
            messageDO.setOver("0");
            messageDO.setData(patientDO.getName()+"发起安防警报工单!");
            messageDO.setDel("1");
            messageDO.setIsRead("0");
            messageDO.setCreateTime(new Date());
            systemMessageDao.save(messageDO);
            participants.put(patientId, 0);
        }
@ -374,7 +430,7 @@ public class ConsultTeamService {
        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);
        JSONObject imResponseJson = imUtill.createTopics(sessionId, consult.getId(), content, participants, messages, ImUtil.SESSION_TYPE_SECURITY_WARN);
        if (imResponseJson == null || imResponseJson.getInteger("status") == -1) {
            String failMsg = "发起服务咨询时:IM" + imResponseJson.getString("message");
            result.put(ResponseContant.resultFlag, ResponseContant.success);
@ -432,4 +488,6 @@ public class ConsultTeamService {
        }
        return true;
    }
}

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

@ -9,12 +9,14 @@ 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.patient.BasePatientDO;
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.idcard.IdCardUtil;
import com.yihu.jw.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -22,6 +24,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -49,6 +52,8 @@ public class CourseService {
    @Autowired
    private RecruitStudentsRecordDao recruitStudentsRecordDao;
    @Autowired
    private RecruitStudentsDao recruitStudentsDao;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private PatientOrderRefundDao patientOrderRefundDao;
@ -431,18 +436,40 @@ public class CourseService {
        String sql = "SELECT id,`name`,longitude,latitude FROM base.base_org where del = 1 and type = 4";
        List<Map<String , Object>> positionList = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = new ArrayList<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String nowDate = sdf.format(new Date());
        if (positionList.size() > 0){
            for (int i=0;i<positionList.size();i++){
                String sql1 = "SELECT id,`name`,photo,address,longitude,latitude ,funDistance("+positionList.get(i).get("latitude")+","+positionList.get(i).get("longitude")+","+lat2+","+lon2+") funDistance FROM base.base_org where id = '"+positionList.get(i).get("id")+"'";
                String sql1 = "SELECT id,code,`name`,mobile,photo,address,longitude,latitude ,funDistance("+positionList.get(i).get("latitude")+","+positionList.get(i).get("longitude")+","+lat2+","+lon2+") funDistance FROM base.base_org where id = '"+positionList.get(i).get("id")+"'";
                List<Map<String , Object>> mapList = jdbcTemplate.queryForList(sql1);
                Integer num = 0;
                // 判断该机构是否开放报名
                String ksbm = "SELECT COUNT(1) a FROM base_recruit_students WHERE '"+nowDate+"' > create_time AND '"+nowDate+"' < end_time AND del = 1 AND org_code = '"+mapList.get(0).get("code")+"'";
                num = jdbcTemplate.queryForObject(ksbm,Integer.class);
                if (num > 0){
                    String sqlNum = "SELECT allm.num - bbm.num num\n" +
                            "FROM (SELECT num FROM base_recruit_students WHERE org_code = '"+mapList.get(0).get("code")+"') allm,(\n" +
                            "SELECT COUNT(rsr.id) num FROM base_recruit_students rs,base_recruit_students_record rsr WHERE '"+nowDate+"' >rs.start_time AND rs.org_code = '"+mapList.get(0).get("code")+"'\n" +
                            "AND '"+nowDate+"' < rs.end_time AND rs.del = 1 AND rs.id = rsr.recruit_students_id AND rsr.status IN (2,3,6)) bbm";
                    num = jdbcTemplate.queryForObject(sqlNum,Integer.class);
                } else {
                    num = -1; //未开放报名
                }
                String sqlCourse = "SELECT GROUP_CONCAT(DISTINCT `name` SEPARATOR '、') course FROM base_course WHERE org_code = '"+mapList.get(0).get("code")+"' AND del = 1";
                String course = jdbcTemplate.queryForObject(sqlCourse,String.class);
                JSONObject obj = new JSONObject();
                obj.put("id",mapList.get(0).get("id"));
                obj.put("orgCode",mapList.get(0).get("code"));
                obj.put("name",mapList.get(0).get("name"));
                obj.put("photo",mapList.get(0).get("photo"));
                obj.put("address",mapList.get(0).get("address"));
                obj.put("longitude",mapList.get(0).get("longitude"));
                obj.put("latitude",mapList.get(0).get("latitude"));
                obj.put("mobile",mapList.get(0).get("mobile"));
                obj.put("funDistance",mapList.get(0).get("funDistance"));
                obj.put("num",num);
                obj.put("course",course);
                list.add(obj);
            }
            if (list.size() > 0){
@ -674,6 +701,69 @@ public class CourseService {
        return object;
    }
    /**
     * 招生报名
     */
    public JSONObject enrollment(String patient,String recruitStudentsId){
        JSONObject result = new JSONObject();
        RecruitStudentsDO recruitStudentsDO = recruitStudentsDao.findOne(recruitStudentsId);
        long now = System.currentTimeMillis();
        long start = recruitStudentsDO.getStartTime().getTime();
        if(now<start){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "招生未开始");
            return result;
        }
        long end = recruitStudentsDO.getEndTime().getTime();
        if(now>end){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "招生已结束");
            return result;
        }
        if(isEnrollment(patient,recruitStudentsId)){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "请不要重复报名");
            return result;
        }
        BasePatientDO patientDO = patientDao.findById(patient);
        RecruitStudentsRecordDO recordDO = new RecruitStudentsRecordDO();
        recordDO.setDel(1);
        recordDO.setStatus("1");
        recordDO.setCreateTime(new Date());
        recordDO.setMobile(patientDO.getMobile());
        recordDO.setOrderNo(getOrderNo("1"));
        recordDO.setOrgCode(recruitStudentsDO.getOrgCode());
        recordDO.setOrgName(recruitStudentsDO.getOrgName());
        recordDO.setPatient(patientDO.getId());
        recordDO.setPatientName(patientDO.getName());
        recordDO.setPrice(recruitStudentsDO.getFee());
        recordDO.setSex(IdCardUtil.getSex(patientDO.getSex(),patientDO.getIdcard()));
        recordDO.setRecruitName(recruitStudentsDO.getName());
        recordDO.setRecruitStudentsId(recruitStudentsId);
        recruitStudentsRecordDao.save(recordDO);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put("recordDO",recordDO);
        return result;
    }
    /**
     * 绑定居民是否已经报名 有待审核,待付款,已付款,退款中的订单都不能报名
     * @param patient
     * @param recruitStudentsId
     * @return
     */
    public boolean isEnrollment(String patient,String recruitStudentsId){
        String sql = "select * from base_recruit_students_record where recruit_students_id = '"+recruitStudentsId+
                "' and patient='"+patient+"' and status in ('1','2','3','6') and del =1 ";
        List<RecruitStudentsRecordDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RecruitStudentsRecordDO.class));
        if(list.size()>0){
            return true;
        }
        return false;
    }
    public CourseSalesOrderRecordDO buyCourseOrder(String patient, String patientName, String courseId,String payType){
        CourseDO courseDO = courseDao.findOne(courseId);

+ 25 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -796,7 +796,18 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    |
     */
    public com.alibaba.fastjson.JSONObject updAqgDeviceSosInfo(String deviceSn,String seqid,String name,String num,String dial_flag,String clear){
        String url = MessageFormat.format(AqgConfig.sos_numbers, deviceSn,seqid);
        List<DevicePatientDevice> devices = patientDeviceDao.findByDeviceSn(deviceSn);
        String url ="";
        if ("4".equals(devices.get(0).getCategoryCode())){//手表
            Device device = deviceDao.findOne(devices.get(0).getDeviceId());
            if (device!=null){
                if ("X1".equals(device.getModel())){
                    url = MessageFormat.format(AqgConfig.X1sos_numbers, deviceSn,seqid);
                }
            }
        }else {
            url = MessageFormat.format(AqgConfig.sos_numbers, deviceSn,seqid);
        }
        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
        if(StringUtils.isBlank(clear)){
            param.add("name", name);
@ -818,7 +829,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
     * @throws Exception
     */
    public com.alibaba.fastjson.JSONObject getDeviceLastLocation(String deviceSn,String type) throws Exception{
        String url = MessageFormat.format(AqgConfig.device_last_locationdata, deviceSn);
        String url = MessageFormat.format(AqgConfig.device_last_locationData, deviceSn);
        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
        param.add("type", type);
        HttpEntity<com.alibaba.fastjson.JSONObject> response = httpClientUtil.aqgCookieHttp(url, param, HttpMethod.GET, getCookie());
@ -858,7 +869,18 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
     */
    public com.alibaba.fastjson.JSONObject updateDeviceFenceArea(String deviceSn,Integer fenceNO,String enable,String name,String freq,
                                                                 String time_begin,String time_end,String safe_area ,String clear) throws Exception{
        String url = MessageFormat.format(AqgConfig.fence_area, deviceSn,fenceNO);
        List<DevicePatientDevice> devices = patientDeviceDao.findByDeviceSn(deviceSn);
        String url ="";
        if ("4".equals(devices.get(0).getCategoryCode())){//手表
            Device device = deviceDao.findOne(devices.get(0).getDeviceId());
            if (device!=null){
                if ("X1".equals(device.getModel())){
                    url = MessageFormat.format(AqgConfig.X1fence_area, deviceSn,fenceNO);
                }
            }
        }else {
            url = MessageFormat.format(AqgConfig.S3fence_area, deviceSn,fenceNO);
        }
        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
        if(StringUtils.isBlank(clear)){
            if (StringUtils.isNotBlank(safe_area)){

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

@ -447,7 +447,7 @@ public class DoctorDoorCoachOrderService {
            first = first.replace("key2", null != doorServiceOrder.getDoctorName() ? doorServiceOrder.getDoctorName() : "");
            List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
            String openId = basePatientWechatDos.get(0).getOpenid();
            messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyjjd",openId,first,null,null,30,json, DateUtil.dateToChineseDate(new Date()),"上门服务已接单");
            messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyjjd",openId,first,null,null,30,json, DateUtil.dateToChineseDate(new Date()),"上门预约已接单");
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getMessage());
@ -612,7 +612,7 @@ public class DoctorDoorCoachOrderService {
            json.put("finish",finish);
            List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
            String openId = basePatientWechatDos.get(0).getOpenid();
            String first="key1预约上门服务医生已完成服务。".replace("key1", DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm"));
            String first="key1预约上门预约医生已完成服务。".replace("key1", DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm"));
            messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","fwyspf",openId,first,null,null,31,json,DateUtil.dateToChineseDate(new Date()),"服务医生评分");
        }catch (Exception e){
@ -637,7 +637,7 @@ public class DoctorDoorCoachOrderService {
    }
    /**
     * 系统更新医生上门服务工单状态
     * 系统更新医生上门预约工单状态
     * @param doctor
     * @param dispatchOrderStatus
     */
@ -706,7 +706,7 @@ public class DoctorDoorCoachOrderService {
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Map<String, Integer> map = new HashMap<>();
        Integer all = list.size();
        Integer all = 0;
        Integer waitForAccept = 0;//待接单
        Integer waitForServe = 0;//待服务
        Integer served = 0;//已完成
@ -740,6 +740,7 @@ public class DoctorDoorCoachOrderService {
               }
           }
       }
       all = waitForAccept+waitForServe+served+cancel;
       map.put("all",all);
       map.put("waitForAccept",waitForAccept);
       map.put("waitForServe",waitForServe);
@ -808,7 +809,7 @@ public class DoctorDoorCoachOrderService {
                "  o.serve_lat as lat, " +
                "  o.`status` as status, " +
                "  o.`dispatcher_name` as dispatcherName, " +
                "  concat( o.patient,'_' ,c.id, '_',o.`number`,'_11' ) as sessionId " +
                "  concat( o.patient,'_' ,c.id, '_',o.`number`,'_21' ) as sessionId " +
                patientTypeTemp +
                " FROM " +
                " ( base_door_coach_order o " +
@ -832,7 +833,7 @@ public class DoctorDoorCoachOrderService {
                " LEFT JOIN base_patient p ON o.patient = p.id " +
                applicationSql +
                " WHERE  " +
                "  o.hospital = '{hospital}' " +buffer+
                "  o.hospital = '{hospital}' and o.type != 3 " +buffer+
                " AND (o.`status` = {status} or -100 = {status})";
        String finqlCountSql = countSql.replace("{hospital}", hospital)
@ -841,10 +842,9 @@ public class DoctorDoorCoachOrderService {
        List<Map<String,Object>> sqlResultlist = new ArrayList<>();
        try {
            sqlResultlist = jdbcTemplate.queryForList(finalSql);
            logger.info(finalSql);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库查询【调度员】上门服务工单列表信息失败:" + e.getMessage());
            result.put(ResponseContant.resultMsg, "从数据库查询【调度员】上门预约工单列表信息失败:" + e.getMessage());
            return result;
        }
@ -853,7 +853,7 @@ public class DoctorDoorCoachOrderService {
            count = jdbcTemplate.queryForObject(finqlCountSql, Integer.class);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库统计【调度员】上门服务工单数量失败:" + e.getMessage());
            result.put(ResponseContant.resultMsg, "从数据库统计【调度员】上门预约工单数量失败:" + e.getMessage());
            return result;
        }
@ -967,7 +967,6 @@ public class DoctorDoorCoachOrderService {
                    map.put("position",hospital1.getLongitude()+","+hospital1.getLatitude());
                }
            }
            logger.info("服务医生人员sql:"+finalSql);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库查询 服务医生人员 列表信息失败:" + e.getMessage());
@ -991,7 +990,7 @@ public class DoctorDoorCoachOrderService {
                String notFinishSql ="select o.id,o.number,o.patient,o.patient_name,o.patient_phone,o.patient_expected_serve_time,o.`status`, CASE p.sex when 1 then '男' when 2 THEN '女' END as sex,p.idcard, " +
                        "year(now()) - ((CASE LENGTH(p.idcard) WHEN 18 THEN substring(p.idcard, 7, 4) WHEN 15 THEN CONCAT('19',substring(p.idcard, 7, 2)) END )) as age , p.photo,o.serve_lat AS lat,o.serve_lon AS lon,o.id AS orderId " +
                        "from base_door_coach_order o LEFT JOIN base_patient p on o.patient = p.id and p.patient_status=1  " +
                        "where o.doctor ='"+doctor + "' and o.status in (2,3,4)";
                        "where o.doctor ='"+doctor + "' and o.status in (2,3,4,5)";
                List<Map<String, Object>> notFinishList = jdbcTemplate.queryForList(notFinishSql);
                map.put("notFinishList", notFinishList);
            }

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

@ -104,7 +104,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
     */
    public JSONObject create(String jsonData) {
        logger.info("创建上门服务jsonData参数:" + jsonData);
        logger.info("创建上门预约jsonData参数:" + jsonData);
        JSONObject result = new JSONObject();
        JSONObject jsonObjectParam;
@ -122,7 +122,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
            orderDO = EntityUtils.jsonToEntity(jsonObjectParam.get("order").toString(), BaseDoorCoachOrderDO.class);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "上门服务工单服务基本信息:" + e.getMessage();
            String failMsg = "上门预约工单服务基本信息:" + e.getMessage();
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
@ -160,7 +160,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
                });
        if(bool){
            String failMsg = "当前服务对象存在未完成的上门服务,请先完成该服务!";
            String failMsg = "当前服务对象存在未完成的上门预约,请先完成该服务!";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
@ -169,7 +169,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        orderDO.setHospital(jsonObjectParam.getJSONObject("hospital").get("code").toString());
        orderDO.setCreateTime(new Date());
        //判断创建上门服务类型,发起类型(1本人发起 2家人待预约 3医生代预约)
        //判断创建上门预约类型,发起类型(1本人发起 2家人待预约 3医生代预约)
        if(orderDO.getProxyPatient().equals(orderDO.getPatient())){
            orderDO.setType(1);
        }else if(!orderDO.getProxyPatient().equals(orderDO.getPatient())){
@ -249,7 +249,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
            orderDO = EntityUtils.jsonToEntity(jsonObjectParam.get("order").toString(), BaseDoorCoachOrderDO.class);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "上门服务工单服务基本信息:" + e.getMessage();
            String failMsg = "上门预约工单服务基本信息:" + e.getMessage();
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
@ -281,7 +281,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
                    });
            if(bool){
                String failMsg = "当前服务对象存在未完成的上门服务,请先完成该服务!";
                String failMsg = "当前服务对象存在未完成的上门预约,请先完成该服务!";
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg, failMsg);
                logger.error(failMsg);
@ -353,7 +353,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
    }
    public List<Map<String,Object>> selectItemsByHospital(String hospital,String serverItemName){
        String sql ="select dict_code code,dict_value name,ext1 fee from base_business_sys_dict where 1=1 ";
        String sql ="select org_code,dict_code code,dict_value name,ext1 fee from base_business_sys_dict where dict_name='DOOR_APPLY_ITEM' ";
        if (StringUtils.isNotBlank(hospital)){
            sql +=" and org_code='"+hospital+"' ";
        }
@ -361,6 +361,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
            sql += " and dict_value like '%"+serverItemName+"%' ";
        }
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
        return result;
    }
@ -415,7 +416,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
    }
    /**
     * 修改上门服务工单(包括医生,费用,居民确认信息等)
     * 修改上门预约工单(包括医生,费用,居民确认信息等)
     *
     * @param jsonData
     * @return
@ -492,7 +493,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
    }
    /**
     * 上门服务工单服务基本信息
     * 上门预约工单服务基本信息
     *
     * @param result
     * @param jsonObjectParam
@ -505,7 +506,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
            wlyyDoorServiceOrder = EntityUtils.jsonToEntity(jsonObjectParam.get("order").toString(), BaseDoorCoachOrderDO.class);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "上门服务工单服务基本信息:" + e.getMessage();
            String failMsg = "上门预约工单服务基本信息:" + e.getMessage();
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return new BaseDoorCoachOrderDO();
@ -561,7 +562,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        }
        result.put("serveTown",orderDO.getServeTown());
        result.put("serveAddress",orderDO.getServeAddress());
        result.put("type",11);
        result.put("type",21);
        return result;
    }
    /**
@ -595,7 +596,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        }
        JSONObject resObj = JSONObject.parseObject(response);
        if (resObj.getIntValue("status") == -1) {
            logger.error("上门服务工单消息发送失败:" + resObj.getString("message"));
            logger.error("上门预约工单消息发送失败:" + resObj.getString("message"));
            return result;
        }
        result = 1;
@ -791,11 +792,21 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
            orderDO.setDispatcherName(dispatcherName);
        }
        //如果是调度员取消,推送IM取消工单json消息,
        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;
        if (StringUtils.isNotBlank(dispatcher)){
            if (!consultTeamService.finishConsult(orderDO.getId(),dispatcher,dispatcherName,2)){
                String failMsg = "咨询结束失败 无法取消工单";
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg,failMsg);
                return result;
            }
        }
        else {
            if (!consultTeamService.finishConsult(orderDO.getId(),orderDO.getPatient(),orderDO.getPatientName(),1)){
                String failMsg = "咨询结束失败 无法取消工单";
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg,failMsg);
                return result;
            }
        }
        orderDO.setStatus(BaseDoorCoachOrderDO.Status.cancel.getType());
        this.save(orderDO);
@ -843,7 +854,6 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        }
        // 工单状态变更记录
        BaseDoorCoachProcessLogDO processLogDO = new BaseDoorCoachProcessLogDO();
        processLogDO.setOrderId(orderId);
@ -922,7 +932,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
                params.add(new BasicNameValuePair("openId", doctor.getOpenid()));
                params.add(new BasicNameValuePair("first", first));
                params.add(new BasicNameValuePair("remark", templateConfig.getRemark()));
                params.add(new BasicNameValuePair("keywords", "上门服务预约待派单"));
                params.add(new BasicNameValuePair("keywords", "上门预约待派单"));
                params.add(new BasicNameValuePair("keywords", signFamily.getHospitalName()));
                params.add(new BasicNameValuePair("keywords", doctorName));
                httpClientUtil.post(url, params, "UTF-8");
@ -946,7 +956,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
                params.add(new BasicNameValuePair("openId", doctor.getOpenid()));
                params.add(new BasicNameValuePair("first", first));
                params.add(new BasicNameValuePair("remark", templateConfig.getRemark()));
                params.add(new BasicNameValuePair("keywords", "上门服务预约待接单"));
                params.add(new BasicNameValuePair("keywords", "上门预约待接单"));
                params.add(new BasicNameValuePair("keywords", signFamily.getHospitalName()));
                params.add(new BasicNameValuePair("keywords", doctorName));
                httpClientUtil.post(url, params, "UTF-8");
@ -1138,7 +1148,7 @@ 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 all = 0;
        Integer waitForAccept = 0;//待接单
        Integer waitForServe = 0;//待服务
        Integer served = 0;//已完成
@ -1172,6 +1182,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
                }
            }
        }
        all = waitForAccept+waitForServe+served+cancel;
        map.put("all",all);
        map.put("waitForAccept",waitForAccept);
        map.put("waitForServe",waitForServe);

+ 20 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java

@ -19,6 +19,7 @@ import com.yihu.jw.entity.care.lifeCare.LifeCareOrderDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.entity.EntityUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
@ -541,4 +542,23 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        return false;
    }
    public PageEnvelop getPatientOrderList(String patient, Integer status, int page, int size) {
        page = page>0?page-1:0;
        String sqlCount = "select count(ord.id) from  base_life_care_order ord where ord.patient = '"+patient+"' ";
        String sql = "select ord.id,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') createTime,DATE_FORMAT(ord.patient_expected_serve_time,'%Y-%m-%d %H:%i:%S') serveTime,ord.status,ord.hospital,ord.hospital_name hospitalName" +
                ",ord.doctor,ord.doctor_name doctorName,ord.expected_doctor_name expectedDoctorName,group_concat(Distinct fee.name SEPARATOR '、') serveItems" +
                " from base_life_care_order ord LEFT JOIN base_life_care_fee_detail fee on ord.id = fee.order_id " +
                "and fee.`status`<>3 where ord.patient = '"+patient+"' ";
        String fliter = "";
       if (status != null){
           fliter += " and ord.status = "+status;
       }
       Long count = jdbcTemplate.queryForObject(sqlCount+fliter,Long.class);
       fliter += " group by ord.id order by ord.create_time desc limit "+page*size+","+size;
       List<Map<String,Object>> result = jdbcTemplate.queryForList(sql+fliter);
       return PageEnvelop.getSuccessListWithPage("查询成功",result,page,size,count);
    }
}

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

@ -86,12 +86,12 @@ public class DoctorMessageService {
            result.put("bedApply",tmpJson);
        }
        if (typeNull||type.equals("11")){//安全监护
        if (typeNull||type.equals("11")){//安全监护 已取消已完成不可见
            JSONObject tmpJson = new JSONObject();
            count=0;
            List<Map<String,Object>> listTmp = new ArrayList<>();
            String sql ="select count(*) count,patient_name,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,serve_desc from base_security_monitoring_order ord where 1=1 " +
                    "and status <>-1 and status<> 7  ";
                    "and status <>-1 and status<> 0  ";
            sql+= "and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
@ -110,7 +110,7 @@ public class DoctorMessageService {
            }
            result.put("security",tmpJson);
        }
        if (typeNull||type.equals("12")){//紧急救助
        if (typeNull||type.equals("12")){//紧急救助 申请中
            JSONObject tmpJson = new JSONObject();
            count=0;
            List<Map<String,Object>> listTmp = new ArrayList<>();

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

@ -4,6 +4,8 @@ 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.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
@ -25,6 +27,8 @@ public class PatientMessageService {
    private OrgNoticeDao orgNoticeDao;
    @Autowired
    private UserNoticeDao userNoticeDao;
    @Autowired
    private SystemMessageDao systemMessageDao;
    public PageEnvelop getNoticeList(String patient,String beginTime, String endTime, int page, int size){
        page = page>0?page-1:0;
@ -64,4 +68,31 @@ public class PatientMessageService {
        }
        return orgNoticeDO;
    }
    /**
     *50 紧急预警系统消息
     *
     */
    public List<Map<String,Object>> getSystemMessage(String patient){
        String sql = " select A.*,B.notRead from " +
                "(select  count(1) as 'all',type,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time " +
                "from base_system_message where receiver = '"+patient+"' and del=1 and type='50' GROUP BY type ORDER BY create_time desc)A " +
                "LEFT JOIN (select count(1) notRead,type " +
                "from base_system_message where receiver = '"+patient+"' and is_read=0 and del=1 and type='50' GROUP BY type)B on A.type = B.type " +
                "ORDER BY A.create_time desc ";
        return jdbcTemplate.queryForList(sql);
    }
    public List<Map<String,Object>> getSystemMessageList(String patient,String type){
        String sql = " select id,title,type,relation_code,sender,sender_name,is_read,code,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time " +
                "from base_system_message where receiver = '"+patient+"' and del=1 and type='"+type+"'  ORDER BY create_time desc";
        return jdbcTemplate.queryForList(sql);
    }
    public void updateMessageRead(String messageId){
        SystemMessageDO messageDO = systemMessageDao.findOne(messageId);
        messageDO.setIsRead("1");
        messageDO.setOver("1");
        systemMessageDao.save(messageDO);
    }
}

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

@ -8,13 +8,20 @@ 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.common.DictService;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.family.PatientFamilyMemberService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.care.util.CountDistance;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.care.assistance.EmergencyAssistanceDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.restmodel.emergency.EmergencyOrderVO;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
@ -56,12 +63,10 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    @Autowired
    private ServicePackageService servicePackageService;
    @Autowired
    private SecurityMonitoringOrderCancelLogDao securityMonitoringOrderCancelLogDao;
    private EmergencyWarnCancelLogDao emergencyWarnCancelLogDao;
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private SecurityMonitoringOrderPatientConfirmLogDao securityMonitoringOrderPatientConfirmLogDao;
    @Autowired
    private SecurityMonitoringDoctorStatusDao doctorStatusDao;
    @Autowired
    private SystemMessageDao systemMessageDao;
@ -70,7 +75,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private SecurityMonitoringConclusionDao securityMonitoringConclusionDao;
    private EmergencyWarnConclusionDao emergencyWarnConclusionDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
@ -87,6 +92,12 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    private BaseTeamMemberDao baseTeamMemberDao;
    @Autowired
    private ImUtil imUtil;
    @Autowired
    private DictService dictService;
    @Autowired
    private EmergencyWarnDoctorResponseDao emergencyWarnDoctorResponseDao;
    @Autowired
    private PatientFamilyMemberService familyMemberService;
    private Logger logger = LoggerFactory.getLogger(SecurityMonitoringOrderService.class);
@ -154,21 +165,17 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        }
        //已取消的订单也可以申请
        boolean bool = securityMonitoringOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
                new Integer[]{SecurityMonitoringOrderDO.Status.waitForSend.getType(),
                        SecurityMonitoringOrderDO.Status.waitForArrive.getType(),
                        SecurityMonitoringOrderDO.Status.signed.getType(),
                        SecurityMonitoringOrderDO.Status.registerSummary.getType(),
                        SecurityMonitoringOrderDO.Status.waitForAdded.getType(),
                });
        if(bool){
            String failMsg = "当前服务对象存在未完成的服务,请先完成该服务!";
            result.put("resultFlag", 0);
            result.put("resultMsg", failMsg);
            logger.error(failMsg);
            return result;
        }
//        boolean bool = securityMonitoringOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
//                new Integer[]{SecurityMonitoringOrderDO.Status.apply.getType()
//                });
//        if(bool){
//            String failMsg = "当前服务对象存在未完成的服务,请先完成该服务!";
//            result.put("resultFlag", 0);
//            result.put("resultMsg", failMsg);
//            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){
@ -180,7 +187,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        orderDO.setCreateTime(new Date());
        //判断创建预警服务类型,发起类型(1本人发起 2家人待预约 3医生代预约)
        orderDO.setType(3);//发起类型
        orderDO.setType(1);//发起类型
        orderDO.setServiceStatus("2");
        this.save(orderDO);
        //创建im会话  安防警报咨询的sessionid  为居民code+(wlyy_consult_team表consult)+20
@ -209,8 +216,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        return result;
    }
    public JSONObject getSecurityOrderDetail(String orderID){
    public JSONObject getSecurityOrderDetail(String orderID,String doctor){
        JSONObject result = new JSONObject();
        EmergencyOrderVO emergencyOrderVO = new EmergencyOrderVO();
        SecurityMonitoringOrderDO orderDO = securityMonitoringOrderDao.findOne(orderID);
        if (orderDO==null){
            String failMsg = "工单不存在!";
@ -219,49 +227,158 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            logger.error(failMsg);
            return result;
        }
        Integer conclusionStatus = Integer.valueOf(orderDO.getConclusionStatus()==null?"0":(orderDO.getConclusionStatus()+""));
        String conclusionStatusName = "";
        switch (conclusionStatus){
            case 1:conclusionStatusName="待补录";break;
            case 2:conclusionStatusName="已登记";break;
        emergencyOrderVO.setId(orderDO.getId());
        BasePatientDO patientDO = basePatientDao.findById(orderDO.getPatient());
        Integer statustemp = Integer.valueOf(orderDO.getStatus()+"");
        String statusName = "";
        switch (statustemp){
            case -2:statusName="误警报";break;
            case -1:statusName="已取消";break;
            case 0:statusName="已完成";break;
            case 1:statusName="申请中";break;
        }
        emergencyOrderVO.setStatusName(statusName);
        emergencyOrderVO.setOrderId(orderID);
        emergencyOrderVO.setStatus(orderDO.getStatus());
        emergencyOrderVO.setCreateTime(orderDO.getCreateTime());
        emergencyOrderVO.setServeLat(orderDO.getServeLat());
        emergencyOrderVO.setServeLon(orderDO.getServeLon());
        emergencyOrderVO.setServeAddress(orderDO.getServeAddress());
        emergencyOrderVO.setPatient(orderDO.getPatient());
        emergencyOrderVO.setPatientName(orderDO.getPatientName());
        emergencyOrderVO.setSex(patientDO.getSex());
        if(StringUtils.isNotBlank(patientDO.getIdcard())){
            emergencyOrderVO.setAge((IdCardUtil.getAgeForIdcard(patientDO.getIdcard()))+"");
        }
        emergencyOrderVO.setLiveAddress(patientDO.getAddress());
        emergencyOrderVO.setOrderSource(orderDO.getOrderSource());
        if(orderDO.getStatus()==-2){//误报警
            emergencyOrderVO.setUpdateUserName(orderDO.getUpdateUserName());
            emergencyOrderVO.setUpdateUser(orderDO.getUpdateUser());
            emergencyOrderVO.setUpdateTime(orderDO.getUpdateTime());
            emergencyOrderVO.setEmergencyCancel(orderDO.getEmergencyCancel());
        }
        emergencyOrderVO.setUpdateTime(orderDO.getUpdateTime());
        if (orderDO.getStatus()==-1){//已取消
            emergencyOrderVO.setUpdateTime(orderDO.getCancelTime());
        }
        //小结
        Integer conclusionStatus = Integer.valueOf(orderDO.getConclusionStatus()==null?"0":(orderDO.getConclusionStatus()+""));
        if (conclusionStatus==2){
            SecurityMonitoringConclusionDO conclusionDO = securityMonitoringConclusionDao.findByOrderId(orderDO.getId());
            EmergencyWarnConclusionDO conclusionDO = emergencyWarnConclusionDao.findByOrderId(orderDO.getId());
            if (conclusionDO!=null){
                orderDO.setMonitoringConclusion(conclusionDO);
                conclusionDO.setReasonName(dictService.fingByNameAndCode(ConstantUtil.DICT_EMERGENCY_REASON,String.valueOf(conclusionDO.getEmergencyReason())));
                conclusionDO.setTreatmentStatusName(dictService.fingByNameAndCode(ConstantUtil.DICT_EMERGENCY_TREATMENT_STATUS,String.valueOf(conclusionDO.getEmergencyTreatmentStatus())));
                emergencyOrderVO.setEmergencyWarnConclusionDO(conclusionDO);
            }
        }
        JSONObject jsonObject = JSON.parseObject(JSON.toJSONStringWithDateFormat(orderDO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
        jsonObject.put("conclusionStatusName",conclusionStatusName);
        Integer statustemp = Integer.valueOf(orderDO.getStatus()+"");
        String statusName = "";
        switch (statustemp){
            case -1:statusName="已取消";break;
            case 1:statusName="待处置";break;
            case 2:statusName="前往居民定位";break;
            case 3:statusName="已签到";break;
            case 4:statusName="已登记小结";break;
            case 5:statusName="待补录";break;
            case 6:statusName="待评价";break;
            case 7:statusName="已完成";break;
        //附加信息 电子围栏状态
        if (orderDO.getOrderSource()==2){
            Map<String,Object> map = new HashMap<>();
            map.put("inFenceStatus",false);
            map.put("inFenceName","疑似超出安全区域");
            emergencyOrderVO.setInformation(map);
        }
        BasePatientDO patientDO = basePatientDao.findById(orderDO.getPatient());
        if (patientDO!=null){
            jsonObject.put("patientAddress",patientDO.getAddress());
        //通知对象
        List<Map<String,Object>> noticePersons = new ArrayList<>();
        JSONArray familyArr =  familyMemberService.getPatientMembers(orderDO.getPatient(),null,null,null);
        for (int i=0;i<familyArr.size();i++){
            String patientId = familyArr.getJSONObject(i).getString("id");
            BasePatientDO patientDO1 = basePatientDao.findById(patientId);
            Map<String,Object> noticeObj = new HashMap<>();
            noticeObj.put("type","0");
            noticeObj.put("typeName","家属");
            noticeObj.put("id",patientDO1.getId());
            noticeObj.put("name",patientDO1.getName());
            noticeObj.put("photo",patientDO1.getPhoto());
            noticeObj.put("mobile",patientDO1.getMobile());
            List<Map<String,Object>> arr = new ArrayList<>();
            Map<String,Object> tmp = new HashMap<>();
            tmp.put("name","系统预警");
            tmp.put("status",0);
            tmp.put(statusName,"未读");
            SystemMessageDO messageDO = systemMessageDao.findByRelationCodeAndReceiver(orderDO.getId(),patientId);
            if (messageDO != null){
                if (StringUtils.isNotBlank(messageDO.getIsRead())){
                    tmp.put("status",Integer.parseInt(messageDO.getIsRead()));
                    if (Integer.parseInt(messageDO.getIsRead())==1){
                        tmp.put(statusName,"已读");
                    }
                }
            }
            arr.add(tmp);
            noticeObj.put("response",arr);
            noticePersons.add(noticeObj);
        }
        else {
            jsonObject.put("patientAddress",null);
        //医生信息
        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<Map<String,Object>> items = jdbcTemplate.queryForList(sql);
        if (items.size()>0){
            Map<String,Object> mapTmp = items.get(0);
            List<BaseDoctorDO> doctorDOS = baseTeamMemberDao.findAllMembers(mapTmp.get("team_code").toString());
            JSONArray otherDoctorDistance = new JSONArray();
            JSONObject otherDoctorDistanceObj = new JSONObject();
            for(BaseDoctorDO doc:doctorDOS){
                Map<String,Object> noticeObj = new HashMap<>();
                noticeObj.put("type","1");
                noticeObj.put("typeName","助老员");
                noticeObj.put("id",doc.getId());
                noticeObj.put("name",doc.getName());
                noticeObj.put("photo",doc.getPhoto());
                noticeObj.put("mobile",doc.getMobile());
                List<Map<String,Object>> arr = new ArrayList<>();
                Map<String,Object> tmp = new HashMap<>();
                tmp.put("name","系统预警");
                tmp.put("status",0);
                tmp.put("statusName","未响应");
                if (emergencyWarnDoctorResponseDao.findByDoctorAndOrderId(doc.getId(),orderDO.getId())!=null){
                    tmp.put("status",1);
                    tmp.put("statusName","已响应");
                }
                arr.add(tmp);
                noticeObj.put("response",arr);
                noticePersons.add(noticeObj);
                if (StringUtils.isBlank(doc.getDoctorLat()) || StringUtils.isBlank(doc.getDoctorLon())) {
                    continue;
                }
                double distanceTmp = countDistance.getDistance(Double.parseDouble(orderDO.getServeLat()),Double.parseDouble(orderDO.getServeLon()),Double.parseDouble(doc.getDoctorLat()),Double.parseDouble(doc.getDoctorLon()));
                otherDoctorDistanceObj = new JSONObject();
                otherDoctorDistanceObj.put("doctor",doc.getId());
                otherDoctorDistanceObj.put("doctorName",doc.getName());
                otherDoctorDistanceObj.put("doctorAddress",doc.getDoctorLocateAddress());
                otherDoctorDistanceObj.put("doctorLon",doc.getDoctorLon());
                otherDoctorDistanceObj.put("doctorLat",doc.getDoctorLat());
                otherDoctorDistanceObj.put("distance",distanceTmp);//两点距离
                otherDoctorDistance.add(otherDoctorDistanceObj);
            }
            emergencyOrderVO.setOtherDoctorDistance(otherDoctorDistance.toJSONString());
        }
        jsonObject.put("statusName",statusName);
        emergencyOrderVO.setNoticePersons(noticePersons);
        JSONObject jsonObject = JSON.parseObject(JSON.toJSONStringWithDateFormat(emergencyOrderVO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
        //获取咨询
        ConsultDo consult = consultDao.queryByRelationCode(orderID);
        if (null != consult) {
            String sessionId = orderDO.getPatient() + "_" + consult.getId() + "_" + consult.getType();
            jsonObject.put("sessionId",sessionId);
            if (1==orderDO.getStatus()&&StringUtils.isNotBlank(doctor)){//查询未读数量
                try {
                    Integer count = imUtil.UserSessionsUnreadMessageCount(sessionId,doctor);
                    jsonObject.put("UnRead",count);
                }catch (Exception e){
                    jsonObject.put("sessionId",sessionId);
                    jsonObject.put("UnRead",0);
                }
            }
        }
        else {
            jsonObject.put("sessionId",null);
            jsonObject.put("UnRead",0);
        }
        result.put("resultFlag", 1);
@ -270,30 +387,57 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    }
    public JSONArray getSecurityOrderList(String doctor,String serverDoctor,String patientName, String patient, String status, Integer page, Integer pageSize){
    public JSONObject errorWarning(String orderId,Integer emergencyCancel,String doctor){
        JSONObject result = new JSONObject();
        SecurityMonitoringOrderDO orderDO = securityMonitoringOrderDao.findOne(orderId);
        if (orderDO==null){
            String failMsg = "工单不存在!";
            result.put("resultFlag", 0);
            result.put("resultMsg", failMsg);
            logger.error(failMsg);
            return result;
        }
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        orderDO.setStatus(-2);
        orderDO.setCancelTime(new Date());
        orderDO.setUpdateTime(new Date());
        orderDO.setUpdateUserName(doctorDO.getName());
        orderDO.setUpdateUser(doctorDO.getId());
        orderDO.setEmergencyCancel(emergencyCancel);
        securityMonitoringOrderDao.save(orderDO);
        result = getSecurityOrderDetail(orderId,null);
        return result;
    }
    public PageEnvelop getSecurityOrderList(String doctor, String serverDoctor, String patientName, String patient, String status, Integer page, Integer pageSize){
        String sqlCount = "select count(ord.id) from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                "where 1=1 ";
        String fliter = "  ";
        String sql = " select p.id patientCode,p.name,p.sex,p.photo,p.idcard,ord.id orderId,ord.number,ord.serve_desc,ord.create_time,ord.`status`,ord.doctor," +
                "ord.doctor_name,ord.patient_phone,ord.conclusion_status from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                "where 1=1 ";
        if (StringUtils.isNotBlank(doctor)){
            sql+=" and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
            fliter+=" and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                    " 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' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
        }
        if (StringUtils.isNotBlank(serverDoctor)){
            sql +=" and ord.doctor = '"+serverDoctor+"' ";
            fliter +=" and ord.doctor = '"+serverDoctor+"' ";
        }
        if (StringUtils.isNotBlank(patientName)){
            sql+=" and (ord.patient_name like '%"+patientName+"%' or p.idcard='"+patientName+"')  ";
            fliter+=" and (ord.patient_name like '%"+patientName+"%' or p.idcard='"+patientName+"')  ";
        }
        if (StringUtils.isNotBlank(patient)){
            sql+=" and ord.patient='"+patient+"' ";
            fliter+=" and ord.patient='"+patient+"' ";
        }
        if (StringUtils.isNotBlank(status)){
            sql+=" and ord.status='"+Integer.parseInt(status)+"' ";
            fliter+=" and ord.status='"+Integer.parseInt(status)+"' ";
        }
        sql+=" order by ord.create_time desc limit " + (page*pageSize) + "," + pageSize;
        List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
        Long count = jdbcTemplate.queryForObject(sqlCount+fliter,Long.class);
        fliter+=" order by ord.create_time desc limit " + (page*pageSize) + "," + pageSize;
        List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql+fliter);
        JSONArray result = new JSONArray();
        for (Map<String,Object>one:sqlResult){
@ -323,14 +467,10 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            Integer statustemp = Integer.valueOf(one.get("status")+"");
            String statusName = "";
            switch (statustemp){
                case -2:statusName="误警报";break;
                case -1:statusName="已取消";break;
                case 1:statusName="待处置";break;
                case 2:statusName="前往居民定位";break;
                case 3:statusName="已签到";break;
                case 4:statusName="已登记小结";break;
                case 5:statusName="待补录";break;
                case 6:statusName="待评价";break;
                case 7:statusName="已完成";break;
                case 0:statusName="已完成";break;
                case 1:statusName="申请中";break;
            }
            tmp.put("statusName",statusName);
            result.add(tmp);
@ -345,13 +485,13 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                tmp.put("deviceFlag","0");
            }
        }
        return result;
        return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,count);
    }
    public List<Map<String,Object>> getSecurityOrderUnCompleteList(String doctor){
        List<Map<String,Object>> result = new ArrayList<>();
        String sql = " select p.id patientCode,p.name,p.sex,p.idcard,p.photo,ord.id orderId,ord.number,ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time,ord.`status`,ord.doctor," +
                "ord.doctor_name,ord.patient_phone,ord.conclusion_status from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                "where ord.status <>-1 and ord.status<> 7  ";
                "where ord.status <>-1 and ord.status<>0  ";
        sql+= "and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                "base_team_member m " +
                "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
@ -371,8 +511,10 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        return result;
    }
    /**
     * 系统更新医生上门服务工单状态
     * 系统更新医生工单状态
     * @param doctor
     * @param dispatchOrderStatus
     */
@ -399,24 +541,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        if (null == doorServiceOrder) {
            throw new Exception("该工单不存在");
        }
        doorServiceOrder.setStatus(SecurityMonitoringOrderDO.Status.waitForArrive.getType()); //
        this.updateDispatchStatusBySystem(doorServiceOrder.getDoctor(), 3);//待服务
        doorServiceOrder.setServiceResponseTime(new Date());
        //新增工单医生关联关系
//        JSONObject jsonObjectParam = new JSONObject();
//        JSONObject doc = new JSONObject();
//        doc.put("doctor",doorServiceOrder.getDoctor());
//        doc.put("doctorName",doorServiceOrder.getDoctorName());
//        doc.put("hospitalLevel",hospitalLevel);
//        doc.put("doctorJobCode",jobCode);
//        doc.put("doctorJobName",jobCodeName);
//        JSONArray docArr = new JSONArray();
//        docArr.add(doc);
//        jsonObjectParam.put("doctorArr",docArr);
        // 无费用
//        if (wlyyDoorServiceOrderService.orderWithDoctorAdd(new JSONObject(), jsonObjectParam, doorServiceOrder)) return null;
//        doorServiceOrder.setStatus(SecurityMonitoringOrderDO.Status.waitForArrive.getType()); //
//        this.updateDispatchStatusBySystem(doorServiceOrder.getDoctor(), 3);//待服务
//        doorServiceOrder.setServiceResponseTime(new Date());
        securityMonitoringOrderDao.save(doorServiceOrder);
@ -452,84 +579,65 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
     */
    @Transactional(rollbackFor = Exception.class)
    public JSONObject acceptOrder(String orderId,String doctor) throws Exception {
        JSONObject result = new JSONObject();
        SecurityMonitoringOrderDO doorServiceOrderDO = securityMonitoringOrderDao.findOne(orderId);
        if(null == doorServiceOrderDO){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "当前工单不存在,id:" + orderId;
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        }
        if (doorServiceOrderDO.getStatus()!=1){//待处置工单才可进行接单操作
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "当前工单已被取消或接收:" + orderId;
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        }
        SecurityMonitoringDoctorStatusDo doctorStatusDo = doctorStatusDao.findByDoctor(doctor);
        BaseDoctorDO doctorVO = baseDoctorDao.findById(doctor);
        if (null == doctorStatusDo) {
            doctorStatusDo =new SecurityMonitoringDoctorStatusDo();
            doctorStatusDo.setDoctor(doctor);
            doctorStatusDo.setStatus(2);
            doctorStatusDo.setCreateTime(new Date());
            doctorStatusDo.setCreateUser(doctor);
            doctorStatusDo.setCreateUserName(null != doctorVO ? doctorVO.getName() : null);
            doctorStatusDao.save(doctorStatusDo);
        }
        SecurityMonitoringDoctorStatusDo doorDoctorStatusDO = doctorStatusDao.queryByDoctorAndStatusIn(doctor,new Integer[]{SecurityMonitoringDoctorStatusDo.Status.waitForSend.getType(),
                SecurityMonitoringDoctorStatusDo.Status.waitForAccept.getType(),
                SecurityMonitoringDoctorStatusDo.Status.waitForServe.getType(),
                SecurityMonitoringDoctorStatusDo.Status.serving.getType(),
        });
        if(null == doorDoctorStatusDO){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "当前接单的医生不存在或禁止接单,doctor:" + doctor;
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        }
        BaseDoctorDO doctorDO= baseDoctorDao.findById(doctor);
        doorServiceOrderDO.setDoctor(doctor);
        doorServiceOrderDO.setDoctorName(doctorDO.getName());
        doorServiceOrderDO.setDoctorType("医生");
        doorServiceOrderDO.setStatus(SecurityMonitoringOrderDO.Status.waitForArrive.getType());//前往居民定位
        doorServiceOrderDO.setUpdateUser(doctor);
        doorServiceOrderDO.setUpdateUserName(doctorDO.getName());
        securityMonitoringOrderDao.save(doorServiceOrderDO);
        // 派单时,把医生拉入会话,作为其中一个成员,医生拒单时,退出会话
        //TODO 接单时创建两个人聊天
//        ConsultDo consult = consultDao.queryByRelationCode(orderId);
//        String sessionId = doorServiceOrderDO.getPatient() + "_" + consult.getId() + "_" + doorServiceOrderDO.getNumber() + "_" + consult.getType();
//        imUtill.updateParticipantNew(sessionId,doctor,null);
        // 工单状态变更记录
//        WlyyDoorProcessLogDO processLogDO = new WlyyDoorProcessLogDO();
//        processLogDO.setOrderId(orderId);
//        processLogDO.setStatus(WlyyDoorServiceOrderDO.Status.waitForAccept.getType());
//        processLogDO.setDispatcher(dispatcher);
//        processLogDO.setDispatcherName(dispathcherName);
//        processLogDO.setCreateTime(new Date());
//        wlyyDoorProcessLogDao.save(processLogDO);
        // 发送IM消息通知患者医生已派单
//        String noticeContent = "已转派"+doorServiceOrderDO.getDoctorName()+"医生为您服务,请耐心等待医生接单";
//        this.qucikSendIM(doorServiceOrderDO.getId(), dispatcher, "智能助手","1", noticeContent);
        SecurityMonitoringOrderDO doorServiceOrder = acceptOrder1(orderId, doctor);
        if(doorServiceOrder==null){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "当前接单的医生不存在或禁止接单,doctor:" + doctor;
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        }
//        JSONObject result = new JSONObject();
//        SecurityMonitoringOrderDO doorServiceOrderDO = securityMonitoringOrderDao.findOne(orderId);
//        if(null == doorServiceOrderDO){
//            result.put(ResponseContant.resultFlag, ResponseContant.fail);
//            String failMsg = "当前工单不存在,id:" + orderId;
//            result.put(ResponseContant.resultMsg, failMsg);
//            logger.error(failMsg);
//            return result;
//        }
//        if (doorServiceOrderDO.getStatus()!=1){//待处置工单才可进行接单操作
//            result.put(ResponseContant.resultFlag, ResponseContant.fail);
//            String failMsg = "当前工单已被取消或接收:" + orderId;
//            result.put(ResponseContant.resultMsg, failMsg);
//            logger.error(failMsg);
//            return result;
//        }
//        SecurityMonitoringDoctorStatusDo doctorStatusDo = doctorStatusDao.findByDoctor(doctor);
//        BaseDoctorDO doctorVO = baseDoctorDao.findById(doctor);
//        if (null == doctorStatusDo) {
//            doctorStatusDo =new SecurityMonitoringDoctorStatusDo();
//            doctorStatusDo.setDoctor(doctor);
//            doctorStatusDo.setStatus(2);
//            doctorStatusDo.setCreateTime(new Date());
//            doctorStatusDo.setCreateUser(doctor);
//            doctorStatusDo.setCreateUserName(null != doctorVO ? doctorVO.getName() : null);
//            doctorStatusDao.save(doctorStatusDo);
//        }
//
//        SecurityMonitoringDoctorStatusDo doorDoctorStatusDO = doctorStatusDao.queryByDoctorAndStatusIn(doctor,new Integer[]{SecurityMonitoringDoctorStatusDo.Status.waitForSend.getType(),
//                SecurityMonitoringDoctorStatusDo.Status.waitForAccept.getType(),
//                SecurityMonitoringDoctorStatusDo.Status.waitForServe.getType(),
//                SecurityMonitoringDoctorStatusDo.Status.serving.getType(),
//        });
//        if(null == doorDoctorStatusDO){
//            result.put(ResponseContant.resultFlag, ResponseContant.fail);
//            String failMsg = "当前接单的医生不存在或禁止接单,doctor:" + doctor;
//            result.put(ResponseContant.resultMsg, failMsg);
//            logger.error(failMsg);
//            return result;
//        }
//        BaseDoctorDO doctorDO= baseDoctorDao.findById(doctor);
//        doorServiceOrderDO.setDoctor(doctor);
//        doorServiceOrderDO.setDoctorName(doctorDO.getName());
//        doorServiceOrderDO.setDoctorType("医生");
//        doorServiceOrderDO.setStatus(SecurityMonitoringOrderDO.Status.waitForArrive.getType());//前往居民定位
//        doorServiceOrderDO.setUpdateUser(doctor);
//        doorServiceOrderDO.setUpdateUserName(doctorDO.getName());
//        securityMonitoringOrderDao.save(doorServiceOrderDO);
//
//
//        SecurityMonitoringOrderDO doorServiceOrder = acceptOrder1(orderId, doctor);
//        if(doorServiceOrder==null){
//            result.put(ResponseContant.resultFlag, ResponseContant.fail);
//            String failMsg = "当前接单的医生不存在或禁止接单,doctor:" + doctor;
//            result.put(ResponseContant.resultMsg, failMsg);
//            logger.error(failMsg);
//            return result;
//        }
        result = getSecurityOrderDetail(orderId);
        // 发送微信模板消息通知患者医生已接单
//        BasePatientDO patient = basePatientDao.findById(doorServiceOrder.getPatient());//
@ -551,9 +659,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
//            logger.error(e.getMessage());
//        }
        //  待接单消息设为已操作, 434 医生接单-- 王五接受了服务工单12345678
        messageUtil.createMessage("医生接单","634",doorServiceOrder.getPatient(),doorServiceOrder.getPatientName(),
                doorServiceOrder.getId(), doorServiceOrder.getDoctor(),doorServiceOrder.getDoctorName() ,null, doorServiceOrder.getDoctorName() + "接受了服务工单"+ doorServiceOrder.getNumber());
        return result;
//        messageUtil.createMessage("医生接单","634",doorServiceOrder.getPatient(),doorServiceOrder.getPatientName(),
//                doorServiceOrder.getId(), doorServiceOrder.getDoctor(),doorServiceOrder.getDoctorName() ,null, doorServiceOrder.getDoctorName() + "接受了服务工单"+ doorServiceOrder.getNumber());
        return getSecurityOrderDetail(orderId,null);
    }
@ -582,8 +690,8 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            logger.error(failMsg);
            return result;
        }
        if(orderDO.getStatus() > SecurityMonitoringOrderDO.Status.waitForSend.getType()){
            String failMsg = "只有医生接单前的工单才可取消";
        if(orderDO.getStatus() == SecurityMonitoringOrderDO.Status.complete.getType()){
            String failMsg = "当前工单已结束";
            result.put("resultFlag", 0);
            result.put("resultMsg", failMsg);
            logger.error(failMsg);
@ -609,25 +717,13 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        }
        //保存取消记录
        SecurityMonitoringOrderCancelLog cancelLogDO = new SecurityMonitoringOrderCancelLog();
        EmergencyWarnCancelLogDO cancelLogDO = new EmergencyWarnCancelLogDO();
        cancelLogDO.setOrderId(orderId);
        cancelLogDO.setPatient(orderDO.getPatient());
        cancelLogDO.setCancelType(type);
        cancelLogDO.setCancelReason(reason);
        cancelLogDO.setTime(orderDO.getCancelTime());
        securityMonitoringOrderCancelLogDao.save(cancelLogDO);
        //保存居民确认取消记录
        JSONObject confirmInfo = new JSONObject();
        confirmInfo.put("orderId",orderId);
        confirmInfo.put("patient",orderDO.getPatient());
        confirmInfo.put("patientName",orderDO.getPatientName());
        confirmInfo.put("type",4);
        confirmInfo.put("description",reason);
        JSONObject confirmInfoJson = new JSONObject();
        confirmInfoJson.put("confirmInfo",confirmInfo);
        this.orderWithConfirmLogAdd(result,confirmInfo,orderId);
        emergencyWarnCancelLogDao.save(cancelLogDO);
//        Consult consult = consultDao.queryByRelationCode(orderId);
//        // 发送微信模板消息,通知居民工单已取消(smyyyqx-上门预约已取消)
@ -648,40 +744,10 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
//        }
//        pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 30, patient.getOpenid(), patient.getName(), json);
        result = getSecurityOrderDetail(orderId);
        result = getSecurityOrderDetail(orderId,null);
        return result;
    }
    @Transactional(rollbackFor = Exception.class)
    public boolean orderWithConfirmLogAdd(JSONObject result, JSONObject jsonObjectParam, String orderId) {
        // 确认信息
        JSONObject confirmInfo = jsonObjectParam.getJSONObject("confirmInfo");
        if (null != confirmInfo) {
            SecurityMonitoringOrderPatientConfirmLog confirmLogDO = null;
            try {
                confirmLogDO = EntityUtils.jsonToEntity(confirmInfo.toString(), SecurityMonitoringOrderPatientConfirmLog.class);
            } catch (Exception e) {
                String failMsg = "工单关联【居民确认操作日志记录】时出错";
                result.put("resultFlag", 0);
                result.put("resultMsg", failMsg);
                logger.error(failMsg);
                return true;
            }
            confirmLogDO.setOrderId(orderId);
            confirmLogDO.setCreateTime(new Date());
            try {
                securityMonitoringOrderPatientConfirmLogDao.save(confirmLogDO);
            } catch (Exception e) {
                String failMsg = "保存工单关联的【居民确认操作日志记录】时出错";
                result.put("resultFlag", 0);
                result.put("resultMsg", failMsg);
                logger.error(failMsg);
                return true;
            }
        }
        return false;
    }
    /**
     * 签到保存
     * @param orderId
@ -693,7 +759,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
     */
    public JSONObject signIn(String orderId, String signTime, Integer signWay, String signLocation,
                                         String signImg, String twoDimensionalCode,String doctorId) throws Exception {
        SecurityMonitoringOrderDO doorServiceOrder = securityMonitoringOrderDao.findOne(orderId);
       /* SecurityMonitoringOrderDO doorServiceOrder = securityMonitoringOrderDao.findOne(orderId);
        doorServiceOrder.setDoctorSignTime(DateUtil.strToDate(signTime));
        doorServiceOrder.setDoctorSignWay(signWay);
        // 签到方式-2扫码时,需要去解析地址
@ -717,8 +783,10 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            doorServiceOrder = securityMonitoringOrderDao.save(doorServiceOrder);
            // 修改医生上门服务工单状态 4服务中
            this.updateDispatchStatusBySystem(doorServiceOrder.getDoctor(), 4);
            return getSecurityOrderDetail(orderId);
        }
        }*/
        return getSecurityOrderDetail(orderId,null);
    }
    /**
@ -737,7 +805,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
     * @return
     * @throws Exception
     */
    public JSONObject updateDoorConclusion(Integer manageStatus,String orderId,String conclusion,Integer examPapeStatus) throws Exception {
    public JSONObject updateDoorConclusion(Integer emergency_reason,Integer treatment_status,String orderId,String conclusion,String conclusion_img) throws Exception {
        JSONObject result = new JSONObject();
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
@ -748,17 +816,19 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            result.put("resultMsg", failMsg);
            return result;
        }
        SecurityMonitoringConclusionDO doorConclusion =  securityMonitoringConclusionDao.findByOrderId(orderId);
        EmergencyWarnConclusionDO doorConclusion =  emergencyWarnConclusionDao.findByOrderId(orderId);
        if (doorConclusion==null){
            doorConclusion = new SecurityMonitoringConclusionDO();
            doorConclusion = new EmergencyWarnConclusionDO();
            doorConclusion.setOrderId(orderId);
            doorConclusion.setPatient(one.getPatient());
            doorConclusion.setPatientName(one.getPatientName());
            doorConclusion.setDoctor(one.getDoctor());
            doorConclusion.setDoctorName(one.getDoctorName());
        }
        doorConclusion.setStatus(manageStatus);
        doorConclusion.setEmergencyReason(emergency_reason);
        doorConclusion.setEmergencyTreatmentStatus(treatment_status);
        doorConclusion.setConclusion(conclusion);
        doorConclusion.setConclusionImg(conclusion_img);
        BaseDoctorDO doctorVO = baseDoctorDao.findById(one.getDoctor());
        if (doorConclusion != null && org.apache.commons.lang.StringUtils.isNotEmpty(doorConclusion.getId())) {
            doorConclusion.setUpdateTime(new Date());
@ -770,22 +840,22 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            doorConclusion.setCreateUser(one.getDoctor());
            doorConclusion.setCreateUserName(null != doctorVO ? doctorVO.getName() : null);
        }
        securityMonitoringConclusionDao.save(doorConclusion);
        // 设置是否需要上传补录报告
        if (!(one.getStatus()==SecurityMonitoringOrderDO.Status.complete.getType())){
            one.setStatus(SecurityMonitoringOrderDO.Status.registerSummary.getType());//已登记服务小结
        if (!consultTeamService.finishConsult(one.getId(),one.getPatient(),one.getPatient(),1)){
            String failMsg = "咨询结束失败 无法结束工单";
            throw new Exception(failMsg);
        }
        one.setExamPaperStatus(examPapeStatus);
        emergencyWarnConclusionDao.save(doorConclusion);
        one.setStatus(SecurityMonitoringOrderDO.Status.complete.getType());//已完成
        one.setConclusionStatus(2);
        securityMonitoringOrderDao.save(one);
        return getSecurityOrderDetail(orderId);
        return getSecurityOrderDetail(orderId,null);
    }
    /**
     * 跳过登记服务小结
     * @param orderId
     */
    public JSONObject cancelConclusion(String orderId) {
    public JSONObject cancelConclusion(String orderId) throws Exception {
        JSONObject result = new JSONObject();
        SecurityMonitoringOrderDO one = securityMonitoringOrderDao.findOne(orderId);
        if (one==null){
@ -794,13 +864,12 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            result.put("resultMsg", failMsg);
            return result;
        }
        if (one.getStatus()==SecurityMonitoringOrderDO.Status.complete.getType()){//修改工单记录
            securityMonitoringOrderDao.updateConclusionStatus2(orderId);
        }
        else {
            securityMonitoringOrderDao.updateConclusionStatus(orderId);
        if (!consultTeamService.finishConsult(one.getId(),one.getPatient(),one.getPatient(),1)){
            String failMsg = "咨询结束失败 无法结束工单";
            throw new Exception(failMsg);
        }
        return getSecurityOrderDetail(orderId);
        securityMonitoringOrderDao.updateConclusionStatus(orderId);
        return getSecurityOrderDetail(orderId,null);
    }
    /**
@ -820,68 +889,42 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
     * @param orderId
     * @return
     */
    public SecurityMonitoringConclusionDO getDoorConclusion(String orderId){
        SecurityMonitoringConclusionDO doorConclusion = securityMonitoringConclusionDao.findByOrderId(orderId);
    public EmergencyWarnConclusionDO getDoorConclusion(String orderId){
        EmergencyWarnConclusionDO doorConclusion = emergencyWarnConclusionDao.findByOrderId(orderId);
        SecurityMonitoringOrderDO one = securityMonitoringOrderDao.findOne(orderId);
        if (doorConclusion==null&&one!=null) {
            doorConclusion = new SecurityMonitoringConclusionDO();
            doorConclusion = new EmergencyWarnConclusionDO();
            doorConclusion.setOrderId(one.getId());
            doorConclusion.setPatient(one.getPatient());
            doorConclusion.setPatientName(one.getPatientName());
            doorConclusion.setDoctor(one.getDoctor());
            doorConclusion.setDoctorName(one.getDoctorName());
        }else {
            doorConclusion.setReasonName(dictService.fingByNameAndCode(ConstantUtil.DICT_EMERGENCY_REASON,String.valueOf(doorConclusion.getEmergencyReason())));
            doorConclusion.setTreatmentStatusName(dictService.fingByNameAndCode(ConstantUtil.DICT_EMERGENCY_TREATMENT_STATUS,String.valueOf(doorConclusion.getEmergencyTreatmentStatus())));
        }
        return doorConclusion;
    }
    public JSONObject saveOrderFinishBydoctor(String orderId ,String finishImg) throws Exception {
        SecurityMonitoringOrderDO one = securityMonitoringOrderDao.findOne(orderId);
        one.setDoctorConfirmFinishImg(finishImg);
        one.setStatus(SecurityMonitoringOrderDO.Status.complete.getType());
        one.setDoctorConfirmFinishTime(new Date());
        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());
//        SecurityMonitoringOrderDO one = securityMonitoringOrderDao.findOne(orderId);
//        one.setDoctorConfirmFinishImg(finishImg);
//        one.setStatus(SecurityMonitoringOrderDO.Status.complete.getType());
//        one.setDoctorConfirmFinishTime(new Date());
//        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 {
//            WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_process_feedback","fwyspf");
//            String first = templateConfig.getFirst();
//            first = first.replace("key1", DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm"));
//            first = first .replace("key2", null != one.getDoctorName() ? one.getDoctorName() : "");
//            org.json.JSONObject json = new org.json.JSONObject();
//            json.put("first", first);
//            json.put("keyword1", DateUtil.dateToStrShort(new Date()));
//            json.put("keyword2", "服务医生评分");
//            json.put("url", templateConfig.getUrl());
//            json.put("remark", templateConfig.getRemark());
//            json.put("id",orderId);
//            //json.put("consult",consult.getCode());
//            WlyyDoorCommentDO wlyyDoorCommentDO = this.DoorCommentDao.selectCommentDoctor(patient.getCode(),orderId);
//            String finish="";
//            if(wlyyDoorCommentDO!=null){
//                finish = "0";
//                json.put("finish",finish);
//            }else {
//                finish = "1";
//                json.put("finish",finish);
//            }
//            pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 31, patient.getOpenid(), patient.getName(), json);
        }catch (Exception e){
            logger.error(e.getMessage());
        }
        return getSecurityOrderDetail(orderId);
        return getSecurityOrderDetail(orderId,null);
    }
    /**
@ -910,8 +953,8 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        // 设置服务小结
        SecurityMonitoringConclusionDO doorConclusion = this.getDoorConclusion(id);
        doorServiceOrder.setMonitoringConclusion(doorConclusion);
        EmergencyWarnConclusionDO doorConclusion = this.getDoorConclusion(id);
        doorServiceOrder.setEmergencyWarnConclusionDO(doorConclusion);
        return doorServiceOrder;
@ -1002,6 +1045,74 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        return result;
    }
    public JSONObject updateDoctorLocation(String doctor,String orderId,String doctorAddress,String doctorLat,String doctorLon){
        JSONObject result = new JSONObject();
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        if (doctorDO==null){
            String failMsg = "当前医生不存在";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        else {
            doctorDO.setDoctorLocateAddress(doctorAddress);
            doctorDO.setDoctorLat(doctorLat);
            doctorDO.setDoctorLon(doctorLon);
            baseDoctorDao.save(doctorDO);
            result.put(ResponseContant.resultFlag, ResponseContant.success);
        }
        return result;
    }
    public JSONObject updatePatientLocation(String patient,String patientAddress,String patientLat,String patientLon){
        JSONObject result = new JSONObject();
        BasePatientDO patientDO = basePatientDao.findById(patient);
        if (patientDO==null){
            String failMsg = "患者不存在";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        List<SecurityMonitoringOrderDO> monitoringOrderDO = securityMonitoringOrderDao.findByPatientAndStatus(patient,1);
        if (monitoringOrderDO.size()>0){
            for (SecurityMonitoringOrderDO tmp:monitoringOrderDO){
                tmp.setServeAddress(patientAddress);
                tmp.setServeLat(patientLat);
                tmp.setServeLon(patientLon);
                securityMonitoringOrderDao.save(monitoringOrderDO);
            }
            result.put(ResponseContant.resultFlag, ResponseContant.success);
        }
        else {
            result.put(ResponseContant.resultFlag, ResponseContant.success);
            result.put(ResponseContant.resultMsg,null);
        }
        return result;
    }
    public JSONObject responseOrder(String orderId,String doctor){
        JSONObject result = new JSONObject();
        SecurityMonitoringOrderDO one = securityMonitoringOrderDao.findOne(orderId);
        if (one==null){
            String failMsg = "工单不存在" ;
            result.put("resultFlag", 0);
            result.put("resultMsg", failMsg);
            return result;
        }
        if (emergencyWarnDoctorResponseDao.findByDoctorAndOrderId(doctor,orderId)==null){
            EmergencyWarnDoctorResponseDO responseDO = new EmergencyWarnDoctorResponseDO();
            responseDO.setOrderId(orderId);
            responseDO.setDoctor(doctor);
            responseDO.setResponseTime(new Date());
            emergencyWarnDoctorResponseDao.save(responseDO);
        }
        result.put("resultFlag", 1);
        result.put("resultMsg", "success");
        return result;
    }
    private String getRandomIntStr(){
        Random rand = new Random();
        int i = rand.nextInt(); //int范围类的随机数

+ 5 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java

@ -149,14 +149,17 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
        return res;
    }
    public PageEnvelop<List<Map<String,Object>>> assessmentPage(String doctorId,String name, int page, int size,
    public PageEnvelop<List<Map<String,Object>>> assessmentPage(String doctorId,String name,int type, int page, int size,
                    Integer status,Integer levelConclusion,Integer servicePackageStatus){
        String sql = "SELECT c.id,c.patient,c.assessment_time,c.service_package_status servicePackageStatus, " +
                "c.`status`,c.level_conclusion levelConclusion,c.org_code orgCode,c.org_name orgName,p.name,p.photo,p.mobile,p.sex,p.idcard  ";
        String countSql = "SELECT count(*) ";
        String filters = "from base_capacity_assessment_record c left join base_capacity_doctor d on c.id =d.capacity_id ,base_patient p " +
                "WHERE  c.patient = p.id  and c.assessment_time>='" + DateUtil.getNowYear() + "-01-01'";
                "WHERE  c.patient = p.id  " ;
        if(type==0){
            filters += " and c.assessment_time>='" + DateUtil.getNowYear() + "-01-01' ";
        }
        if(StringUtils.isNoneBlank(doctorId)){
            filters += " and (c.doctor = '"+doctorId+"' or d.doctor_id = '"+doctorId+"')";

+ 26 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/ConstantUtil.java

@ -40,6 +40,16 @@ public class ConstantUtil {
     emergency_assistance_message //紧急救助快速消息
     emergency_assistance_call //紧急救助快速呼叫
     foodClassification 食物分类
     emergency_reason //紧急预警工单发起原因
     emergency_treatment_status //紧急预警工单处理结果
     emergency_cancel //紧急预警工单取消状态
     courseStatus 课程状态
     courseType 课程类型
     pay_type 付款方式
     orderPayStatus //订单支付状态
     liveStatus 直播状态
     intake 摄入量
     refundStatus 退款状态
     */
    public static final String DICT_ARCHIVETYPE = "archiveType";
    public static final String DICT_ARCHIVESTATUS = "archiveStatus";
@ -52,12 +62,22 @@ public class ConstantUtil {
    public static final String DICT_SERVICE_TYPE = "service_type";
    public static final String DICT_LABEL_TYPE = "label_type";
    public static final String DICT_LEVEL_CONCLUSION = "level_conclusion";
    public static final String DICT_SERVICEPACKAGESTATUS= "servicePackageStatus";
    public static final String DICT_CAPACITY_AGREE_STATUS= "capacity_agree_status";
    public static final String DICT_SEX= "sex";
    public static final String DICT_EMERGENCY_ASSISTANCE_MESSAGE= "emergency_assistance_message";
    public static final String DICT_EMERGENCY_ASSISTANCE_CALL= "emergency_assistance_call";
    public static final String DICT_FOODCLASSIFICATION= "foodClassification";
    public static final String DICT_SERVICEPACKAGESTATUS = "servicePackageStatus";
    public static final String DICT_CAPACITY_AGREE_STATUS = "capacity_agree_status";
    public static final String DICT_SEX = "sex";
    public static final String DICT_EMERGENCY_ASSISTANCE_MESSAGE = "emergency_assistance_message";
    public static final String DICT_EMERGENCY_ASSISTANCE_CALL = "emergency_assistance_call";
    public static final String DICT_FOODCLASSIFICATION = "foodClassification";
    public static final String DICT_EMERGENCY_REASON = "emergency_reason";
    public static final String DICT_EMERGENCY_TREATMENT_STATUS = "emergency_treatment_status";
    public static final String DICT_EMERGENCY_CANCEL = "emergency_cancel";
    public static final String DICT_course_Status = "courseStatus";
    public static final String DICT_course_type = "courseType";
    public static final String DICT_pay_type = "pay_type";
    public static final String DICT_porderPayStatus = "orderPayStatus";
    public static final String DICT_liveStatus = "liveStatus";
    public static final String DICT_intake = "intake";
    public static final String DICT_refundStatus = "refundStatus";
}

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

@ -1,142 +0,0 @@
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"
 *   }
 * }
 */

+ 106 - 1
svr/svr-cloud-care/src/main/resources/application.yml

@ -388,4 +388,109 @@ systemSetting:
base:
  url: http://172.17.110.212:10020/
  hospitalUrl: http://172.26.0.107:10022/
  hospitalUrl: http://172.26.0.107:10022/
---
spring:
  profiles: hzprod
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.26.0.13:3306/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
    username: root
    password: '*ukOOSl&c0!y'
#  elasticsearch:
#    cluster-name: jkzl #集群名 默认elasticsearch
#    cluster-nodes: 172.26.0.115:9300,172.26.0.115:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
#    client-transport-sniff: false
#    jest:
#      uris: http://172.26.0.112:9200,http://172.26.0.112:9200
#      connection-timeout: 60000 # Connection timeout in milliseconds.
#      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://172.26.0.13:61616
    user: admin
    password: admin
  redis:
    host: 172.26.0.13 # Redis server host.
    port: 6379  # Redis server port.
    password: Kb6wKDQP1W4
fastDFS:
  fastdfs_file_url: http://172.26.0.13:8888/
fast-dfs:
  tracker-server: 172.26.0.13:22122 #服务器地址
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
myFamily:
  qrCodeFailurTime: 2
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: 1
  mqUser: 1
  mqPwd: 1
  SourceSysCode: S60
  TargetSysCode: S01
wechat:
  appId: wx2c55f5b7b2f3cb56
  appSecret: 0dd9927e58125ad5f0efb9299860d145
  wechat_token: 27eb3bb24f149a7760cf1bb154b08041
  wechat_base_url: http%3A%2F%2Fhzijk.cityihealth.com%2Fcityihealth%2FcloudCare%2F
  accId: gh_da06ed9e5751
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段
  flag: true #演示环境  true走Mysql数据库  false走Oracle
im:
  im_list_get: http://172.26.0.12:3000/
  data_base_name: im_internet_hospital
es:
  pwflag: 2 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_prod
    FollowUp: wlyy_followup
  type:
    Statistics: hlw_quota_prod
    FollowUpContent: wlyy_followup_content
  host:  http://172.26.0.13:9000
  tHost: 172.26.0.13:9300
  clusterName: jkzl
  securityUser: lion:jkzlehr
  user: lion
  password: jkzlehr
# 上传文件临时路径配置
FileTempPath:
  upload_temp_path : /var/local/temp
  image_path : /var/local/upload/images
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 1
wlyy:
  url: 1
qywx:
  url: 2
  id: 1
express:
  sf_url: http://mrds-admin-ci.sit.sf-express.com:45478
  sf_code: HD000001
  sf_check_word: AAAABBBBCCCCDDDD
baiduApi:
  AK: 0vjnCSReegE7A47a941ohjv9a07ONiMC
  url: http://api.map.baidu.com/
  # 系统配置
systemSetting:
  isApplication: 0 # 是否需要资质申请 1需要 0 不需要
base:
  hospitalUrl: http://127.0.0.7:10022/

+ 8 - 0
svr/svr-cloud-care/src/main/resources/bootstrap.yml

@ -29,3 +29,11 @@ spring:
    config:
      uri: ${wlyy.spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: hzprod
  cloud:
    config:
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy-spring.config.label:jwdev}

+ 1 - 1
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -259,7 +259,7 @@ public class SpecialistService{
                    "d.label AS healthcode," +
                    "a.health_assistant AS healthAssistant,a.health_assistant_name AS healthAssistantName," +
//                    "a.health_assistant_name AS healthAssistantName, " +
                    ",a.is_manage AS isManage, " +
                    " a.is_manage AS isManage, " +
                    "a.id AS specialCode " +
                    "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
                    "JOIN "+basedb+".wlyy_patient_disease_server b ON a.id=b.specialist_relation_code AND b.disease=" +labelCode+" and b.del=1 "+

+ 243 - 0
wlyy-starter/pom.xml

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <!-- Parent -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version>
    </parent>
    <!-- Self -->
    <groupId>com.yihu.jw</groupId>
    <artifactId>wlyy-starter</artifactId>
    <packaging>pom</packaging>
    <version>2.0.0</version>
    <!-- 模块列表 -->
    <modules>
        <!--<module>../starter/hbase-starter</module>-->
       <module>../starter/swagger-starter</module>
    </modules>
    <!-- 项目发布到这个服务器 -->
    <distributionManagement>
        <repository>
            <id>jkzlRepositories</id>
            <name>jkzlRepositories</name>
            <url>http://192.168.1.220:8081/nexus/content/repositories/jkzlRepositories/</url>
        </repository>
    </distributionManagement>
    <properties>
        <version.spring-cloud>Edgware.SR4</version.spring-cloud>
        <version.jackson>2.6.6</version.jackson>
        <version.fastdfs>1.27</version.fastdfs>
        <version.swagger>2.7.0</version.swagger>
        <version.swagger-ui>2.7.0</version.swagger-ui>
        <version.swagger2markup>1.3.2</version.swagger2markup>
        <version.springfox-staticdocs>2.6.1</version.springfox-staticdocs>
        <version.mysql>5.1.45</version.mysql>
        <version.commons-dbcp2>2.1.1</version.commons-dbcp2>
        <version.commons-lang3>3.4</version.commons-lang3>
        <version.commons.collections>3.2.1</version.commons.collections>
        <version.hibernate>5.0.12.Final</version.hibernate>
        <version.hibernate-validator>6.0.10.Final</version.hibernate-validator>
        <version.hibernate-jpa-api>1.0.0.Final</version.hibernate-jpa-api>
        <version.elasticsearch>2.4.0</version.elasticsearch>
        <version.elasticsearch-sql>2.4.1.0</version.elasticsearch-sql>
        <version.jest>2.4.0</version.jest>
        <verion.fastjson>1.2.17</verion.fastjson>
        <version.druid>1.0.15</version.druid>
        <version.jna>3.0.9</version.jna>
        <version.hbase-client>2.2.4</version.hbase-client>
        <version.spring-data-hadoop>2.2.0.RELEASE</version.spring-data-hadoop>
        <version.spring-data-solr>2.1.3.RELEASE</version.spring-data-solr>
        <version.bcprov-jdk15on>1.59</version.bcprov-jdk15on>
        <version.json>20160212</version.json>
        <version.json-lib>2.4</version.json-lib>
        <version.pinyin4j>2.5.0</version.pinyin4j>
        <version.cat>2.0.0</version.cat>
        <version.feign-okhttp>9.3.1</version.feign-okhttp>
    </properties>
    <dependencyManagement>
        <dependencies>
            <!-- Spring Cloud -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${version.spring-cloud}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- Swagger-ui library -->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${version.swagger}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${version.swagger-ui}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-staticdocs</artifactId>
                <version>${version.springfox-staticdocs}</version>
            </dependency>
            <dependency>
                <groupId>io.github.swagger2markup</groupId>
                <artifactId>swagger2markup</artifactId>
                <version>${version.swagger2markup}</version>
            </dependency>
            <!-- Alibaba library -->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>${verion.fastjson}</version>
            </dependency>
            <!-- jna library -->
            <dependency>
                <groupId>com.sun.jna</groupId>
                <artifactId>jna</artifactId>
                <version>${version.jna}</version>
            </dependency>
            <!-- Apache library -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-dbcp2</artifactId>
                <version>${version.commons-dbcp2}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${version.commons-lang3}</version>
            </dependency>
            <dependency>
                <groupId>commons-collections</groupId>
                <artifactId>commons-collections</artifactId>
                <version>${version.commons.collections}</version>
            </dependency>
            <!-- Jackson library -->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${version.jackson}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${version.jackson}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${version.jackson}</version>
            </dependency>
            <!-- Json library -->
            <dependency>
                <groupId>org.json</groupId>
                <artifactId>json</artifactId>
                <version>${version.json}</version>
            </dependency>
            <!-- Net json library -->
            <dependency>
                <groupId>net.sf.json-lib</groupId>
                <artifactId>json-lib</artifactId>
                <version>${version.json-lib}</version>
            </dependency>
            <!-- Hbase library -->
            <dependency>
                <groupId>org.apache.hbase</groupId>
                <artifactId>hbase-client</artifactId>
                <version>${version.hbase-client}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.hadoop</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.hbase</groupId>
                <artifactId>hbase-common</artifactId>
                <version>${version.hbase-client}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.hbase</groupId>
                <artifactId>hbase-protocol</artifactId>
                <version>${version.hbase-client}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-hadoop-hbase</artifactId>
                <version>${version.spring-data-hadoop}</version>
            </dependency>
            <!-- security library -->
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15on</artifactId>
                <version>${version.bcprov-jdk15on}</version>
            </dependency>
            <!-- 拼音 -->
            <dependency>
                <groupId>com.belerweb</groupId>
                <artifactId>pinyin4j</artifactId>
                <version>${version.pinyin4j}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <configuration>
                    <attach>true</attach>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

+ 2 - 0
wlyy-starter/readme.MD

@ -0,0 +1,2 @@
i健康2.0工程基础maven
    1.一般子maven需要的jar包在父类maven工程定义好,子maven工程不需要添加版本号,版本由父maven决定