Browse Source

上传图片和记录测通

recovery
hyy-alt 4 years ago
parent
commit
2d23aa8691
  1. 19
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/OtherRecordsService.java

19
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/OtherRecordsService.java

@ -1,6 +1,8 @@
package com.ccsens.wisdomcar.service;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import com.ccsens.util.StringUtil;
import com.ccsens.wisdomcar.bean.dto.OtherRecordsDto;
import com.ccsens.wisdomcar.bean.po.PatientInformationRecord;
import com.ccsens.wisdomcar.bean.po.PatientInformationRecordExample;
@ -39,31 +41,36 @@ public class OtherRecordsService implements IOtherRecordsService {
@Resource
private PatientInformationRecordMapper patientInformationRecordMapper;
@Resource
private Snowflake snowflake;
@Override
public void upload(OtherRecordsDto.PicturesAndRecords param) {
//通过t_patient_information_record里面的分解任务id 找到患者平车id 最新的 拿到患者平车id t_patient_information_record
List<Long> longs = patientWisdomCarDao.queryByNew(param.getId()); //拿到患者平车id
if(ObjectUtil.isNotNull(longs)){
if(param.getPictures().isEmpty()){ //判断是否是图片是否为空
if(param.getPictures().size()!=0){ //判断是否是图片是否为空
for (int i = 0; i < param.getPictures().size(); i++) {
PatientInformationRecord patientInformationRecord = new PatientInformationRecord();
patientInformationRecord.setId(snowflake.nextId());
patientInformationRecord.setPatientCarId(longs.get(0));
patientInformationRecord.setTaskSubId(param.getId());
patientInformationRecord.setInformationType((byte) 0); //上传图片
patientInformationRecord.setContent(param.getPictures().get(i)); //拿到图片 存到库里面
patientInformationRecord.setRecStatus((byte) 0);
patientInformationRecordMapper.insert(patientInformationRecord);
patientInformationRecordMapper.insertSelective(patientInformationRecord);
}
}
if(param.getRecords().isEmpty()) { //判断是否是记录是否为空
if(!StringUtil.isEmpty(param.getRecords())) { //判断是否是记录是否为空
PatientInformationRecord patientInformationRecord = new PatientInformationRecord();
patientInformationRecord.setId(snowflake.nextId());
patientInformationRecord.setPatientCarId(longs.get(0));
patientInformationRecord.setTaskSubId(param.getId());
patientInformationRecord.setInformationType((byte) 1); //上传记录
patientInformationRecord.setContent(param.getRecords()); //拿到记录 存到库里面
patientInformationRecord.setRecStatus((byte) 0);
patientInformationRecordMapper.insert(patientInformationRecord);
patientInformationRecordMapper.insertSelective(patientInformationRecord);
}
}
}
@ -77,13 +84,11 @@ public class OtherRecordsService implements IOtherRecordsService {
PatientInformationRecordExample patientInformationRecordExample = new PatientInformationRecordExample();
patientInformationRecordExample.createCriteria().andPatientCarIdEqualTo(longs.get(0)).andTaskSubIdEqualTo(param.getId());
List<PatientInformationRecord> patientInformationRecords = patientInformationRecordMapper.selectByExample(patientInformationRecordExample);
int i=0;
for (PatientInformationRecord patientInformationRecord : patientInformationRecords) {
OtherRecordsVo.Query query = new OtherRecordsVo.Query();
query.setComment(patientInformationRecord.getContent());
query.setType(patientInformationRecord.getInformationType());
i++;
patientInformationRecordList.set(i,query);
patientInformationRecordList.add(query);
}
}
return patientInformationRecordList;

Loading…
Cancel
Save