Kaynağa Gözat

医生端--血糖超标消息增加上次数值

hzp 8 yıl önce
ebeveyn
işleme
3d8926e8c3

+ 7 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java

@ -70,4 +70,11 @@ public interface DevicePatientHealthIndexDao
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.user=?1 and a.type=?2 order by a.record_date desc limit 0,1",nativeQuery = true)
	DevicePatientHealthIndex findLastData(String patient, Integer type);
	/**
	 * 上次血糖值
     */
	@Query("select a.value1 from DevicePatientHealthIndex a where a.type=1 and a.user = ?1 and a.id<?2 and a.value2 = ?3")
	String getPreValue(String user,Long id,String value2);
}

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

@ -40,7 +40,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query(" from Message a where a.read = 1 and over ='1' and a.sender = ?1 and a.receiver=?2 and a.signStatus='1'")
    Message findByPatient(String patient,String doctor);
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.sender=?2 and a.tzType=?3")
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.sender=?2 and a.tzType=?3 order by a.czrq desc")
    List<Message> getHealthIndexMessageByPatient(String doctor,String patient,String type,Pageable pageRequest);
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2) order by a.czrq desc")

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

@ -6,6 +6,9 @@ import javax.transaction.Transactional;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.health.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.deviece.DeviceDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.util.DateUtil;
@ -51,6 +54,9 @@ public class MessageService extends BaseService {
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private DevicePatientHealthIndexDao devicePatientHealthIndexDao;
    /**
     * IM消息数量
@ -273,7 +279,7 @@ public class MessageService extends BaseService {
     */
    public List<Map<String, Object>> getHealthIndexMessage(String doctor) throws Exception {
        List<Map<String, Object>> re = new ArrayList<>();
        String sql = "select a.sender,a.tz_type,count(1) count,max(date_format(a.czrq,'%Y-%c-%d %h:%i:%s')) last_time from wlyy_Message a where a.receiver='" + doctor + "' and a.has_read='1' and a.type='2' group by a.sender,a.tz_type order by last_time desc";
        String sql = "select a.sender,a.tz_type,count(1) count,max(date_format(a.czrq,'%Y-%c-%d %H:%i:%s')) last_time from wlyy_Message a where a.receiver='" + doctor + "' and a.has_read='1' and a.type='2' group by a.sender,a.tz_type order by last_time desc";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String, Object> item : list) {
@ -329,7 +335,16 @@ public class MessageService extends BaseService {
                map.put("read", String.valueOf(item.getRead()));
                map.put("sex", String.valueOf(item.getSex()));
                map.put("value1", String.valueOf(item.getValue1()));
                map.put("value2", String.valueOf(item.getValue2()));
                String value2 = String.valueOf(item.getValue2().intValue());
                map.put("value2",value2);
                //获取上次血糖值
                if("1".equals(type))
                {
                    String preValue = devicePatientHealthIndexDao.getPreValue(item.getSender(),Long.valueOf(item.getTzCode()),value2);
                    map.put("preValue",preValue);
                }
                map.put("czrq", DateUtil.dateToStrLong(item.getCzrq()));
                re.add(map);

+ 1 - 1
patient-co-wlyy/src/main/resources/system.properties

@ -50,7 +50,7 @@ chat_server=http://weixin.xmtyw.cn/res/chat/
sign_check_upload=http://172.19.103.87:8011/wlyy_service
# IM配置
im_list_get=http://192.168.131.109:3008/
im_list_get=http://172.19.103.29:3000/
im_group_server=http://172.19.103.29:3000/api/v1/chats/gm
msg_push_server=http://172.19.103.29:3000/api/v1/chats/sm