Explorar o código

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

liubing %!s(int64=2) %!d(string=hai) anos
pai
achega
501fdbc354

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

@ -289,11 +289,12 @@
    </dependencies>
    <build>
        <finalName>svr-cloud-care-test</finalName>
        <finalName>svr-cloud-care</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <!-- 生成的jar中,不要包含pom.xml和pom.properties这两个文件 -->
@ -312,6 +313,7 @@
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>copy-lib</id>
@ -333,6 +335,7 @@
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <!-- 指定配置文件目录,这样jar运行时会去找到同目录下的resources文件夹下查找 -->
@ -349,6 +352,7 @@
            </plugin>
            <!-- 拷贝资源文件 外面的resource目录-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
@ -368,6 +372,7 @@
                        </configuration>
                    </execution>
                </executions>
                <version>3.2.0</version>
            </plugin>
        </plugins>
    </build>

+ 28 - 1
svr/svr-cloud-care/readme.MD

@ -3,4 +3,31 @@
    每个模块下面有独立的Endpoint,service,model和dao
@ObserverRequired
医生端观察者模式。医生端请求的post的接口必须加这个注解
医生端观察者模式。医生端请求的post的接口必须加这个注解
为了做接口权限
controller 链接配置规范
不同角色链接前缀要区分,同一个接口不同角色不能复用controller层
通用接口 /common/
居民统一用 /patient/
幼儿接口 /children/
老人接口 /older/
医生统一用 /patient/
助老员 /helper/
社工 /social/
医生行政管理端 /manager/
免登录统一 /open/
开放第三方对接的接口 /wlyygc/
第三方单点登录安全方案一,点击我们链接,链接带对方平台的用户随机token,
前端把token传给后端,后端调用第三方接口 通过token获取用户信息,这样才能安全,
避免在连接上面直接带用户参数,
方案二 参数全部加密传输

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

@ -180,6 +180,8 @@ public class DoctorDeviceController extends BaseController {
								@RequestParam(value = "patient")String patient,
								@ApiParam(name = "orderId", required = false,value = "对应工单的id")
								@RequestParam(value = "orderId", required = false) String orderId,
								@ApiParam(name = "videoType", required = false,value = "视频直播类型:ys")
								@RequestParam(value = "videoType", required = false) String videoType,
								@ApiParam(name = "deviceSn",value = "设备SN码")
								@RequestParam(value = "deviceSn")String deviceSn){
		try {
@ -189,7 +191,7 @@ public class DoctorDeviceController extends BaseController {
			if(permissionService.noPermission(2,param)){
				return write(-1,"该操作没有权限");
			}
			org.json.JSONObject result = deviceManageService.getDeviceInfo(patient, deviceSn,doctorId,orderId);
			org.json.JSONObject result = deviceManageService.getDeviceInfo(patient, deviceSn,doctorId,orderId,videoType);
			if (result.getInt(ResponseContant.resultFlag)==ResponseContant.success){
				return write(200,"获取成功","data", JSON.parseObject(result.getString(ResponseContant.resultMsg)));
			}else {

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

@ -440,12 +440,14 @@ public class PatientDeviceController extends BaseController {
                                         @RequestParam(value = "deviceSN")String deviceSn,
                                         @ApiParam(name = "orderId", required = false,value = "对应工单的id")
                                         @RequestParam(value = "orderId", required = false) String orderId,
                                         @ApiParam(name = "videoType", required = false,value = "视频直播类型:ys")
                                         @RequestParam(value = "videoType", required = false) String videoType,
                                         @ApiParam(name="day",value = "yyyy-mm-dd")
                                         @RequestParam(value = "day",required = false)String day){
        try {
            String uid = permissionService.getUID();
            JSONObject result = patientDeviceService.getPatientDeviceDetail(patient,deviceSn,day,uid,orderId);
            JSONObject result = patientDeviceService.getPatientDeviceDetail(patient,deviceSn,day,uid,orderId,videoType);
            if (result.getInt(ResponseContant.resultFlag)==ResponseContant.success){
                return write(200,"获取成功","data", JSON.parseObject(result.getString(ResponseContant.resultMsg)));
            }else {

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

@ -159,10 +159,12 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
                                          @RequestParam(value = "deviceSN") String deviceSn,
                                          @ApiParam(name = "orderId", required = false,value = "对应工单的id")
                                          @RequestParam(value = "orderId", required = false) String orderId,
                                          @ApiParam(name = "videoType", required = false,value = "视频直播类型:ys")
                                          @RequestParam(value = "videoType", required = false) String videoType,
                                          @ApiParam(name = "day", value = "yyyy-mm-dd")
                                          @RequestParam(value = "day", required = false) String day) {
        try {
            org.json.JSONObject result = patientDeviceService.getPatientDeviceDetail(patient, deviceSn, day,permissionService.getUID(),orderId);
            org.json.JSONObject result = patientDeviceService.getPatientDeviceDetail(patient, deviceSn, day,permissionService.getUID(),orderId,videoType);
            if (result.getInt(ResponseContant.resultFlag) == ResponseContant.success) {
                return success(JSON.parseObject(result.getString(ResponseContant.resultMsg)));
            } else {

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/DeviceManageService.java

@ -67,8 +67,8 @@ public class DeviceManageService extends BaseJpaService<BaseDeviceRepairEntity,B
    }
    /*设备详细信息*/
    public org.json.JSONObject getDeviceInfo(String patient, String deviceSn,String doctorId,String orderId) throws Exception {
        return patientDeviceService.getPatientDeviceDetail(patient, deviceSn, null,doctorId,orderId);
    public org.json.JSONObject getDeviceInfo(String patient, String deviceSn,String doctorId,String orderId,String videoType) throws Exception {
        return patientDeviceService.getPatientDeviceDetail(patient, deviceSn, null,doctorId,orderId,videoType);
    }
    /*监护信息*/

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

@ -930,7 +930,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
     * @param deviceSn 设备sn码
     * @return
     */
    public JSONObject getPatientDeviceDetail(String patient,String deviceSn,String day,String doctor,String orderId) throws Exception {
    public JSONObject getPatientDeviceDetail(String patient,String deviceSn,String day,String doctor,String orderId,String videoType) throws Exception {
        JSONObject result = new JSONObject();
        BasePatientDO patientDO = patientDao.findById(patient);
        if (null==patientDO){
@ -943,10 +943,6 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
            result.put(ResponseContant.resultMsg,"未查询到该设备");
        }else {
            DevicePatientDevice device = devices.get(0);
//            if (!patient.equals(device.getUser())){
//                result.put(ResponseContant.resultFlag,ResponseContant.fail);
//                result.put(ResponseContant.resultMsg,"居民未绑定该设备");
//            }else {
            String sql = "select dd.photo,GROUP_CONCAT(DISTINCT p.name) as patientName,pd.device_sn,dd.brands,dd.category_code,dd.model,pd.device_name,date_format(pd.czrq,'%Y-%m-%d %H:%i:%S' ) deviceTime,wd.manufacturer,p.mobile,p.address,p.idcard,wd.device_type  " +
                    "from dm_device dd INNER JOIN wlyy_patient_device pd on dd.category_code = pd.category_code INNER JOIN base_patient p on p.id = pd.user " +
                    " INNER JOIN wlyy_devices wd on dd.model = wd.device_model and pd.device_sn = wd.device_code " +
@ -1077,7 +1073,12 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    content +="SOS紧急呼叫器";
                    break;
                case "12"://监控 视频地址
                    com.alibaba.fastjson.JSONObject tmp = ysDeviceService.getDeviceLiveAddress(patient, deviceSn, 1, null);
                    com.alibaba.fastjson.JSONObject tmp = null;
                    if("ys".equals(videoType)){
                        tmp = ysDeviceService.getDeviceLiveAddress2(deviceSn,1);
                    }else {
                        tmp = ysDeviceService.getDeviceLiveAddress(patient, deviceSn, 1, null);
                    }
                    devInfoObj.put("monitorInfoStatus", tmp.getIntValue(ResponseContant.resultFlag));
                    if (tmp.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                        devInfoObj.put("monitorInfo", tmp.getString(ResponseContant.resultMsg));

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

@ -763,6 +763,8 @@ public class YsDeviceService {
            JSONObject tmp = new JSONObject();
            tmp.put("url",responseBody.getJSONObject("data").getString("url"));
            tmp.put("accessToken",accessToken);
            tmp.put("deviceSerial",deviceSerial);
            tmp.put("channelNo",1);
            result.put(ResponseContant.resultMsg,tmp);
        }else {
            result.put(ResponseContant.resultFlag,ResponseContant.fail);

+ 59 - 20
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/PatientInfoPlatFormService.java

@ -761,34 +761,53 @@ public class PatientInfoPlatFormService {
            switch (categoryCode) {
                case 4:
                    deviceOnLineMap.put("deviceName",device_name);
                    if (detailInfo.get("wear_flagName").toString().equals("未佩戴"))deviceStatus +=1;
                    if (detailInfo.get("wear_flagName").toString().equals("未佩戴")){
                        deviceStatus +=1;
                        deviceOnLineMap.put("deviceStatusCode",2);
                    }else {
                        deviceOnLineMap.put("deviceStatusCode",0);
                    }
                    deviceOnLineMap.put("deviceStatus",detailInfo.get("wear_flagName").toString());
                    //Map heartRate = detailInfo.get("heartRate").equals("暂无数据?")?(Map) detailInfo.get("heartRate"):new HashMap<>();
                   Map<String,Object> heartRate = !detailInfo.get("heartRate").equals("暂无数据?")?(Map) detailInfo.get("heartRate"): (Map)new HashMap(){{put("value1_status","暂无数据?");}};
                   Map<String,Object> heartRate = !detailInfo.get("heartRate").equals("暂无数据?")?(Map) detailInfo.get("heartRate"): (Map)new HashMap(){{put("value1_status","暂无数据?");put("value1",0);}};
                    Map location = detailInfo.get("location")!=null?(Map) detailInfo.get("location"):new HashMap<>();
                    Map steps = (Map) detailInfo.get("steps");
                    Map steps = !detailInfo.get("steps").equals(0)?(Map)detailInfo.get("steps"):new HashMap(){{put("steps",0);}};
                    if (!heartRate.get("value1_status").equals("正常")) oldIndex+=1;
                    oldCheckInfoMap.put("heartStatus",heartRate.get("value1_status"));
                    oldCheckInfoMap.put("heart",heartRate.get("value1"));
                    oldCheckInfoMap.put("leaveHome",detailInfo.get("homeRange"));
                    oldCheckInfoMap.put("address",location.get("address"));
                    oldCheckInfoMap.put("stepsStatus",detailInfo.get("steps_status"));
                    oldCheckInfoMap.put("steps",steps.get("steps"));
                    if (!detailInfo.get("steps_status").equals("暂无数据?")||!steps.get("steps").equals(0)) {
                        oldCheckInfoMap.put("stepsStatus",detailInfo.get("steps_status"));
                        oldCheckInfoMap.put("steps",steps.get("steps"));
                    }
                    break;
                case 12:
                    deviceOnLineMap.put("deviceName",device_name);
                    deviceOnLineMap.put("deviceStatus",online);
                    if (online.equals("离线")) deviceStatus+=1;
                    if (online.equals("离线")){
                        deviceStatus+=1;
                        deviceOnLineMap.put("deviceStatusCode",1);
                    }else {
                        deviceOnLineMap.put("deviceStatusCode",0);
                    }
                    //deviceOnLineMap.put("deviceStatus",detailInfo.get("warnStatus").toString().equals("true")?"正常":"异常");
                    break;
                case 13:
                    if (online.equals("离线")) deviceStatus+=1;
                    if (online.equals("离线")) {
                        deviceStatus+=1;
                        deviceOnLineMap.put("deviceStatusCode",1);
                    }else {
                        deviceOnLineMap.put("deviceStatusCode",0);
                    }
                    deviceOnLineMap.put("deviceName",device_name);
                    deviceOnLineMap.put("deviceStatus",online);
                    if (!detailInfo.get("breath_status").equals("正常"))oldIndex+=1;
                    oldCheckInfoMap.put("breathStatus",detailInfo.get("breath_status"));
                    oldCheckInfoMap.put("breath",detailInfo.get("breath"));
                    oldCheckInfoMap.put("bedStatus",detailInfo.get("bedStatus"));
                    break;
                case 14:
@ -797,18 +816,30 @@ public class PatientInfoPlatFormService {
                    if (!detailInfo.get("warnStatus").equals("异常"))oldIndex+=1;
                    oldCheckInfoMap.put("qgValueStatus",detailInfo.get("warnStatus"));
                    oldCheckInfoMap.put("qgValue",detailInfo.get("value"));
                    if (online.equals("离线")) deviceStatus+=1;
                    if (online.equals("离线")){
                        deviceStatus+=1;
                        deviceOnLineMap.put("deviceStatusCode",1);
                    }else {
                        deviceOnLineMap.put("deviceStatusCode",0);
                    }
                    break;
                case 15:
                    deviceOnLineMap.put("deviceName",device_name);
                    deviceOnLineMap.put("deviceStatus",online);
                    if (online.equals("离线")) deviceStatus+=1;
                    if (online.equals("离线")) {
                        deviceStatus+=1;
                        deviceOnLineMap.put("deviceStatusCode",1);
                    }else {
                        deviceOnLineMap.put("deviceStatusCode",0);
                    }
                    if (!detailInfo.get("value1_Status").equals("异常"))oldIndex+=1;
                    oldCheckInfoMap.put("ygValueStatus",detailInfo.get("value1_Status"));
                    oldCheckInfoMap.put("ygValue",detailInfo.get("value"));
                    if (!detailInfo.get("temperature_status").equals("异常"))oldIndex+=1;
                    oldCheckInfoMap.put("temperatureStatus",detailInfo.get("temperature_status"));
                    oldCheckInfoMap.put("temperatureValue",detailInfo.get("temperature_value"));
                    if (!detailInfo.get("temperature_status").equals("暂无数据?")) {
                        oldCheckInfoMap.put("temperatureStatus",detailInfo.get("temperature_status"));
                        oldCheckInfoMap.put("temperatureValue",detailInfo.get("temperature_value"));
                    }
                    break;
            }
@ -826,6 +857,8 @@ public class PatientInfoPlatFormService {
            resultMap.put("synthesisProposal",dict(dictList,"device_index2"));
        }else if (deviceStatus==0&&oldIndex==0){
            resultMap.put("synthesisProposal",dict(dictList,"device_index1"));
        }else {
            resultMap.put("synthesisProposal","待分析!");
        }
        resultMap.put("deviceRunInfo",deviceOnLineList);
        resultMap.put("oldCheck",oldCheckInfoList);
@ -1009,12 +1042,13 @@ public class PatientInfoPlatFormService {
                sqlResult = jdbcTemplate.queryForList(sql+pageSql);
                if (sqlResult.size()>0){
                    Integer xl = Integer.parseInt(sqlResult.get(0).get("value1").toString());
                    if (xl>=50&&xl<=100) {
                    Integer xlValue1 = Integer.parseInt(dict(dictList,"xlValue1"));
                    Integer xlValue2 = Integer.parseInt(dict(dictList,"xlValue1"));
                    if (xl>=xlValue1&&xl<=xlValue2) {
                        dictCode= "zc1";
                    }else if (xl<50){
                    }else if (xl<xlValue1){
                        dictCode="xl2";
                    }else if (xl>100){
                    }else if (xl>xlValue2){
                        dictCode="xl3";
                    }
                    sqlResult.get(0).put("value1_status",dict(dictList,dictCode));
@ -1153,6 +1187,8 @@ public class PatientInfoPlatFormService {
                                detailInfo.put("bedStatus", dict(dictList,"yachuang1"));
                                Integer heartRate = response.getInteger("heartrate");
                                Integer breath = response.getInteger("breathrate");
                                Integer xlValue1 = Integer.parseInt(dict(dictList,"xlValue1"));
                                Integer xlValue2 = Integer.parseInt(dict(dictList,"xlValue1"));
                                dictCode = "";
                                if (heartRate > 100) {
                                    dictCode = "xl3";
@ -1165,11 +1201,14 @@ public class PatientInfoPlatFormService {
                                detailInfo.put("heartRate", heartRate);
                                detailInfo.put("breath", breath);
                                detailInfo.put("heartRate_status",dict(dictList,dictCode));
                                if (breath > 20) {
                                Integer hxValue1 = Integer.parseInt(dict(dictList,"hxValue1"));
                                Integer hxValue2 = Integer.parseInt(dict(dictList,"hxValue2"));
                                if (breath > hxValue2) {
                                    dictCode = "hx1";
                                } else if (breath < 10) {
                                } else if (hxValue1 < 10) {
                                    dictCode = "hx2";
                                } else if (breath >= 10 && breath <= 20) {
                                } else if (breath >= hxValue1 && breath <= hxValue2) {
                                    dictCode = "zc1";
                                }
                                detailInfo.put("breath_status",dict(dictList,dictCode));
@ -1243,7 +1282,7 @@ public class PatientInfoPlatFormService {
                sqlResult = jdbcTemplate.queryForList(sql);
                dictCode ="";
                if (sqlResult.size()>0){
                    if (Integer.parseInt(sqlResult.get(0).get("temperature_value").toString())<50) {
                    if (Integer.parseInt(sqlResult.get(0).get("temperature_value").toString())<Integer.parseInt(dict(dictList,"wdValue1"))) {
                        dictCode = "zc1";
                    }else {
                        dictCode = "yc1";
@ -1302,7 +1341,7 @@ public class PatientInfoPlatFormService {
                        double homeLat = Double.parseDouble(homeLatLon.split(",")[0]);
                        double homeLon = Double.parseDouble(homeLatLon.split(",")[1]);
                        double homeDistance = countDistance.getDistance(homeLat,homeLon,Double.parseDouble(sqlResult.get(0).get("lat").toString()),(Double.parseDouble(sqlResult.get(0).get("lon").toString())));
                        if (homeDistance * 1000 > 50) {
                        if (homeDistance * 1000 > Integer.parseInt(dict(dictList,"ljjjValue1"))) {
                            detailInfo.put("isAtHome","离家");
                        }else {
                            detailInfo.put("isAtHome","居家");