12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196 |
- <template>
- <div class="patient-container">
- <patient-sidebar :id="patientID" defaultActive="4-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="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-col :span="7">
- <div style="width: 400px">
- <el-row>
- <div>KT/V</div>
- </el-row>
- <el-row>
- <div v-if="check_content.length > 0">{{check_content}}</div>
- <div v-if="check_content.length == 0">{{"当前项目暂无数据"}}</div>
-
- </el-row>
- </div>
- </el-col>
-
- </div>
- <div v-else>
- <el-row>
- <template v-for="(item, index) in items">
- <el-col :span="7" :key="index">
- <div style="width: 400px">
- <el-row>
- <img :src="item.value" alt="">
- </el-row>
- <el-row>
- <div>{{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="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"
- :key="item.item_id"
- :rules="item.item_name != 'URR(%)' || item.item_name != 'KT/V' ?[
- { required: true, message: '请输入数值', trigger: 'blur' }
- ]:[]"
- :prop="'formItem.' + index + '.value'"
- >
- <el-input
- placeholder="请填入"
- v-model="item.value"
- style="width:95%"
- type="number"
- :disabled="item.item_name == 'URR(%)' || item.item_name == 'KT/V'"
- @input='changeInput(item)'
- >
- <template slot="append" v-if="item.item_name == 'URR(%)'"><el-button style="background-color: #409eff; color: #000;" type="primary" @click="calURR(form.formItem,item.value)">点击计算URR</el-button></template>
- <template slot="append" v-if="item.item_name == 'KT/V'"><el-button style="background-color: #409eff; color: #000;" type="primary" @click="calKTV(form.formItem,item.value)">点击计算KT/V</el-button></template>
- <template slot="append" v-else>{{ item.unit }}</template>
-
- </el-input>
- </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>
- </div>
-
- </template>
-
- <script>
- import PatientSidebar from './components/PatientSidebar'
- 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 },
- data() {
- return {
- total: 0,
- check_content:"",
- 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: {
- 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
- },
- calURR(items, value){
- let valueOne = 0
- let valueTwo = 0
-
- for(let i = 0; i < items.length; i++){
- if(items[i].item_name == "透析前尿素氮"){
- valueOne = items[i].value
- }
- if(items[i].item_name == "透析后尿素氮"){
- valueTwo = items[i].value
- }
- }
- if(valueOne.length == 0){
- this.$message.error("透析前尿素氮不能为空")
- return
- }
- if(valueTwo.length == 0){
- this.$message.error("透析后尿素氮不能为空")
- return
- }
- value = (((valueOne - valueTwo) / valueOne) * 100).toFixed(2)
- for(let i = 0; i < items.length; i++){
- if(items[i].item_name == "URR(%)"){
- items[i].value = value
- }
- }
- },
- calKTV(items, value){
- let valueOne = 0
- let valueTwo = 0
- let valueThree = 0
- let valueFour = 0
- let valueSix = 0
- for(let i = 0; i < items.length; i++){
- if(items[i].item_name == "透析前尿素氮"){
- valueOne = items[i].value
- }
- if(items[i].item_name == "透析后尿素氮"){
- valueTwo = items[i].value
- }
- if(items[i].item_name == "透析时间"){
-
- valueThree = items[i].value
-
- }
- if(items[i].item_name == "实际超滤量"){
- valueFour = items[i].value
-
- }
-
-
- if(items[i].item_name == "透后体重"){
- valueSix = items[i].value
- }
-
- }
-
-
- if(valueOne.length == 0){
- this.$message.error("透析前尿素氮不能为空")
- return
- }
- if(valueTwo.length == 0){
- this.$message.error("透析后尿素氮不能为空")
- return
- }
- if(valueThree.length == 0){
- this.$message.error("透析时间不能为空")
- return
- }
- if(valueFour.length == 0){
- this.$message.error("实际超滤量不能为空")
- return
- }
-
- if(valueSix.length == 0){
- this.$message.error("透后体重不能为空")
- return
- }
- console.log((-Math.log((valueTwo / valueOne - (0.008 * valueThree)))) )
- console.log((4-3.5*(valueTwo/valueOne)))
-
- console.log((4-3.5*(valueTwo/valueOne)) * valueFour/valueSix)
-
- value = ((-Math.log((valueTwo / valueOne - (0.008 * valueThree)))) + (4-3.5*(valueTwo/valueOne)) * valueFour/valueSix).toFixed(5)
-
- for(let i = 0; i < items.length; i++){
- if(items[i].item_name == "KT/V"){
- items[i].value = value
- }
- }
-
- },
- 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) {
- let valueSix = 0
- for(let i = 0; i < this.items.length; i++){
- if(this.items[i].item_name == "KT/V"){
- valueSix = this.items[i].value
- }
- }
- if(valueSix.length == 0){
- this.$message.error("KT/V不能为空")
- return
- }
-
-
- 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,3)
- .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
- this.check_content = ""
- 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
- }
- }
-
- for(let i = 0;i < this.items.length; i++){
- this.check_content = this.check_content + "\n" + this.items[i].item_name+":"+this.items[i].value +this.items[i].unit +"\n"
- }
- }
- })
- .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>
|