瀏覽代碼

居民端维护健康记录

wujunjie 8 年之前
父節點
當前提交
0c97a33d6a

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -90,6 +90,7 @@ public class PatientHealthIndexService extends BaseService {
        Map<String, Object> map = new HashMap<>();
        for (Map<String, Object> device : devicePatient) {
            String time = device.get("record_date") == null ? null : device.get("record_date").toString();
            String deviceSN = device.get("device_sn") == null ? "0" : "1";
            String value1 = device.get("value1") == null ? null : device.get("value1").toString();
            String value2 = device.get("value2") == null ? null : device.get("value2").toString();
            String value3 = device.get("value3") == null ? null : device.get("value3").toString();
@ -97,6 +98,7 @@ public class PatientHealthIndexService extends BaseService {
            String value5 = device.get("value5") == null ? null : device.get("value5").toString();
            String value6 = device.get("value6") == null ? null : device.get("value6").toString();
            String value7 = device.get("value7") == null ? null : device.get("value7").toString();
            map.put("isDevice", deviceSN);
            if (StringUtils.isNotEmpty(time)) {
                Date date = sdf.parse(time);
                time = sdf.format(date);

+ 18 - 25
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/PatientHealthController.java

@ -42,14 +42,17 @@ public class PatientHealthController extends BaseController {
        try {
            List list = new ArrayList();
            String patient = getUID();
//            String patient = "test_4429a0a4138a281e7c6316eb9bd";
//            健康指标类型(1血糖,2血压,3体重,4腰围)
            Map map = healthIndexService.findDataByPatient(patient, 1);
            Map map1 = healthIndexService.findDataByPatient(patient, 2);
            Map map2 = healthIndexService.findDataByPatient(patient, 3);
            Map map3 = healthIndexService.findDataByPatient(patient, 4);
            if (map != null) {
//            血糖各个时间段取值
            if (map.size()!=0) {
                Map sugar = new HashMap();
                Object time = map.get("time");
                String isDevice = map.get("isDevice").toString();
                Object value1 = map.get("value1");
                Object value2 = map.get("value2");
                Object value3 = map.get("value3");
@ -58,6 +61,7 @@ public class PatientHealthController extends BaseController {
                Object value6 = map.get("value6");
                Object value7 = map.get("value7");
                sugar.put("type", 1);
                sugar.put("isDevice", isDevice);
                if (time!=null){
                    sugar.put("time", time);
                }
@ -90,9 +94,11 @@ public class PatientHealthController extends BaseController {
                }
                list.add(sugar);
            }
            if (map1 != null) {
//            血压  value1高压 value2低压 value3脉搏 value4心率不齐
            if (map1.size()!=0) {
                Map pa = new HashMap();
                Object time = map1.get("time");
                String isDevice = map1.get("isDevice").toString();
                Object value1 = map1.get("value1");
                Object value2 = map1.get("value2");
                Object value3 = map1.get("value3");
@ -101,6 +107,7 @@ public class PatientHealthController extends BaseController {
                Object value6 = map1.get("value6");
                Object value7 = map1.get("value7");
                pa.put("type", 2);
                pa.put("isDevice", isDevice);
                if (time!=null){
                    pa.put("time", time);
                }
@ -108,34 +115,30 @@ public class PatientHealthController extends BaseController {
                    pa.put("value1", value1);
                }
                if (value2!=null) {
                    pa.remove("value1");
                    pa.put("value2", value2);
                }
                if (value3!=null) {
                    pa.remove("value2");
                    pa.put("value3", value3);
                }
                if (value4!=null) {
                    pa.remove("value3");
                    pa.put("value4", value4);
                }
                if (value5!=null) {
                    pa.remove("value4");
                    pa.put("value5", value5);
                }
                if (value6!=null) {
                    pa.remove("value5");
                    pa.put("value6", value6);
                }
                if (value7!=null) {
                    pa.remove("value6");
                    pa.put("value7", value7);
                }
                list.add(pa);
            }
            if (map2 != null) {
//            体重 value1 体重
            if (map2.size()!=0) {
                Map weight = new HashMap();
                Object time = map2.get("time");
                String isDevice = map2.get("isDevice").toString();
                Object value1 = map2.get("value1");
                Object value2 = map2.get("value2");
                Object value3 = map2.get("value3");
@ -144,6 +147,7 @@ public class PatientHealthController extends BaseController {
                Object value6 = map2.get("value6");
                Object value7 = map2.get("value7");
                weight.put("type", 3);
                weight.put("isDevice", isDevice);
                if (time!=null){
                    weight.put("time", time);
                }
@ -151,34 +155,30 @@ public class PatientHealthController extends BaseController {
                    weight.put("value1", value1);
                }
                if (value2!=null) {
                    weight.remove("value1");
                    weight.put("value2", value2);
                }
                if (value3!=null) {
                    weight.remove("value2");
                    weight.put("value3", value3);
                }
                if (value4!=null) {
                    weight.remove("value3");
                    weight.put("value4", value4);
                }
                if (value5!=null) {
                    weight.remove("value4");
                    weight.put("value5", value5);
                }
                if (value6!=null) {
                    weight.remove("value5");
                    weight.put("value6", value6);
                }
                if (value7!=null) {
                    weight.remove("value6");
                    weight.put("value7", value7);
                }
                list.add(weight);
            }
            if (map3 != null) {
//            腰围 value1腰围
            if (map3.size()!=0) {
                Map waist = new HashMap();
                Object time = map3.get("time");
                String isDevice = map3.get("isDevice").toString();
                Object value1 = map3.get("value1");
                Object value2 = map3.get("value2");
                Object value3 = map3.get("value3");
@ -187,6 +187,7 @@ public class PatientHealthController extends BaseController {
                Object value6 = map3.get("value6");
                Object value7 = map3.get("value7");
                waist.put("type", 4);
                waist.put("isDevice", isDevice);
                if (time!=null){
                    waist.put("time", time);
                }
@ -194,27 +195,21 @@ public class PatientHealthController extends BaseController {
                    waist.put("value1", value1);
                }
                if (value2!=null) {
                    waist.remove("value1");
                    waist.put("value2", value2);
                }
                if (value3!=null) {
                    waist.remove("value2");
                    waist.put("value3", value3);
                }
                if (value4!=null) {
                    waist.remove("value3");
                    waist.put("value4", value4);
                }
                if (value5!=null) {
                    waist.remove("value4");
                    waist.put("value5", value5);
                }
                if (value6!=null) {
                    waist.remove("value5");
                    waist.put("value6", value6);
                }
                if (value7!=null) {
                    waist.remove("value6");
                    waist.put("value7", value7);
                }
                list.add(waist);
@ -402,8 +397,7 @@ public class PatientHealthController extends BaseController {
                                               @ApiParam(name = "end", value = "结束时间", defaultValue = "2016-09-23 00:00:00")
                                               @RequestParam(value = "end", required = true) String end) {
        try {
//            List<DevicePatientHealthIndex> list = healthIndexService.findChartByPatien(getUID(), type, begin, end);
            List<DevicePatientHealthIndex> list = healthIndexService.findChartByPatien("test_4429a0a4138a281e7c6316eb9bd", type, begin, end);
            List<DevicePatientHealthIndex> list = healthIndexService.findChartByPatien(getUID(), type, begin, end);
            if (list == null) {
                return success("查询成功!");
            }
@ -456,7 +450,6 @@ public class PatientHealthController extends BaseController {
                                          @RequestParam(value = "pagesize", required = true) int pagesize) {
        try {
            List<DevicePatientHealthIndex> list = healthIndexService.findIndexByPatient(getUID(), type, start, end, page, pagesize);
            System.out.println("<===========================================>");
            JSONArray jsonArray = new JSONArray();
            if (list != null) {
                for (DevicePatientHealthIndex model : list) {