Parcourir la 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 il y a 7 ans
Parent
commit
3e9311d828

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

@ -128,7 +128,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query(" select a from Message a where a.type=?2 and a.del='1' and a.read=1 and a.receiver=?1 and a.over='1' order by a.createTime desc ")
    List<Message> findUnReadByReceiverAndType(String receiver,Integer type);
    @Query("select a from Message a where a.receiver = ?1 and a.state = 1 and a.over = ?2 and a.type in (16,20,22,23) order by a.czrq desc")
    @Query("select a from Message a where a.read = 1 and a.receiver = ?1 and a.state = 1 and a.over = ?2 and a.type in (16,20,22,23) order by a.czrq desc")
    List<Message> getSpecialistApply(String receiver,String over);
    @Query("select a from Message a where a.receiver = ?1 and a.state = 1 and a.type = 17 order by a.czrq desc")
@ -158,6 +158,9 @@ 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 in (19,21) order by a.czrq desc")
    List<Message> getSpecialistUnRead(String receiver);
    @Query("select a from Message a where a.read = 1 and a.receiver = ?1 and a.state = 1 and a.type in (19,20,21,22,23) order by a.czrq desc")
    List<Message> getSpecialistUnRead2(String receiver);
    @Query("update Message a set a.read=0,a.over = '0' where a.id = ?1")
    @Modifying

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

@ -111,7 +111,7 @@ public class MessageService extends BaseService {
    /**
     * 查询医生未读消息和最后消息
     */
    public JSONObject findDoctorAllMessage(String doctor,Integer type) throws Exception {
    public JSONObject findDoctorAllMessage(String doctor,Integer type,Integer flag) throws Exception {
        // 签约未读消息总数
        int sign = messageDao.amountUnreadByReceiver(doctor);
        JSONObject signJson = new JSONObject();
@ -252,8 +252,14 @@ public class MessageService extends BaseService {
            familyMesJson.put("amount", 0);
        }
        //专科消息
        List<Message> specialistList = messageDao.getSpecialistUnRead(doctor);
        List<Message> specialistList = null;
        if (flag == 1){
            specialistList = messageDao.getSpecialistUnRead(doctor);
        }else if (flag == 2){
            specialistList = messageDao.getSpecialistUnRead2(doctor);
        }
        JSONObject specialistMesJson = new JSONObject();
        JSONArray jsonArray = new JSONArray();
        if (specialistList != null && specialistList.size() > 0) {
@ -621,7 +627,7 @@ public class MessageService extends BaseService {
     *
     * @param doctor
     */
    public String setMessageReaded(String doctor,List<Integer> types) {
    public String setMessageReaded(String doctor,List<Integer> types,Integer flag) {
        StringBuffer buffer = new StringBuffer();
        buffer.append("type in (");
        for (int i = 0;i<types.size();i++){
@ -630,14 +636,19 @@ public class MessageService extends BaseService {
        buffer.deleteCharAt(buffer.length()-1);
        buffer.append(")");
        int i = 0;
        if (types.contains(19)&&types.contains(21)){
        if (flag == 1){
            String sql = " update wlyy_message a set a.has_read = 0,a.over = '0' where a.receiver = '"+doctor+"' and "+buffer;
            i = jdbcTemplate.update(sql);
        }else {
            String sql1 = " update wlyy_message a set a.has_read = 0,a.over = '0' where a.receiver = '"+doctor+"' and type = 20";
            i=jdbcTemplate.update(sql1);
            String sql2 = "update wlyy_message a set a.has_read = 0 where a.receiver = '"+doctor+"' and type IN (22,23)";
            i=jdbcTemplate.update(sql2);
        }else if (flag == 2){
            if (types.contains(19)&&types.contains(21)){
                String sql = " update wlyy_message a set a.has_read = 0,a.over = '0' where a.receiver = '"+doctor+"' and "+buffer;
                i = jdbcTemplate.update(sql);
            }else {
                String sql1 = " update wlyy_message a set a.has_read = 0,a.over = '0' where a.receiver = '"+doctor+"' and type = 20";
                i=jdbcTemplate.update(sql1);
                String sql2 = "update wlyy_message a set a.has_read = 0 where a.receiver = '"+doctor+"' and type IN (22,23)";
                i=jdbcTemplate.update(sql2);
            }
        }
        return Integer.toString(i);

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

@ -554,6 +554,7 @@ public class RehabilitationManageService extends BaseService {
                String serviceItemId = object.getString("service_item_id");
                String title = object.getString("title");
                Patient p = patientDao.findByCode(patient);
                Doctor doctor1 = doctorDao.findByCode(doctor);
                String patientName = p.getName();
                String openId = p.getOpenid();
                WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_service","fwxmpj");
@ -563,7 +564,7 @@ public class RehabilitationManageService extends BaseService {
                JSONObject json = new JSONObject();
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                json.put("keyword1", title);
                json.put("keyword2",doctor);
                json.put("keyword2",doctor1.getName());
                json.put("keyword3", sdf.format(new Date()));
                json.put("toUser", p.getCode());
                json.put("represented",p.getCode());//被代理人

+ 1 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/messages/ImMessageController.java

@ -1,17 +1,12 @@
package com.yihu.wlyy.web.common.messages;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.service.app.message.MessageService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -19,9 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping(value = "/im/common/message", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-消息")
@ -36,7 +28,7 @@ public class ImMessageController extends BaseController {
    public String messages(@ApiParam(name = "type", value = "文章审核的时候必传,消息类型,14:提交文章审核,15:审核结果")
                               @RequestParam(value = "type", required = false,defaultValue = "15") Integer type) {
        try {
            JSONObject json = messageService.findDoctorAllMessage(getUID(),type);
            JSONObject json = messageService.findDoctorAllMessage(getUID(),type,1);
            return write(200, "获取消息总数成功!", "data", json);
        } catch (Exception e) {
            error(e);

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

@ -52,9 +52,11 @@ public class DoctorMessageController extends BaseController {
    @ResponseBody
    @ApiOperation("查询医生未读消息和最后消息")
    public String messages(@ApiParam(name = "type", value = "文章审核的时候必传,消息类型,14:提交文章审核,15:审核结果")
                               @RequestParam(value = "type", required = false) Integer type) {
                               @RequestParam(value = "type", required = false) Integer type,
    @ApiParam(name = "flag", value = "标识家医/专科")
    @RequestParam(value = "flag", required = false) Integer flag) {
        try {
            JSONObject json = messageService.findDoctorAllMessage(getUID(),type);
            JSONObject json = messageService.findDoctorAllMessage(getUID(),type,flag);
            return write(200, "获取消息总数成功!", "data", json);
        } catch (Exception e) {
            error(e);
@ -716,14 +718,16 @@ public class DoctorMessageController extends BaseController {
    @ResponseBody
    @ApiOperation("一键已读" )
    public String setMessageRead(@ApiParam(name = "types",value = "消息集合")
                                     @RequestParam(value = "types")String types) {
                                     @RequestParam(value = "types")String types,
                                 @ApiParam(name = "flag",value = "标识家医/专科")
                                 @RequestParam(value = "flag")Integer flag) {
        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));
            return write(200, "获取消息总数成功!", "data", messageService.setMessageReaded(getUID(),typeList,flag));
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());