zhizhi wu 5 years ago
parent
commit
d49530cc1f
  1. 70
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/OtherRecordsService.java

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

@ -1,5 +1,6 @@
package com.ccsens.wisdomcar.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import com.ccsens.util.StringUtil;
@ -9,7 +10,9 @@ import com.ccsens.wisdomcar.bean.po.PatientInformationRecordExample;
import com.ccsens.wisdomcar.bean.po.PatientWisdomCar;
import com.ccsens.wisdomcar.bean.po.PatientWisdomCarExample;
import com.ccsens.wisdomcar.bean.vo.OtherRecordsVo;
import com.ccsens.wisdomcar.bean.vo.ProjectVo;
import com.ccsens.wisdomcar.persist.dao.PatientWisdomCarDao;
import com.ccsens.wisdomcar.persist.dao.StepTaskDao;
import com.ccsens.wisdomcar.persist.mapper.PatientInformationRecordMapper;
import com.ccsens.wisdomcar.persist.mapper.PatientWisdomCarMapper;
import com.ccsens.wisdomcar.persist.mapper.WisdomCarMapper;
@ -38,6 +41,8 @@ public class OtherRecordsService implements IOtherRecordsService {
@Resource
private PatientWisdomCarDao patientWisdomCarDao;
@Resource
private StepTaskDao stepTaskDao;
@Resource
private PatientInformationRecordMapper patientInformationRecordMapper;
@ -48,48 +53,53 @@ public class OtherRecordsService implements IOtherRecordsService {
@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().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.insertSelective(patientInformationRecord);
}
}
if(!StringUtil.isEmpty(param.getRecords())) { //判断是否是记录是否为空
//拿到患者平车id
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarTaskId(param.getId());
if (bindCar == null) {
log.info("没有找到绑定的平车信息:{}", param);
return ;
}
//判断是否是图片是否为空
if (CollectionUtil.isNotEmpty(param.getPictures())){
for (int i = 0; i < param.getPictures().size(); i++) {
PatientInformationRecord patientInformationRecord = new PatientInformationRecord();
patientInformationRecord.setId(snowflake.nextId());
patientInformationRecord.setPatientCarId(longs.get(0));
patientInformationRecord.setPatientCarId(bindCar.getId());
patientInformationRecord.setTaskSubId(param.getId());
patientInformationRecord.setInformationType((byte) 1); //上传记录
patientInformationRecord.setContent(param.getRecords()); //拿到记录 存到库里面
patientInformationRecord.setRecStatus((byte) 0);
//上传图片
patientInformationRecord.setInformationType((byte) 0);
//拿到图片 存到库里面
patientInformationRecord.setContent(param.getPictures().get(i));
patientInformationRecordMapper.insertSelective(patientInformationRecord);
}
}
//判断是否是记录是否为空
if(!StringUtil.isEmpty(param.getRecords())) {
PatientInformationRecord patientInformationRecord = new PatientInformationRecord();
patientInformationRecord.setId(snowflake.nextId());
patientInformationRecord.setPatientCarId(bindCar.getId());
patientInformationRecord.setTaskSubId(param.getId());
patientInformationRecord.setInformationType((byte) 1);
patientInformationRecord.setContent(param.getRecords());
patientInformationRecordMapper.insertSelective(patientInformationRecord);
}
}
@Override
public List<OtherRecordsVo.Query> query(OtherRecordsDto.Query param) {
List<OtherRecordsVo.Query> patientInformationRecordList = new ArrayList<>();
//通过任务id 找到创建的最新的
List<Long> longs = patientWisdomCarDao.queryByNew(param.getId()); //拿到患者平车id
if(ObjectUtil.isNotNull(longs)){
PatientInformationRecordExample patientInformationRecordExample = new PatientInformationRecordExample();
patientInformationRecordExample.createCriteria().andPatientCarIdEqualTo(longs.get(0)).andTaskSubIdEqualTo(param.getId());
List<PatientInformationRecord> patientInformationRecords = patientInformationRecordMapper.selectByExample(patientInformationRecordExample);
for (PatientInformationRecord patientInformationRecord : patientInformationRecords) {
OtherRecordsVo.Query query = new OtherRecordsVo.Query();
query.setComment(patientInformationRecord.getContent());
query.setType(patientInformationRecord.getInformationType());
patientInformationRecordList.add(query);
}
//拿到患者平车id
PatientInformationRecordExample patientInformationRecordExample = new PatientInformationRecordExample();
patientInformationRecordExample.createCriteria().andTaskSubIdEqualTo(param.getId());
List<PatientInformationRecord> patientInformationRecords = patientInformationRecordMapper.selectByExample(patientInformationRecordExample);
for (PatientInformationRecord patientInformationRecord : patientInformationRecords) {
OtherRecordsVo.Query query = new OtherRecordsVo.Query();
query.setComment(patientInformationRecord.getContent());
query.setType(patientInformationRecord.getInformationType());
patientInformationRecordList.add(query);
}
return patientInformationRecordList;
}

Loading…
Cancel
Save