|
@@ -153,8 +153,16 @@
|
|
|
<el-radio :label="'否'">否</el-radio>
|
|
<el-radio :label="'否'">否</el-radio>
|
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="过敏史" prop="historyAllergic">
|
|
|
|
|
- <el-input v-model="form.historyAllergic" placeholder="请输入过敏史"/>
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ label="过敏史"
|
|
|
|
|
+ prop="historyAllergic"
|
|
|
|
|
+ :required="form.isHistoryAllergic === '是'"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="form.historyAllergic"
|
|
|
|
|
+ placeholder="请输入过敏史"
|
|
|
|
|
+ :disabled="form.isHistoryAllergic === '否'"
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<!-- 定位在右下角的按钮 -->
|
|
<!-- 定位在右下角的按钮 -->
|
|
|
<el-button
|
|
<el-button
|
|
@@ -403,7 +411,7 @@
|
|
|
|
|
|
|
|
<!-- 搜索区域 -->
|
|
<!-- 搜索区域 -->
|
|
|
<el-form :model="commonDrugQuery" :inline="true" size="small" label-width="80px">
|
|
<el-form :model="commonDrugQuery" :inline="true" size="small" label-width="80px">
|
|
|
- <el-form-item label="药品名称" prop="diagnose">
|
|
|
|
|
|
|
+ <el-form-item label="药品名称" prop="drugName">
|
|
|
<el-input v-model="commonDrugQuery.drugName" placeholder="请输入药品名称" clearable
|
|
<el-input v-model="commonDrugQuery.drugName" placeholder="请输入药品名称" clearable
|
|
|
@keyup.enter.native="handleCommonPrescribeQuery"/>
|
|
@keyup.enter.native="handleCommonPrescribeQuery"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -495,6 +503,14 @@ export default {
|
|
|
},
|
|
},
|
|
|
name: "Prescribe",
|
|
name: "Prescribe",
|
|
|
data() {
|
|
data() {
|
|
|
|
|
+ // 自定义验证规则 - 过敏史条件验证
|
|
|
|
|
+ const validateAllergyHistory = (rule, value, callback) => {
|
|
|
|
|
+ if (this.form.isHistoryAllergic === '是' && !value) {
|
|
|
|
|
+ callback(new Error('请填写过敏史'));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ callback();
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
return {
|
|
return {
|
|
|
//审核记录数据
|
|
//审核记录数据
|
|
|
recordLoading: false,
|
|
recordLoading: false,
|
|
@@ -568,13 +584,33 @@ export default {
|
|
|
currentConfirm: null,
|
|
currentConfirm: null,
|
|
|
form: {},
|
|
form: {},
|
|
|
rules: {
|
|
rules: {
|
|
|
- prescribeType: [{required: true, message: "处方类型不能为空", trigger: "change"}],
|
|
|
|
|
- patientName: [{required: true, message: "患者姓名不能为空", trigger: "blur"}],
|
|
|
|
|
- patientAge: [{required: true, message: "患者年龄不能为空", trigger: "blur"}],
|
|
|
|
|
- patientGender: [{required: true, message: "患者性别不能为空", trigger: "change"}],
|
|
|
|
|
- diagnose: [{required: true, message: "诊断不能为空", trigger: ["blur", "change"]}],
|
|
|
|
|
- doctorId: [{required: true, message: "医生ID不能为空", trigger: "blur"}],
|
|
|
|
|
- status: [{required: true, message: "处方状态不能为空", trigger: "change"}]
|
|
|
|
|
|
|
+ prescribeType: [
|
|
|
|
|
+ { required: true, message: "处方类型不能为空", trigger: "change" }
|
|
|
|
|
+ ],
|
|
|
|
|
+ patientName: [
|
|
|
|
|
+ { required: true, message: "患者姓名不能为空", trigger: "blur" }
|
|
|
|
|
+ ],
|
|
|
|
|
+ patientAge: [
|
|
|
|
|
+ { required: true, message: "患者年龄不能为空", trigger: "blur" }
|
|
|
|
|
+ ],
|
|
|
|
|
+ patientGender: [
|
|
|
|
|
+ { required: true, message: "患者性别不能为空", trigger: "change" }
|
|
|
|
|
+ ],
|
|
|
|
|
+ weight: [
|
|
|
|
|
+ { required: true, message: "患者体重不能为空", trigger: ["blur", "change"] }
|
|
|
|
|
+ ],
|
|
|
|
|
+ isHistoryAllergic: [
|
|
|
|
|
+ { required: true, message: "患者是否有过敏史不能为空", trigger: ["blur", "change"] }
|
|
|
|
|
+ ],
|
|
|
|
|
+ historyAllergic: [
|
|
|
|
|
+ { validator: validateAllergyHistory, trigger: ["blur", "change"] }
|
|
|
|
|
+ ],
|
|
|
|
|
+ diagnose: [
|
|
|
|
|
+ { required: true, message: "诊断不能为空", trigger: ["blur", "change"] }
|
|
|
|
|
+ ],
|
|
|
|
|
+ remark: [
|
|
|
|
|
+ { required: true, message: "医嘱不能为空", trigger: ["blur", "change"] }
|
|
|
|
|
+ ]
|
|
|
},
|
|
},
|
|
|
// 新增:Tab相关
|
|
// 新增:Tab相关
|
|
|
activeTab: 'basic',
|
|
activeTab: 'basic',
|
|
@@ -622,6 +658,20 @@ export default {
|
|
|
if (newVal === 'drug' && this.form.prescribeId) {
|
|
if (newVal === 'drug' && this.form.prescribeId) {
|
|
|
this.getDrugList();
|
|
this.getDrugList();
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 监听是否有过敏史字段变化,动态调整过敏史字段的必填校验
|
|
|
|
|
+ 'form.isHistoryAllergic': function(newVal) {
|
|
|
|
|
+ if (newVal === '否') {
|
|
|
|
|
+ // 如果选择"否",清空过敏史字段
|
|
|
|
|
+ this.form.historyAllergic = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ // 触发过敏史字段的重新验证
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ if (this.$refs["form"]) {
|
|
|
|
|
+ this.$refs["form"].validateField('historyAllergic');
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
@@ -774,9 +824,6 @@ export default {
|
|
|
/**
|
|
/**
|
|
|
* 添加建议内容到对应字段(拼接而非覆盖)
|
|
* 添加建议内容到对应字段(拼接而非覆盖)
|
|
|
*/
|
|
*/
|
|
|
- /**
|
|
|
|
|
- * 添加建议内容到对应字段(拼接而非覆盖,使用英文逗号分隔)
|
|
|
|
|
- */
|
|
|
|
|
handleAddSuggest(row) {
|
|
handleAddSuggest(row) {
|
|
|
const text = row.diagnose;
|
|
const text = row.diagnose;
|
|
|
if (!text) return;
|
|
if (!text) return;
|
|
@@ -888,7 +935,7 @@ export default {
|
|
|
this.reset();
|
|
this.reset();
|
|
|
const prescribeId = row.prescribeId || this.ids[0];
|
|
const prescribeId = row.prescribeId || this.ids[0];
|
|
|
this.currentConfirm = row.doctorConfirm;
|
|
this.currentConfirm = row.doctorConfirm;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
getPrescribe(prescribeId).then(response => {
|
|
getPrescribe(prescribeId).then(response => {
|
|
|
this.form = response.data;
|
|
this.form = response.data;
|
|
|
if(row.doctorConfirm === 0) {
|
|
if(row.doctorConfirm === 0) {
|
|
@@ -925,24 +972,62 @@ export default {
|
|
|
},
|
|
},
|
|
|
/** 提交按钮操作 */
|
|
/** 提交按钮操作 */
|
|
|
submitForm() {
|
|
submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
|
|
- if (valid) {
|
|
|
|
|
- if (this.form.prescribeId != undefined) {
|
|
|
|
|
- updatePrescribe(this.form).then(response => {
|
|
|
|
|
- this.$message.success("修改成功");
|
|
|
|
|
- this.open = false;
|
|
|
|
|
- this.getList();
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- addPrescribe(this.form).then(response => {
|
|
|
|
|
- this.$message.success("新增成功");
|
|
|
|
|
- this.open = false;
|
|
|
|
|
- this.getList();
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 检查必填字段
|
|
|
|
|
+ const missingField = this.getFirstMissingField();
|
|
|
|
|
+ if (missingField) {
|
|
|
|
|
+ this.$message.error(`请填写${missingField}`);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.savePrescribe();
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /** 获取第一个未填写的必填字段 */
|
|
|
|
|
+ getFirstMissingField() {
|
|
|
|
|
+ const fieldConfig = {
|
|
|
|
|
+ 'prescribeType': '处方类型',
|
|
|
|
|
+ 'patientName': '患者姓名',
|
|
|
|
|
+ 'patientAge': '患者年龄',
|
|
|
|
|
+ 'patientGender': '患者性别',
|
|
|
|
|
+ 'weight': '患者体重',
|
|
|
|
|
+ 'isHistoryAllergic': '是否有过敏史',
|
|
|
|
|
+ 'diagnose': '诊断',
|
|
|
|
|
+ 'remark': '医嘱'
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ for (let [key, name] of Object.entries(fieldConfig)) {
|
|
|
|
|
+ const value = this.form[key];
|
|
|
|
|
+
|
|
|
|
|
+ // 检查字段是否为空
|
|
|
|
|
+ if (value === undefined || value === null || value === '') {
|
|
|
|
|
+ return name;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 特殊处理过敏史
|
|
|
|
|
+ if (key === 'isHistoryAllergic' && value === '是' && !this.form.historyAllergic) {
|
|
|
|
|
+ return '过敏史';
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /** 保存处方数据 */
|
|
|
|
|
+ savePrescribe() {
|
|
|
|
|
+ const request = this.form.prescribeId != undefined
|
|
|
|
|
+ ? updatePrescribe(this.form)
|
|
|
|
|
+ : addPrescribe(this.form);
|
|
|
|
|
+
|
|
|
|
|
+ request.then(response => {
|
|
|
|
|
+ this.$message.success(this.form.prescribeId != undefined ? "修改成功" : "新增成功");
|
|
|
|
|
+ this.open = false;
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ console.error('保存失败:', error);
|
|
|
|
|
+ this.$message.error("保存失败");
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
/** 导出按钮操作 */
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
handleExport() {
|
|
|
this.$modal.confirm('是否确认导出所有处方数据项?').then(() => {
|
|
this.$modal.confirm('是否确认导出所有处方数据项?').then(() => {
|
|
@@ -1110,6 +1195,7 @@ export default {
|
|
|
this.collectionDialogVisible = true;
|
|
this.collectionDialogVisible = true;
|
|
|
},
|
|
},
|
|
|
// 表单重置
|
|
// 表单重置
|
|
|
|
|
+ // 表单重置
|
|
|
reset() {
|
|
reset() {
|
|
|
this.form = {
|
|
this.form = {
|
|
|
prescribeId: undefined,
|
|
prescribeId: undefined,
|
|
@@ -1125,7 +1211,7 @@ export default {
|
|
|
patientGender: "1",
|
|
patientGender: "1",
|
|
|
patientTel: undefined,
|
|
patientTel: undefined,
|
|
|
weight: undefined,
|
|
weight: undefined,
|
|
|
- isHistoryAllergic: "否",
|
|
|
|
|
|
|
+ isHistoryAllergic: undefined,
|
|
|
historyAllergic: undefined,
|
|
historyAllergic: undefined,
|
|
|
diagnose: undefined,
|
|
diagnose: undefined,
|
|
|
doctorId: undefined,
|
|
doctorId: undefined,
|
|
@@ -1134,6 +1220,13 @@ export default {
|
|
|
remark: undefined
|
|
remark: undefined
|
|
|
};
|
|
};
|
|
|
this.resetForm("form");
|
|
this.resetForm("form");
|
|
|
|
|
+
|
|
|
|
|
+ // 重置后清除验证状态
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ if (this.$refs["form"]) {
|
|
|
|
|
+ this.$refs["form"].clearValidate();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
// 药品表单重置
|
|
// 药品表单重置
|
|
|
resetDrugForm() {
|
|
resetDrugForm() {
|