Procházet zdrojové kódy

消息查询提交

chenweida před 8 roky
rodič
revize
8a628ec98b

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

@ -41,4 +41,6 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query(" from Message a where a.read = 1 and over ='1' and a.sender = ?1 and a.receiver=?2 and a.signStatus='1'")
    Message findByPatient(String patient,String doctor);
    @Query("select count(a) from Message a where a.read = 0 and over ='0'  and a.receiver=?1 and a.type=?2 ")
    int findMessageNum(String doctor, Integer type);
}

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

@ -1,13 +1,11 @@
package com.yihu.wlyy.service.app.message;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.*;
import javax.transaction.Transactional;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
@ -18,6 +16,8 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
@ -40,6 +40,8 @@ public class MessageService extends BaseService {
    private ConsultTeamDao consultTeamDao;
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 汇总查询医生的消息总数
@ -280,4 +282,23 @@ public class MessageService extends BaseService {
        return messageDao.findAll(spec, pageRequest);
    }
    public JSONObject findMessageNum(String doctor, Integer type) {
        JSONObject jo=new JSONObject();
        //得到消息总数
        int count= messageDao.findMessageNum(doctor,type);
        String DateString="";
        String message="";
        String sql="select w.* from wlyy_message w where w.type=3 and w.receiver='"+doctor+"' order by w.czrq desc limit 0,1";
        List<Message> returnList= jdbcTemplate.query(sql,new BeanPropertyRowMapper(Message.class));
        if(returnList!=null&&returnList.size()>0){
            Message m=returnList.get(0);
            DateString=DateUtil.dateToStrShort(m.getCzrq());
            message=m.getContent();
        }
        jo.put("count",count);
        jo.put("message",message);
        jo.put("date",DateString);
        return jo;
    }
}

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

@ -30,6 +30,7 @@ import com.yihu.wlyy.service.app.disease.PatientDiseaseService;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.task.SignUploadTask;
import com.yihu.wlyy.util.MD5;
import org.apache.commons.beanutils.converters.IntegerConverter;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -1665,9 +1666,7 @@ public class FamilyContractService extends BaseService {
        return result;
    }
    public List<SignFamily> findNoHealthSignFamilyNum(String doctor) {
        return signFamilyDao.findNoHealthSignFamilyNum(doctor);
    }
    public Map<String,Object> findNoHealthSignFamilyHealth(String doctor, Integer page, Integer pagesize,String patientName,String patientAddr) {
        Map<String,Object> returnMap=new HashMap();

+ 17 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java

@ -246,4 +246,21 @@ public class DoctorMessageController extends BaseController {
			return error(-1, "获取消息失败!");
		}
	}
	/**
	 * @param type 消息类型  1.是家庭签约信息  2.体征消息  3分配健管师
	 * @return
	 */
	@RequestMapping(value = "findMessageNum")
	@ResponseBody
	public String findMessageNum(Integer type) {
		try {
			JSONObject obj = messageService.findMessageNum(getUID(), type);
			return write(200, "获取消息成功!", "list", obj);
		} catch (Exception e) {
			error(e);
			return error(-1, "获取消息失败!");
		}
	}
}

+ 1 - 24
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -759,30 +759,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
        }
    }
    /**
     * 获取没有健康管理师的签约数据数目
     *
     * @param doctor 医生code
     * @return
     */
    @RequestMapping(value = "/findNoHealthSignFamilyNum")
    @ResponseBody
    public String findNoHealthSignFamilyNum(String doctor) {
        try {
            List<SignFamily> signFamily = familyContractService.findNoHealthSignFamilyNum(doctor);
            JSONObject jo = new JSONObject();
            if (signFamily != null && signFamily.size() > 0) {
                jo.put("date", DateUtil.dateToStr(signFamily.get(0).getCzrq(), "yyyy-MM-dd"));
                jo.put("num", signFamily.size());
            } else {
                jo.put("num", 0);
            }
            return write(200, "查询成功", "data", jo);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    /**
     * 获取没有健康管理师的患者列表