Sfoglia il codice sorgente

Merge branch 'dev' of yeshijie/patient-co-management into dev

yeshijie 7 anni fa
parent
commit
0517821431

+ 95 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java

@ -16,6 +16,7 @@ import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -72,6 +73,8 @@ public class DeviceService {
    private DoctorSwitchDao doctorSwitchDao;
    @Autowired
    private TrackPatientDao trackPatientDao;
    @Value("${systemConfig.server_url}")
    private String wlyyService;
    private ObjectMapper objectMapper = new ObjectMapper();
    private Integer aStart;
@ -1150,4 +1153,96 @@ public class DeviceService {
        }
    }
    /******************************体征上传 start**************************************************/
    private String bloodSugarUnit = "mmol/L";
    private String bloodPressureUnit = "mmHg";
    private String pulseUnit = "bpm";
    private String heightUnit = "cm";
    private String weightUnit = "kg";
    private String bmiUnit = "kg/m^2";
    private String waistUnit = "cm";
    public void upload(PatientDevice patientDevice,PatientHealthIndex obj,String userType){
        com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
        if(patientDevice!=null){
            //未绑定居民
            Patient patient = patientDao.findByCode(patientDevice.getUser());
            json.put("idcard",patient.getIdcard());
            json.put("username",patient.getName());
            json.put("usercode",patient.getCode());
            json.put("device_name",patientDevice.getDeviceName());
            json.put("device_model",patientDevice.getDeviceName());
        }
        json.put("sn",obj.getDeviceSn());
        json.put("ext_code",userType);
        com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
        com.alibaba.fastjson.JSONObject js = new com.alibaba.fastjson.JSONObject();
        js.put("measure_time",obj.getRecordDate());
        switch (obj.getType()){
            case 1:
                //血糖
                js.put("blood_sugar",obj.getValue1());
                js.put("blood_sugar_unit",bloodSugarUnit);
                js.put("blood_sugar_result",obj.getValue2());
                break;
            case 2:
                //血压
                js.put("systolic",obj.getValue1());
                js.put("systolic_unit",bloodPressureUnit);
                js.put("diastolic",obj.getValue2());
                js.put("diastolic_unit",bloodPressureUnit);
                if(StringUtils.isNotBlank(obj.getValue3())){
                    js.put("pulse",obj.getValue3());
                    js.put("pulse_unit",pulseUnit);
                }
                break;
            case 3:
                //体重/身高/BMI
                js.put("height",obj.getValue1());
                js.put("height_unit",heightUnit);
                js.put("weight",obj.getValue2());
                js.put("weight_unit",weightUnit);
                if(StringUtils.isNotBlank(obj.getValue3())){
                    js.put("bmi",obj.getValue3());
                    js.put("bmi_unit",bmiUnit);
                }
                break;
            case 4:
                //腰围
                js.put("waist",obj.getValue1());
                js.put("waist_unit",waistUnit);
                break;
            default:
                break;
        }
        jsonArray.add(js);
        json.put("data",jsonArray);
        try {
            String url = wlyyService + "/iot/upload";
            Map<String, Object> params = new HashedMap();
            params.put("jsonStr", json.toString());
            HttpResponse response = httpHelper.post(url, params);
            if (response != null && response.getStatusCode() == 200) {
                JSONObject jsonObject = JSONObject.fromObject(response.getBody());
                if (!"200".equals(jsonObject.optString("status"))) {
                    throw new Exception(jsonObject.optString("msg"));
                }
            } else {
                throw new Exception("接口调用错误!" + response.getBody());
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    /******************************体征上传 end****************************************************/
}

+ 4 - 1
patient-co-service/wlyy_device/src/main/resources/application.yml

@ -59,6 +59,7 @@ systemConfig:
  msg_push_server: http://127.0.0.1:3000/system/sendmsg.im
  jw_server: http://172.19.103.87:8011/wlyy_service
  socket_server: http://192.168.131.102:3008
  server_url: http://192.168.131.24:8080/
# Specify the DBMS
---
@ -97,6 +98,7 @@ systemConfig:
  msg_push_server: http://127.0.0.1:3000/system/sendmsg.im
  jw_server: http://172.19.103.88:8011/wlyy_service-1.0-SNAPSHOT
  socket_server: http://172.19.103.88:3000
  server_url: http://ehr.yihu.com/wlyy/
---
spring:
  profiles: production
@ -131,4 +133,5 @@ healthStandard:
systemConfig:
  msg_push_server: http://127.0.0.1:3000/system/sendmsg.im
  jw_server: http://59.61.92.90:8072/wlyy_service
  socket_server: http://27.155.101.77:3000
  socket_server: http://27.155.101.77:3000
  server_url: http://www.yihu.com/wlyy/