todo:营养餐

This commit is contained in:
ryoeiken 2021-01-15 17:43:45 +08:00
parent 4bb136057d
commit 3c47781540
4 changed files with 71 additions and 8 deletions

View File

@ -161,6 +161,13 @@ public class FtCateringDaoController extends BaseController {
System.out.println(ftCateringDao);
List<Long> patientIds = iFtCateringDaoService.notInTable(ftCateringDao);
List<FtCateringDao> ftCateringDaoList = iFtCateringDaoService.copyAndAdd(patientIds, ftCateringDao);
return null;
}
}

View File

@ -22,4 +22,8 @@ public interface IFtCateringDaoService extends IService<FtCateringDao> {
Integer deleteByPatientId(Long[] ids);
Integer cancelByPatientId(Long[] ids);
List<Long> notInTable(FtCateringDao ftCateringDao);
List<FtCateringDao> copyAndAdd(List<Long> patientIds, FtCateringDao ftCateringDao);
}

View File

@ -38,13 +38,9 @@ public class FtCateringDaoServiceImpl extends ServiceImpl<FtCateringDaoMapper, F
List<Integer> types = ftCateringDao.getTypes();
List<Long> patientIds = ftCateringDao.getPatientIds();
for (Long patientId : patientIds) {
for (int i = 1; i < 5; i++) {
FtCateringDao cateringDao = new FtCateringDao();
cateringDao.setPatientId(patientId);
cateringDao.setPatientId(ftCateringDao.getPatientId());
cateringDao.setNumber(ftCateringDao.getNumber());
cateringDao.setFrequency(ftCateringDao.getFrequency());
cateringDao.setCateringUsage(ftCateringDao.getCateringUsage());
@ -63,7 +59,6 @@ public class FtCateringDaoServiceImpl extends ServiceImpl<FtCateringDaoMapper, F
this.baseMapper.insert(cateringDao);
list.add(cateringDao);
}
}
return list;
}
@ -99,4 +94,59 @@ public class FtCateringDaoServiceImpl extends ServiceImpl<FtCateringDaoMapper, F
return rows;
}
@Override
public List<Long> notInTable(FtCateringDao ftCateringDao) {
List<Long> patientIds = ftCateringDao.getPatientIds();
List<Long> patientNotInTable = new ArrayList<>();
for (Long patientId : patientIds) {
QueryWrapper<FtCateringDao> wrapper = new QueryWrapper<>();
wrapper.eq("patient_id", patientId);
List<FtCateringDao> ftCateringDaoList = this.baseMapper.selectList(wrapper);
if (ftCateringDaoList.size() == 0) {
patientNotInTable.add(patientId);
}
}
return patientNotInTable;
}
@Override
public List<FtCateringDao> copyAndAdd(List<Long> patientIds, FtCateringDao ftCateringDao) {
List<FtCateringDao> list = new ArrayList<>();
List<Integer> types = ftCateringDao.getTypes();
for (Long patientId : patientIds) {
for (int i = 1; i < 5; i++) {
FtCateringDao cateringDao = new FtCateringDao();
cateringDao.setPatientId(patientId);
cateringDao.setNumber(ftCateringDao.getNumber());
cateringDao.setFrequency(ftCateringDao.getFrequency());
cateringDao.setCateringUsage(ftCateringDao.getCateringUsage());
cateringDao.setCreateAt(new Date());
cateringDao.setType(i);
for (Integer type : types) {
if (i == type) {
cateringDao.setFlag(true);
break;
} else {
cateringDao.setFlag(false);
}
}
this.baseMapper.insert(cateringDao);
list.add(cateringDao);
}
}
return list;
}
}

View File

@ -239,7 +239,7 @@
<el-select v-model="form.patientId" placeholder="请选择病人" @change="changePatient">
<el-option
v-for="item in patientOptions"
:key="item.name"
:key="item.patientId"
:label="item.name"
:value="item.patientId"
></el-option>
@ -758,8 +758,10 @@ export default {
},
//
changeDepart(value) {
const _this = this;
selectPatientByDepartId(value).then(response => {
this.patientOptions = response.data;
_this.patientOptions = response.data;
_this.form.patientId = null;
});
},
//