Sfoglia il codice sorgente

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

huangwenjie 7 anni fa
parent
commit
056b3c427f

+ 14 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/device/PatientDevice.java

@ -47,6 +47,9 @@ public class PatientDevice extends IdEntity {
    //设备活动类型
    private String deviceActivityType;
    //上传的协议图片地址
    private String agreementPhoto;
    //========================非表字段======================
    //患者居住地址
    private String address;
@ -225,6 +228,17 @@ public class PatientDevice extends IdEntity {
        this.deviceActivityType = deviceActivityType;
    }
    @Column(name = "agreement_photo")
    public String getAgreementPhoto() {
        return agreementPhoto;
    }
    public void setAgreementPhoto(String agreementPhoto) {
        this.agreementPhoto = agreementPhoto;
    }
    @Transient
    public String getAddress() {
        return address;

+ 43 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/device/PatientDeviceLog.java

@ -13,6 +13,8 @@ import java.util.Date;
@Table(name = "wlyy_patient_device_log")
public class PatientDeviceLog extends IdEntity {
    //dm_device表主键
    private long deviceId;
    //患者id
    private String patient;
    //设备sn码
@ -23,13 +25,27 @@ public class PatientDeviceLog extends IdEntity {
    private String categoryCode;
    //操作人code
    private String operator;
    //操作人姓名
    private String operatorName;
    // 医生或者患者(1医生 2患者)
    private Integer role;
    //操作动作(1绑定 2解绑)
    private Integer operateCode;
    // 创建时间
    private Date createTime;
    //是否有效(0无效1有效)
    private int isDel;
    //上传的协议图片地址
    private String agreementPhoto;
    @Column(name = "device_id")
    public long getDeviceId() {
        return deviceId;
    }
    public void setDeviceId(long deviceId) {
        this.deviceId = deviceId;
    }
    @Column(name = "patient")
    public String getPatient() {
@ -76,6 +92,15 @@ public class PatientDeviceLog extends IdEntity {
        this.operator = operator;
    }
    @Column(name = "operator_name")
    public String getOperatorName() {
        return operatorName;
    }
    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }
    @Column(name = "role")
    public Integer getRole() {
        return role;
@ -104,8 +129,25 @@ public class PatientDeviceLog extends IdEntity {
        this.createTime = createTime;
    }
    public PatientDeviceLog() {
    @Column(name = "is_del")
    public int getIsDel() {
        return isDel;
    }
    public void setIsDel(int isDel) {
        this.isDel = isDel;
    }
    @Column(name = "agreement_photo")
    public String getAgreementPhoto() {
        return agreementPhoto;
    }
    public void setAgreementPhoto(String agreementPhoto) {
        this.agreementPhoto = agreementPhoto;
    }
    public PatientDeviceLog() {
    }
}

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java

@ -74,6 +74,12 @@ public interface DevicePatientHealthIndexDao
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.user=?1 and a.type=?2 and a.del='1' order by a.record_date desc limit 0,1",nativeQuery = true)
	DevicePatientHealthIndex findLastData(String patient, Integer type);
	/**
	 * 获取患者一天的具体某个类型的数据
	 */
	@Query("select a from DevicePatientHealthIndex a where a.type=?1 and a.user = ?2 and DATE_FORMAT(a.recordDate,'%Y-%m-%d') = ?3 and a.deviceSn = ?4 and a.del = '1' order by a.recordDate,a.id")
	List<DevicePatientHealthIndex> findByDateAndType(int type,String patient, String date,String devicesn);
	/**
	 * 上次血糖值
	 */

+ 58 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/PatientDeviceLogService.java

@ -7,12 +7,18 @@ import com.yihu.wlyy.repository.patient.PatientDeviceDao;
import com.yihu.wlyy.repository.patient.PatientDeviceLogDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.utils.Clock;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Component
@Transactional(rollbackFor = Exception.class)
@ -24,9 +30,11 @@ public class PatientDeviceLogService extends BaseService {
    private PatientDeviceLogDao patientDeviceLogDao;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     *
     * 绑定和解绑的时候会保存一条数据
     * @param patientDevice
     * @param role
     * @param operateCode
@ -37,19 +45,68 @@ public class PatientDeviceLogService extends BaseService {
           patientDevice = patientDeviceDao.findByDeviceSn(deviceSn).get(0);
       }
        PatientDeviceLog patientDeviceLog = new PatientDeviceLog();
        patientDeviceLog.setDeviceId(patientDevice.getDeviceId());
        patientDeviceLog.setPatient(patientDevice.getUser());
        patientDeviceLog.setCategoryCode(patientDevice.getCategoryCode());
        patientDeviceLog.setDeviceName(patientDevice.getDeviceName());
        patientDeviceLog.setDeviceSn(patientDevice.getDeviceSn());
        patientDeviceLog.setRole(role);
        patientDeviceLog.setOperateCode(operateCode);
        patientDeviceLog.setAgreementPhoto(patientDevice.getAgreementPhoto());
        if (role==1){
            patientDeviceLog.setOperatorName(patientDevice.getDoctorName());
            patientDeviceLog.setOperator(patientDevice.getDoctor());
        }else if (role==2){
            patientDeviceLog.setOperatorName(patientDevice.getAgentName());
            patientDeviceLog.setOperator(patientDevice.getAgent());
        }
        patientDeviceLog.setCreateTime(new Date());
        patientDeviceLogDao.save(patientDeviceLog);
    }
    public Map<String,Object> getDevicesList(String noGaugeDay,String isBinding,String categoryCode,int pageNo,int pageSize){
        List<Map<String,Object>> resultList =  new ArrayList<>();
        Map<String,Object> resultMap = new HashedMap();
        int start = (pageNo-1)*pageSize;
        String sql ="SELECT b.*,dd.photo FROM (SELECT a.* FROM (" +
                "  SELECT sf.name, pd.* FROM wlyy_patient_device_log pd" +
                "  LEFT JOIN wlyy_sign_family sf ON pd.patient = sf.patient" +
                "  WHERE" +
                "   pd.is_del = 1" +
                "  AND sf.`status` > 0" +
                "  ORDER BY" +
                "  create_time DESC) a" +
                " GROUP BY a.device_sn) b" +
                " LEFT JOIN dm_device dd ON b.device_id = dd.id where 1=1 ";
        resultList = jdbcTemplate.queryForList(sql);
        resultMap.put("tatalCount",resultList.size());
        //筛选条件--是否绑定
        if (!StringUtils.isEmpty(isBinding)){
            sql += " and b.operate_code= "+isBinding;
        }
        //筛选条件--设备类型
        if (!StringUtils.isEmpty(categoryCode)){
            sql += " and b.category_code= "+categoryCode;
        }
        //筛选条件--今日未测量
        if (!StringUtils.isEmpty(noGaugeDay) && StringUtils.equals("1",noGaugeDay)){
            sql += " and b.patient NOT IN (SELECT user FROM device.wlyy_patient_health_index WHERE TO_DAYS(record_date)=TO_DAYS(NOW()))";
        }
        //筛选条件--七天内未测量
        if (!StringUtils.isEmpty(noGaugeDay) && StringUtils.equals("2",noGaugeDay)){
            sql += " and b.patient NOT IN (SELECT user FROM device.wlyy_patient_health_index WHERE DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= DATE(record_date))";
        }
        //筛选条件--一个月内未测量
        if (!StringUtils.isEmpty(noGaugeDay) && StringUtils.equals("3",noGaugeDay)){
            sql += " and b.patient NOT IN (SELECT user FROM device.wlyy_patient_health_index WHERE DATE_SUB(CURDATE(), INTERVAL INTERVAL 1 MONTH) <= DATE(record_date))";
        }
        //筛选条件--超过一个月未测量
        if (!StringUtils.isEmpty(noGaugeDay) && StringUtils.equals("4",noGaugeDay)){
            sql += " and b.patient NOT IN (SELECT user FROM device.wlyy_patient_health_index WHERE  DATE_SUB(CURDATE(), INTERVAL 1 MONTH) > DATE(record_date))";
        }
        resultList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
        resultMap.put("data",resultList);
        return resultMap;
    }
}

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

@ -1933,4 +1933,67 @@ public class PatientHealthIndexService extends BaseService {
        }
        return patientHealthStandardDao.save(list);
    }
    public List<Map<String, String>> getHealthIndexByPatientAndDate(String patientCode, String deviceSn, String choseDate,int type) throws Exception {
        List<Map<String, String>> re = new ArrayList<>();
        // 排序
        Sort sort = new Sort(Direction.DESC, "recordDate");
        List<DevicePatientHealthIndex> list = patientHealthIndexDao.findByDateAndType(type,patientCode,choseDate,deviceSn);
        if (list != null && list.size() > 0) {
            for (DevicePatientHealthIndex item : list) {
                Map<String, String> map = new HashMap<>();
                if (type == 1)    //血糖
                {
                    String gi = item.getValue1();
                    String giType = item.getValue2();
                    map.put("time", DateUtil.dateToStrLong(item.getRecordDate()));
                    map.put("gi", gi); //  血糖值
                    map.put("gi_type", giType); //  血糖值类型
                    String text = gi + " mmol/L";
                    if ("1".equals(giType)) {
                        text += "(早餐前)";
                    } else if ("2".equals(giType)) {
                        text += "(早餐后)";
                    } else if ("3".equals(giType)) {
                        text += "(午餐前)";
                    } else if ("4".equals(giType)) {
                        text += "(午餐后)";
                    } else if ("5".equals(giType)) {
                        text += "(晚饭前)";
                    } else if ("6".equals(giType)) {
                        text += "(晚饭后)";
                    } else if ("7".equals(giType)) {
                        text += "(睡前)";
                    }
                    map.put("text", text); //  展示
                    re.add(map);
                } else if (type == 2) //血压
                {
                    String sys = item.getValue1();   //收缩压
                    String dia = item.getValue2();    //舒张压
                    String pul = item.getValue3();    //脉搏
                    map.put("time", DateUtil.dateToStrLong(item.getRecordDate()));
                    map.put("sys", sys);
                    map.put("dia", dia);
                    map.put("pul", pul);
                    re.add(map);
                } else if (type == 3) //体重
                {
                    String weight = item.getValue1();   //体重
                    String height = item.getValue2();   //身高
                    String bmi = item.getValue3();      //BMI
                    map.put("time", DateUtil.dateToStrShort(item.getRecordDate()));
                    map.put("weight", weight);
                    map.put("height", height);
                    map.put("bmi", bmi);
                    map.put("text", weight + " kg");
                    re.add(map);
                }
            }
        }
        return re;
    }
}

+ 131 - 38
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java

@ -10,6 +10,7 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -58,12 +60,33 @@ public class SpecialistService extends BaseService {
                " FROM " +
                " wlyy_doctor d " +
                " WHERE " +
                " d.`level` = '5' " +
                " d.`level` = '4' " +
                " AND `status` = 1";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public List<Map<String,Object>> findHealthAssistantPatientCount()throws Exception{
        List<Map<String,Object>> list = findHealthAssistant();
        if(list!=null&&list.size()>0){
            for(Map<String,Object> map:list){
                map.put("count",getAssistantPatientCount(map.get("code").toString()));
            }
        }
        return list;
    }
    public Long getAssistantPatientCount(String doctor)throws Exception{
        Map<String,Object> param = new HashedMap();
        param.put("doctor",doctor);
        HttpResponse response = HttpUtils.doGet(specialistUrl+"getAssistantPatientCount",param);
        JSONObject  rs = new JSONObject(response.getContent());
        if("succes".equals(rs.getString("message"))){
            return rs.getLong("obj");
        }
        return 0L;
    }
    public List<SignPatientLabel> findLabelbyType(String type,Long teamCode){
        //自定义标签
        if("4".equals(type)){
@ -76,6 +99,49 @@ public class SpecialistService extends BaseService {
        }
    }
    public List<Map<String,Object>> findLabelAndPatientCount(String doctor,String type,Long teamCode)throws Exception{
        //自定义标签
        if("4".equals(type)){
            List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatusAndTeamCode(type,1,teamCode);
            return setPatientCount(list,doctor);
        }else{
            //非自定义标签
            List<SignPatientLabel> list = signPatientLabelDao.findByLabelTypeAndStatus(type,1);
            return setPatientCount(list,doctor);
        }
    }
    public List<Map<String,Object>> setPatientCount(List<SignPatientLabel> list,String doctor)throws Exception{
        List<Map<String,Object>> rs = new ArrayList<>();
        if(list!=null&&list.size()>0){
            for(SignPatientLabel label:list){
                Map<String,Object> map = new HashedMap();
                map.put("label",label.getLabelCode());
                map.put("labelName",label.getLabelName());
                map.put("labelType",label.getLabelType());
                map.put("count",getLabelpatientCount(doctor,label.getLabelCode(),label.getLabelType()));
                rs.add(map);
            }
        }
        return rs;
    }
    public Long getLabelpatientCount(String doctor,String labelType,String labelCode)throws Exception{
        Map<String,Object> param = new HashedMap();
        param.put("doctor",doctor);
        param.put("labelType",labelType);
        param.put("labelCode",labelCode);
        HttpResponse response = HttpUtils.doGet(specialistUrl+"getLabelpatientCount",param);
        JSONObject  rs = new JSONObject(response.getContent());
        if("succes".equals(rs.getString("message"))){
            return rs.getLong("obj");
        }
        return 0L;
    }
    public Long findSpecialistPatientRelationCout(String doctor)throws Exception{
        Map<String,Object> param = new HashedMap();
        param.put("doctor",doctor);
@ -123,52 +189,79 @@ public class SpecialistService extends BaseService {
        return "";
    }
    public List<Map<String,Object>> getPatientByLabel(String labelType,String labelCode,Integer page,Integer size){
        String sql="SELECT " +
                " p. NAME, " +
                " p. CODE, " +
                " IFNULL( " +
                "  YEAR ( " +
                "   from_days(datediff(now(), p.birthday)) " +
                "  ), " +
                "  '未知' " +
                " ) age, " +
                " lb.labelName, " +
                " lb.labelType, " +
                " lb.label, " +
                " p.photo, " +
                " h.label_name as health, " +
                " h.label AS healthcode " +
    public JSONArray getPatientByLabel(String doctor,String labelType,String labelCode,Integer page,Integer size)throws Exception{
        Map<String,Object> param = new HashedMap();
        param.put("doctor",doctor);
        param.put("labelType",labelType);
        param.put("labelCode",labelCode);
        param.put("page",page);
        param.put("size",size);
        HttpResponse response = HttpUtils.doGet(specialistUrl+"getPatientByLabel",param);
        JSONObject  rs = new JSONObject(response.getContent());
        if("succes".equals(rs.getString("message"))){
            return rs.getJSONArray("obj");
        }
        return null;
    }
    public List<Map<String,Object>> findDoctorTeamMenmber(String doctor){
        String sql = "SELECT " +
                " d.`code`, " +
                " d. name, " +
                " d.photo, " +
                " d.`level`, " +
                " d.dept, " +
                " d.dept_name, " +
                " d.job, " +
                " d.job_name " +
                " FROM " +
                " ( " +
                " wlyy_admin_team_member m " +
                " JOIN wlyy_doctor d ON d. CODE = m.doctor_code " +
                " WHERE " +
                " m.team_id = ( " +
                "  SELECT " +
                "   i.label_type AS labelType, " +
                "   i.label, " +
                "   i.label_name AS labelName, " +
                "   i.patient " +
                "   id " +
                "  FROM " +
                "   wlyy_sign_patient_label_info i " +
                "   wlyy_admin_team t " +
                "  WHERE " +
                "   i.label = '"+labelCode+"' " +
                "  AND i.label_type = '"+labelType+"' " +
                "  AND i.`status` = '1' " +
                " ) lb " +
                " JOIN wlyy_patient p ON p. CODE = lb.patient " +
                " LEFT JOIN ( " +
                " SELECT " +
                "  t.label, " +
                "  t.label_name, " +
                "  t.patient " +
                "   t.leader_code = '"+doctor+"' " +
                " )";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public List<Map<String,Object>> getDoctorInHospital(String doctor,String name,Integer page,Integer size){
        String sql = "SELECT " +
                " d. name, " +
                " d. code, " +
                " d.job, " +
                " d.job_name, " +
                " d.dept, " +
                " d.dept_name, " +
                " d.photo " +
                " FROM " +
                "  wlyy_sign_patient_label_info t " +
                " wlyy_doctor d " +
                " WHERE " +
                "  t.label_type = '8' " +
                " AND t.`status` = '1' " +
                " ) h ON h.patient = lb.patient " +
                " LIMIT LIMIT "+(page-1)*size+","+size;
                " d.hospital = ( " +
                "  SELECT " +
                "   dd.hospital " +
                "  FROM " +
                "   wlyy_doctor dd " +
                "  WHERE " +
                "   dd. CODE = '"+doctor+"' " +
                " ) " +
                " AND d.`level` = 4 ";
        if(StringUtils.isNotBlank(name)){
            sql = sql +" AND d.`name` LIKE '%"+name+"%'";
        }
        sql = sql +" LIMIT "+(page-1)*size+","+size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
}

+ 28 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java

@ -18,6 +18,7 @@ import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.health.bank.CreditLogService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
@ -73,6 +74,8 @@ public class DoctorDeviceController extends BaseController {
	private DoctorService doctorService;
	@Autowired
	private PatientDeviceLogService patientDeviceLogService;
	@Autowired
	private CommonUtil commonUtil;
	private ObjectMapper  objectMapper=new ObjectMapper();
@ -101,7 +104,7 @@ public class DoctorDeviceController extends BaseController {
	@RequestMapping(value = "SavePatientDeviceAndCredit",method = RequestMethod.POST)
	@ResponseBody
	@ObserverRequired
	public String SavePatientDeviceAndCredit(@ApiParam(name="data",value="设备数据json",defaultValue = "{\"user\":\"915cca0a-5b1d-11e6-834 4-fa163e8aee56\",\"deviceId\": \"3\",\"deviceName\": \"血压计-优瑞恩\",\"deviceSn\": \"16C000337\",\"categoryCode\": \"1\",\"userType\": \"-1\"}")
	public String SavePatientDeviceAndCredit(@ApiParam(name="data",value="设备数据json",defaultValue = "{\"user\":\"915cca0a-5b1d-11e6-834 4-fa163e8aee56\",\"deviceId\": \"3\",\"deviceName\": \"血压计-优瑞恩\",\"deviceSn\": \"16C000337\",\"categoryCode\": \"1\",\"userType\": \"-1\",\"agreementPhoto\":\"www.baidu.com\"}")
							 @RequestParam(value="data",required = true) String data) {
		try {
			PatientDevice device = objectMapper.readValue(data,PatientDevice.class);
@ -111,6 +114,9 @@ public class DoctorDeviceController extends BaseController {
			if (doctor!=null){
				device.setDoctorName(doctor.getName());
			}
			if (StringUtils.isNotEmpty(device.getAgreementPhoto())){
				device.setAgreementPhoto(commonUtil.copyTempImage(device.getAgreementPhoto()));
			}
			//首绑和设备类型判断  判断是否可以增加积分
			Map<String,Object> checkMap = patientDeviceService.checkBindingFirstAndType(device);
			boolean flag = (Boolean)checkMap.get("flag");
@ -391,4 +397,25 @@ public class DoctorDeviceController extends BaseController {
		}
	}
	@RequestMapping(value = "/getDevicesList",method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation(value = "医生端-设备管理中设备列表",notes = "设备列表")
	public String getDevicesList(@ApiParam(value = "未测量天数(1今日为测量 2七天未测量 3本月未测量 4超过一个月未测量)", name = "noGaugeDay") @RequestParam(value = "noGaugeDay",required = false)String noGaugeDay,
								 @ApiParam(value = "是否绑定(1绑定 2解绑)", name = "isBinding") @RequestParam(value = "isBinding",required = false)String isBinding,
								 @ApiParam(value = "设备类型(1血糖仪 2血压计)", name = "categoryCode") @RequestParam(value = "categoryCode",required = false)String categoryCode,
								 @ApiParam(name="page",value="第几页",defaultValue = "1") @RequestParam(value="page",required = true) String page,
								 @ApiParam(name="pageSize",value="",defaultValue = "10") @RequestParam(value="pageSize",required = true) String pageSize) {
		if (StringUtils.isBlank(pageSize)) {
			pageSize = "10";
		}
		if (page.equals("0")) {
			page = "1";
		}
		try {
			return  write(200,"查找成功!","data",patientDeviceLogService.getDevicesList(noGaugeDay,isBinding,categoryCode,Integer.valueOf(page),Integer.valueOf(pageSize)));
		} catch (Exception e) {
			error(e);
			return error( -1, "查询失败!");
		}
	}
}

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthController.java

@ -456,4 +456,18 @@ public class DoctorHealthController extends BaseController {
		}
	}
	@RequestMapping(value = "/patientHealthIndexByDateAndDeviceSn",method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("医生端--根据时间和设备sn码查询某个居民的体征记录")
	public String patientHealthIndexByDateAndDeviceSn(@ApiParam(value = "居民code)", name = "patientCode") @RequestParam(value = "patientCode",required = true)String patientCode,
													  @ApiParam(value = "设备sn码", name = "deviceSn") @RequestParam(value = "deviceSn",required = true)String deviceSn,
													  @ApiParam(value = "日期", name = "choseDay") @RequestParam(value = "choseDay",required = true)String choseDay,
													  @ApiParam(value = "健康指标类型(1血糖,2血压,3体重,4腰围)",name = "type")@RequestParam(value = "type",required = true)int type){
		try {
			List<Map<String,String>> list = healthIndexService.getHealthIndexByPatientAndDate(patientCode,deviceSn,choseDay,type);
			return write(200, "获取健康指标历史记录成功", "data", list);
		} catch (Exception ex) {
			return invalidUserException(ex, -1, ex.getMessage());
		}
	}
}

+ 103 - 47
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistController.java

@ -12,6 +12,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2018/5/31.
@ -24,106 +25,161 @@ public class SpecialistController extends BaseController {
    @Autowired
    private SpecialistService specialistService;
    @RequestMapping(value = "setPatientLabelInfo",method = RequestMethod.POST)
    @RequestMapping(value = "setPatientLabelInfo", method = RequestMethod.POST)
    @ApiOperation("设置居民标签")
    public String setPatientLabelInfo(@ApiParam(name = "json", value = "居民标签实体") @RequestParam(required = true) String json){
    public String setPatientLabelInfo(@ApiParam(name = "json", value = "居民标签实体") @RequestParam(required = true) String json) {
        try {
            List<SignPatientLabelInfo> info = (List<SignPatientLabelInfo>) JSONArray.parseArray(json, SignPatientLabelInfo.class);
            return write(200,"获取成功","data",specialistService.setPatientLabelInfo(info));
        }catch (Exception e){
            return write(200, "获取成功", "data", specialistService.setPatientLabelInfo(info));
        } catch (Exception e) {
            error(e);
            return error(-1,"请求失败");
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "findHealthAssistant",method = RequestMethod.GET)
    @RequestMapping(value = "findHealthAssistant", method = RequestMethod.GET)
    @ApiOperation("获取所有计管师")
    public String findHealthAssistant(){
    public String findHealthAssistant() {
        try {
            return write(200,"获取成功","data",specialistService.findHealthAssistant());
        }catch (Exception e){
            return write(200, "获取成功", "data", specialistService.findHealthAssistant());
        } catch (Exception e) {
            error(e);
            return error(-1,"请求失败");
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "findHealthAssistantPatientCount", method = RequestMethod.GET)
    @ApiOperation("获取所有计管师下居民数目")
    public String findHealthAssistantPatientCount(){
        try {
            return write(200, "获取成功", "data", specialistService.findHealthAssistantPatientCount());
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "findLabelbyType",method = RequestMethod.GET)
    @RequestMapping(value = "findLabelbyType", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取标签")
    public String findLabelbyType(@ApiParam(name = "type", value = "标签类型") @RequestParam(required = true)String type,
                                  @ApiParam(name = "teamCode", value = "团队id") @RequestParam(required = false)Long teamCode){
    public String findLabelbyType(@ApiParam(name = "type", value = "标签类型") @RequestParam(required = true) String type,
                                  @ApiParam(name = "teamCode", value = "团队id") @RequestParam(required = false) Long teamCode) {
        try {
            return write(200,"获取成功","data",specialistService.findLabelbyType(type,teamCode));
        }catch (Exception e){
            return write(200, "获取成功", "data", specialistService.findLabelbyType(type, teamCode));
        } catch (Exception e) {
            error(e);
            return error(-1,"请求失败");
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "findSpecialistPatientRelationCout",method = RequestMethod.GET)
    @RequestMapping(value = "findLabelAndPatientCount", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取标签与居民数量")
    public String findLabelAndPatientCount(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
                                           @ApiParam(name = "type", value = "标签类型") @RequestParam(required = true)String type,
                                           @ApiParam(name = "teamCode", value = "团队id") @RequestParam(required = false)Long teamCode) {
        try {
            return write(200, "获取成功", "data", specialistService.findLabelAndPatientCount(doctor,type,teamCode));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
        @RequestMapping(value = "findSpecialistPatientRelationCout", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取专科医生下未分配标签居民数目")
    public String findSpecialistPatientRelationCout(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor){
    public String findSpecialistPatientRelationCout(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
        try {
            return write(200,"获取成功","data",specialistService.findSpecialistPatientRelationCout(doctor));
        }catch (Exception e){
            return write(200, "获取成功", "data", specialistService.findSpecialistPatientRelationCout(doctor));
        } catch (Exception e) {
            error(e);
            return error(-1,"请求失败");
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "findNoLabelPatientRelation",method = RequestMethod.GET)
    @RequestMapping(value = "findNoLabelPatientRelation", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取专科医生下未分配标签居民")
    public  String findNoLabelPatientRelation(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor){
    public String findNoLabelPatientRelation(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
        try {
            return write(200,"获取成功","data",specialistService.findNoLabelPatientRelation(doctor));
        }catch (Exception e){
            return write(200, "获取成功", "data", specialistService.findNoLabelPatientRelation(doctor));
        } catch (Exception e) {
            error(e);
            return error(-1,"请求失败");
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "findPatientRelatioByAssistant",method = RequestMethod.GET)
    @RequestMapping(value = "findPatientRelatioByAssistant", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取计管师下未分配标签居民")
    public String findPatientRelatioByAssistant(@ApiParam(name = "assistant", value = "计管师") @RequestParam(required = true)String assistant,
                                                @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                                @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size)throws Exception {
    public String findPatientRelatioByAssistant(@ApiParam(name = "assistant", value = "计管师") @RequestParam(required = true) String assistant,
                                                @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
                                                @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true) Integer size) throws Exception {
        try {
            return write(200,"获取成功","data",specialistService.findPatientRelatioByAssistant(assistant,page,size));
        }catch (Exception e){
            return write(200, "获取成功", "data", specialistService.findPatientRelatioByAssistant(assistant, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1,"请求失败");
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "saveHealthAssistant",method = RequestMethod.POST)
    @RequestMapping(value = "saveHealthAssistant", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("分配计管师居民")
    public String saveHealthAssistant(String json){
    public String saveHealthAssistant(String json) {
        try {
            return write(200,"获取成功","data",specialistService.saveHealthAssistant(json));
        }catch (Exception e){
            return write(200, "获取成功", "data", specialistService.saveHealthAssistant(json));
        } catch (Exception e) {
            error(e);
            return error(-1,"请求失败");
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "getPatientByLabel",method = RequestMethod.POST)
    @RequestMapping(value = "getPatientByLabel", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取标签下居民")
    public String getPatientByLabel(@ApiParam(name = "labelType", value = "标签类型")String labelType,
                                    @ApiParam(name = "labelCode", value = "标签code")String labelCode,
                                    @ApiParam(name = "page", value = "第几页,1开始")Integer page,
                                    @ApiParam(name = "size", value = "每页大小")Integer size) {
    public String getPatientByLabel(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                    @ApiParam(name = "labelType", value = "标签类型")@RequestParam(required = true) String labelType,
                                    @ApiParam(name = "labelCode", value = "标签code") @RequestParam(required = true)String labelCode,
                                    @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                    @ApiParam(name = "size", value = "每页大小")@RequestParam(required = true) Integer size) {
        try {
            return write(200,"获取成功","data",specialistService.getPatientByLabel(labelType,labelCode,page,size));
        }catch (Exception e){
            return write(200, "获取成功", "data", specialistService.getPatientByLabel(doctor,labelType, labelCode, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1,"请求失败");
            return error(-1, "请求失败");
        }
    }
}
    @RequestMapping(value = "findDoctorTeamMenmber", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取团队成员")
    public String findDoctorTeamMenmber(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor) {
        try {
            return write(200, "获取成功", "data", specialistService.findDoctorTeamMenmber(doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "getDoctorInHospital", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取院内工作人员")
    public String getDoctorInHospital(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                      @ApiParam(name = "name", value = "医生姓名模糊") @RequestParam(required = false)String name,
                                      @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                      @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size){
        try {
            return write(200, "获取成功", "data", specialistService.getDoctorInHospital(doctor,name,page,size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -35,7 +35,7 @@ im:
#专病配置
specialist:
  url: http://localhost:10051/svr-wlyy-specialist/
  url: http://localhost:10051/svr-specialist/
#物联网配置
iot:
#  url: http://192.168.131.24:8088/svr-iot/

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml

@ -31,7 +31,7 @@ im:
#专病配置
specialist:
  url: http://localhost:10051/svr-wlyy-specialist/
  url: http://localhost:10051/svr-specialist/
#物联网配置
iot:
  url: http://192.168.131.24:8088/svr-iot/

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/application-test.yml

@ -30,7 +30,7 @@ im:
#专病配置基础服务地址
specialist:
  url: http://172.19.103.33:10051/svr-wlyy-specialist/
  url: http://172.19.103.33:10051/svr-specialist/
#物联网配置
iot:
  url: http://172.19.103.33:8088/svr-iot/