bug 处理

This commit is contained in:
13405411873 2025-04-14 23:42:59 +08:00
parent 0f250c71fc
commit 8539cf87a0
5 changed files with 390 additions and 280 deletions

View File

@ -56,9 +56,8 @@ public class PatientScriptController extends BaseController {
* @return 新增结果
*/
@PostMapping("/add")
public AjaxResult insert(@RequestBody PatientScript patientScript) throws IOException, InterruptedException {
patientScript.setIsAll("1");
return toAjax(this.patientScriptService.save(patientScript));
public AjaxResult insert(@RequestBody List<PatientScript> patientScripts) throws IOException, InterruptedException {
return toAjax(this.patientScriptService.saveBatch(patientScripts));
}

View File

@ -25,5 +25,8 @@ public interface PatientScriptService {
void exportReport2(HttpServletResponse response, Long reportId) throws Exception;
Boolean saveBatch(List<PatientScript> patientScripts) ;
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.script.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.data.Pictures;
@ -9,6 +10,7 @@ import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfChunk;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfWriter;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.script.entity.MriInfo;
import com.ruoyi.script.entity.PatientScript;
import com.ruoyi.script.mapper.PatientScriptMapper;
@ -30,6 +32,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -185,16 +188,13 @@ public class PatientScriptServiceImpl implements PatientScriptService {
@Override
public Boolean save(PatientScript patientScript) throws IOException, InterruptedException {
patientScript.setCreateId(1110L);
patientScript.setCreateTime(new Date());
patientScript.setStatus("生成中");
// 此处可以根据插入的实体信息使用自己的方式获取生成的 ID
scriptMapper.addData(patientScript);
// 多任务同时处理
taskExecutor.execute(new Runnable() {
@SneakyThrows
@Override
public void run() {
try {
if (!patientScript.getType().equals("mri")){
String unique_id = generateOtp();
String playground = "playground"+unique_id;
@ -269,6 +269,11 @@ public class PatientScriptServiceImpl implements PatientScriptService {
scriptMapper.updateStatus(patientScript);
}
}catch (Exception e){
patientScript.setStatus("生成异常");
scriptMapper.updateStatus(patientScript);
}
}
});
@ -680,6 +685,40 @@ public class PatientScriptServiceImpl implements PatientScriptService {
}
@Override
public Boolean saveBatch(List<PatientScript> patientScripts) {
for (PatientScript patientScript : patientScripts) {
patientScript.setIsAll("1");
patientScript.setStatus("待生成");
patientScript.setCreateId(SecurityUtils.getUserId());
patientScript.setCreateTime(new Date());
scriptMapper.addData(patientScript);
}
return true;
}
// 每半小时执行一次
@Scheduled(cron = "0 0/3 * * * ?")
public void scanData() throws IOException, InterruptedException {
PatientScript patientScript =new PatientScript();
patientScript.setStatus("生成中");
List<PatientScript> patientScripts = scriptMapper.selectList(patientScript);
if (CollectionUtil.isNotEmpty(patientScripts)){
return;
}
PatientScript patientScript2 =new PatientScript();
patientScript2.setStatus("待生成");
List<PatientScript> patientScriptList = scriptMapper.selectList(patientScript2);
//获取最后一个
if (CollectionUtil.isNotEmpty(patientScriptList)){
PatientScript patientScript1 = patientScriptList.get(patientScriptList.size() - 1);
this.save(patientScript1);
}
}
@Override
public void exportReport(HttpServletResponse response, Long reportId) throws Exception {
PatientScript patientScript = scriptMapper.getById(reportId);

View File

@ -59,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="patientCard != null and patientCard != ''"> and patient_card like concat('%',#{patientCard},'%') </if>
<if test="scanDoctor != null and scanDoctor != ''"> and scan_doctor like concat('%',#{scanDoctor},'%') </if>
<if test="isAll != null and isAll != ''"> and is_all= #{isAll} </if>
<if test="status != null and status != ''"> and status= #{status} </if>
</where>
order by create_time desc
</select>

View File

@ -78,63 +78,95 @@
</el-table>
</el-dialog>
<!-- 添加或修改测评记录对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="1800px" append-to-body>
<div class="dialog_box">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="扫描文件" prop="filePath">
<brain-upload :limit="1" v-model="form.filePath" />
<div v-for="(item, index) in form" :key="index">
<div class="title_">患者{{index+1}}</div>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item :label="'扫描文件' " :prop="'items.' + index + '.filePath'" :rules="rules.filePath">
<brain-upload :limit="1" v-model="item.filePath" />
</el-form-item>
<el-form-item label="患者姓名" prop="patientName">
<el-input v-model="form.patientName" placeholder="请输入患者姓名" />
</el-col>
<el-col :span="6">
<el-form-item :label="'患者姓名' " :prop="'items.' + index + '.patientName'" :rules="rules.patientName">
<el-input v-model="item.patientName" placeholder="请输入患者姓名" />
</el-form-item>
<el-form-item label="患者年龄" prop="patientAge">
<el-input-number v-model="form.patientAge" placeholder="患者年龄" />
</el-col>
<el-col :span="6">
<el-form-item :label="'患者年龄' " :prop="'items.' + index + '.patientAge'" :rules="rules.patientAge">
<el-input-number v-model="item.patientAge" placeholder="患者年龄" />
</el-form-item>
<el-form-item label="性别" prop="patientSex">
<el-radio-group v-model="form.patientSex">
</el-col>
<el-col :span="6">
<el-form-item :label="'性别' " :prop="'items.' + index + '.patientSex'" :rules="rules.patientSex">
<el-radio-group v-model="item.patientSex">
<el-radio label="男"></el-radio>
<el-radio label="女"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="证件信息号" prop="patientCard">
<el-input v-model="form.patientCard" placeholder="证件信息号" />
</el-col>
<el-col :span="6">
<el-form-item :label="'证件信息号' " :prop="'items.' + index + '.patientCard'" :rules="rules.patientCard">
<el-input v-model="item.patientCard" placeholder="证件信息号" />
</el-form-item>
<el-form-item label="扫描时间" prop="scanTime">
</el-col>
<el-col :span="6">
<el-form-item :label="'扫描时间' " :prop="'items.' + index + '.scanTime'" :rules="rules.scanTime">
<el-date-picker
v-model="form.scanTime"
v-model="item.scanTime"
type="datetime"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="病历号" prop="blOrder">
<el-input v-model="form.blOrder" placeholder="病历号" />
</el-col>
<el-col :span="6">
<el-form-item :label="'病历号' " :prop="'items.' + index + '.blOrder'" :rules="rules.blOrder">
<el-input v-model="item.blOrder" placeholder="病历号" />
</el-form-item>
<el-form-item label="扫描地点" prop="scanPosition">
<el-input v-model="form.scanPosition" placeholder="扫描地点" />
</el-col>
<el-col :span="6">
<el-form-item :label="'扫描地点' " :prop="'items.' + index + '.scanPosition'" :rules="rules.scanPosition">
<el-input v-model="item.scanPosition" placeholder="扫描地点" />
</el-form-item>
<el-form-item label="扫描医生" prop="scanDoctor">
<el-input v-model="form.scanDoctor" placeholder="扫描医生" />
</el-col>
<el-col :span="6">
<el-form-item :label="'扫描医生' " :prop="'items.' + index + '.scanDoctor'" :rules="rules.scanDoctor">
<el-input v-model="item.scanDoctor" placeholder="扫描医生" />
</el-form-item>
<el-form-item label="诊断医师" prop="zdDoctor">
<el-input v-model="form.zdDoctor" placeholder="诊断医师" />
</el-col>
<el-col :span="6">
<el-form-item :label="'诊断医师' " :prop="'items.' + index + '.zdDoctor'" :rules="rules.zdDoctor">
<el-input v-model="item.zdDoctor" placeholder="诊断医师" />
</el-form-item>
<el-form-item label="审核医生" prop="shDoctor">
<el-input v-model="form.shDoctor" placeholder="审核医生" />
</el-col>
<el-col :span="6">
<el-form-item :label="'审核医生' " :prop="'items.' + index + '.shDoctor'" :rules="rules.shDoctor">
<el-input v-model="item.shDoctor" placeholder="审核医生" />
</el-form-item>
</el-col>
<div class="right_button">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="removeItem(index)">删除</el-button>
</div>
</el-row>
</div>
<el-form-item>
<el-button type="primary" @click="addItem">添加行</el-button>
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listRecord,
@ -203,19 +235,14 @@
pageSize: 10,
},
//
form: {
form: [
{
patientSex: '男',
scanTime: ''
},
}
],
//
rules: {
scanPosition: [
{
required: true,
message: "扫描地点不能为空",
trigger: "blur",
},
],
filePath: [
{
required: true,
@ -223,6 +250,14 @@
trigger: "blur",
},
],
scanPosition: [
{
required: true,
message: "扫描地点不能为空",
trigger: "blur",
},
]
},
jsonOpen: false,
jsonData: {},
@ -250,8 +285,12 @@
},
//
reset() {
this.form = {
};
this.form = [
{
patientSex: '男',
scanTime: ''
}
];
this.resetForm("form");
},
/** 搜索按钮操作 */
@ -281,37 +320,40 @@
this.reset();
const recordId = row.id || this.ids
getRecord(recordId).then(response => {
this.form = response.data;
this.form = [response.data];
this.open = true;
this.title = "修改测评记录";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.scanTime = dayjs(this.form.scanTime).format('YYYY-MM-DD HH:mm:ss')
this.form.type = 'noDti'
if (this.form.recordId != null) {
updateRecord(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
//this.open = false;
this.getList();
});
} else {
addRecord(this.form).then(response => {
let flag = false;
this.form.forEach(it=>{
if (!it.filePath){
flag = true
this.$modal.msgError("请上传文件");
}
if (!it.scanPosition){
flag = true
this.$modal.msgError("请输入扫描地点");
}
})
if (flag) return;
const formData = this.form.map(item => ({
...item,
scanTime: dayjs(item.scanTime).format('YYYY-MM-DD HH:mm:ss'),
type: 'noDti'
}));
addRecord(formData).then(response => {
this.$modal.msgSuccess("提交成功,请耐心等待结果");
//this.open = false;
this.open = false;
this.getList();
});
}
}
});
})
},
downImage(data) {
//
},
/** 删除按钮操作 */
handleDelete(row) {
@ -325,7 +367,6 @@
},
/** 导出按钮操作 */
handleExport() {
if (!this.queryParams.tableType || this.queryParams.tableType == null) {
this.$message.warning("请先选择类型")
return
@ -334,7 +375,6 @@
...this.queryParams
}, `record_${new Date().getTime()}.xls`)
},
exportReport(data) {
let id = data.id
exportReport(id).then(response => {
@ -342,7 +382,6 @@
let blob = new Blob([response], {
type: 'application/pdf' // pdf MIME
})
//console.log(blob)
let fileName = data.patientName + '_' + Date.parse(new Date()) + '.pdf'
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, fileName)
@ -355,7 +394,6 @@
window.URL.revokeObjectURL(link.href)
}
})
},
handleReview(jsonData, jsonType) {
this.jsonType = jsonType
@ -371,7 +409,37 @@
} else {
return score
}
},
addItem() {
this.form.push({
patientSex: '男',
scanTime: ''
});
},
removeItem(index) {
this.form.splice(index, 1);
}
}
};
</script>
<style scoped>
.dialog_box{
width: 100%;
box-sizing: border-box;
padding: 10px;
}
.right_button{
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
padding-right: 12px;
}
.title_{
font-size: 16px;
font-weight: 600;
margin-left: 45px;
margin-bottom: 10px;
}
</style>