Browse Source

老人端

吴世龙 3 years ago
parent
commit
d910b871ab

+ 9 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/family/FamilyMemberEndpoint.java

@ -17,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@ -95,9 +96,9 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
    public Envelop addOlderByRelatives(
            @ApiParam(name = "relatives",value = "家属code")
            @RequestParam("relatives") String relatives,
            @ApiParam(name = "name",value = "老人姓名")
            @ApiParam(name = "name",value = "老人/幼儿 姓名")
            @RequestParam("name") String name,
            @ApiParam(name = "idcard",value = "老人身份证")
            @ApiParam(name = "idcard",value = "老人/幼儿 身份证")
            @RequestParam("idcard") String idcard,
            @RequestParam(value = "relation",defaultValue = "0") Integer relation,
@ -107,14 +108,17 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "relativesIdcard",value = "家属本人身份证")
            @RequestParam(value = "relativesIdcard",required = false) String relativesIdcard,
            @ApiParam(name = "relativesSex",value = "家属本人性别")
            @RequestParam(value = "relativesSex",required = false) String relativesSex
            /**********************/) {
            @RequestParam(value = "relativesSex",required = false) String relativesSex,
            /**********************/
            @ApiParam(name = "type",value = "类型  1老人   2幼儿")
            @RequestParam(value = "type",required = true) Integer type
            ) {
        try {
            if (StringUtils.isEmpty(relatives)) {
                return failed("当前用户信息错误",-1);
            }
            JSONObject result = familyMemberService.addOlderByRelatives(relatives,name,idcard,relation,relativesName,relativesIdcard,relativesSex);
            JSONObject result = familyMemberService.addOlderByRelatives(relatives,name,idcard,relation,relativesName,relativesIdcard,relativesSex,type);
            if (result.getInteger(ResponseContant.resultFlag)==ResponseContant.success){
                return success("添加成功");
            }else {

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

@ -349,13 +349,27 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
        }
    }
    @ApiOperation("获取行动轨迹")
    @RequestMapping(value = "getX1Locations",method = {RequestMethod.POST,RequestMethod.GET})
    @ResponseBody
    public ObjEnvelop getX1Locations(@ApiParam(name = "patient",value = "patient")
                                     @RequestParam(value = "patient")String patient,
                                     @ApiParam(name = "date",value = "date")
                                     @RequestParam(value = "date")String date){
        try {
            return ObjEnvelop.getSuccess("查询成功",securityMonitoringOrderService.getX1Locations(patient,date));
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @ApiOperation("助老员端获取日常监护居民")
    @GetMapping(value = "findMonitorPatientsByDoctor")
    @ResponseBody
    public ObjEnvelop findMonitorPatientsByDoctor(@ApiParam(name = "doctor",  required = true)@RequestParam(value = "doctor")String doctor,
                                                  @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典,actionTrack行动轨迹", required = true)
                                                  @RequestParam(value = "topicItem",required = true,defaultValue = "preventLost") String topicItem,
                                                  @ApiParam(name = "day", value = "day", required = false)
                                                      @ApiParam(name = "day", value = "day", required = false)
                                                  @RequestParam(value = "day",required = false) String day,
                                                  @ApiParam(name = "page")
                                                  @RequestParam(value = "page",required = false) Integer page,

+ 30 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/family/PatientFamilyMemberService.java

@ -221,7 +221,7 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
        return 1;
    }
    public JSONObject addOlderByRelatives(String relatives,String name,String idcard,Integer relation,String relativesName,String relativesIdcard,String relativesSex) throws Exception {
    public JSONObject addOlderByRelatives(String relatives,String name,String idcard,Integer relation,String relativesName,String relativesIdcard,String relativesSex,Integer type) throws Exception {
        JSONObject result = new JSONObject();
        BasePatientDO patientDO = patientDao.findById(relatives);
@ -255,11 +255,36 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
            return result;
        }
        List<BasePatientDO> addPatients = patientDao.findByNameAndIdcard(name,idcard);
        if (addPatients.size()==0){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"添加成员不存在");
            return result;
        if (2  == type){
            if (addPatients.size()==0){
                BasePatientDO basePatientDO = new BasePatientDO();
                String salt = UUID.randomUUID().toString().substring(0, 5);
                String pw = "";
                if(true){
                    pw = idcard.substring(idcard.length()-7,idcard.length()-1);
                }else{
                    pw = idcard.substring(idcard.length()-6);
                }
                basePatientDO.setIdcard(idcard);
                basePatientDO.setName(name);
                basePatientDO.setPassword(com.yihu.utils.security.MD5.md5Hex(pw + "{" + salt + "}"));
                basePatientDO.setSalt(salt);
                basePatientDO.setArchiveType(2);
                basePatientDO.setArchiveStatus(3);
                basePatientDO.setCreateUserName(relatives);
                basePatientDO.setCreateTime(new Date());
                basePatientDO.setDel("1");
                patientDao.save(basePatientDO);
            }
        }else {
            if (addPatients.size()==0){
                result.put(ResponseContant.resultFlag,ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"添加成员不存在");
                return result;
            }
        }
        BasePatientDO addPatient = addPatients.get(0);
        // 添加自己与对方的关系

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

@ -1575,6 +1575,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    /**
     * 老人家属首页实时监护信息
     * 居家状态取手表 无手表缺省
     * 最近 血糖  血压记录
     * 监控
     */
    public JSONObject patientMonitoringInfo2(String patient) {
@ -1647,9 +1648,38 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        }
        patientSignTopicInfo(result, patient, "preventFall", null, true);
        String healthXYSql ="SELECT value1,value2,value3,value4 FROM wlyy_patient_health_index WHERE `user` = '"+patient+"' AND type = 2  ORDER BY record_date DESC LIMIT 1";
        List<Map<String, Object>> XY = jdbcTemplate.queryForList(healthXYSql);
        String healthXTSql ="SELECT value1,value2,value3,value4 FROM wlyy_patient_health_index WHERE `user` = '"+patient+"' AND type = 1  ORDER BY record_date DESC LIMIT 1";
        List<Map<String, Object>> XT = jdbcTemplate.queryForList(healthXTSql);
        if (XY.size()!= 0) {
            for (Map<String, Object> map : XY) {
                result.put("xy",map);
            }
        }else {
            result.put("xy",null);
        }
        if (XT.size()!= 0) {
            for (Map<String, Object> map : XT) {
                result.put("xt",map);
            }
        }else {
            result.put("xt",null);
        }
        return result;
    }
    //行动轨迹
    public org.json.JSONArray getX1Locations(String patient,String date){
        List<DevicePatientDevice> byUserAndCategoryCode = patientDeviceDao.findByUserAndCategoryCode(patient, "4");//手表
        org.json.JSONArray x1Locations = patientDeviceService.getX1Locations(byUserAndCategoryCode.get(0).getDeviceSn(), date);
        return x1Locations;
    }
    public void preventLost(JSONObject result, String patient, String deviceSn) {
        //手表与拐杖同时绑定时优先手表,围栏状态其中一个超出围栏即为超出围栏
        try {

+ 5 - 6
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/data/SaveDataPushJob.java

@ -46,6 +46,9 @@ public class SaveDataPushJob implements Job {
    public void execute(JobExecutionContext context) throws JobExecutionException {
        // id  日期  字段(保存的) 表名(从哪里取到的)
        String date = DateUtil.dateToStrShort(new Date());
        //System.out.println(date);
        date = DateUtil.getNextDay(date, -1);
        //System.out.println(date);
        saveSecurityMonitoringOrder(date);
        saveEmergencyAssistanceOrder(date);
        saveDoorCoachOrder(date);
@ -61,14 +64,14 @@ public class SaveDataPushJob implements Job {
    //安防监护工单
    public void saveSecurityMonitoringOrder(String date){
        String securityMonitoringOrderSql="SELECT id,number,patient,serve_desc,serve_town,serve_address,doctor_name,`status`,hospital,service_status from base_security_monitoring_order WHERE create_time > '"+date+"'";
        String securityMonitoringOrderSql="SELECT id,number,patient,serve_desc,serve_town,serve_address,doctor_name,`status`,hospital,service_status from base_security_monitoring_order WHERE create_time >= '"+date+"'";
        List<ZhSecurityMonitoringOrderDO> query = jdbcTemplate.query(securityMonitoringOrderSql, new BeanPropertyRowMapper<>(ZhSecurityMonitoringOrderDO.class));
        zhSecurityMonitoringOrderDao.save(query);
    }
    //紧急救助工单
    public void saveEmergencyAssistanceOrder(String date){
        String emergencyAssistanceOrderSql ="SELECT id,patient_name,patient_phone,patient_idcard,org_name,serve_address,doctor_name,doctor_address,complete_time,team_code,proxy_patient_name,proxy_patient_phone,type,order_source FROM base_emergency_assistance_order WHERE create_time > '"+date+"'";
        String emergencyAssistanceOrderSql ="SELECT id,patient_name,patient_phone,patient_idcard,org_name,serve_address,doctor_name,doctor_address,complete_time,team_code,proxy_patient_name,proxy_patient_phone,type,order_source FROM base_emergency_assistance_order WHERE create_time >= '"+date+"'";
        List<ZhEmergencyAssistanceDO> query = jdbcTemplate.query(emergencyAssistanceOrderSql, new BeanPropertyRowMapper<>(ZhEmergencyAssistanceDO.class));
        zhEmergencyAssistanceDao.save(query);
    }
@ -129,8 +132,4 @@ public class SaveDataPushJob implements Job {
        List<ZhDeviceDetail> query = jdbcTemplate.query(deviceSql, new BeanPropertyRowMapper<>(ZhDeviceDetail.class));
        zhDeviceDetailDao.save(query);
    }
}

+ 1 - 1
svr/svr-cloud-job/src/main/resources/system.properties

@ -30,4 +30,4 @@ EME_WARNING_OVERTIME_NOT_RESPONSE=0 0 * * * ?
EME_WARNING_OVERTIME_NOT_RESPONSE_DAY=0 30 9 * * ?
#\u5B9A\u65F6\u63A8\u9001\u4FDD\u5B58\u6570\u636E
SAVE_DATA_PUSH_JOB= 0 0 23 * * ?
SAVE_DATA_PUSH_JOB= 0 0 2 * * ? *