Ver código fonte

修改线上就诊消息接口

mengkang 5 anos atrás
pai
commit
015aa61c31

+ 8 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/SystemMessageDao.java

@ -1,9 +1,12 @@
package com.yihu.jw.hospital.message.dao;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import org.hibernate.annotations.SQLUpdate;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@ -18,4 +21,9 @@ public interface SystemMessageDao extends PagingAndSortingRepository<SystemMessa
    @Query("from SystemMessageDO p where p.id = ?1")
    SystemMessageDO queryById(String id);
    @Modifying
    @Transactional
    @Query(value = "update SystemMessageDO p set p.read=?2 where p.id=?1",nativeQuery = true)
    void updateStatus(String id,String read);
}

+ 19 - 3
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/SystemMessageService.java

@ -2,13 +2,11 @@ package com.yihu.jw.hospital.message.service;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.UUID;
/**
 * @author zmk
@ -21,6 +19,22 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
    @Autowired
    private SystemMessageDao systemMessageDao;
    /**
     * 新增线上就诊消息
     * @param systemMessageDO
     * @return
     * @throws Exception
     */
    public SystemMessageDO addMessage(SystemMessageDO systemMessageDO) throws Exception{
            systemMessageDO.setRead("0");
            systemMessageDO.setDel("1");
            systemMessageDO.setCreateTime(new Date());
            systemMessageDO = systemMessageDao.save(systemMessageDO);
            return systemMessageDO;
    }
    /**
     * 更新线上就诊消息
     * @param id
@ -35,7 +49,9 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
        }
        systemMessageDO.setRead(read);
        systemMessageDO.setReadTime(new Date());
        systemMessageDO = systemMessageDao.save(systemMessageDO);
        systemMessageDao.save(systemMessageDO);
       /* systemMessageDao.updateStatus(id,read);*/
        return systemMessageDO;
    }

+ 21 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/SystemMessageController.java

@ -31,6 +31,25 @@ public class SystemMessageController extends EnvelopRestEndpoint {
    @Autowired
    private SystemMessageService systemMessageService;
    @PostMapping(value="/addMessage")
    @ApiOperation("新增线上就诊消息")
    public Envelop addMessage(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody SystemMessageDO systemMessageDO){
        try {
            SystemMessageDO messageDO = systemMessageService.addMessage(systemMessageDO);
            if (null == messageDO){
                return failed("新增失败");
            }
            return success("新增成功");
        }catch (Exception e){
            return failed("新增失败,"+e.getMessage());
        }
    }
    @PostMapping(value="/updateMessage")
    @ApiOperation("更新线上就诊消息")
    public Envelop updateMessage(
@ -82,8 +101,8 @@ public class SystemMessageController extends EnvelopRestEndpoint {
    @GetMapping(value ="/queryById")
    @ApiOperation(value = "获取线上就诊消息详情")
    public Envelop queryById(
            @ApiParam(name = "Id", value = "Id", required = true)
            @RequestParam(value = "Id", required = true)String id){
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id", required = true)String id){
        try {
            SystemMessageDO systemMessageDO = systemMessageService.queryById(id);
            if (null == systemMessageDO){