浏览代码

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

trick9191 8 年之前
父节点
当前提交
aa1d67a23a

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

@ -83,4 +83,22 @@ public interface DevicePatientHealthIndexDao
	@Query(value = "select a.value1 from device.wlyy_patient_health_index a where a.type=1 and a.user = ?1 and a.id<?2 and a.value2 = ?3 order by a.record_date desc limit 0,1",nativeQuery = true)
	String getPreValue(String user,Long id,String value2);
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.user = ?1 and a.type = ?2 and a.value2 =?3 and a.record_date >= ?4 and a.record_date <= ?5 and a.del = '1' order by a.record_date desc limit ?6 ,?7",nativeQuery = true)
	List<DevicePatientHealthIndex> findIndexByPatientNative(String patient, int type,String gi_type, Date start, Date end,int currentSize,int pageSize);
	/**
	 * 获取患者某一天的血糖  普通sql写法
	 * @param patient
	 * @param date
	 * @return
	 */
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.type=1 and a.user = ?1 and DATE_FORMAT(a.record_date,'%Y-%m-%d') = ?2 order by a.record_date,a.id",nativeQuery = true)
	List<DevicePatientHealthIndex> findByDateNative(String patient, String date );
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.user = ?1 and a.type = ?2 and a.record_date >= ?3 and a.record_date <= ?4 and a.del = '1' order by a.record_date desc limit ?5 ,?6",nativeQuery = true)
	List<DevicePatientHealthIndex> findIndexByPatientNative(String patient, int type, Date start, Date end,int currentSize,int pageSize);
	@Query(value = "select DATE_FORMAT(a.record_date,'%Y-%m-%d') from device.wlyy_patient_health_index a where a.user = ?1 and a.record_date >= ?2 and a.record_date <= ?3 and a.del = '1' group by DATE_FORMAT(a.record_date,'%Y-%m-%d') order by DATE_FORMAT(a.record_date,'%Y-%m-%d') desc limit ?4,5?",nativeQuery = true)
	List<String> findDateList(String patient,Date start ,Date end,int currentSize,int pageSize);
}

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -43,6 +43,9 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("select a from Message a where a.receiver = ?1 and a.sender=?2 and a.tzType=?3 order by a.czrq desc")
    List<Message> getHealthIndexMessageByPatient(String doctor,String patient,String type,Pageable pageRequest);
    @Query("update Message a set a.read = 0 where a.receiver = ?1 and a.sender=?2 and a.tzType=?3")
    int updateHealthIndexMessageByPatient(String doctor,String patient,String type);
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2) order by a.czrq desc")
    List<Message> getSystemMessageUnread(String doctor);

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -316,7 +316,7 @@ public class DoctorInfoService extends BaseService {
    public Page<Doctor> getDoctorListByHospital(String query, String hospital,
                                                long id, int pageSize) {
        // 排序
        Sort sort = new Sort(Direction.DESC, "id");
        Sort sort = new Sort(Direction.DESC, "evaluateScore","id");
        // 分页信息
        PageRequest pageRequest = new PageRequest(0, pageSize, sort);
        // 查询全部

+ 3 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/EvaluateService.java

@ -151,9 +151,9 @@ public class EvaluateService extends BaseService {
			anonymousScore = anonymousScore.add(realScore.multiply(new BigDecimal("0.3")));
			anonymousScore =anonymousScore.add(anonymousScore1.multiply(new BigDecimal("0.2")));
			anonymousScore =anonymousScore.add(anonymousScore2.multiply(new BigDecimal("0.25")));
			anonymousScore =anonymousScore.add(anonymousScore2.multiply(new BigDecimal("0.25")));
			int evaTimes = Integer.parseInt(evaluateTimesList.get(0).get("count").toString());
			if(evaTimes>0){
			anonymousScore =anonymousScore.add(anonymousScore3.multiply(new BigDecimal("0.25")));
			int evaTimes = 0;
			if(evaluateTimesList.size()>0){
				evaTimes = evaluateTimesList.size();
			}else{
				evaTimes = 1;

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

@ -441,7 +441,8 @@ public class PatientHealthIndexService extends BaseService {
        boolean hadData = false;
        Date date = DateUtil.strToDateShort(dateString);
        /***************** 按时间排序 ***************************/
        List<DevicePatientHealthIndex> list = patientHealthIndexDao.findByDate(patient, dateString);
        List<DevicePatientHealthIndex> list = patientHealthIndexDao.findByDateNative(patient, dateString);
        if (list != null && list.size() > 0) {
            obj.put("type",1);
            obj.put("czrq",date);
@ -775,7 +776,7 @@ public class PatientHealthIndexService extends BaseService {
        {
            PageRequest pageRequest = new PageRequest(page, pageSize);
            //根据时间过滤排序
            List<String> dateList = patientHealthIndexDao.findDateList(patient, startDate, endDate, pageRequest);
            List<String> dateList = patientHealthIndexDao.findDateList(patient, startDate, endDate, pageRequest.getPageNumber(),pageRequest.getPageSize());
            if (dateList != null && dateList.size() > 0) {
                for (String dateString : dateList) {
                    DevicePatientHealthIndex obj = getPatientXT(patient, dateString);
@ -788,8 +789,8 @@ public class PatientHealthIndexService extends BaseService {
            // 排序
            Sort sort = new Sort(Direction.DESC, "recordDate");
            PageRequest pageRequest = new PageRequest(page, pageSize, sort);
            Page<DevicePatientHealthIndex> list = patientHealthIndexDao.findIndexByPatient(patient, type, startDate, endDate, pageRequest);
            re = list.getContent();
            List<DevicePatientHealthIndex> list = patientHealthIndexDao.findIndexByPatientNative(patient, type, startDate, endDate, pageRequest.getOffset(),pageRequest.getPageSize());
            re = list;
        }
        return re;
    }
@ -986,12 +987,13 @@ public class PatientHealthIndexService extends BaseService {
        //最新血糖指标
        if (type == 1) {
            DevicePatientHealthIndex obj = patientHealthIndexDao.findLastData(patientCode, 1);
            if (obj != null) {
                String dateString = DateUtil.dateToStrShort(obj.getRecordDate());
                return getPatientXT(patientCode, dateString);
            } else {
                return null;
            }
//            if (obj != null) {
//                String dateString = DateUtil.dateToStrShort(obj.getRecordDate());
//                return getPatientXT(patientCode, dateString);
//            } else {
//                return null;
//            }
            return obj;
        } else if(type ==2) {  //其他指标
            return patientHealthIndexDao.findLastData(patientCode, 2);
        }else{

+ 11 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthRecordService.java

@ -84,7 +84,7 @@ public class PatientHealthRecordService extends BaseService {
	/**
	 * 按分类查询患者运动记录
	 * @param patient 患者标识
	 * @param page 页码
	 * @param
	 * @param pageSize 分页大小
	 * @return
	 */
@ -209,7 +209,7 @@ public class PatientHealthRecordService extends BaseService {
	/**
	 * 按分类查询患者饮食记录
	 * @param patient 患者标识
	 * @param page 页码
	 * @param
	 * @param pageSize 分页大小
	 * @return
	 */
@ -250,16 +250,24 @@ public class PatientHealthRecordService extends BaseService {
		if (sports != null && sports.getSize() > 0) {
			for (PatientHealthRecordSports temp : sports) {
				jsonObject.put("sports", temp.getSportsName());
			}
				jsonObject.put("sports_time",temp.getSportsTime());
				jsonObject.put("sports_type",temp.getSportsType());
				jsonObject.put("sports_typeName",temp.getSportsTypeName());
				jsonObject.put("czrq",DateUtil.dateToStr(temp.getCzrq(), DateUtil.YYYY_MM_DD));
				jsonObject.put("sortDate",DateUtil.dateToStr(temp.getSortDate(), DateUtil.YYYY_MM_DD));
		}
		}
		if (medication != null) {
			for (PatientHealthRecordMedication temp : medication) {
				jsonObject.put("medication", temp.getMedicinesName());
				jsonObject.put("recordDate",DateUtil.dateToStr(temp.getRecordDate(), DateUtil.YYYY_MM_DD));
			}
		}
		if (diet != null) {
			for (PatientHealthRecordDiet temp : diet) {
				jsonObject.put("diet", temp.getContent());
				jsonObject.put("recordDate",DateUtil.dateToStr(temp.getRecordDate(), DateUtil.YYYY_MM_DD));
				jsonObject.put("images",temp.getImages());
			}
		}
		return jsonObject;

+ 1 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -403,10 +403,8 @@ public class MessageService extends BaseService {
                }
                re.add(map);
                item.setRead(0);//把消息设置为已读
            }
            messageDao.save(list);
            messageDao.updateHealthIndexMessageByPatient(doctor,patient,type);
        }
        return re;
    }

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -263,6 +263,7 @@ public class FamilyContractService extends BaseService {
        // 查询医生基本信息
        Doctor d = doctorDao.findByCode(doctor);
        json.put("doctor", d.getCode());
        json.put("evaluateScore", d.getEvaluateScore());
        json.put("name", d.getName());
        json.put("photo", d.getPhoto());
        json.put("sex", d.getSex());

+ 20 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/EvaluateController.java

@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by 卓 on 2017/5/10.
@ -81,4 +82,23 @@ public class EvaluateController  extends BaseController {
        }
    }
    /**
     * 保存评价
     * @param doctor 保存评价内容的JSON
     * @return
     */
    @RequestMapping(value = "doctor/label")
    @ResponseBody
    public String doctorLabel(@RequestParam(required = true,value="doctor") String doctor){
        try{
            List<Map<String,Object>> result = evaluateLabelService.findDistinctLabelByLaDoctor(doctor);
            return  write(200,"查询成功!","list",result);
        }catch (Exception e){
            error(e);
            return write(-1,e.getMessage());
        }
    }
}

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

@ -273,7 +273,7 @@ public class PatientHealthController extends BaseController {
		try {
			Map<String,Object> map = new HashMap<>();
			String patient = getUID();
			com.alibaba.fastjson.JSONObject xt = healthIndexService.findLastBypatient(patient,1);
			DevicePatientHealthIndex xt = healthIndexService.findLastByPatien(patient,1);
			if(xt!=null)
			{
				map.put("xt",xt.toString());

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/hosptail/HospitalController.java

@ -180,6 +180,7 @@ public class HospitalController extends BaseController {
                    json.put("name", doctor.getName());
                    json.put("photo", doctor.getPhoto());
                    json.put("sex", doctor.getSex());
                    json.put("evaluateScore", doctor.getEvaluateScore());
                    String sexName = "";
                    switch (doctor.getSex()) {
                        case 1: