1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213 |
- <template>
- <div class="patient-container">
- <patient-sidebar :id="patientID" defaultActive="1-3"></patient-sidebar>
- <div
- class="patient-app-container app-container"
- v-loading="pageLoading"
- element-loading-text="拼命加载中"
- >
- <el-row :gutter="20">
- <el-col :span="7">
- <el-table
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266'
- }"
- :row-style="{ color: '#303133' }"
- :data="projects"
- border
- style="width: 100%"
- highlight-current-row
- @current-change="handleCurrentChange"
- ref="singleTable"
- >
- <el-table-column label="检验检查项目" align="center">
- <el-table-column
- prop="project_name"
- label="检验项目"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="count"
- label="次数"
- width="80"
- align="center"
- >
- </el-table-column>
- </el-table-column>
- </el-table>
- </el-col>
- <el-col :span="17" v-loading="itemLoading">
- <div class="filter-container" style="float:right">
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- @click="openPic()"
- icon="el-icon-circle-plus-outline"
- :disabled="project ? false : true"
- >上传图片
- </el-button>
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- @click="openNew()"
- icon="el-icon-circle-plus-outline"
- :disabled="project ? false : true"
- >新增
- </el-button
- >
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- icon="el-icon-edit-outline"
- @click="openEdit()"
- :disabled="itemDate ? false : true"
- >修改
- </el-button
- >
- <el-button
- size="small"
- class="filter-item"
- type="danger"
- icon="el-icon-delete"
- @click="deleteInspection()"
- :disabled="itemDate ? false : true"
- >删除
- </el-button
- >
- </div>
- <div class="filter-container">
- <el-button class="filter-item" type="text" style="color:#000"
- >{{ itemName }}
- <span v-if="itemDate"
- >(检查日期:{{ itemDate }})</span
- ></el-button
- >
- </div>
- <div v-if="!isPic">
- <el-table
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266'
- }"
- :row-style="{ color: '#303133' }"
- :data="items"
- border
- style="width: 100%"
- id="user-inspection-order"
-
- >
- <el-table-column
- prop="item_name"
- label="检验项目"
- align="center"
- min-width="180"
- >
- <template slot-scope="scope">
- {{ scope.row.item_name }} {{ scope.row.item_name_addition }}
- </template>
- </el-table-column>
-
- <el-table-column
- prop="name"
- label="结果"
- align="center"
- min-width="80"
- >
- <template slot-scope="scope">
- <div v-if="items[0].value.indexOf('http') < 0">
- <span v-if="scope.row.value =='阳性'" style="color:red">{{ scope.row.value }}</span>
- <span v-else>{{ scope.row.value }}</span>
- <span v-if="scope.row.range_type == 1">
- {{ scope.row.value_direction }}
- </span>
- </div>
- <div v-else>
- <img :src="scope.row.value">
- </div>
- </template>
- </el-table-column>
-
- <el-table-column
- prop="address"
- label="参考值"
- align="center"
- min-width="120"
- >
- <template slot-scope="scope">
- <div v-if="items[0].value.indexOf('http') < 0">
- <span v-if="scope.row.range_type == 1"
- >{{ scope.row.range_min }}~{{ scope.row.range_max }}</span
- >
- <span v-else>{{ scope.row.range_value }}</span>
- </div>
- </template>
-
- </el-table-column>
-
- <el-table-column
- prop="111"
- label="单位"
- align="center"
- min-width="80"
- >
- <template slot-scope="scope">
- <div v-if="items[0].value.indexOf('http') < 0">
- <span>{{ scope.row.unit }}</span>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div v-else>
- <el-row>
- <template v-for="(item, index) in items">
- <el-col :span="7" :key="index">
- <div style=" margin: 5px;">
- <el-row :gutter="20">
- <el-col :span="8" style="width: 100%;height: 150px;">
- <div style="width: 100%;height: 150px;" >
- <div @click="imgClicks(item.value)">
- <el-tooltip
- class="item"
- effect="dark"
- :hide-after="2000"
- content="点击查看大图"
- placement="top-start"
- >
- <img style="width: 300px;height: 150px;" :src="item.value" alt="">
- </el-tooltip>
- </div>
- </div>
- </el-col>
- </el-row>
- <el-row>
- <div style="word-break: break-all;word-wrap: break-word; text-align:center">{{item.item_name}}</div>
- </el-row>
- </div>
- </el-col>
- </template>
- </el-row>
-
- </div>
-
- <el-pagination
- align="right"
- @current-change="handleCurrentChangePage"
- :current-page="queryParams.page"
- :page-size="1"
- background
- style="margin-top:20px;"
- layout="total, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
- </el-col>
- </el-row>
- </div>
-
- <el-dialog
- :title="formTitle"
- :visible.sync="dialogFormVisible"
- width="1000px"
- id="user-inspection-form"
- v-loading="formLoading"
- >
- <el-form :model="form" ref="form" label-position="top">
- <el-row>
- <el-col :span="24" v-if="form.formItem[0].project_id == 14">
- <el-form-item label="传染病周期提醒: ">
- <el-radio-group v-model="form.remind_cycle">
- <el-radio :label="1">一月一次</el-radio>
- <el-radio :label="2">两月一次</el-radio>
- <el-radio :label="3">三月一次</el-radio>
- <el-radio :label="4">半年一次</el-radio>
- <el-radio :label="5">一年一次</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- <el-col :span="7">
- <el-form-item
- label="检验日期"
- prop="inspect_date"
- :rules="[
- { required: true, message: '请输入检验日期', trigger: 'blur' }
- ]"
- >
- <el-date-picker
- style="width:95%"
- v-model="form.inspect_date"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm"
- format="yyyy-MM-dd HH:mm"
- placeholder="选择日期"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="1"> </el-col>
-
- <template v-for="(item, index) in form.formItem">
- <el-col :span="7" :key="index">
- <el-form-item
- :label="item.item_name"
- v-if="item.range_type == 1"
- :key="item.item_id"
- :prop="'formItem.' + index + '.value'"
- >
- <el-input
- placeholder="请填入"
- v-model="item.value"
- style="width:95%"
- type="number"
- @input='changeInput(item)'
- >
- <template slot="append">{{ item.unit }}</template>
- </el-input>
- </el-form-item>
- <el-form-item
- :label="item.item_name"
- v-else
- :key="item.item_id"
- :prop="'formItem.' + index + '.value'"
- >
- <el-select
- v-model="item.value"
- placeholder="请选择"
- style="width:95%"
- >
- <el-option
- v-for="(optionItem, oidex) in item.select_options"
- :key="oidex"
- :label="optionItem"
- :value="optionItem"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1" :key="'form-col' + index"> </el-col>
- </template>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogFormVisible = false">取 消</el-button>
- <el-button
- type="primary"
- v-if="form.method == 'add'"
- @click="submitNew('form')"
- >保 存
- </el-button
- >
- <el-button type="primary" v-else @click="submitEdit('form')"
- >保 存
- </el-button
- >
- </div>
- </el-dialog>
-
- <el-dialog
- :title="formTitle"
- :visible.sync="dialogPicFormVisible"
- width="1000px"
- id="user-inspection-form"
- >
- <el-form :model="form" ref="form" label-position="top">
- <el-row>
- <el-col :span="7">
- <el-form-item
- label="检验日期"
- prop="inspect_date"
- :rules="[
- { required: true, message: '请输入检验日期', trigger: 'blur' }
- ]"
- >
- <el-date-picker
- style="width:95%"
- v-model="form.inspect_date"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm"
- format="yyyy-MM-dd HH:mm"
- placeholder="选择日期"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <template v-for="(item, index) in form.imgs">
- <el-col :span="5" :key="index">
- <div>
- <el-row>
- <img width="100px" :src="item.img_url" alt="">
- </el-row>
- <el-row>
- <el-input v-model="item.desc" style="width: 100px"></el-input>
- </el-row>
- <el-row>
- <el-button
- type="danger"
- @click="deletePic(item,index)"
- >删除
- </el-button>
- </el-row>
- </div>
- </el-col>
- <el-col :span="1" :key="'form-col' + index"> </el-col>
- </template>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-upload
- :data="uploadData"
- :multiple="false"
- action="https://upload.qiniup.com"
- :show-file-list="false"
- :on-error="handleAvatarError"
- :on-success="handleAvatarSuccess"
- :before-upload="beforeAvatarUpload">
- <el-button type="primary">选择文件</el-button>
- </el-upload>
- <el-button @click="dialogPicFormVisible = false">取 消</el-button>
- <el-button
- type="primary"
- v-if="this.form.pic_method== 'add'"
- @click="submitPicNew()"
- >保 存
- </el-button>
-
- <el-button
- type="primary"
- v-if="this.form.pic_method == 'edit'"
- @click="submitEditPicNew()"
- >修 改
- </el-button>
- </div>
- </el-dialog>
-
- <el-image-viewer
- v-if="showViewer"
- :on-close="closeViewer"
- :url-list="imgs"
- ></el-image-viewer>
- </div>
-
- </template>
-
- <script>
- import PatientSidebar from './components/PatientSidebar'
- import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
- import { getToken } from '@/api/qiniu'
-
- import {
- CreatePatientInspection,
- CreatePatientPICInspection,
- editPatientPICInspection,
- DeletePatientInspection,
- EditPatientInspection,
- fetchInspectionReference,
- fetchPatientInspections
- } from '@/api/inspection'
- import { getFileExtension, uParseTime } from '@/utils/tools'
-
- export default {
- name: 'Inspection',
- components: { PatientSidebar, ElImageViewer},
- data() {
- return {
- showViewer:false,
- imgs:[],
- total: 0,
- qiniuDomain: 'https://images.shengws.com/',
- isPic:false,
- uploadData: { token: '', key: '' },
- pageLoading: true,
- itemLoading: false,
- formLoading: false,
- itemDate: '',
- patientID: 0,
- panelClass: 'patient-app-container',
- patientInfo: {
- id: 0
- },
- itemName: '请选择项目',
- formTitle: '',
- dialogPicFormVisible: false,
- dialogFormVisible: false,
- patient_info: null,
-
- form: {
- remind_cycle: '',
- method: 'add',
- pic_method:'add',
- project_id: 0,
- inspect_date: '',
- old_inspect_date: '',
- formItem: [{ id: 0, value: '' }],
- imgs: [],
- delete_imgs:[],
- },
- formItem: [],
- items: [],
- inspections: [],
- inspectionsMap: {},
- projects: [],
- project: null,
- queryParams: {
- patient: 0,
- project_id: 0,
- page: 1
- }
- }
- },
- methods: {
- imgClicks(val){
- console.log('asdasgg',val);
- this.imgs = []
- this.imgs.push(val)
- this.showViewer = true
- },
- closeViewer(){
- this.showViewer = false
- },
- beforeAvatarUpload(file) {
- // const isJPG = file.type === "image/jpeg";
- var fileType = file.type
- const isJPG = fileType.indexOf('image') > -1
- const isLt2M = file.size / 1024 / 1024 < 5
-
- if (!isJPG) {
- this.$message.error('只能上传图片')
- return false
- }
- if (!isLt2M) {
- this.$message.error('上传头像图片大小不能超过 5MB!')
- return false
- }
-
- var date = new Date()
- var ext = getFileExtension(file.name)
- var key =
- date.getFullYear() +
- '/' +
- (date.getMonth() + 1) +
- '/' +
- date.getDate() +
- '/' +
- date.getHours() +
- '/' +
- date.getMinutes() +
- '/' +
- date.getSeconds() +
- '/' +
- '_s_' +
- file.uid +
- '.' +
- ext
- this.loading = this.$loading({
- lock: true,
- text: '上传中...',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- })
-
- const _self = this
- return new Promise((resolve, reject) => {
- getToken()
- .then(response => {
- const token = response.data.data.uptoken
- _self._data.uploadData.token = token
- _self._data.uploadData.key = key
- resolve(true)
- })
- .catch(err => {
- console.log(err)
- reject(false)
- this.loading.close()
- })
- })
- },
-
- handleAvatarError(err, file, fileList) {
- this.$message.error(err)
- this.loading.close()
- return false
- },
- handleAvatarSuccess(res, file) {
- this.form.imgs.push({
- img_url: this.qiniuDomain + res.url + '?imageView2/2/w/500/h/500/q/90',
- desc: '',
- id: 0
- })
- this.loading.close()
- },
- changeInput(item) {
-
- if (item.item_name == '血清铁' || item.item_name == '总铁结合力') {
- let index1 = ''
- let index2 = ''
- this.form.formItem.map((it, index) => {
- if (this.form.formItem[index].item_name == '血清铁') {
- index1 = index
- }
- if (this.form.formItem[index].item_name == '总铁结合力') {
- index2 = index
- }
- if (it.item_name == '转铁蛋白饱和度(计算)') {
- it.value = (parseFloat(this.form.formItem[index1].value) / parseFloat(this.form.formItem[index2].value)) * 100
- }
- })
- }
- },
- deleteInspection() {
- if (this.project == null || this.itemDate == '') {
- this.$message.error('请先选择删除删除的记录')
- return false
- }
-
- this.$confirm('确认删除此记录?', '删除', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- var params = {
- patient: this.patientID,
- date: this.itemDate,
- project_id: this.project.project_id
- }
- DeletePatientInspection(params).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- } else {
- this.$notify({
- title: '成功',
- message: '删除成功',
- type: 'success',
- duration: 2000
- })
-
- for (var index in this.projects) {
- if (this.projects[index].project_id == params.project_id) {
- this.projects[index].count--
- break
- }
- }
- this.total -= 1
- this.itemDate = ''
- this.items = []
- if (this.total > 0) {
- this.queryParams.page = 1
- this.fetchPatientInspections(this.queryParams)
- }
- }
- })
- })
- .catch(() => {
- })
- },
- openEdit() {
-
- if (this.project == null) {
- this.$message.error('请先选择项目')
- return false
- }
- if(this.isPic){
- this.form.pic_method = 'edit'
- this.formTitle = '修改' + this.project.project_name
- this.form.project_id = this.project.project_id
- this.form.inspect_date = this.itemDate
- this.form.old_inspect_date = this.itemDate
- this.form.imgs = []
- this.form.delete_imgs = []
- for(var index in this.inspections){
- this.form.imgs.push({
- id: this.inspections[index].id,
- img_url: this.inspections[index].inspect_value,
- desc: this.inspections[index].item_name
- })
- }
- console.log(this.form.imgs)
- this.dialogPicFormVisible = true
- }else{
- console.log("22222")
- this.form.method = 'edit'
- this.formTitle = '修改' + this.project.project_name
- this.form.project_id = this.project.project_id
- this.form.inspect_date = this.itemDate
- this.form.old_inspect_date = this.itemDate
- this.form.remind_cycle = this.patient_info.remind_cycle
- console.log(this.form.remind_cycle)
-
- this.form.formItem = []
- for (var index in this.project.inspection_reference) {
- this.form.formItem.push({
- id: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].id : 0,
- project_id: this.project.inspection_reference[index].project_id,
- project_name: this.project.inspection_reference[index].project_name,
- item_id: this.project.inspection_reference[index].id,
- item: this.project.inspection_reference[index].item,
- item_name: this.project.inspection_reference[index].item_name,
- range_type: this.project.inspection_reference[index].range_type,
- value: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].inspect_value : '',
- select_options: this.project.inspection_reference[index].range_options.split(','),
- unit: this.project.inspection_reference[index].unit
- })
- }
- console.log(this.form.formItem)
- this.dialogFormVisible = true
-
- }
-
- },
- openPic() {
- if (this.project == null) {
- this.$message.error('请先选择项目')
- return false
- }
-
- this.form.pic_method = 'add'
- this.formTitle = '新增' + this.project.project_name
- this.form.project_id = this.project.project_id
- this.form.imgs=[]
- this.form.delete_imgs=[]
- this.form.remind_cycle = this.patient_info.remind_cycle
- var today = new Date()
- this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
- this.form.formItem = []
- for (var index in this.project.inspection_reference) {
- // var formItem = this.project.inspection_reference[index];
- // formItem["value"] = '';
- // if (formItem.range_type==2) {
- // formItem["select_options"] = formItem.range_options.split(",");
- // }
- this.form.formItem.push({
- id: 0,
- project_id: this.project.inspection_reference[index].project_id,
- project_name: this.project.inspection_reference[index].project_name,
- item_id: this.project.inspection_reference[index].id,
- item: this.project.inspection_reference[index].item,
- item_name: this.project.inspection_reference[index].item_name,
- range_type: this.project.inspection_reference[index].range_type,
- value: '',
- select_options: this.project.inspection_reference[
- index
- ].range_options.split(','),
- unit: this.project.inspection_reference[index].unit
- })
- }
- console.log('form.formItem', this.form.formItem)
- this.dialogPicFormVisible = true
-
- },
- openNew() {
- if (this.project == null) {
- this.$message.error('请先选择项目')
- return false
- }
- this.form.method = 'add'
- this.formTitle = '新增' + this.project.project_name
- this.form.project_id = this.project.project_id
- this.form.remind_cycle = this.patient_info.remind_cycle
- var today = new Date()
- this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
- this.form.formItem = []
- for (var index in this.project.inspection_reference) {
- // var formItem = this.project.inspection_reference[index];
- // formItem["value"] = '';
- // if (formItem.range_type==2) {
- // formItem["select_options"] = formItem.range_options.split(",");
- // }
- this.form.formItem.push({
- id: 0,
- project_id: this.project.inspection_reference[index].project_id,
- project_name: this.project.inspection_reference[index].project_name,
- item_id: this.project.inspection_reference[index].id,
- item: this.project.inspection_reference[index].item,
- item_name: this.project.inspection_reference[index].item_name,
- range_type: this.project.inspection_reference[index].range_type,
- value: '',
- select_options: this.project.inspection_reference[
- index
- ].range_options.split(','),
- unit: this.project.inspection_reference[index].unit
- })
- }
- console.log('form.formItem', this.form.formItem)
- this.dialogFormVisible = true
- },
- submitEdit(formName) {
- this.$refs[formName].validate(valid => {
- if (valid) {
- this.formLoading = true
- if (this.form.formItem.length == 0) {
- this.$message.error('未填写项目')
- return false
- }
- for (var index in this.form.formItem) {
- this.form.formItem[index].value = '' + this.form.formItem[index].value
- }
-
- EditPatientInspection(this.patientID, this.form, this.form.remind_cycle, this.form.inspect_date, this.form.project_id).then(response => {
- if (response.data.state == 1) {
- this.$notify({
- title: '成功',
- message: '修改成功',
- type: 'success',
- duration: 2000
- })
- this.patient_info.remind_cycle =
- response.data.data.remind_cycle
- this.itemDate = this.form.inspect_date
- this.items = []
- var inspections = response.data.data.inspections
- this.inspections = response.data.data.inspections
- if (inspections == null) {
- this.inspections = []
- return false
- }
- var inspectionsMap = {}
- this.inspectionsMap = {}
- for (var index in inspections) {
- inspectionsMap[inspections[index].item_id] =
- inspections[index]
- this.inspectionsMap[inspections[index].item_id] =
- inspections[index]
- }
- var items = this.project.inspection_reference
- console.log('itmes', items)
- for (var index in items) {
- if (items[index].id in inspectionsMap) {
- var item = {}
- for (var key in items[index]) {
- item[key] = items[index][key]
- }
- item.value = inspectionsMap[items[index].id].inspect_value
- item.value_direction = ''
- if (item.range_type == 1) {
- var value = parseFloat(item.value)
- var range_min = parseFloat(item.range_min)
- var range_max = parseFloat(item.range_max)
- if (value < range_min) {
- item.value_direction = '↓'
- } else if (value > range_max) {
- item.value_direction = '↑'
- }
- }
- this.items.push(item)
- }
- }
-
- this.resetForm(formName)
- this.dialogFormVisible = false
- } else {
- this.$message.error(response.data.msg)
- return false
- }
- })
- .catch(v => {
- this.$message.error(v)
- return false
- })
- this.formLoading = false
- return false
- } else {
- return false
- }
- })
- },
- submitNew(formName) {
- this.$refs[formName].validate(valid => {
- if (valid) {
- this.formLoading = true
- if (this.form.formItem.length == 0) {
- this.$message.error('未填写项目')
- return false
- }
- for (var index in this.form.formItem) {
- this.form.formItem[index].value =
- '' + this.form.formItem[index].value
- }
- CreatePatientInspection(
- this.patientID,
- this.form,
- this.form.remind_cycle
- )
- .then(response => {
- if (response.data.state == 1) {
- this.$notify({
- title: '成功',
- message: '新增成功',
- type: 'success',
- duration: 2000
- })
- // this.form.remind_reycle = response.data.data.remind_reycc
- this.patient_info.remind_cycle =
- response.data.data.remind_cycle
- console.log(this.patient_info.remind_cycle)
-
- this.itemDate = this.form.inspect_date
- this.items = []
- for (var index in this.projects) {
- if (this.projects[index].project_id == this.form.project_id) {
- this.projects[index].count++
- break
- }
- }
- this.total += 1
- var inspections = response.data.data.inspections
- this.inspections = response.data.data.inspections
- if (inspections == null) {
- this.inspections = []
- return false
- }
- var inspectionsMap = {}
- this.inspectionsMap = {}
- for (var index in inspections) {
- inspectionsMap[inspections[index].item_id] =
- inspections[index]
- this.inspectionsMap[inspections[index].item_id] =
- inspections[index]
- }
- var items = this.project.inspection_reference
- for (var index in items) {
- if (items[index].id in inspectionsMap) {
- var item = {}
- for (var key in items[index]) {
- item[key] = items[index][key]
- }
- item.value = inspectionsMap[items[index].id].inspect_value
- item.value_direction = ''
- if (item.range_type == 1) {
- var value = parseFloat(item.value)
- var range_min = parseFloat(item.range_min)
- var range_max = parseFloat(item.range_max)
- if (value < range_min) {
- item.value_direction = '↓'
- } else if (value > range_max) {
- item.value_direction = '↑'
- }
- }
- this.items.push(item)
- }
- }
-
- this.resetForm(formName)
- this.dialogFormVisible = false
-
- this.queryParams.patient = this.patientID
- this.queryParams.project_id = this.project.project_id
- this.queryParams.page = 1
- this.total = 0
- this.fetchPatientInspections(this.queryParams)
- } else {
- this.$message.error(response.data.msg)
- return false
- }
- })
- .catch(v => {
- this.$message.error(v)
- return false
- })
- this.formLoading = false
- return false
- } else {
- return false
- }
- })
- },
- submitEditPicNew() {
- if (this.form.imgs.length == 0) {
- this.$message.error('未上传图片')
- return false
- }
- this.formLoading = true
- editPatientPICInspection(
- this.patientID,
- this.form
- )
- .then(response => {
- if (response.data.state === 1) {
- this.$notify({
- title: '成功',
- message: '修改成功',
- type: 'success',
- duration: 2000
- })
- this.itemDate = this.form.inspect_date
- this.items = []
- this.dialogPicFormVisible = false
- this.queryParams.patient = this.patientID
- this.queryParams.project_id = this.project.project_id
- this.queryParams.page = 1
- this.total = 0
- this.fetchPatientInspections(this.queryParams)
- } else {
- this.$message.error(response.data.msg)
- return false
- }
- })
- .catch(v => {
- this.$message.error(v)
- return false
- })
- this.formLoading = false
-
- },
- deletePic(item,index){
- if(item.id == 0){
- this.form.imgs.splice(index,1)
- }else{
- for(let index in this.form.imgs){
- if(item.id == this.form.imgs[index].id){
- this.form.imgs.splice(index,1)
- this.form.delete_imgs.push({
- id:item.id,
- })
- }
- }
-
- }
- },
- submitPicNew() {
- this.formLoading = true
- if (this.form.imgs.length == 0) {
- this.$message.error('未上传图片')
- return false
- }
- CreatePatientPICInspection(
- this.patientID,
- this.form
- )
- .then(response => {
- if (response.data.state === 1) {
- this.$notify({
- title: '成功',
- message: '新增成功',
- type: 'success',
- duration: 2000
- })
- this.itemDate = this.form.inspect_date
- this.items = []
- for (var index in this.projects) {
- if (this.projects[index].project_id == this.form.project_id) {
- this.projects[index].count++
- break
- }
- }
- this.total += 1
- // var inspections = response.data.data.inspections
- // this.inspections = response.data.data.inspections
- // if (inspections == null) {
- // this.inspections = []
- // return false
- // }
- // var inspectionsMap = {}
- // this.inspectionsMap = {}
- //
- // var items = this.project.inspection_reference
- // for (var index in items) {
- // if (items[index].id in inspectionsMap) {
- // var item = {}
- // for (var key in items[index]) {
- // item[key] = items[index][key]
- // }
- // item.value = inspectionsMap[items[index].id].inspect_value
- // item.value_direction = ''
- // this.items.push(item)
- // }
- // }
- this.dialogPicFormVisible = false
- this.queryParams.patient = this.patientID
- this.queryParams.project_id = this.project.project_id
- this.queryParams.page = 1
- this.total = 0
- this.fetchPatientInspections(this.queryParams)
- } else {
- this.$message.error(response.data.msg)
- return false
- }
- })
- .catch(v => {
- this.$message.error(v)
- return false
- })
- this.formLoading = false
-
- },
- fetchInspectionReference() {
- fetchInspectionReference(this.patientID)
- .then(response => {
- if (response.data.state == 1) {
- var reference = response.data.data.reference
- var patient_info = response.data.data.patient_info
- this.projects = reference
- this.patient_info = patient_info
- this.pageLoading = false
- this.form.remind_cycle = this.patient_info.remind_cycle
- } else {
- this.$message.error(response.data.msg)
- return false
- }
- })
- .catch(v => {
- })
- },
- setCurrent(row) {
- this.$refs.singleTable.setCurrentRow(row)
- },
- resetForm(formName) {
- this.$refs[formName].resetFields()
- },
- handleCurrentChange(row) {
- this.itemDate = ''
- this.form.method = 'add'
- if (typeof row === 'undefined' || row == null) {
- this.project = null
- this.items = []
- this.itemName = '请选择项目'
- } else {
- this.itemLoading = true
- this.project = row
- this.items = row.inspection_reference
- this.itemName = row.project_name
-
- this.queryParams.patient = this.patientID
- this.queryParams.project_id = this.project.project_id
- this.queryParams.page = 1
- this.total = 0
- this.fetchPatientInspections(this.queryParams)
- }
- },
-
- handleCurrentChangePage(val) {
- this.itemLoading = true
- this.queryParams.page = val
- this.fetchPatientInspections(this.queryParams)
- },
- fetchPatientInspections(params) {
- this.items = []
- this.isPic = false
- fetchPatientInspections(params)
- .then(response => {
- if (response.data.state == 1) {
- var inspections = response.data.data.inspections
- this.total = response.data.data.total
- this.itemDate = response.data.data.date
- this.inspections = response.data.data.inspections
- if (inspections == null) {
- this.inspections = []
- return false
- }
- var inspectionsMap = {}
- this.inspectionsMap = {}
- for (var index in inspections) {
- inspectionsMap[inspections[index].item_id] = inspections[index]
- this.inspectionsMap[inspections[index].item_id] = inspections[index]
- }
-
- var items = this.project.inspection_reference
- for (var index in items) {
- var item = {}
- for (var key in items[index]) {
- item[key] = items[index][key]
- }
- if (item.item_id > 0) {
- if (inspectionsMap[items[index].item_id] == undefined) {
- item.value = inspectionsMap[items[index].id].inspect_value
- item.item_name = inspectionsMap[items[index].id].item_name
-
- } else {
- item.value = inspectionsMap[items[index].item_id].inspect_value
- item.item_name = inspectionsMap[items[index].item_id].item_name
-
- }
- } else {
- item.value = inspectionsMap[items[index].id].inspect_value
- item.item_name = inspectionsMap[items[index].id].item_name
-
- }
- // item["inspect_desc"] = inspectionsMap[items[index].id].inspect_desc
- // item["inspect_type"] = inspectionsMap[items[index].id].inspect_type
- item.value_direction = ''
- if (item.range_type == 1) {
- var value = parseFloat(item.value)
- var range_min = parseFloat(item.range_min)
- var range_max = parseFloat(item.range_max)
- if (value < range_min) {
- item.value_direction = '↓'
- } else if (value > range_max) {
- item.value_direction = '↑'
- }
- }
- this.items.push(item)
-
-
- if(item.value.indexOf("http") >= 0){
- this.isPic = true
- }
- }
- }
- })
- .catch(v => {
- })
- setTimeout(() => {
- this.itemLoading = false
- }, 1000)
- }
- },
- created() {
- const id = this.$route.query && this.$route.query.id
- this.patientID = parseInt(id)
- if (isNaN(this.patientID) || this.patientID <= 0) {
- this.$notify.error({
- title: '错误',
- message: '无效的id'
- })
- this.$router.push('/patients/patients')
- }
-
- this.fetchInspectionReference()
- }
- }
- </script>
-
- <style>
- #oictable ::-webkit-scrollbar {
- height: 15px;
- }
- </style>
-
- <style>
- #user-inspection-order td {
- border-bottom: 0px !important;
- border-right: 0px !important;
- }
-
- #user-inspection-order th {
- border-right: 0px !important;
- }
-
- #user-inspection-form .el-form-item__content {
- line-height: 0 !important;
- }
-
- .el-table td,
- .el-table th.is-leaf,
- .el-table--border,
- .el-table--group {
- border-color: #d0d3da;
- }
-
- .el-table--border::after,
- .el-table--group::after,
- .el-table::before {
- background-color: #d0d3da;
- }
- </style>
|