Browse Source

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

# Conflicts:
#	patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/specialty/index.jsp
wangzhinan 7 years ago
parent
commit
521993ffc2

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java

@ -30,7 +30,7 @@ public class Message extends IdEntity {
	/** type
	 *  消息类型(1.是家庭签约信息  2.体征消息  3分配健管师 4.随访提醒 5.咨询回复提醒,6.续方咨询待审核提醒,7.续方消息待取药
	 *  8.续方支付成功后团队长分配健管师,9线下调整完成,10意见反馈 11账号申诉,12.协同服务 13.孕检提醒 14.文章提交审核消息  15、健康文章审核结果
	 *  16.专科医生申请签约消息,17、家庭医生转诊预约消息,18、专科医生共管通知,:19 受理提醒,20 待办工作提醒 21 服务进展提醒-已完成 22 服务进展提醒-未完成 23 服务进展提醒-待完成 24、协同服务消息
	 *  16.专科医生申请签约消息,17、家庭医生转诊预约消息,18、专科医生共管通知,:19 受理提醒,20 待办工作提醒 21 服务进展提醒-已完成 22 服务进展提醒-未完成 23 服务进展提醒-待完成 24 收到协同任务 25 在线助手已接收 26 在线助手已退回 27 协同服务已完成
	 *  101患者申请取消签约、102患者同意取消签约、103患者拒绝取消签约、104患者填写了血糖记录、105患者填写了血压记录、106患者填写了体重记录、
	 *  107患者填写了腰围记录、108患者填写了运动记录、109患者填写了用药记录、110患者填写了饮食记录、111患者提交了问卷随访、112请求添加好友消息、
	 *  113入群消息、114群解散消息、115踢出群消息、116新的网络咨询、117网络咨询追问、

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

@ -60,13 +60,13 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @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,6,7,12,101,14,15,16,17,18,19,20,21,22,23,24) order by a.czrq desc")
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6,7,12,101,14,15,16,17,18,19,20,21,22,23,24,25,26,27) order by a.czrq desc")
    List<Message> getSystemMessageUnread(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.prescriptionStatus=?2 and a.type in (6,7) order by a.createTime desc")
    List<Message> getSysTemMessageByPrescription(String doctor, String prescriptionStatus);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7,12,101,14,15,301,16,17,18,19,20,21,22,23,24) and (a.del = '1' or a.del is null) ")
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7,12,101,14,15,301,16,17,18,19,20,21,22,23,24,25,26,27) and (a.del = '1' or a.del is null) ")
    List<Message> getSystemMessage(String doctor, Pageable pageRequest);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 and a.prescriptionStatus='0' ")
@ -170,4 +170,15 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Modifying
    int setSpecialistReadById(Long id);
    @Query("select a from Message a where a.read = 1 and a.receiver = ?1 and a.state = 1 and a.type in (24,25,26,27) order by a.czrq desc")
    List<Message> getSynergyService(String receiver);
    @Query("select a from Message a where  a.receiver = ?1 and a.state = 1 and a.type in (24,25,26,27) order by a.czrq desc")
    List<Message> getSynergyMessages(String receiver,Pageable pageable);
    @Query("update Message a set a.read = 0 where a.receiver = ?1 and a.type in (24,25,26,27)")
    @Modifying
    int setSynergyMessagesByRead(String doctor);
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -1150,7 +1150,7 @@ public class FamilyMemberService extends BaseService {
        }
        fm.setFamilyRelation(relation);
        fm.setCzrq(new Date());
        fm.setIsAuthorize(1);//默认授权
        fm.setIsAuthorize(0);//默认授权
        // 添加对方与自己的关系
        PatientFamilyMember fmt = memberDao.findByPatientAndFamilyMember(member, patient);
@ -1166,7 +1166,7 @@ public class FamilyMemberService extends BaseService {
        int relationTrans = familyRelationTrans(p, relation);
        fmt.setFamilyRelation(relationTrans);
        fmt.setCzrq(new Date());
        fmt.setIsAuthorize(1);//默认授权
        fmt.setIsAuthorize(0);//默认授权
        memberDao.save(fm);
        memberDao.save(fmt);

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/CreditLogService.java

@ -119,7 +119,7 @@ public class CreditLogService {
        object.put("filter",patientIds.toArray());
        object.put("page",page);
        object.put("size",size);
        String url = getBaseUrl() + "selectByRanking";
        String url = /*getBaseUrl()*/"http://localhost:10051/svr-health-bank/" + "selectByRanking";
        String response = null;
        JSONArray data =null;
        JSONObject object1 = null;
@ -288,7 +288,7 @@ public class CreditLogService {
        object.put("name",patient.getName());
        object.put("idCard",patient.getIdcard());
        String response = null;
        String url =getBaseUrl() + "selectAccount";
        String url =/*getBaseUrl()*/"http://localhost:10051/svr-health-bank/" + "selectAccount";
        Map<String,String> params = new HashMap<>();
        params.put("creditsDetail",object.toJSONString());
        try {

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

@ -279,6 +279,20 @@ public class MessageService extends BaseService {
            specialistMesJson.put("amount", 0);
        }
        List<Message> synergyList = new ArrayList<>();
        synergyList = messageDao.getSynergyService(doctor);
        JSONObject synergyMesJson = new JSONObject();
        if (synergyList != null && synergyList.size() > 0) {
            synergyMesJson.put("amount", synergyList.size());
            JSONObject  synergyJson = new JSONObject();
            synergyJson.put("title", synergyList.get(0).getTitle());
            synergyJson.put("type", synergyList.get(0).getType());
            synergyJson.put("msg", "您有"+synergyList.size()+"个专科服务消息,请查看!");
            synergyJson.put("msgTime", DateUtil.dateToStrLong(synergyList.get(0).getCreateTime()));
            synergyMesJson.put("lastMessage", synergyJson);
        }else{
            synergyMesJson.put("amount", 0);
        }
        JSONObject json = new JSONObject();
        json.put("imMsgCount", getImMsgAmount(doctor));//IM消息数量
@ -291,6 +305,7 @@ public class MessageService extends BaseService {
        json.put("deviceUnbind",deviceMesJson);//设备解绑消息
        json.put("familyList",familyMesJson);//居民签约申请
        json.put("specialistList",specialistMesJson);//专科服务消息
        json.put("synergyList",synergyMesJson);//协同服务消息
        return json;
    }
@ -1055,4 +1070,33 @@ public class MessageService extends BaseService {
        }
    }
    /**
     * 获取协同服务消息
     *
     * @param message
     * @param page
     * @param size
     * @return
     * @throws Exception
     */
    public List<Message> getSynergyMessages(Message message, Integer page, Integer size) throws Exception{
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC,"createTime");
        // 分页信息
        Pageable pageRequest = new PageRequest(page - 1, size, sort);
        return messageDao.getSynergyMessages(message.getReceiver(),pageRequest);
    }
    /**
     * 设置协同消息一键已读
     *
     * @param doctor
     * @return
     */
    public Integer setSynergyMessagesByRead(String doctor) {
      return   messageDao.setSynergyMessagesByRead(doctor);
    }
}

+ 23 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistEvaluateSevice.java

@ -183,10 +183,10 @@ public class SpecialistEvaluateSevice extends BaseService {
    }
    /**
     * 发送消息 type:19 受理提醒,20 待办工作提醒 21 服务进展提醒-已完成 22 服务进展提醒-未完成 23 服务进展提醒-待完成
     * 发送消息 type:19 受理提醒,20 待办工作提醒 21 服务进展提醒-已完成 22 服务进展提醒-未完成 23 服务进展提醒-待完成 24 收到协同任务 25 在线助手已接收 26 在线助手已退回 27 协同服务已完成
     */
    public JSONObject sendMessage(Message message,String hospitalCode,String patientCode,Integer num){
    public JSONObject sendMessage(Message message,String hospitalCode,String patientCode,Integer num,JSONObject jsonObject){
        JSONObject object = new JSONObject();
        try {
            Hospital hospital = null;
@ -225,6 +225,26 @@ public class SpecialistEvaluateSevice extends BaseService {
                message.setType(23);
                message.setTitle("康复计划-服务进展提醒");
                message.setContent("您的"+patient.getName()+"签约居民今日有"+num+"个康复计划项目待完成,请尽快处理");
            }else if (message.getType() == 24){
                message.setOver("1");
                message.setType(24);
                message.setTitle("收到协同任务");
                message.setContent("您接收到“"+jsonObject.getString("type")+"”协同服务:"+jsonObject.getString("content").substring(0,19));
            }else if (message.getType() == 25){
                message.setOver("1");
                message.setType(25);
                message.setTitle("在线助手已接收");
                message.setContent("您发起的“"+jsonObject.getString("type")+"”协同服务,已被在线助手接收,负责人:"+jsonObject.getString("customerName")+",联系方式:"+jsonObject.getString("phone")+"。");
            }else if (message.getType() == 26){
                message.setOver("1");
                message.setType(26);
                message.setTitle("在线助手已退回");
                message.setContent("您发起的“"+jsonObject.getString("type")+"”协同服务,已被在线助手退回。原因:"+jsonObject.getString("returnedRemark"));
            }else if (message.getType() == 27){
                message.setOver("1");
                message.setType(27);
                message.setTitle("协同服务已完成");
                message.setContent("您发起的“"+jsonObject.getString("type")+"”协同服务,已完成。");
            }
            message.setCode(getCode());
//            message.setSenderName(sendDoctor.getName());
@ -247,4 +267,5 @@ public class SpecialistEvaluateSevice extends BaseService {
        return object;
    }
}

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/rehabilitation/RehabilitationManageService.java

@ -629,7 +629,7 @@ public class RehabilitationManageService extends BaseService {
            message.setSender(patient);
            message.setReceiver(doctor);
            message.setRelationCode(planDetailId);
            specialistEvaluateSevice.sendMessage(message,hospotal,patient,null);
            specialistEvaluateSevice.sendMessage(message,hospotal,patient,null,null);
            //发送微信模板消息
            int evaluation = object.getInt("evaluation");
            if (evaluation == 1){
@ -703,7 +703,7 @@ public class RehabilitationManageService extends BaseService {
            message1.setType(type);
            message1.setReceiver(doctor);
            message1.setRelationCode(planDetailIds);
            specialistEvaluateSevice.sendMessage(message1,null,patient,num);
            specialistEvaluateSevice.sendMessage(message1,null,patient,num,null);
        }
    }
@ -802,7 +802,7 @@ public class RehabilitationManageService extends BaseService {
            message1.setType(type);
            message1.setReceiver(doctor);
            message1.setRelationCode(planDetailIds);
            specialistEvaluateSevice.sendMessage(message1,hospital,patient,num);
            specialistEvaluateSevice.sendMessage(message1,hospital,patient,num,null);
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/rehabilitation/RehabilitationPlanService.java

@ -162,7 +162,7 @@ public class RehabilitationPlanService extends BaseService {
                    message.setType(19);
                    message.setRelationCode(detail.getString("planId"));
                    message.setReceiver(detail.getString("doctor"));
                    specialistEvaluateSevice.sendMessage(message, detail.getString("hospital"), patient, null);
                    specialistEvaluateSevice.sendMessage(message, detail.getString("hospital"), patient, null,null);
                }
            }
            return rs.getString("message");

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

@ -692,7 +692,9 @@ public class DoctorMessageController extends BaseController {
                              @ApiParam(name = "patient",value = "居民code",required = true)
                              @RequestParam(value = "patient",required = true)String patient,
                              @ApiParam(name = "time",value = "时间",required = false)
                              @RequestParam(value = "time",required = false)Integer time) {
                              @RequestParam(value = "time",required = false)Integer time,
                              @ApiParam(name = "jsonObject",value = "参数",required = false)
                              @RequestParam(value = "jsonObject",required = false) String jsonObject){
        try {
            com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(message);
            Message message1 = new Message();
@ -700,7 +702,8 @@ public class DoctorMessageController extends BaseController {
            message1.setType(object.getInteger("type"));
            message1.setReceiver(object.getString("receiver"));
            message1.setRelationCode(object.getString("relationCode"));
            return write(200, "获取消息成功!","data",specialistEvaluateSevice.sendMessage(message1,hospital,patient,time));
            com.alibaba.fastjson.JSONObject jsonObject1 = com.alibaba.fastjson.JSONObject.parseObject(jsonObject);
            return write(200, "获取消息成功!","data",specialistEvaluateSevice.sendMessage(message1,hospital,patient,time,jsonObject1));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取消息失败!");
@ -759,5 +762,53 @@ public class DoctorMessageController extends BaseController {
    }
    /**
     * 获取协同服务消息列表
     *
     * @param message
     * @param page
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "getSynergyMessages",method = RequestMethod.GET)
    @ApiOperation("协同服务消息列表")
    @ResponseBody
    public String getSynergyMessage(@ApiParam(name = "message",value = "消息对象")@RequestParam(value = "message")String message,
                                       @ApiParam(name="page",value="第几页",defaultValue = "1") @RequestParam(value="page",required = true) String page,
                                       @ApiParam(name="pageSize",value="",defaultValue = "10") @RequestParam(value="pageSize",required = true) String pageSize){
        if (StringUtils.isBlank(pageSize)) {
            pageSize = "10";
        }
        if (page.equals("0")) {
            page = "1";
        }
        Message message1 = new Message();
        com.alibaba.fastjson.JSONObject object = JSON.parseObject(message);
        message1.setReceiver(getUID());
        try {
            return write(200,"查询成功!","data",messageService.getSynergyMessages(message1,Integer.valueOf(page),Integer.valueOf(pageSize)));
        }catch (Exception e){
            error(e);
            return error( -1, "查询失败!");
        }
    }
    /**
     * 设置协同消息已读
     * @return
     */
    @RequestMapping(value = "setSynergyMessagesByRead",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("设置协同消息已读" )
    public String setSynergyMessagesByRead() {
        try {
            return write(200, "获取消息总数成功!", "data", messageService.setSynergyMessagesByRead(getUID()));
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
}