浏览代码

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

# Conflicts:
#	common/common-entity/sql记录
yeshijie 4 年之前
父节点
当前提交
c63bc2afa0

+ 1 - 1
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -947,7 +947,7 @@ public class ImService {
	 * 添加一条咨询记录
	 * @param patient 患者信息
	 * @param title 咨询标题
	 * @param type 咨询类型:9在线复诊,13专家咨询
	 * @param type 咨询类型:9在线复诊,13专家咨询,23在线咨询
	 * @return
	 */
	public ConsultDo addConsult(String patient, String title, String symptoms, String images, int type,String source) {

+ 7 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/DoctorConsultEndpoint.java

@ -79,14 +79,16 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
    public Envelop records(
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor",required = false) String doctor,
            @ApiParam(name = "title", value = "咨询标题关键字")
            @RequestParam(value = "title",required = false) String title,
            @ApiParam(name = "symptoms", value = "咨询内容")
            @RequestParam(value = "symptoms",required = false) String symptoms,
            @ApiParam(name = "name", value = "居民姓名")
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "id", value = "咨询ID")
            @RequestParam(value = "id",required = false) String id,
            @ApiParam(name = "type", value = "咨询类型")
            @RequestParam(value = "type",required = true) String type,
            @ApiParam(name = "status", value = "咨询状态:0进行中,1已完成,-1患者取消,-2超时未响应自动关闭")
            @RequestParam(value = "status",required = true) Integer status,
            @RequestParam(value = "status",required = false) Integer status,
            @ApiParam(name = "start_time", value = "开始时间 YYYY-MM-DD HH:MM:SS")
            @RequestParam(value = "start_time",required = false) String start_time,
            @ApiParam(name = "end_time", value = "结束时间 YYYY-MM-DD HH:MM:SS")
@ -98,9 +100,8 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
    )throws Exception{
        try {
            List<Map<String,Object>>  data = imService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time);
            Long total = imService.countConsultRecordByDoctor(doctor, id,type,status,title,start_time,end_time);
            List<Map<String,Object>>  data = consultService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, symptoms,start_time,end_time,name);
            Long total = consultService.countConsultRecordByDoctor(doctor, id,type,symptoms,status,start_time,end_time,name);
            JSONObject result = new JSONObject();
            result.put("total",total);

+ 7 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java

@ -122,16 +122,16 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@ApiOperation(value = "新增在线咨询")
	public Envelop addOnlineConsult(
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = false) String patient,
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name = "doctor", value = "医生CODE")
			@RequestParam(value = "doctor",required = true) String doctor,
			@ApiParam(name = "symptoms", value = "主述")
			@ApiParam(name = "symptoms", value = "咨询问题")
			@RequestParam(value = "symptoms",required = false) String symptoms,
			@ApiParam(name = "images", value = "图片")
			@RequestParam(value = "images",required = false) String images,
			@ApiParam(name = "voice", value = "语音")
			@RequestParam(value = "voice",required = false) String voice,
			@ApiParam(name = "type", value = "咨询类型:1专家咨询 14导诊助手 17专家视频咨询")
			@ApiParam(name = "type", value = "咨询类型:23在线咨询")
			@RequestParam(value = "type",required = false) Integer type,
			@ApiParam(name = "source", value = "咨询类型来源")
			@RequestParam(value = "source",required = false) String source)throws Exception{
@ -185,6 +185,8 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name = "title", value = "咨询标题关键字")
			@RequestParam(value = "title",required = false) String title,
			@ApiParam(name = "symptoms", value = "咨询内容")
			@RequestParam(value = "symptoms",required = false) String symptoms,
			@ApiParam(name = "id", value = "咨询ID")
			@RequestParam(value = "id",required = false) String id,
			@ApiParam(name = "type", value = "咨询类型")
@ -198,8 +200,8 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "doctorName", value = "医生名字")
			@RequestParam(value = "doctorName",required = false) String doctorName)throws Exception{
		try {
			List<Map<String,Object>>  data = consultService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,status,doctorName);
			Long total = imService.countConsultRecordByPatient(patient, id,type,title);
			List<Map<String,Object>>  data = consultService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,symptoms,status,doctorName);
			Long total = consultService.countConsultRecordByPatient(patient, id,type,title,symptoms,doctorName,status);
			JSONObject result = new JSONObject();
			result.put("total",total);

+ 117 - 10
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultService.java

@ -132,7 +132,8 @@ public class ConsultService {
     * @param doctorName 医生名字
     * @return
     */
    public List<Map<String,Object>>  findConsultRecordByPatient(String patient, String id,String type, int page,int pagesize, String title,Integer status,String doctorName) {
    public List<Map<String,Object>>  findConsultRecordByPatient(String patient, String id,String type, int page
            ,int pagesize, String title, String symptoms,Integer status,String doctorName) {
        String  sql = "SELECT " +
                "a.id AS \"id\"," +
@ -161,10 +162,13 @@ public class ConsultService {
            title="%"+title+"%";
            sql +=" and a.title like '"+title+"'";
        }
        if(!StringUtils.isEmpty(symptoms)){
            symptoms="%"+symptoms+"%";
            sql +=" and a.symptoms like '"+symptoms+"'";
        }
        if(!StringUtils.isEmpty(doctorName)){
            title="%"+doctorName+"%";
            sql +=" and d.name like '"+title+"'";
            doctorName="%"+doctorName+"%";
            sql +=" and d.name like '"+doctorName+"'";
        }
        //咨询状态
@ -182,6 +186,109 @@ public class ConsultService {
        return result;
    }
    /**
     * 查询患者所有的咨询记录总数
     * @param patient 患者标识
     * @param id 会话ID(等同IM表topicId)
     * @param type 咨询会话类型
     * @param title 标题关键字
     * @return
     */
    public Long countConsultRecordByPatient(String patient, String id,String type, String title,String symptoms,String doctorName,Integer status) {
        String  sql = "SELECT " +
                " COUNT(1) AS \"total\" " +
                "FROM wlyy_consult a," +
                "wlyy_consult_team b," +
                "base_doctor d " +
                "WHERE a.id=b.consult " +
                "AND b.doctor=d.id AND a.patient='"+patient+"' AND a.type in ("+type+") ";
        if(!StringUtils.isEmpty(title)){
            title="%"+title+"%";
            sql +=" and a.title like '"+title+"'";
        }
        if(!StringUtils.isEmpty(symptoms)){
            symptoms="%"+symptoms+"%";
            sql +=" and a.symptoms like '"+symptoms+"'";
        }
        if(!StringUtils.isEmpty(doctorName)){
            doctorName="%"+doctorName+"%";
            sql +=" and d.name like '"+doctorName+"'";
        }
        //咨询状态
        if(status != null && status != 0){
            sql +=" and b.status ="+status;
        }
        if (!StringUtils.isEmpty(id)) {
            sql += " and a.id = '" + id + "'";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = Long.parseLong(rstotal.get(0).get("total").toString());
        }
        return count;
    }
    /**
     * 查询患者所有的咨询记录总数
     * @param doctor 患者标识
     * @param id 会话ID(等同IM表topicId)
     * @param type 咨询会话类型
     * @param symptoms 标题关键字
     * @return
     */
    public Long countConsultRecordByDoctor(String doctor, String id,String type, String symptoms,Integer status,String start_time,String end_time,String name) {
        String  sql = "SELECT " +
                " COUNT(1) AS \"total\" " +
                "FROM wlyy_consult a," +
                "wlyy_consult_team b," +
                "base_patient d " +
                "WHERE a.id=b.consult " +
                "AND b.patient=d.id AND b.doctor='"+doctor+"' AND a.type in ("+type+") ";
        if (!StringUtils.isEmpty(symptoms)) {
            symptoms = "%" + symptoms + "%";
            sql += " and a.symptoms like '" + symptoms + "'";
        }
        if (!StringUtils.isEmpty(name)) {
            name = "%" + name + "%";
            sql += " and b.name like '" + name + "'";
        }
        if (!StringUtils.isEmpty(start_time)) {
            sql += " and a.czrq >= '" + start_time + "'";
        }
        if (!StringUtils.isEmpty(end_time)) {
            sql += " and a.czrq <= '" + end_time + "'";
        }
        //咨询状态
        if (status != null) {
            sql += " and b.status = "+status;
        }
        //咨询类型
        if (!StringUtils.isEmpty(type)) {
            sql += " AND a.type in (" + type + ")";
        }
        if (!StringUtils.isEmpty(id)) {
            sql += " and a.id = '" + id + "'";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = Long.parseLong(rstotal.get(0).get("total").toString());
        }
        return count;
    }
    /**
     * 查询医生所有的咨询记录
     * @param doctor 医生标识
@ -189,7 +296,7 @@ public class ConsultService {
     * @param type 咨询会话类型 : 0 全部
     * @param status 咨询状态:0全部,1候诊中,2就诊中,3结束
     * @param pagesize 分页大小
     * @param title 标题关键字
     * @param symptoms 标题关键字
     * @param start_time 开始时间
     * @param end_time 结束时间
     * @return
@ -197,7 +304,7 @@ public class ConsultService {
    public List<Map<String,Object>>  findConsultRecordByDoctor(String doctor, String id,
                                                               String type, Integer status,
                                                               int page,int pagesize,
                                                               String title,String start_time,String end_time) {
                                                               String symptoms,String start_time,String end_time,String name) {
        String sql = "SELECT " +
                    "a.id AS \"id\"," +
                    "a.type AS \"type\"," +
@ -222,9 +329,9 @@ public class ConsultService {
                sql += " AND b.doctor='" + doctor + "' ";
            }
            if (!StringUtils.isEmpty(title)) {
                title = "%" + title + "%";
                sql += " and a.symptoms like '" + title + "'";
            if (!StringUtils.isEmpty(symptoms)) {
                symptoms = "%" + symptoms + "%";
                sql += " and a.symptoms like '" + symptoms + "'";
            }
            if (!StringUtils.isEmpty(start_time)) {
                sql += " and a.czrq >= '" + start_time + "'";
@ -422,7 +529,7 @@ public class ConsultService {
                "AND a.patient= '" +patient+"' "+
//                "AND b.to_doctor='" +doctor+"' "+
                "AND a.del='1' " +
                "AND type = 23" +
                "AND type = 23 " +
                "AND a.status=0";
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);