Jelajahi Sumber

医生端新增指导接口,居民端查询列表接口修改

wujunjie 8 tahun lalu
induk
melakukan
57793b4bd5

+ 4 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorGuidanceTempDao.java

@ -20,8 +20,10 @@ public interface DoctorGuidanceTempDao extends PagingAndSortingRepository<Doctor
    int deleteByCode(String code);
    @Query("select t from DoctorGuidanceTemp t where t.owner = ?1 order by t.sendTimes desc")
    Page<List<DoctorGuidanceTemp>> findByOwner(String owner, Pageable pageRequest);
    Page<DoctorGuidanceTemp> findByOwner(String owner, Pageable pageRequest);
//    Page<List<DoctorGuidanceTemp>> findByOwner(String owner, Pageable pageRequest);
    @Query("select t from DoctorGuidanceTemp t where t.owner = ?1 or t.owner = 'system' order by t.sendTimes desc")
    Page<List<DoctorGuidanceTemp>> findByOwnerAndSystem(String owner, Pageable pageRequest);
    Page<DoctorGuidanceTemp> findByOwnerAndSystem(String owner, Pageable pageRequest);
//    Page<List<DoctorGuidanceTemp>> findByOwnerAndSystem(String owner, Pageable pageRequest);
}

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

@ -219,6 +219,7 @@ public class PatientHealthGuidanceService extends BaseService {
	 * @return
	 */
	public JSONArray findGuidanceByPatient(String patient, long id, int pagesize) {
		JSONArray array = new JSONArray();
		// 分页信息
		PageRequest pageRequest = new PageRequest(0, pagesize);
@ -235,13 +236,18 @@ public class PatientHealthGuidanceService extends BaseService {
					continue;
				}
//				控制返回内容50字以内
				String content = temp[3].toString().substring(0,50);
				String content = temp[3].toString();
				String contain = "";
				if(content.length()>50){
					contain = content.substring(0,50);
				}else {
					contain = content.substring(0,content.length()-1);
				}
				JSONObject json = new JSONObject();
				json.put("name", temp[0]);
				json.put("photo", temp[1]);
				json.put("id", temp[2]);
//				json.put("content", temp[3]);
				json.put("content", content);
				json.put("content", contain);
				json.put("czrq", DateUtil.dateToStrLong((Date) temp[4]));
				json.put("level", temp[5]);
				array.put(json);

+ 48 - 48
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorGuidanceTempService.java

@ -81,7 +81,7 @@ public class DoctorGuidanceTempService extends BaseService {
     */
    public DoctorGuidanceTemp add(String doctor, String content,String modelName,String imagesUrl) {
        DoctorGuidanceTemp guidanceTemp = new DoctorGuidanceTemp();
        String imgsUrl = null;
        String imgsUrl = "";
        guidanceTemp.setCode(getCode());
        guidanceTemp.setOwner(doctor);
@ -91,10 +91,22 @@ public class DoctorGuidanceTempService extends BaseService {
        guidanceTemp.setModelName(modelName);
        try {
            imgsUrl = CommonUtil.copyTempImage(imagesUrl);
        } catch (Exception e) {
            e.printStackTrace();
            String[] images = imagesUrl.split(",");
            for (String image: images) {
                if (image.contains("http://")){
                    imgsUrl += image+",";
                }else {
                    try {
                        imgsUrl += CommonUtil.copyTempImage(image);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        if (imgsUrl.endsWith(",")){
            imgsUrl = imgsUrl.substring(0,imgsUrl.length()-1);
        }
        guidanceTemp.setImagesUrl(imgsUrl);
@ -153,60 +165,48 @@ public class DoctorGuidanceTempService extends BaseService {
     * @return
     */
    public List<Map<String,Object>> list(String doctor, String type,int pageSize,int pageNo) throws Exception {
//        List<DoctorGuidanceTemp> temps = null;
        Page<List<DoctorGuidanceTemp>> temps = null;
        Page<DoctorGuidanceTemp> temps = null;
        PageRequest pageRequest = new PageRequest(pageNo, pageSize);
        List<Map<String,Object>> listMap = new ArrayList<>();
        if (type.equals("1")) {
            temps = guidanceTempDao.findByOwner("system",pageRequest);
            /*for(List<DoctorGuidanceTemp> te : temps){
                for (DoctorGuidanceTemp temp : te){
                    Map<String,Object> tem = new HashMap<>();
                    tem.put("code",temp.getCode());
                    tem.put("owner",temp.getOwner());
                    tem.put("sendTimes",temp.getSendTimes());
                    tem.put("lastTime",temp.getLastTime());
                    tem.put("modelName",temp.getModelName());
                    listMap.add(tem);
                }
            }*/
            List<List<DoctorGuidanceTemp>> temd = temps.getContent();
            for (int i=0;i<temd.size();i++){
                DoctorGuidanceTemp doctorGuidanceTemp = (DoctorGuidanceTemp)temd.get(i);
                Map<String,Object> tem = new HashMap<>();
                tem.put("code",doctorGuidanceTemp.getCode());
                tem.put("owner",doctorGuidanceTemp.getOwner());
                tem.put("sendTimes",doctorGuidanceTemp.getSendTimes());
                tem.put("lastTime",doctorGuidanceTemp.getLastTime());
                tem.put("modelName",doctorGuidanceTemp.getModelName());
                listMap.add(tem);
            }
           List<DoctorGuidanceTemp> list = temps.getContent();
           for (int i=0;i<list.size();i++){
               DoctorGuidanceTemp dgt = list.get(i);
               Map<String,Object> tem = new HashMap<>();
               tem.put("code",dgt.getCode());
               tem.put("owner",dgt.getOwner());
               tem.put("sendTimes",dgt.getSendTimes());
               tem.put("lastTime",dgt.getLastTime());
               tem.put("modelName",dgt.getModelName());
               listMap.add(tem);
           }
        } else if (type.equals("2")) {
            temps = guidanceTempDao.findByOwner(doctor,pageRequest);
            List<List<DoctorGuidanceTemp>> temd = temps.getContent();
            for (int i=0;i<temd.size();i++){
                DoctorGuidanceTemp doctorGuidanceTemp = (DoctorGuidanceTemp)temd.get(i);
                    Map<String,Object> tem = new HashMap<>();
                    tem.put("code",doctorGuidanceTemp.getCode());
                    tem.put("owner",doctorGuidanceTemp.getOwner());
                    tem.put("sendTimes",doctorGuidanceTemp.getSendTimes());
                    tem.put("lastTime",doctorGuidanceTemp.getLastTime());
                    tem.put("modelName",doctorGuidanceTemp.getModelName());
                    listMap.add(tem);
            List<DoctorGuidanceTemp> list = temps.getContent();
            for (int i=0;i<list.size();i++){
                DoctorGuidanceTemp dgt = list.get(i);
                Map<String,Object> tem = new HashMap<>();
                tem.put("code",dgt.getCode());
                tem.put("owner",dgt.getOwner());
                tem.put("sendTimes",dgt.getSendTimes());
                tem.put("lastTime",dgt.getLastTime());
                tem.put("modelName",dgt.getModelName());
                listMap.add(tem);
            }
        } else {
            temps = guidanceTempDao.findByOwnerAndSystem(doctor,pageRequest);
            List<List<DoctorGuidanceTemp>> temd = temps.getContent();
            for (int i=0;i<temd.size();i++){
                DoctorGuidanceTemp doctorGuidanceTemp = (DoctorGuidanceTemp)temd.get(i);
            List<DoctorGuidanceTemp> list = temps.getContent();
            for (int i=0;i<list.size();i++){
                DoctorGuidanceTemp dgt = list.get(i);
                Map<String,Object> tem = new HashMap<>();
                tem.put("code",doctorGuidanceTemp.getCode());
                tem.put("owner",doctorGuidanceTemp.getOwner());
                tem.put("sendTimes",doctorGuidanceTemp.getSendTimes());
                tem.put("lastTime",doctorGuidanceTemp.getLastTime());
                tem.put("modelName",doctorGuidanceTemp.getModelName());
                tem.put("code",dgt.getCode());
                tem.put("owner",dgt.getOwner());
                tem.put("sendTimes",dgt.getSendTimes());
                tem.put("lastTime",dgt.getLastTime());
                tem.put("modelName",dgt.getModelName());
                listMap.add(tem);
            }
        }