Sfoglia il codice sorgente

Merge branch 'dev' of wangzhinan/patient-co-management into dev

huangwenjie 7 anni fa
parent
commit
19f3bdda79

+ 11 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Hospital.java

@ -38,6 +38,8 @@ public class Hospital extends IdEntity {
	private String townName;
	//级别,1医院,2社区医院
	private int level;
	//医院等级
	private int grade;
	//医院详细地址
	private String address;
	//医院简介
@ -169,6 +171,13 @@ public class Hospital extends IdEntity {
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	
	
	public int getGrade() {
		return grade;
	}
	public void setGrade(int grade) {
		this.grade = grade;
	}
}

+ 56 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/specialist/ServiceItemService.java

@ -140,4 +140,60 @@ public class ServiceItemService extends BaseService {
        }
        return JSONObject.parseObject(response);
    }
    /*public JSONObject importData(HttpServletRequest request) throws Exception {
        String response = null;
        String url =getBaseUrl() + "importData";
        JSONObject object =
        try {
            response = httpClientUtil.po;
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        return JSONObject.parseObject(response);
    }*/
   /* public boolean importData(Workbook workbook) {
        Sheet[] sheets = workbook.getSheets();
        Sheet sheet = sheets[0];
        int rows = ReadExcelUtil.getRightRows(sheet);
        for (int row = 1; row < rows; row++) {  //索引从0开始,第一行为标题
            Hospital hospital = new Hospital();
            Map<Integer, ExcelData> mapping = mapping(hospital);
            int finalRow = row;
            mapping.forEach((index, excelData) -> {
                String value = sheet.getCell(index, finalRow).getContents().trim();
                excelData.transform(value);
            });
            //Additional Handel
            String hospitalExist = this.isNameExist(hospital.getName());
            if (hospitalExist.equals("true")) {//机构存在,但是未判断wlyyRole是否存在
                hospital = hospitalDao.findByName(hospital.getName());
                WlyyRole wlyyRole = new WlyyRole();
                WlyyRole wlyyRole1 = wlyyRoleDao.findByName(hospital.getName());
                if(wlyyRole1==null){//不存在则保存
                    wlyyRole.setName(hospital.getName());
                    wlyyRole.setCode(hospital.getCode());
                    wlyyRole.setCzrq(new Date());
                    wlyyRoleDao.save(wlyyRole);
                }
                continue;
            }
            //机构不存在,先保存机构,在判断wlyyRole是否存在
            hospital.setDel("1");
            hospital = hospitalDao.save(hospital);
            WlyyRole wlyyRole = new WlyyRole();
            WlyyRole wlyyRole1 = wlyyRoleDao.findByName(hospital.getName());
            if(wlyyRole1==null){//不存在则保存
                wlyyRole.setName(hospital.getName());
                wlyyRole.setCode(hospital.getCode());
                wlyyRole.setCzrq(new Date());
                wlyyRoleDao.save(wlyyRole);
            }
        }
        return true;
    }*/
}

+ 13 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/HttpClientUtil.java

@ -170,4 +170,17 @@ public class HttpClientUtil {
		restTemplate.put(url, formEntity, String.class);
	}
	public static String postBody(String url){
		RestTemplate restTemplate = new RestTemplate();
		HttpHeaders headers = new HttpHeaders();
		MediaType type = MediaType.parseMediaType("application/json;charset=UTF-8");
		headers.setContentType(type);
		headers.add("Accept", MediaType.APPLICATION_JSON.toString());
		org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(headers);
		String ret = restTemplate.postForObject(url, formEntity, String.class);
		return ret;
	}
}

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

@ -87,6 +87,8 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Modifying
    int setMessageReaded(String doctor, Integer type);
    @Query("update Message a set a.read = 0,a.over = '0' where a.receiver = ?1 and a.type not in (1,2,6,7)")
    @Modifying
    int setSysMessageReaded(String doctor);
@ -133,7 +135,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("select a from Message a where a.read = 1 and a.receiver = ?1 and a.state = 1 and a.type = 18 order by a.czrq desc")
    List<Message> getFamilySign(String receiver);
    @Query("select a from Message a where a.receiver = ?1 and a.state = 1 and a.type in(18,19,20,21,22) and a.read = 1")
    @Query("select a from Message a where a.receiver = ?1 and a.state = 1 and a.type in(18,19,20,21,22)")
    List<Message> selectFamilySign(String receiver,Pageable pageableRequest);
    @Query("select a from Message a where a.read= ?2 and a.receiver = ?1 and a.state = 1 and a.over = ?3 and a.type = 17 order by a.czrq desc")

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

@ -582,6 +582,26 @@ public class MessageService extends BaseService {
        }
    }
    /**
     * 家医设置专科消息一键已读
     *
     * @param doctor
     */
    public String setMessageReaded(String doctor,List<Integer> types) {
        StringBuffer buffer = new StringBuffer();
        buffer.append("type in (");
        for (int i = 0;i<types.size();i++){
            buffer.append(types.get(i)+",");
        }
        buffer.deleteCharAt(buffer.length()-1);
        buffer.append(")");
        String sql = " update wlyy_message a set a.has_read = 0,a.over = '0' where a.receiver = ?1 and "+buffer;
        int i = jdbcTemplate.update(sql);
        return Integer.toString(i);
    }
    /**
     * 获取消息提醒设置
     * @param user

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

@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -621,4 +622,29 @@ public class DoctorMessageController extends BaseController {
        }
    }
    /**
     * 一键已读
     *
     * @param types
     * @return
     */
    @RequestMapping(value = "setMessageReads",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("专科医生待处理消息")
    public String setMessageRead(@ApiParam(name = "types",value = "消息集合")
                                     @RequestParam(value = "types")String types) {
        try {
            com.alibaba.fastjson.JSONArray array = com.alibaba.fastjson.JSONArray.parseArray(types);
            List<Integer> typeList = new ArrayList<>();
            for (int i=0;i<array.size();i++){
                typeList.add(array.getInteger(i));
            }
            return write(200, "获取消息总数成功!", "data", messageService.setMessageReaded(getUID(),typeList));
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
}