Browse Source

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

Shi Kejing 3 years ago
parent
commit
4a0f59cd02
20 changed files with 297 additions and 63 deletions
  1. 18 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  2. 13 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/RecruitStudentsDO.java
  3. 1 1
      svr/svr-base/src/main/resources/application.yml
  4. 4 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/AqgConfig.java
  5. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/assistance/EmergencyAssistanceDao.java
  6. 11 9
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java
  7. 13 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/PatientCourseEndpoint.java
  8. 16 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/DoctorDoorCoachOrderController.java
  9. 2 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/PatientDoorCoachOrderController.java
  10. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java
  11. 7 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java
  12. 2 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/wechat/WechatCoreController.java
  13. 50 9
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java
  14. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java
  15. 25 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  16. 3 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientHealthIndexService.java
  17. 4 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java
  18. 89 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java
  19. 33 11
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java
  20. 2 2
      svr/svr-cloud-care/src/main/resources/application.yml

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

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

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

@ -609,7 +609,7 @@ spring:
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://172.19.103.87:61616
    broker-url: tcp://172.26.0.12:61616
    user: admin
    password: admin
  redis:

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

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

@ -17,5 +17,5 @@ public interface EmergencyAssistanceDao extends PagingAndSortingRepository<Emerg
    List<EmergencyAssistanceDO> findByPatientAndStatus(String patient,Integer status);
    EmergencyAssistanceDO findByProxyPatientAndStatus(String proxyPatient,Integer status);
    List<EmergencyAssistanceDO> findByProxyPatientAndStatus(String proxyPatient,Integer status);
}

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

@ -131,22 +131,24 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "getOrderList")
    @ApiOperation(value = "查看居民救助历史记录(所有状态)")
    public ListEnvelop getOrderList(@ApiParam(name="patientId",value = "居民id")
                               @RequestParam(value = "patientId",required = false) String patientId,
                                    @RequestParam(value = "patientId",required = false) String patientId,
                                    @ApiParam(name="patientName",value = "患者姓名/身份证")
                                    @RequestParam(value = "patientName",required = false) String patientName,
                                    @ApiParam(name="doctor",value = "查看医生")
                               @RequestParam(value = "doctor",required = false) String doctor,
                                    @RequestParam(value = "doctor",required = false) String doctor,
                                    @ApiParam(name="status",value = "状态")
                               @RequestParam(value = "status",required = true) String status,
                                    @RequestParam(value = "status",required = true) String status,
                                    @ApiParam(name="page",value = "page")
                               @RequestParam(value = "page",required = true) Integer page,
                                    @RequestParam(value = "page",required = true) Integer page,
                                    @ApiParam(name="pageSize",value = "pageSize")
                               @RequestParam(value = "pageSize",required = true) Integer pageSize
                                    @RequestParam(value = "pageSize",required = true) Integer pageSize
    ){
        try {
            page = page>0?page-1:0;
            if (StringUtils.isBlank(patientId)&&StringUtils.isBlank(doctor)){
                return ListEnvelop.getError("请求参数错误");
            }
            return ListEnvelop.getSuccess( "查询成功",assistanceService.getOrderList(patientId,doctor,status,page,pageSize,"desc"));
            return ListEnvelop.getSuccess( "查询成功",assistanceService.getOrderList(patientId,patientName,doctor,status,page,pageSize,"desc"));
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("查询失败"+e.getMessage());
@ -198,9 +200,9 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "医生编辑救助服务小结")
    @ObserverRequired
    public ObjEnvelop updateConclusion(@ApiParam(value = "字典emergency_reason值",name = "emergency_reason",required = true)
                                       @RequestParam Integer emergency_reason,
                                       @RequestParam(value = "emergency_reason") Integer emergency_reason,
                                       @ApiParam(value = "字典emergency_treatment_status值",name = "treatment_status",required = true)
                                       @RequestParam Integer treatment_status,
                                       @RequestParam(value = "treatment_status") Integer treatment_status,
                                       @ApiParam(value = "工单id", name = "orderId")
                                       @RequestParam(value = "orderId") String orderId,
                                       @ApiParam(value = "服务小结", name = "conclusion")
@ -331,7 +333,7 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    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 = "doctor", defaultValue = "4") Integer emergencyCancel){
                                   @RequestParam(value = "emergencyCancel", defaultValue = "4") Integer emergencyCancel){
        try {
            JSONObject result = assistanceService.errorWarning(orderId,emergencyCancel,getUID());
            if (result.getIntValue("resultFlag") == 0) {

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

@ -236,6 +236,19 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping("isEnrollment")
    @ApiOperation(value = "是否已经报名")
    public Envelop isEnrollment(@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 {
            return success("查询成功",courseService.isEnrollment(patient,recruitStudentsId));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @PostMapping("enrollment")
    @ApiOperation(value = "招生报名")
    public Envelop enrollment(@ApiParam(name = "patient", value = "居民id", defaultValue = "3ae2673512154d5280d1dcf5ffa5626d")

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

@ -623,4 +623,20 @@ public class DoctorDoorCoachOrderController extends BaseController {
            return ObjEnvelop.getError("查询失败");
        }
    }
    @PostMapping(value = "updateOrderCardInfo")
    @ApiOperation(value = "更新预约简要信息")
    public String updateOrderCardInfo(
            @ApiParam(name = "jsonData", value = "json数据") @RequestParam(value = "jsonData", required = true) String jsonData) {
        try{
            JSONObject result = patientDoorCoachOrderService.updateOrderCardInfo(jsonData);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return error(-1,result.getString(ResponseContant.resultMsg));
            }
            return write(200,"保存成功","data",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            e.printStackTrace();
        }
        return error(-1,"保存失败");
    }
}

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

@ -57,8 +57,7 @@ public class PatientDoorCoachOrderController extends EnvelopRestEndpoint {
        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));

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

@ -79,8 +79,8 @@ public class PatientMessageEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = "/updateMessageRead")
    @ApiOperation("已读消息")
    public Envelop updateMessageRead(@ApiParam(name = "messageId",required = true)
                                         @RequestParam(value = "patient")String messageId){
                                         @RequestParam(value = "messageId")String messageId){
        patientMessageService.updateMessageRead(messageId);
        return Envelop.getSuccess("查询成功");
        return Envelop.getSuccess("修改成功");
    }
}

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

@ -8,6 +8,7 @@ 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("查询失败");
        }
    }
@ -111,7 +112,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    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 = "doctor", defaultValue = "4") Integer emergencyCancel){
                                   @RequestParam(value = "emergencyCancel", defaultValue = "4") Integer emergencyCancel){
        try {
            JSONObject result = securityMonitoringOrderService.errorWarning(orderId,emergencyCancel,getUID());
            if (result.getIntValue("resultFlag") == 0) {
@ -198,9 +199,9 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    @ApiOperation("编辑保存服务工单小结")
    public ObjEnvelop updateDoorConclusion(
            @ApiParam(value = "字典emergency_reason值",name = "emergency_reason",required = true)
            @RequestParam Integer emergency_reason,
            @RequestParam(value = "emergency_reason") Integer emergency_reason,
            @ApiParam(value = "字典emergency_treatment_status值",name = "treatment_status",required = true)
            @RequestParam Integer treatment_status,
            @RequestParam(value = "treatment_status") Integer treatment_status,
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId") String orderId,
            @ApiParam(value = "服务小结", name = "conclusion")

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

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

@ -194,7 +194,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        JSONObject IMObj = consultTeamService.addServiceConsult(assistanceDO.getId(),patient,proxyPatient,null);
        String sessionId=patient+"_"+ IMObj.getJSONObject("resultMsg").getString("consult") + "_20";
        assistanceDO.setSessionId(sessionId);
        //向会话中发送一条 陈XX发起紧急救助
        //向会话中发送一条消息
        ConsultTeamDo consultTeam = consultTeamDao.queryByRelationCode(assistanceDO.getId());
        if (consultTeam!=null){
            if (StringUtils.isNotBlank(assistanceDO.getSendMessage())){
@ -307,6 +307,30 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        //通知对象
        List<Map<String,Object>> noticePersons = new ArrayList<>();
        JSONArray familyArr =  familyMemberService.getPatientMembers(assistanceDO.getPatient(),null,null,null);
        String emeCallPhone = "";
        if (assistanceDO.getOrderSource()!=1){//设备发起工单
            String category = assistanceDO.getOrderSource()==2?"4":"7";
            List<DevicePatientDevice> devices = patientDeviceDao.findByUserAndCategoryCode(assistanceDO.getPatient(),category);
            if (devices.size()>0){
                try {
                    com.alibaba.fastjson.JSONObject jsonTmp = patientDeviceService.getAqgDeviceInfo(devices.get(0).getDeviceSn());
                    if (jsonTmp.containsKey("sos_numbers")){//取第一个号码
                        JSONArray array = jsonTmp.getJSONArray("sos_numbers");
                        for (int i=0;i<array.size();i++){
                            JSONObject obj = array.getJSONObject(i);
                            if (obj.getBooleanValue("dial_flag")){
                                emeCallPhone = obj.getString("num");
                                break;
                            }
                        }
                    }
                    System.out.println("1");
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
        for (int i=0;i<familyArr.size();i++){
            String patientId = familyArr.getJSONObject(i).getString("id");
            BasePatientDO patientDO1 = patientDao.findById(patientId);
@ -321,13 +345,20 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            Map<String,Object> tmp = new HashMap<>();
            tmp.put("name","系统预警");
            tmp.put("status",0);
            tmp.put(statusName,"未读");
            tmp.put("statusName","未读");
            if (assistanceDO.getOrderSource()!=1){//设备发起工单
                Map<String,Object> tmp2 = new HashMap<>();
                tmp2.put("name","电话通知");
                tmp2.put("status",emeCallPhone.equals(patientDO1.getMobile())?1:0);
                tmp2.put("statusName",emeCallPhone.equals(patientDO1.getMobile())?"已呼叫":"未呼叫");
                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,"已读");
                        tmp.put("statusName","已读");
                    }
                }
            }
@ -402,7 +433,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
//            }
//            otherDoctorDistance.sort(Comparator.comparing(obj -> ((JSONObject) obj).getInteger("distance")));
//        }
        emergencyOrderVO.setOtherDoctorDistance(otherDoctorDistanceObj.toJSONString());
        emergencyOrderVO.setOtherDoctorDistance(otherDoctorDistance.toJSONString());
        emergencyOrderVO.setNoticePersons(noticePersons);
        JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONStringWithDateFormat(emergencyOrderVO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
@ -493,6 +524,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);//申请中
@ -525,15 +557,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(),null);
            JSONObject detail  = getOrderDetail(assistanceDO.get(0).getId(),null);
            tmpObj.put("exist","true");
            tmpObj.put("assistanceDO",detail.getJSONObject("resultMsg"));
            result.put(ResponseContant.resultFlag, ResponseContant.success);
@ -548,8 +580,8 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
     * @param doctor
     * @return
     */
    public List<EmergencyAssistanceDO> getOrderList(String patient,String doctor,String status,Integer page,Integer pageSize,String sort){
        StringBuilder sql = new StringBuilder(" select ord.* from base_emergency_assistance_order ord where 1=1 ");
    public List<EmergencyAssistanceDO> getOrderList(String patient,String patientName,String doctor,String status,Integer page,Integer pageSize,String sort){
        StringBuilder sql = new StringBuilder(" select ord.* from base_emergency_assistance_order ord inner join base_patient pa on pa.id = ord.patient and pa.del=1  where 1=1 ");
        if (StringUtils.isNotBlank(doctor)){
            sql.append(" AND EXISTS (" +
                    "SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
@ -560,6 +592,9 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        if (StringUtils.isNotBlank(patient)){
            sql.append(" and ( ord.patient  = '"+patient+"' or ord.proxy_patient='"+patient+"' )");
        }
        if (StringUtils.isNotBlank(patientName)){
            sql.append(" and (pa.name like '%"+patientName+"%' or pa.idcard like '%"+patientName+"%') ");
        }
        sql.append(" and ord.status in ( '").append(status.replace(",","','")).append("') ");
        sql.append(" order by ord.create_time "+sort+" limit "+page*pageSize+","+pageSize);
@ -796,6 +831,12 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        assistanceDO.setUpdateUserName(doctorDO.getName());
        assistanceDO.setUpdateUser(doctorDO.getId());
        assistanceDO.setEmergencyCancel(emergencyCancel);
        if (!consultTeamService.finishConsult(assistanceDO.getId(),assistanceDO.getPatient(),doctor,2)){
            String failMsg = "修改失败:咨询未能结束";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        emergencyAssistanceDao.save(assistanceDO);
        result = getOrderDetail(orderId,null);

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

@ -746,7 +746,7 @@ public class CourseService {
        recordDO.setPatientName(patientDO.getName());
        recordDO.setPrice(recruitStudentsDO.getFee());
        recordDO.setSex(IdCardUtil.getSex(patientDO.getSex(),patientDO.getIdcard()));
        recordDO.setRecruitName(recruitStudentsDO.getTheme());
        recordDO.setRecruitName(recruitStudentsDO.getName());
        recordDO.setRecruitStudentsId(recruitStudentsId);
        recruitStudentsRecordDao.save(recordDO);

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

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

@ -757,7 +757,9 @@ public class PatientHealthIndexService extends BaseJpaService<DevicePatientHealt
                }
                case "6": {
                    obj.setType(6);
                    obj.setValue1(map.get("temperature"));  //腰围
                    obj.setValue1(map.get("temperature"));  //体温
                    Double tem = Double.parseDouble(map.get("temperature"));
                    obj.setValue2(tem<37.2?"0":"1");
                    break;
                }
                default: {

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

@ -446,8 +446,10 @@ public class DoctorDoorCoachOrderService {
            first = first.replace("key1",(patient.getName()==null?"":patient.getName()));
            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()),"上门预约已接单");
            if (basePatientWechatDos.size()>0){
                String openId = basePatientWechatDos.get(0).getOpenid();
                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());

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

@ -792,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(),orderDO.getPatient(),dispatcher,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.getPatient(),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);
@ -844,7 +854,6 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        }
        // 工单状态变更记录
        BaseDoorCoachProcessLogDO processLogDO = new BaseDoorCoachProcessLogDO();
        processLogDO.setOrderId(orderId);
@ -1337,6 +1346,80 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        return object;
    }
    @Transactional(rollbackFor = Exception.class)
    public JSONObject updateOrderCardInfo(String jsonData){
        JSONObject result = new JSONObject();
        JSONObject jsonObjectParam;
        try {
            jsonObjectParam = JSONObject.parseObject(jsonData);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "参数转换成JSON对象异常:" + e.getMessage();
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        }
        BaseDoorCoachOrderDO wlyyDoorServiceOrder = baseDoorCoachOrderDao.findOne(jsonObjectParam.getString("orderId"));
        wlyyDoorServiceOrder.setPatientName(jsonObjectParam.getString("patientName"));
        // 居民电话
        if(!StringUtils.isEmpty(jsonObjectParam.getString("phone"))){
            wlyyDoorServiceOrder.setPatientPhone(jsonObjectParam.getString("phone"));
        }
        // 医生预计达到时间
        if(!StringUtils.isEmpty(jsonObjectParam.getString("doctorArrivingTime"))){
            wlyyDoorServiceOrder.setDoctorArrivingTime(jsonObjectParam.get("doctorArrivingTime").toString());
        }
        // 居民期望服务时间
        if(!StringUtils.isEmpty(jsonObjectParam.getString("patientExpectedServeTime"))){
        wlyyDoorServiceOrder.setPatientExpectedServeTime(jsonObjectParam.get("patientExpectedServeTime").toString());
        }
        // 服务区
        if(!StringUtils.isEmpty(jsonObjectParam.getString("serveTown"))){
            wlyyDoorServiceOrder.setServeTown(jsonObjectParam.getString("serveTown"));
        }
        // 服务地址
        if(!StringUtils.isEmpty(jsonObjectParam.getString("serveAddress"))){
            wlyyDoorServiceOrder.setServeAddress(jsonObjectParam.getString("serveAddress"));
        }
        wlyyDoorServiceOrder.setServeAddress(jsonObjectParam.getString("serveAddress"));
        if(!StringUtils.isEmpty(jsonObjectParam.getString("serveLat"))){
            wlyyDoorServiceOrder.setServeLat(jsonObjectParam.getString("serveLat"));
        }
        if(!StringUtils.isEmpty(jsonObjectParam.getString("serveLon"))){
            wlyyDoorServiceOrder.setServeLon(jsonObjectParam.getString("serveLon"));
        }
        // 服务描述
        if(!StringUtils.isEmpty(jsonObjectParam.getString("serveDesc"))){
            wlyyDoorServiceOrder.setServeDesc(jsonObjectParam.getString("serveDesc"));
        }
        //服务类型    医生端和居民端公用接口
        if(!StringUtils.isEmpty(jsonObjectParam.getString("serviceStatus"))){
            wlyyDoorServiceOrder.setServiceStatus(jsonObjectParam.getString("serviceStatus"));
        }else {
            wlyyDoorServiceOrder.setServiceStatus("1");//默认为1  预约项目
        }
//        wlyyDoorServiceOrder.setIsPatientConfirm(WlyyDoorServiceOrderDO.IsPatientConfirm.yes.getType());
//        wlyyDoorServiceOrder.setPatientConfirmTime(new Date());
        this.save(wlyyDoorServiceOrder);
        //新增工单居民确认操作日志记录
        if (orderWithConfirmLogAdd(result, jsonObjectParam, wlyyDoorServiceOrder.getId())) {return result;}
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, wlyyDoorServiceOrder);
        //发送 预约卡片信息(2101类型)
        JSONObject orderInfoContent = this.queryOrderCardInfo(wlyyDoorServiceOrder);
        orderInfoContent.put("re_msg_type",1);//医生修改待确认
        this.qucikSendIM(wlyyDoorServiceOrder.getId(), wlyyDoorServiceOrder.getDispatcher(), "智能助手", "2201", orderInfoContent.toJSONString());
        return result;
    }
    /**
     * 添加【工单派单,转单】等系统消息

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

@ -16,11 +16,14 @@ 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.base.im.ConsultTeamDo;
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.dao.ConsultTeamDao;
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;
@ -97,6 +100,8 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    private EmergencyWarnDoctorResponseDao emergencyWarnDoctorResponseDao;
    @Autowired
    private PatientFamilyMemberService familyMemberService;
    @Autowired
    private ConsultTeamDao consultTeamDao;
    private Logger logger = LoggerFactory.getLogger(SecurityMonitoringOrderService.class);
@ -192,6 +197,13 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        //创建im会话  安防警报咨询的sessionid  为居民code+(wlyy_consult_team表consult)+20
        JSONObject IMObj = consultTeamService.addSecurityMoConsult(orderDO.getId(),orderDO.getPatient(),null,null);
        String sessionId=orderDO.getPatient()+"_"+ IMObj.getJSONObject("resultMsg").getString("consult") + "_22";
        orderDO.setSessionId(sessionId);
        if (StringUtils.isNotBlank(orderDO.getServeDesc())){
            ConsultTeamDo consultTeam = consultTeamDao.queryByRelationCode(orderDO.getId());
            if (consultTeam!=null){
                imUtil.sendTopicIM(orderDO.getPatient(),patientDO.getName(),consultTeam.getConsult(),"1",orderDO.getServeDesc(),null);
            }
        }
        //推送socket给医生  推送紧急预警
        for (BaseDoctorDO doctorDO:doctorDOS){
            JSONObject message = new JSONObject();
@ -296,13 +308,13 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            Map<String,Object> tmp = new HashMap<>();
            tmp.put("name","系统预警");
            tmp.put("status",0);
            tmp.put(statusName,"未读");
            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,"已读");
                        tmp.put("statusName","已读");
                    }
                }
            }
@ -403,36 +415,46 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        orderDO.setUpdateUserName(doctorDO.getName());
        orderDO.setUpdateUser(doctorDO.getId());
        orderDO.setEmergencyCancel(emergencyCancel);
        if (!consultTeamService.finishConsult(orderDO.getId(),orderDO.getPatient(),doctor,2)){
            String failMsg = "修改失败:咨询未能结束";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        securityMonitoringOrderDao.save(orderDO);
        result = getSecurityOrderDetail(orderId,null);
        return result;
    }
    public JSONArray getSecurityOrderList(String doctor,String serverDoctor,String patientName, String patient, String status, Integer page, Integer pageSize){
    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){
@ -480,7 +502,7 @@ 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<>();

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

@ -439,8 +439,8 @@ hospital:
wechat:
  appId: wx2c55f5b7b2f3cb56
  appSecret: 0dd9927e58125ad5f0efb9299860d145
  wechat_token: 1
  wechat_base_url: http%3a%2f%2fweixin.xmtyw.cn%2fwlyy-dev
  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