针灸质控中心平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1023 lines
32 KiB

<template>
<div class="app-container" v-loading="loading">
<div class="hospital">{{ tenantName || "- - - -" }}</div>
<el-form
v-if="stepNum == 1"
:rules="rules"
ref="form"
:model="form"
label-width="110px"
>
<!-- 姓名、性别(单选)、出生日期、年龄、联系方式 -->
<div class="card">
<div class="card-title">基本信息</div>
<div>
<!-- <el-upload
name="file"
accept=".img,.png,.jpg"
:action="uploadFileUrl"
list-type="picture-card"
class="idcardupd"
:show-file-list="false"
:on-success="changeFile"
:on-change="uploader"
:on-progress="handleProgress"
>
<div slot="trigger" class="idcardupd-but">
<img
src="@/assets/images/idcard.png"
class="img-icon"
style="margin-right: 5px"
/>
<span>扫描身份证</span>
</div>
</el-upload> -->
<el-form-item label="姓名" prop="SCWJ-NAME">
<el-input
v-model="form['SCWJ-NAME']"
placeholder="请输入姓名"
></el-input>
</el-form-item>
<el-form-item label="性别" prop="SCWJ-SEX">
<el-radio-group v-model="form['SCWJ-SEX']">
<el-radio label="男">男</el-radio>
<el-radio label="女">女</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="出生日期" prop="SCWJ-BIRTH">
<el-date-picker
v-model="form['SCWJ-BIRTH']"
value-format=" yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="选择日期"
@change="calculateAge"
>
</el-date-picker>
</el-form-item>
<el-form-item label="年龄" prop="SCWJ-AGE">
<el-input
v-model="form['SCWJ-AGE']"
type="number"
placeholder="请输入年龄"
></el-input>
</el-form-item>
<el-form-item label="联系方式" prop="SCWJ-PHONE">
<el-input
v-model="form['SCWJ-PHONE']"
type="number"
placeholder="请输入联系方式"
></el-input>
</el-form-item>
<el-form-item label="身高cm" prop="SCWJ-HEIGHT">
<el-input
@blur="calculateBMI"
v-model="form['SCWJ-HEIGHT']"
type="number"
placeholder="请输入身高"
></el-input>
</el-form-item>
<el-form-item label="体重kg" prop="SCWJ-WEIGHT">
<el-input
@blur="calculateBMI"
v-model="form['SCWJ-WEIGHT']"
type="number"
placeholder="请输入体重"
></el-input>
</el-form-item>
<el-form-item label="BMI" prop="SCWJ-BMI">
<el-input
:disabled="true"
v-model="form['SCWJ-BMI']"
type="number"
placeholder="BMI"
></el-input>
</el-form-item>
<el-form-item label="结论" prop="SCWJ-JL">
<span :class="`BIMTips${BMIVerdict[form['SCWJ-JL']]}`">
{{ form["SCWJ-JL"] || "- - -" }}
</span>
</el-form-item>
</div>
</div>
<!-- 睡眠质量评估 -->
<div class="card">
<div class="card-title">睡眠质量评估</div>
<el-form-item label="上床睡觉" prop="SCWJ-SCSJ">
<el-time-select
@change="calculateSleepTime"
placeholder="请选择时间"
v-model="form['SCWJ-SCSJ']"
:picker-options="{
start: '00:30',
step: '00:15',
end: '23:59',
}"
></el-time-select>
</el-form-item>
<el-form-item label="入睡时间" prop="SCWJ-RSSJ">
<el-time-select
@change="calculateSleepTime"
placeholder="请选择时间"
v-model="form['SCWJ-RSSJ']"
:picker-options="{
start: '00:30',
step: '00:15',
end: '23:59',
}"
></el-time-select>
</el-form-item>
<el-form-item label="睡醒时间" prop="SCWJ-SXSJ">
<el-time-select
@change="calculateSleepTime"
placeholder="请选择时间"
v-model="form['SCWJ-SXSJ']"
:picker-options="{
start: '00:30',
step: '00:15',
end: '23:59',
}"
></el-time-select>
</el-form-item>
<el-form-item label="起床时间" prop="SCWJ-QCSJ">
<el-time-select
@change="calculateSleepTime"
placeholder="请选择时间"
v-model="form['SCWJ-QCSJ']"
:picker-options="{
start: '00:30',
step: '00:15',
end: '23:59',
}"
></el-time-select>
</el-form-item>
<el-form-item label="睡眠效率" prop="SCWJ-SMXL">
<span :class="`BIMTips${BMIVerdict[form['SCWJ-SMXL']]}`">
{{ form["SCWJ-SMXL"] || "- - -" }}%
</span>
</el-form-item>
</div>
<!-- 疾病风险选择(现病史) -->
<div class="card">
<div class="card-title">疾病风险选择</div>
<el-form-item prop="SCWJ-XBS" class="form-item-xbs">
<el-checkbox-group v-model="form['SCWJ-XBS']">
<el-checkbox
v-for="(item, index) in medicalHistory"
:label="item"
:key="index"
>
</el-checkbox>
</el-checkbox-group>
<el-input v-model="form['SCWJ-XBS-QT']" placeholder="其他" />
</el-form-item>
</div>
</el-form>
<!-- <div v-if="stepNum == 2">
<div class="card">
<div class="card-title">失眠自评(SRSS)</div>
<div
class="item-container"
v-for="(item, index) in scaleList"
:key="index"
>
<div class="item-title">{{ index + 1 }}. {{ item.question }}</div>
<div class="item-radio-box">
<el-radio-group v-model="form[`topic${index + 1}`]">
<el-radio
class="item-radio"
v-for="(criteria, index) in item.options"
:key="index"
:label="criteria.score"
>{{ criteria.label }}
</el-radio>
</el-radio-group>
</div>
</div>
<div class="card-tips">
SRSS共有10个项目,每个项目分5级评分(1~5),总分为每个项目得分之和。评分愈高,说明睡眠问题愈严重。此量表最低分为10分(基本无睡眠问题),最高分为50分(最严重)
</div>
</div>
<div class="card">
<div class="card-title">可接受的治疗方式</div>
<el-checkbox-group v-model="form['SCWJ-ZLFS']">
<el-checkbox label="饮食治疗" class="item-radio">
饮食治疗(中药代饮、减脂餐、营养制剂)
</el-checkbox>
<el-checkbox label="运动治疗" class="item-radio">
运动治疗(功率踏车,有氧运动,跑步)
</el-checkbox>
<el-checkbox label="中医治疗" class="item-radio">
中医治疗(针灸、拔罐、埋线)
</el-checkbox>
</el-checkbox-group>
</div>
<div class="card">
<div class="card-title">可接受的治疗周期</div>
<el-radio-group v-model="form['SCWJ-ZLZQ']">
<el-radio class="item-radio" :label="1">1个月</el-radio>
<el-radio class="item-radio" :label="2">2个月</el-radio>
<el-radio class="item-radio" :label="3">3个月</el-radio>
</el-radio-group>
</div>
</div> -->
<div class="card">
<div class="card-title">筛查结论</div>
<div
style="
display: flex;
justify-content: space-between;
margin-bottom: 6px;
"
>
<span>您的体重指数BMI</span>
<span>{{ form["SCWJ-BMI"] || "- - -" }}</span>
</div>
<div
style="
display: flex;
justify-content: space-between;
margin-bottom: 6px;
"
>
<span>您的睡眠效率为</span>
<span>{{ form["SCWJ-SMXL"] || "- - -" }}%</span>
</div>
<div>
<span v-if="tips" :style="{ color: tipsError ? 'red' : 'green' }">
{{ tips }}
</span>
<span v-if="!tips">- - -</span>
</div>
</div>
<!-- <div class="submit-box" v-if="stepNum == 1">
<el-button type="primary" class="submit-box-but" @click="submitForm">
下一步
</el-button>
</div>
<div class="submit-box" v-if="stepNum == 2 && disabled">
<el-button type="primary" class="submit-box-but" @click="scaleSubmitForm">
提交
</el-button>
</div> -->
<div class="submit-box" v-if="disabled">
<el-button type="primary" class="submit-box-but" @click="scaleSubmitForm">
提交
</el-button>
</div>
<div class="hospital1">{{ tenantName || "- - - -" }}</div>
</div>
</template>
<script>
import {
create,
screenSave,
screenSubmit,
queryHospitalNoToken,
} from "@/api/screening.js";
export default {
name: "Notice",
data() {
return {
loading: false,
disabled: true,
tenantId: "",
tenantName: "",
stepNum: 1, // 步骤数
uploadFileUrl: process.env.VUE_APP_BASE_URL + "/baidu/ocr/idcardInfo", // 上传的图片服务器地址
fileList: [],
// 现病史
medicalHistory: [
"高脂血症",
"肝脏疾病(脂肪肝、乙型肝炎、肝硬化等)",
"胰岛素抵抗",
"高尿酸",
"多囊卵巢综合症",
"高血压",
"脑血管病",
"恶性肿瘤",
"冠心病",
"精神疾病",
"胃和十二指肠溃疡",
"肥胖症",
"骨质疏松症",
"遗传性、先天性疾病",
"糖尿病",
"慢性肺系疾病",
"过敏性疾病",
"关节炎",
"痛风",
"肾炎、肾病",
],
BMITips: [
{
label: "体重过轻",
score: 18.5,
},
{
label: "正常",
score: 23.9,
},
{
label: "超重",
score: 27.9,
},
{
label: "肥胖",
score: 28,
},
],
BMIVerdict: {
体重过轻: "1",
正常: "2",
超重: "3",
肥胖: "4",
},
tips: "", //结果提示
tipsError: false, //结果提示
// 1.您觉得平时睡眠足够吗 ?
// ①睡眠过多了 ②睡眠正好 ③睡眠欠一些 ④睡眠不够 ⑤睡眠时间远远不够
// 2.您在睡眠后是否已觉得充分休息过了 ?
// ①觉得充分休息过了 ②觉得休息过了 ③觉得休息了一点 ④不觉得休息过了 ⑤觉得一点儿也没休息
// 3.您晚上已睡过觉,白天是否打瞌睡 ?
// ① 0~5 天 ②很少 (6~12 天) ③有时 (13~18 天)) ④经常(19~24 天) ⑤总是(25~31 天)
// 4.您平均每个晚上大约能睡几小时 ?
// ①≥9小时 ② 7~8 小时 ③ 5~6 小时 ④ 3~4 小时 ⑤ 1~2 小时
// 5.您是否有入睡困难 ?
// ①0~5 天 ②很少 (6~12 天) ③有时(13~18 天 ) ④经常(19~24 天) ⑤总是(25~31 天)
// 6.您入睡后中间是否易醒 ?
// ①0~5 天 ②很少(6~12 天) ③有时(13~18 天) ④经常 (19~24 天) ⑤总是(25~31 天)
// 7.您在醒后是否难于再入睡 ?
// ①0~5天 ②很少(61~2 天) ③有时 (13~18 天) ④经常 (19~24 天) ⑤总是 (25~31 天)
// 8.您是否多梦或常被恶梦惊醒 ?
// ①0~5天 ②很少(61~2 天) ③有时 (13~18 天) ④经常 (19~24 天) ⑤总是 (25~31 天)
// 9.为了睡眠 , 您是否吃安眠药 ?
// ①0~5天 ②很少(61~2 天) ③有时 (13~18 天) ④经常 (19~24 天) ⑤总是 (25~31 天)
// 10.您失眠后心情(心境)如何 ?
// ①无不适 ②无所谓 ③有时心烦、急躁 ④心慌、气短 ⑤乏力、没精神、做事效率低
scaleList: [
{
question: "您觉得平时睡眠足够吗 ?",
options: [
{ label: "睡眠过多了", score: 1 },
{ label: "睡眠正好", score: 2 },
{ label: "睡眠欠一些", score: 3 },
{ label: "睡眠不够", score: 4 },
{ label: "睡眠时间远远不够", score: 5 },
],
},
{
question: "您在睡眠后是否已觉得充分休息过了 ?",
options: [
{ label: "觉得充分休息过了", score: 1 },
{ label: "觉得休息过了", score: 2 },
{ label: "觉得休息了一点", score: 3 },
{ label: "不觉得休息过了", score: 4 },
{ label: "觉得一点儿也没休息", score: 5 },
],
},
{
question: "您晚上已睡过觉,白天是否打瞌睡 ?",
options: [
{ label: "0~5 天", score: 1 },
{ label: "很少 (6~12 天)", score: 2 },
{ label: "有时 (13~18 天)", score: 3 },
{ label: "经常(19~24 天)", score: 4 },
{ label: "总是(25~31 天)", score: 5 },
],
},
{
question: "您平均每个晚上大约能睡几小时 ?",
options: [
{ label: "≥9小时", score: 1 },
{ label: "7~8 小时", score: 2 },
{ label: "5~6 小时", score: 3 },
{ label: "3~4 小时", score: 4 },
{ label: "1~2 小时", score: 5 },
],
},
{
question: "您是否有入睡困难 ?",
options: [
{ label: "0~5 天", score: 1 },
{ label: "很少 (6~12 天)", score: 2 },
{ label: "有时(13~18 天 )", score: 3 },
{ label: "经常(19~24 天)", score: 4 },
{ label: "总是(25~31 天)", score: 5 },
],
},
{
question: "您入睡后中间是否易醒 ?",
options: [
{ label: "0~5 天", score: 1 },
{ label: "很少(6~12 天)", score: 2 },
{ label: "有时(13~18 天)", score: 3 },
{ label: "经常 (19~24 天)", score: 4 },
{ label: "总是(25~31 天)", score: 5 },
],
},
{
question: "您在醒后是否难于再入睡 ?",
options: [
{ label: "0~5天", score: 1 },
{ label: "很少(6~12 天)", score: 2 },
{ label: "有时 (13~18 天)", score: 3 },
{ label: "经常 (19~24 天)", score: 4 },
{ label: "总是 (25~31 天)", score: 5 },
],
},
{
question: "您是否多梦或常被恶梦惊醒 ?",
options: [
{ label: "0~5天", score: 1 },
{ label: "很少(6~12 天)", score: 2 },
{ label: "有时 (13~18 天)", score: 3 },
{ label: "经常 (19~24 天)", score: 4 },
{ label: "总是 (25~31 天)", score: 5 },
],
},
{
question: "为了睡眠 , 您是否吃安眠药 ?",
options: [
{ label: "0~5天", score: 1 },
{ label: "很少(6~12 天)", score: 2 },
{ label: "有时 (13~18 天)", score: 3 },
{ label: "经常 (19~24 天)", score: 4 },
{ label: "总是 (25~31 天)", score: 5 },
],
},
{
question: "您失眠后心情(心境)如何 ?",
options: [
{ label: "无不适", score: 1 },
{ label: "无所谓", score: 2 },
{ label: "有时心烦、急躁", score: 3 },
{ label: "心慌、气短", score: 4 },
{ label: "乏力、没精神、做事效率低", score: 5 },
],
},
], // 表单参数
form: {
"SCWJ-NAME": "",
"SCWJ-SEX": "男",
"SCWJ-BIRTH": "",
"SCWJ-AGE": "",
"SCWJ-PHONE": "",
"SCWJ-HEIGHT": "",
"SCWJ-WEIGHT": "",
"SCWJ-BMI": "",
"SCWJ-JL": "",
"SCWJ-ZLFS": [],
"SCWJ-SCSJ": "22:00", // 上床睡觉
"SCWJ-RSSJ": "22:30", // 入睡时间
"SCWJ-SXSJ": "06:30", // 睡醒时间
"SCWJ-QCSJ": "07:00", // 起床时间
"SCWJ-SMXL": "", // 睡眠效率
"SCWJ-XBS": [], // 现病史
"SCWJ-XBS-QT": "", // 现病史- 其他
// "SCWJ-NAME": "测试患者2",
// "SCWJ-SEX": "男",
// "SCWJ-BIRTH": "1945-01-01",
// "SCWJ-AGE": "70",
// "SCWJ-PHONE": "18534353638",
// "SCWJ-HEIGHT": "170",
// "SCWJ-WEIGHT": "80",
// "SCWJ-BMI": "24.56",
// "SCWJ-JL": "正常",
// "SCWJ-ZLFS": [],
},
// 表单校验
rules: {
"SCWJ-NAME": [
{
required: true,
message: "姓名不能为空",
trigger: "blur",
},
],
"SCWJ-SEX": [
{
required: true,
message: "性别不能为空",
trigger: "change",
},
],
"SCWJ-BIRTH": [
{
required: true,
message: "出生日期不能为空",
trigger: "change",
},
],
"SCWJ-AGE": [
{
required: true,
message: "年龄不能为空",
trigger: "change",
},
],
"SCWJ-PHONE": [
{
required: true,
message: "联系方式不能为空",
trigger: "blur",
},
{
pattern: /^1[3456789]\d{9}$/,
message: "格式不正确",
trigger: "change",
},
],
"SCWJ-HEIGHT": [
{
required: true,
message: "身高不能为空",
trigger: "blur",
},
],
"SCWJ-WEIGHT": [
{
required: true,
message: "体重不能为空",
trigger: "blur",
},
],
"SCWJ-BMI": [
{
required: false,
message: "BMI不能为空",
trigger: "blur",
},
],
"SCWJ-SCSJ": [
{
required: true,
message: "上床睡觉不能为空",
trigger: "change",
},
],
"SCWJ-RSSJ": [
{
required: true,
message: "入睡时间不能为空",
trigger: "change",
},
],
"SCWJ-SXSJ": [
{
required: true,
message: "睡醒时间不能为空",
trigger: "change",
},
],
"SCWJ-QCSJ": [
{
required: true,
message: "起床时间不能为空",
trigger: "change",
},
],
},
loading: false,
};
},
created() {
this.tenantId = this.$route.query.tenantId;
console.log("this.tenantId", this.tenantId);
localStorage.setItem("tenantId", this.tenantId);
this.getQueryHospitalNoToken(); // 组织id获取组织名称
this.calculateSleepTime(); //计算睡眠效率
},
// 监听结论和睡眠效率
watch: {
form: {
handler(newVal, oldVal) {
this.getTips();
},
deep: true,
},
},
methods: {
// 获取筛查结论
getTips() {
console.log("获取筛查结论");
const BMI = this.form["SCWJ-BMI"]; // BMI
const sleepEfficiency = this.form["SCWJ-SMXL"]; // 睡眠效率
if (BMI && sleepEfficiency) {
// BMI大于25或睡眠效率低于85%,{{ "建议找专业医师进一步评估" }}。
if (BMI > 25 || sleepEfficiency < 85) {
this.tips = "建议找专业医师进一步评估";
this.tipsError = true;
} else {
this.tips = "均属于正常范围,请继续保持";
this.tipsError = false;
}
}
},
// 计算睡眠效率
// 上床睡觉时间、入睡时间、睡醒时间、起床时间,自动计算睡眠效率(睡眠时间/在床上时间)
// 睡眠时间 = 睡醒时间 - 入睡时间
// 在床上时间 = 起床时间 - 上床时间
// 睡眠效率 = 睡眠时间 / 在床上时间
// 注:
// 睡醒时间 小于 入睡时间则表示是第二天的时间
// 起床时间 小于 上床则表示是第二天的时间
calculateSleepTime() {
// 获取时间值
const bedTime = this.form["SCWJ-SCSJ"]; // 上床睡觉时间
const sleepTime = this.form["SCWJ-RSSJ"]; // 入睡时间
const wakeTime = this.form["SCWJ-SXSJ"]; // 睡醒时间
const wakeBedTime = this.form["SCWJ-QCSJ"]; // 起床时间
// 如果缺少任一时间,直接返回
if (!bedTime || !sleepTime || !wakeTime || !wakeBedTime) return;
// 将时间字符串转换为分钟数
const toMinutes = (timeStr) => {
const [hour, minute] = timeStr.split(":");
return parseInt(hour) * 60 + parseInt(minute);
};
// 计算在床上时间和睡眠时间
// 在床上时间 = 上床睡觉时间 - 入睡时间
// 睡眠时间 = 入睡时间 - 起床时间
let inBedMinutes = toMinutes(wakeBedTime) - toMinutes(bedTime); // 在床上时间
let sleepMinutes = toMinutes(wakeTime) - toMinutes(sleepTime); // 睡眠时间
// 处理跨天情况
// 如果入睡时间小于上床时间,说明跨天,加上24小时
if (inBedMinutes < 0) {
inBedMinutes += 24 * 60;
}
// 如果睡醒时间小于入睡时间,说明跨天,加上24小时
if (sleepMinutes < 0) {
sleepMinutes += 24 * 60;
}
console.log("inBedMinutes", inBedMinutes);
console.log("sleepMinutes", sleepMinutes);
// 计算睡眠效率(睡眠时间 / 在床上时间)
const sleepEfficiency = (sleepMinutes / inBedMinutes) * 100;
// 更新睡眠效率字段,保留两位小数
this.form["SCWJ-SMXL"] = sleepEfficiency.toFixed(0);
},
// 通过出生日期计算年龄
calculateAge() {
const birthDate = new Date(this.form["SCWJ-BIRTH"]);
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
if (
monthDiff < 0 ||
(monthDiff === 0 && today.getDate() < birthDate.getDate())
) {
age--;
}
this.form["SCWJ-AGE"] = age;
},
// 上传身份信息,获取身份信息字段
async changeFile(e) {
this.loading = false;
console.log("上传身份信息: ", e);
const { code, data } = e;
console.log("data: ", data);
if (code === 200) {
this.spinning = false;
this.codeValue["SCWJ-NAME"] = data.name;
this.codeValue["SCWJ-SEX"] = data.sex;
this.codeValue["SCWJ-idCard"] = data.idcard;
this.codeValue["SCWJ-AGE"] = data.age;
await this.setValueByIdCard(data.idcard);
// await this.saveAnswer(data.name, "SCWJ-NAME");
// await this.saveAnswer(data.idcard, "SCWJ-idCard");
}
},
handleProgress() {
this.loading = true;
},
uploader(res) {
this.loading = false;
},
// 组织id获取组织名称
getQueryHospitalNoToken() {
let params = {
id: this.$route.query.tenantId,
};
queryHospitalNoToken(params).then((response) => {
this.tenantName = response.data.name || "";
});
},
// 计算BIM
calculateBMI() {
if (this.form["SCWJ-WEIGHT"] && this.form["SCWJ-HEIGHT"]) {
const weight = parseFloat(this.form["SCWJ-WEIGHT"]);
const height = parseFloat(this.form["SCWJ-HEIGHT"]);
const bmi = weight / (height / 100) ** 2;
this.form["SCWJ-BMI"] = bmi.toFixed(2);
this.getBMITips(bmi);
}
},
// 通过BIM结果显示对于的结论
// <18.5:体重过轻
// 18.5~23.9:正常
// 24~27.9:超重
// ≥28:肥胖
getBMITips(bmi) {
let tips = "";
if (bmi < 18.5) {
tips = "体重过轻";
}
if (bmi >= 18.5 && bmi < 23.9) {
tips = "正常";
}
if (bmi >= 24 && bmi < 27.9) {
tips = "超重";
}
if (bmi >= 28) {
tips = "肥胖";
}
this.form["SCWJ-JL"] = tips;
},
// 上传成功回 - pdg
handleUploadPdfAdd1(res) {
if (res.code == 200) {
this.importOpen = false;
this.getList();
this.$modal.msgSuccess("导入成功");
} else {
this.$message.error(res.msg || "导入失败");
this.fileList = [];
}
},
// 上传前校检格式和大小 - 图片
handleBeforeUpload1(file) {
const isLt2M = file.size / 1024 / 1024 < 100;
// 校检文件大小
if (!isLt2M) {
this.$message.error("上传文件大小不能超过 100MB!");
}
return isLt2M;
},
// 上传前校检格式和大小 - 文件
handleBeforePdfUpload1(file) {
const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
const whiteList = ["xlsx", "xls"];
if (whiteList.indexOf(fileSuffix) === -1) {
this.$message.error("上传文件只能是.xlsx, .xls");
return false;
}
},
/** 查询公告列表 */
getList() {
this.loading = true;
queryPatient(this.queryParams).then((res) => {
this.listDat = res.data.list;
this.total = res.data.total;
this.loading = false;
});
},
/** 基本信息 */
submitForm: function () {
this.$refs["form"].validate(async (valid) => {
if (valid) {
// 滚动条回到顶部
window.scrollTo(0, 0);
this.stepNum++;
}
});
},
// 量表结果
async scaleSubmitForm() {
try {
this.$refs["form"].validate(async (valid) => {
if (valid) {
// ------ 量表分值计算 ------
let score = 0;
// 计算总分, topic${i}属性不一定存在,先校验是否存在
for (let i = 1; i <= 24; i++) {
if (this.form[`topic${i}`] !== undefined) {
score += this.form[`topic${i}`];
}
}
// ------ 创建筛查 ------
const params = {
param: {
type: 33,
tenantId: this.tenantId,
centerId: this.tenantId,
},
};
create(params).then(async (res) => {
this.loading = true;
this.detailId = res.data.detailId;
this.id = res.data.id;
// ------ 保存答案 ------
// 基本信息
await this.saveAnswer(this.form["SCWJ-NAME"], "SCWJ-NAME");
await this.saveAnswer(this.form["SCWJ-SEX"], "SCWJ-SEX");
await this.saveAnswer(this.form["SCWJ-BIRTH"], "SCWJ-BIRTH");
await this.saveAnswer(this.form["SCWJ-AGE"], "SCWJ-AGE");
await this.saveAnswer(this.form["SCWJ-PHONE"], "SCWJ-PHONE");
await this.saveAnswer(this.form["SCWJ-HEIGHT"], "SCWJ-HEIGHT");
await this.saveAnswer(this.form["SCWJ-WEIGHT"], "SCWJ-WEIGHT");
await this.saveAnswer(this.form["SCWJ-BMI"], "SCWJ-BMI");
await this.saveAnswer(this.form["SCWJ-JL"], "SCWJ-JL");
await this.saveAnswer(this.form["SCWJ-SCSJ"], "SCWJ-SCSJ");
await this.saveAnswer(this.form["SCWJ-RSSJ"], "SCWJ-RSSJ");
await this.saveAnswer(this.form["SCWJ-SXSJ"], "SCWJ-SXSJ");
await this.saveAnswer(this.form["SCWJ-QCSJ"], "SCWJ-QCSJ");
await this.saveAnswer(this.form["SCWJ-SMXL"], "SCWJ-SMXL");
await this.saveAnswer(
this.form["SCWJ-XBS"].toString(),
"SCWJ-XBS"
);
await this.saveAnswer(this.form["SCWJ-XBS-QT"], "SCWJ-XBS-QT");
await this.saveAnswer(this.tips, "SCREEN-JL");
// 筛查总分
// await this.saveAnswer(score, "SCWJ-RESULT");
// await this.saveAnswer(
// this.form["SCWJ-ZLFS"].toString(),
// "SCWJ-ZLFS"
// ); // 治疗方式
// await this.saveAnswer(this.form["SCWJ-ZLZQ"], "SCWJ-ZLZQ"); // 治疗周期
// ------ 提交筛查 ------
const submitParams = { param: { detailId: this.detailId } };
await screenSubmit(submitParams).then((response) => {
this.loading = false;
this.disabled = false;
this.$modal.msgSuccess("提交成功");
});
});
}
});
} catch (error) {
this.loading = false;
this.disabled = false;
console.log("提交失败:", error);
this.$message.error("提交失败,请稍后重试!");
}
},
// 保存答案
async saveAnswer(value, str) {
try {
const params = {
param: {
answer: value,
code: str,
detailId: this.detailId,
},
};
await screenSave(params).then((response) => {});
} catch (error) {
this.loading = false;
this.disabled = false;
console.log("保存失败:", error);
this.$message.error("保存失败,请稍后重试!");
}
},
},
};
</script>
<style scoped src="@/assets/styles/common.css"></style>
<style scoped>
.form-item-xbs >>> .el-form-item__content {
margin-left: 0 !important;
}
.qq {
color: green;
}
.idcardupd {
height: 44px;
margin-bottom: 14px;
}
.idcardupd-but {
height: 44px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
.idcardupd-but span {
padding-top: 1px;
}
.idcardupd-but img {
width: 20px;
height: 20px;
}
.idcardupd >>> .el-upload {
height: 44px;
border: none;
background: #c6a268;
}
.hospital1 {
text-align: center;
font-size: 14px;
color: #999;
}
.hospital {
background: #fff;
font-size: 20px;
color: #70483e;
line-height: 50px;
font-weight: 600;
margin-bottom: 10px;
border-radius: 6px;
text-align: center;
}
.BIMTips1 {
color: #cccccc;
}
.BIMTips2 {
color: #66cc00;
}
.BIMTips3 {
color: #c3c300;
}
.BIMTips4 {
color: #ff9900;
}
.item-radio {
display: block;
margin-bottom: 10px;
}
.item-title {
font-size: 18px;
font-weight: bold;
color: #3d3d3d;
line-height: 26px;
}
.item-radio-box {
margin: 16px 0px;
}
>>> .el-radio__label {
font-size: 16px;
color: #555555;
line-height: 20px;
}
.submit-box {
display: flex;
justify-content: center;
align-items: center;
}
.submit-box .submit-box-but {
background: #c6a268;
width: 100%;
font-size: 16px;
margin-bottom: 10px;
}
.card {
padding: 16px;
background: #fff;
border-radius: 6px;
margin-bottom: 14px;
}
.card-title {
font-weight: 600;
font-size: 20px;
margin-bottom: 16px;
}
.card-tips {
font-size: 14px;
color: #999999;
}
/* */
.app-container {
/* background: linear-gradient(to bottom, #70483e, #f7f8fa); */
background: #70483e;
min-height: 100vh;
}
>>> .el-input__inner {
border: none;
border-bottom: 1px solid #dcdfe6;
border-radius: 0;
}
>>> .el-date-editor.el-input {
width: 100% !important;
}
>>> .el-form-item--medium .el-form-item__label {
padding-right: 30px;
}
>>> .el-radio input[aria-hidden="true"] {
display: none !important;
}
>>> .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled)
.el-radio__inner {
box-shadow: none !important;
}
</style>
<!-- >>> .el-input__inner {
padding: 0 15px !important;
} -->