Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

inspection.vue 39KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213
  1. <template>
  2. <div class="patient-container">
  3. <patient-sidebar :id="patientID" defaultActive="1-3"></patient-sidebar>
  4. <div
  5. class="patient-app-container app-container"
  6. v-loading="pageLoading"
  7. element-loading-text="拼命加载中"
  8. >
  9. <el-row :gutter="20">
  10. <el-col :span="7">
  11. <el-table
  12. :header-cell-style="{
  13. backgroundColor: 'rgb(245, 247, 250)',
  14. color: '#606266'
  15. }"
  16. :row-style="{ color: '#303133' }"
  17. :data="projects"
  18. border
  19. style="width: 100%"
  20. highlight-current-row
  21. @current-change="handleCurrentChange"
  22. ref="singleTable"
  23. >
  24. <el-table-column label="检验检查项目" align="center">
  25. <el-table-column
  26. prop="project_name"
  27. label="检验项目"
  28. align="center"
  29. >
  30. </el-table-column>
  31. <el-table-column
  32. prop="count"
  33. label="次数"
  34. width="80"
  35. align="center"
  36. >
  37. </el-table-column>
  38. </el-table-column>
  39. </el-table>
  40. </el-col>
  41. <el-col :span="17" v-loading="itemLoading">
  42. <div class="filter-container" style="float:right">
  43. <el-button
  44. size="small"
  45. class="filter-item"
  46. type="primary"
  47. @click="openPic()"
  48. icon="el-icon-circle-plus-outline"
  49. :disabled="project ? false : true"
  50. >上传图片
  51. </el-button>
  52. <el-button
  53. size="small"
  54. class="filter-item"
  55. type="primary"
  56. @click="openNew()"
  57. icon="el-icon-circle-plus-outline"
  58. :disabled="project ? false : true"
  59. >新增
  60. </el-button
  61. >
  62. <el-button
  63. size="small"
  64. class="filter-item"
  65. type="primary"
  66. icon="el-icon-edit-outline"
  67. @click="openEdit()"
  68. :disabled="itemDate ? false : true"
  69. >修改
  70. </el-button
  71. >
  72. <el-button
  73. size="small"
  74. class="filter-item"
  75. type="danger"
  76. icon="el-icon-delete"
  77. @click="deleteInspection()"
  78. :disabled="itemDate ? false : true"
  79. >删除
  80. </el-button
  81. >
  82. </div>
  83. <div class="filter-container">
  84. <el-button class="filter-item" type="text" style="color:#000"
  85. >{{ itemName }}
  86. <span v-if="itemDate"
  87. >(检查日期:{{ itemDate }})</span
  88. ></el-button
  89. >
  90. </div>
  91. <div v-if="!isPic">
  92. <el-table
  93. :header-cell-style="{
  94. backgroundColor: 'rgb(245, 247, 250)',
  95. color: '#606266'
  96. }"
  97. :row-style="{ color: '#303133' }"
  98. :data="items"
  99. border
  100. style="width: 100%"
  101. id="user-inspection-order"
  102. >
  103. <el-table-column
  104. prop="item_name"
  105. label="检验项目"
  106. align="center"
  107. min-width="180"
  108. >
  109. <template slot-scope="scope">
  110. {{ scope.row.item_name }} {{ scope.row.item_name_addition }}
  111. </template>
  112. </el-table-column>
  113. <el-table-column
  114. prop="name"
  115. label="结果"
  116. align="center"
  117. min-width="80"
  118. >
  119. <template slot-scope="scope">
  120. <div v-if="items[0].value.indexOf('http') < 0">
  121. <span v-if="scope.row.value =='阳性'" style="color:red">{{ scope.row.value }}</span>
  122. <span v-else>{{ scope.row.value }}</span>
  123. <span v-if="scope.row.range_type == 1">
  124. {{ scope.row.value_direction }}
  125. </span>
  126. </div>
  127. <div v-else>
  128. <img :src="scope.row.value">
  129. </div>
  130. </template>
  131. </el-table-column>
  132. <el-table-column
  133. prop="address"
  134. label="参考值"
  135. align="center"
  136. min-width="120"
  137. >
  138. <template slot-scope="scope">
  139. <div v-if="items[0].value.indexOf('http') < 0">
  140. <span v-if="scope.row.range_type == 1"
  141. >{{ scope.row.range_min }}~{{ scope.row.range_max }}</span
  142. >
  143. <span v-else>{{ scope.row.range_value }}</span>
  144. </div>
  145. </template>
  146. </el-table-column>
  147. <el-table-column
  148. prop="111"
  149. label="单位"
  150. align="center"
  151. min-width="80"
  152. >
  153. <template slot-scope="scope">
  154. <div v-if="items[0].value.indexOf('http') < 0">
  155. <span>{{ scope.row.unit }}</span>
  156. </div>
  157. </template>
  158. </el-table-column>
  159. </el-table>
  160. </div>
  161. <div v-else>
  162. <el-row>
  163. <template v-for="(item, index) in items">
  164. <el-col :span="7" :key="index">
  165. <div style=" margin: 5px;">
  166. <el-row :gutter="20">
  167. <el-col :span="8" style="width: 100%;height: 150px;">
  168. <div style="width: 100%;height: 150px;" >
  169. <div @click="imgClicks(item.value)">
  170. <el-tooltip
  171. class="item"
  172. effect="dark"
  173. :hide-after="2000"
  174. content="点击查看大图"
  175. placement="top-start"
  176. >
  177. <img style="width: 300px;height: 150px;" :src="item.value" alt="">
  178. </el-tooltip>
  179. </div>
  180. </div>
  181. </el-col>
  182. </el-row>
  183. <el-row>
  184. <div style="word-break: break-all;word-wrap: break-word; text-align:center">{{item.item_name}}</div>
  185. </el-row>
  186. </div>
  187. </el-col>
  188. </template>
  189. </el-row>
  190. </div>
  191. <el-pagination
  192. align="right"
  193. @current-change="handleCurrentChangePage"
  194. :current-page="queryParams.page"
  195. :page-size="1"
  196. background
  197. style="margin-top:20px;"
  198. layout="total, prev, pager, next, jumper"
  199. :total="total"
  200. >
  201. </el-pagination>
  202. </el-col>
  203. </el-row>
  204. </div>
  205. <el-dialog
  206. :title="formTitle"
  207. :visible.sync="dialogFormVisible"
  208. width="1000px"
  209. id="user-inspection-form"
  210. v-loading="formLoading"
  211. >
  212. <el-form :model="form" ref="form" label-position="top">
  213. <el-row>
  214. <el-col :span="24" v-if="form.formItem[0].project_id == 14">
  215. <el-form-item label="传染病周期提醒: ">
  216. <el-radio-group v-model="form.remind_cycle">
  217. <el-radio :label="1">一月一次</el-radio>
  218. <el-radio :label="2">两月一次</el-radio>
  219. <el-radio :label="3">三月一次</el-radio>
  220. <el-radio :label="4">半年一次</el-radio>
  221. <el-radio :label="5">一年一次</el-radio>
  222. </el-radio-group>
  223. </el-form-item>
  224. </el-col>
  225. <el-col :span="7">
  226. <el-form-item
  227. label="检验日期"
  228. prop="inspect_date"
  229. :rules="[
  230. { required: true, message: '请输入检验日期', trigger: 'blur' }
  231. ]"
  232. >
  233. <el-date-picker
  234. style="width:95%"
  235. v-model="form.inspect_date"
  236. type="datetime"
  237. value-format="yyyy-MM-dd HH:mm"
  238. format="yyyy-MM-dd HH:mm"
  239. placeholder="选择日期"
  240. >
  241. </el-date-picker>
  242. </el-form-item>
  243. </el-col>
  244. <el-col :span="1">&nbsp;</el-col>
  245. <template v-for="(item, index) in form.formItem">
  246. <el-col :span="7" :key="index">
  247. <el-form-item
  248. :label="item.item_name"
  249. v-if="item.range_type == 1"
  250. :key="item.item_id"
  251. :prop="'formItem.' + index + '.value'"
  252. >
  253. <el-input
  254. placeholder="请填入"
  255. v-model="item.value"
  256. style="width:95%"
  257. type="number"
  258. @input='changeInput(item)'
  259. >
  260. <template slot="append">{{ item.unit }}</template>
  261. </el-input>
  262. </el-form-item>
  263. <el-form-item
  264. :label="item.item_name"
  265. v-else
  266. :key="item.item_id"
  267. :prop="'formItem.' + index + '.value'"
  268. >
  269. <el-select
  270. v-model="item.value"
  271. placeholder="请选择"
  272. style="width:95%"
  273. >
  274. <el-option
  275. v-for="(optionItem, oidex) in item.select_options"
  276. :key="oidex"
  277. :label="optionItem"
  278. :value="optionItem"
  279. >
  280. </el-option>
  281. </el-select>
  282. </el-form-item>
  283. </el-col>
  284. <el-col :span="1" :key="'form-col' + index">&nbsp;</el-col>
  285. </template>
  286. </el-row>
  287. </el-form>
  288. <div slot="footer" class="dialog-footer">
  289. <el-button @click="dialogFormVisible = false">取 消</el-button>
  290. <el-button
  291. type="primary"
  292. v-if="form.method == 'add'"
  293. @click="submitNew('form')"
  294. >保 存
  295. </el-button
  296. >
  297. <el-button type="primary" v-else @click="submitEdit('form')"
  298. >保 存
  299. </el-button
  300. >
  301. </div>
  302. </el-dialog>
  303. <el-dialog
  304. :title="formTitle"
  305. :visible.sync="dialogPicFormVisible"
  306. width="1000px"
  307. id="user-inspection-form"
  308. >
  309. <el-form :model="form" ref="form" label-position="top">
  310. <el-row>
  311. <el-col :span="7">
  312. <el-form-item
  313. label="检验日期"
  314. prop="inspect_date"
  315. :rules="[
  316. { required: true, message: '请输入检验日期', trigger: 'blur' }
  317. ]"
  318. >
  319. <el-date-picker
  320. style="width:95%"
  321. v-model="form.inspect_date"
  322. type="datetime"
  323. value-format="yyyy-MM-dd HH:mm"
  324. format="yyyy-MM-dd HH:mm"
  325. placeholder="选择日期"
  326. >
  327. </el-date-picker>
  328. </el-form-item>
  329. </el-col>
  330. </el-row>
  331. <el-row>
  332. <template v-for="(item, index) in form.imgs">
  333. <el-col :span="5" :key="index">
  334. <div>
  335. <el-row>
  336. <img width="100px" :src="item.img_url" alt="">
  337. </el-row>
  338. <el-row>
  339. <el-input v-model="item.desc" style="width: 100px"></el-input>
  340. </el-row>
  341. <el-row>
  342. <el-button
  343. type="danger"
  344. @click="deletePic(item,index)"
  345. >删除
  346. </el-button>
  347. </el-row>
  348. </div>
  349. </el-col>
  350. <el-col :span="1" :key="'form-col' + index">&nbsp;</el-col>
  351. </template>
  352. </el-row>
  353. </el-form>
  354. <div slot="footer" class="dialog-footer">
  355. <el-upload
  356. :data="uploadData"
  357. :multiple="false"
  358. action="https://upload.qiniup.com"
  359. :show-file-list="false"
  360. :on-error="handleAvatarError"
  361. :on-success="handleAvatarSuccess"
  362. :before-upload="beforeAvatarUpload">
  363. <el-button type="primary">选择文件</el-button>
  364. </el-upload>
  365. <el-button @click="dialogPicFormVisible = false">取 消</el-button>
  366. <el-button
  367. type="primary"
  368. v-if="this.form.pic_method== 'add'"
  369. @click="submitPicNew()"
  370. >保 存
  371. </el-button>
  372. <el-button
  373. type="primary"
  374. v-if="this.form.pic_method == 'edit'"
  375. @click="submitEditPicNew()"
  376. >修 改
  377. </el-button>
  378. </div>
  379. </el-dialog>
  380. <el-image-viewer
  381. v-if="showViewer"
  382. :on-close="closeViewer"
  383. :url-list="imgs"
  384. ></el-image-viewer>
  385. </div>
  386. </template>
  387. <script>
  388. import PatientSidebar from './components/PatientSidebar'
  389. import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
  390. import { getToken } from '@/api/qiniu'
  391. import {
  392. CreatePatientInspection,
  393. CreatePatientPICInspection,
  394. editPatientPICInspection,
  395. DeletePatientInspection,
  396. EditPatientInspection,
  397. fetchInspectionReference,
  398. fetchPatientInspections
  399. } from '@/api/inspection'
  400. import { getFileExtension, uParseTime } from '@/utils/tools'
  401. export default {
  402. name: 'Inspection',
  403. components: { PatientSidebar, ElImageViewer},
  404. data() {
  405. return {
  406. showViewer:false,
  407. imgs:[],
  408. total: 0,
  409. qiniuDomain: 'https://images.shengws.com/',
  410. isPic:false,
  411. uploadData: { token: '', key: '' },
  412. pageLoading: true,
  413. itemLoading: false,
  414. formLoading: false,
  415. itemDate: '',
  416. patientID: 0,
  417. panelClass: 'patient-app-container',
  418. patientInfo: {
  419. id: 0
  420. },
  421. itemName: '请选择项目',
  422. formTitle: '',
  423. dialogPicFormVisible: false,
  424. dialogFormVisible: false,
  425. patient_info: null,
  426. form: {
  427. remind_cycle: '',
  428. method: 'add',
  429. pic_method:'add',
  430. project_id: 0,
  431. inspect_date: '',
  432. old_inspect_date: '',
  433. formItem: [{ id: 0, value: '' }],
  434. imgs: [],
  435. delete_imgs:[],
  436. },
  437. formItem: [],
  438. items: [],
  439. inspections: [],
  440. inspectionsMap: {},
  441. projects: [],
  442. project: null,
  443. queryParams: {
  444. patient: 0,
  445. project_id: 0,
  446. page: 1
  447. }
  448. }
  449. },
  450. methods: {
  451. imgClicks(val){
  452. console.log('asdasgg',val);
  453. this.imgs = []
  454. this.imgs.push(val)
  455. this.showViewer = true
  456. },
  457. closeViewer(){
  458. this.showViewer = false
  459. },
  460. beforeAvatarUpload(file) {
  461. // const isJPG = file.type === "image/jpeg";
  462. var fileType = file.type
  463. const isJPG = fileType.indexOf('image') > -1
  464. const isLt2M = file.size / 1024 / 1024 < 5
  465. if (!isJPG) {
  466. this.$message.error('只能上传图片')
  467. return false
  468. }
  469. if (!isLt2M) {
  470. this.$message.error('上传头像图片大小不能超过 5MB!')
  471. return false
  472. }
  473. var date = new Date()
  474. var ext = getFileExtension(file.name)
  475. var key =
  476. date.getFullYear() +
  477. '/' +
  478. (date.getMonth() + 1) +
  479. '/' +
  480. date.getDate() +
  481. '/' +
  482. date.getHours() +
  483. '/' +
  484. date.getMinutes() +
  485. '/' +
  486. date.getSeconds() +
  487. '/' +
  488. '_s_' +
  489. file.uid +
  490. '.' +
  491. ext
  492. this.loading = this.$loading({
  493. lock: true,
  494. text: '上传中...',
  495. spinner: 'el-icon-loading',
  496. background: 'rgba(0, 0, 0, 0.7)'
  497. })
  498. const _self = this
  499. return new Promise((resolve, reject) => {
  500. getToken()
  501. .then(response => {
  502. const token = response.data.data.uptoken
  503. _self._data.uploadData.token = token
  504. _self._data.uploadData.key = key
  505. resolve(true)
  506. })
  507. .catch(err => {
  508. console.log(err)
  509. reject(false)
  510. this.loading.close()
  511. })
  512. })
  513. },
  514. handleAvatarError(err, file, fileList) {
  515. this.$message.error(err)
  516. this.loading.close()
  517. return false
  518. },
  519. handleAvatarSuccess(res, file) {
  520. this.form.imgs.push({
  521. img_url: this.qiniuDomain + res.url + '?imageView2/2/w/500/h/500/q/90',
  522. desc: '',
  523. id: 0
  524. })
  525. this.loading.close()
  526. },
  527. changeInput(item) {
  528. if (item.item_name == '血清铁' || item.item_name == '总铁结合力') {
  529. let index1 = ''
  530. let index2 = ''
  531. this.form.formItem.map((it, index) => {
  532. if (this.form.formItem[index].item_name == '血清铁') {
  533. index1 = index
  534. }
  535. if (this.form.formItem[index].item_name == '总铁结合力') {
  536. index2 = index
  537. }
  538. if (it.item_name == '转铁蛋白饱和度(计算)') {
  539. it.value = (parseFloat(this.form.formItem[index1].value) / parseFloat(this.form.formItem[index2].value)) * 100
  540. }
  541. })
  542. }
  543. },
  544. deleteInspection() {
  545. if (this.project == null || this.itemDate == '') {
  546. this.$message.error('请先选择删除删除的记录')
  547. return false
  548. }
  549. this.$confirm('确认删除此记录?', '删除', {
  550. confirmButtonText: '确定',
  551. cancelButtonText: '取消',
  552. type: 'warning'
  553. })
  554. .then(() => {
  555. var params = {
  556. patient: this.patientID,
  557. date: this.itemDate,
  558. project_id: this.project.project_id
  559. }
  560. DeletePatientInspection(params).then(response => {
  561. if (response.data.state == 0) {
  562. this.$message.error(response.data.msg)
  563. return false
  564. } else {
  565. this.$notify({
  566. title: '成功',
  567. message: '删除成功',
  568. type: 'success',
  569. duration: 2000
  570. })
  571. for (var index in this.projects) {
  572. if (this.projects[index].project_id == params.project_id) {
  573. this.projects[index].count--
  574. break
  575. }
  576. }
  577. this.total -= 1
  578. this.itemDate = ''
  579. this.items = []
  580. if (this.total > 0) {
  581. this.queryParams.page = 1
  582. this.fetchPatientInspections(this.queryParams)
  583. }
  584. }
  585. })
  586. })
  587. .catch(() => {
  588. })
  589. },
  590. openEdit() {
  591. if (this.project == null) {
  592. this.$message.error('请先选择项目')
  593. return false
  594. }
  595. if(this.isPic){
  596. this.form.pic_method = 'edit'
  597. this.formTitle = '修改' + this.project.project_name
  598. this.form.project_id = this.project.project_id
  599. this.form.inspect_date = this.itemDate
  600. this.form.old_inspect_date = this.itemDate
  601. this.form.imgs = []
  602. this.form.delete_imgs = []
  603. for(var index in this.inspections){
  604. this.form.imgs.push({
  605. id: this.inspections[index].id,
  606. img_url: this.inspections[index].inspect_value,
  607. desc: this.inspections[index].item_name
  608. })
  609. }
  610. console.log(this.form.imgs)
  611. this.dialogPicFormVisible = true
  612. }else{
  613. console.log("22222")
  614. this.form.method = 'edit'
  615. this.formTitle = '修改' + this.project.project_name
  616. this.form.project_id = this.project.project_id
  617. this.form.inspect_date = this.itemDate
  618. this.form.old_inspect_date = this.itemDate
  619. this.form.remind_cycle = this.patient_info.remind_cycle
  620. console.log(this.form.remind_cycle)
  621. this.form.formItem = []
  622. for (var index in this.project.inspection_reference) {
  623. this.form.formItem.push({
  624. id: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].id : 0,
  625. project_id: this.project.inspection_reference[index].project_id,
  626. project_name: this.project.inspection_reference[index].project_name,
  627. item_id: this.project.inspection_reference[index].id,
  628. item: this.project.inspection_reference[index].item,
  629. item_name: this.project.inspection_reference[index].item_name,
  630. range_type: this.project.inspection_reference[index].range_type,
  631. value: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].inspect_value : '',
  632. select_options: this.project.inspection_reference[index].range_options.split(','),
  633. unit: this.project.inspection_reference[index].unit
  634. })
  635. }
  636. console.log(this.form.formItem)
  637. this.dialogFormVisible = true
  638. }
  639. },
  640. openPic() {
  641. if (this.project == null) {
  642. this.$message.error('请先选择项目')
  643. return false
  644. }
  645. this.form.pic_method = 'add'
  646. this.formTitle = '新增' + this.project.project_name
  647. this.form.project_id = this.project.project_id
  648. this.form.imgs=[]
  649. this.form.delete_imgs=[]
  650. this.form.remind_cycle = this.patient_info.remind_cycle
  651. var today = new Date()
  652. this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
  653. this.form.formItem = []
  654. for (var index in this.project.inspection_reference) {
  655. // var formItem = this.project.inspection_reference[index];
  656. // formItem["value"] = '';
  657. // if (formItem.range_type==2) {
  658. // formItem["select_options"] = formItem.range_options.split(",");
  659. // }
  660. this.form.formItem.push({
  661. id: 0,
  662. project_id: this.project.inspection_reference[index].project_id,
  663. project_name: this.project.inspection_reference[index].project_name,
  664. item_id: this.project.inspection_reference[index].id,
  665. item: this.project.inspection_reference[index].item,
  666. item_name: this.project.inspection_reference[index].item_name,
  667. range_type: this.project.inspection_reference[index].range_type,
  668. value: '',
  669. select_options: this.project.inspection_reference[
  670. index
  671. ].range_options.split(','),
  672. unit: this.project.inspection_reference[index].unit
  673. })
  674. }
  675. console.log('form.formItem', this.form.formItem)
  676. this.dialogPicFormVisible = true
  677. },
  678. openNew() {
  679. if (this.project == null) {
  680. this.$message.error('请先选择项目')
  681. return false
  682. }
  683. this.form.method = 'add'
  684. this.formTitle = '新增' + this.project.project_name
  685. this.form.project_id = this.project.project_id
  686. this.form.remind_cycle = this.patient_info.remind_cycle
  687. var today = new Date()
  688. this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
  689. this.form.formItem = []
  690. for (var index in this.project.inspection_reference) {
  691. // var formItem = this.project.inspection_reference[index];
  692. // formItem["value"] = '';
  693. // if (formItem.range_type==2) {
  694. // formItem["select_options"] = formItem.range_options.split(",");
  695. // }
  696. this.form.formItem.push({
  697. id: 0,
  698. project_id: this.project.inspection_reference[index].project_id,
  699. project_name: this.project.inspection_reference[index].project_name,
  700. item_id: this.project.inspection_reference[index].id,
  701. item: this.project.inspection_reference[index].item,
  702. item_name: this.project.inspection_reference[index].item_name,
  703. range_type: this.project.inspection_reference[index].range_type,
  704. value: '',
  705. select_options: this.project.inspection_reference[
  706. index
  707. ].range_options.split(','),
  708. unit: this.project.inspection_reference[index].unit
  709. })
  710. }
  711. console.log('form.formItem', this.form.formItem)
  712. this.dialogFormVisible = true
  713. },
  714. submitEdit(formName) {
  715. this.$refs[formName].validate(valid => {
  716. if (valid) {
  717. this.formLoading = true
  718. if (this.form.formItem.length == 0) {
  719. this.$message.error('未填写项目')
  720. return false
  721. }
  722. for (var index in this.form.formItem) {
  723. this.form.formItem[index].value = '' + this.form.formItem[index].value
  724. }
  725. EditPatientInspection(this.patientID, this.form, this.form.remind_cycle, this.form.inspect_date, this.form.project_id).then(response => {
  726. if (response.data.state == 1) {
  727. this.$notify({
  728. title: '成功',
  729. message: '修改成功',
  730. type: 'success',
  731. duration: 2000
  732. })
  733. this.patient_info.remind_cycle =
  734. response.data.data.remind_cycle
  735. this.itemDate = this.form.inspect_date
  736. this.items = []
  737. var inspections = response.data.data.inspections
  738. this.inspections = response.data.data.inspections
  739. if (inspections == null) {
  740. this.inspections = []
  741. return false
  742. }
  743. var inspectionsMap = {}
  744. this.inspectionsMap = {}
  745. for (var index in inspections) {
  746. inspectionsMap[inspections[index].item_id] =
  747. inspections[index]
  748. this.inspectionsMap[inspections[index].item_id] =
  749. inspections[index]
  750. }
  751. var items = this.project.inspection_reference
  752. console.log('itmes', items)
  753. for (var index in items) {
  754. if (items[index].id in inspectionsMap) {
  755. var item = {}
  756. for (var key in items[index]) {
  757. item[key] = items[index][key]
  758. }
  759. item.value = inspectionsMap[items[index].id].inspect_value
  760. item.value_direction = ''
  761. if (item.range_type == 1) {
  762. var value = parseFloat(item.value)
  763. var range_min = parseFloat(item.range_min)
  764. var range_max = parseFloat(item.range_max)
  765. if (value < range_min) {
  766. item.value_direction = '↓'
  767. } else if (value > range_max) {
  768. item.value_direction = '↑'
  769. }
  770. }
  771. this.items.push(item)
  772. }
  773. }
  774. this.resetForm(formName)
  775. this.dialogFormVisible = false
  776. } else {
  777. this.$message.error(response.data.msg)
  778. return false
  779. }
  780. })
  781. .catch(v => {
  782. this.$message.error(v)
  783. return false
  784. })
  785. this.formLoading = false
  786. return false
  787. } else {
  788. return false
  789. }
  790. })
  791. },
  792. submitNew(formName) {
  793. this.$refs[formName].validate(valid => {
  794. if (valid) {
  795. this.formLoading = true
  796. if (this.form.formItem.length == 0) {
  797. this.$message.error('未填写项目')
  798. return false
  799. }
  800. for (var index in this.form.formItem) {
  801. this.form.formItem[index].value =
  802. '' + this.form.formItem[index].value
  803. }
  804. CreatePatientInspection(
  805. this.patientID,
  806. this.form,
  807. this.form.remind_cycle
  808. )
  809. .then(response => {
  810. if (response.data.state == 1) {
  811. this.$notify({
  812. title: '成功',
  813. message: '新增成功',
  814. type: 'success',
  815. duration: 2000
  816. })
  817. // this.form.remind_reycle = response.data.data.remind_reycc
  818. this.patient_info.remind_cycle =
  819. response.data.data.remind_cycle
  820. console.log(this.patient_info.remind_cycle)
  821. this.itemDate = this.form.inspect_date
  822. this.items = []
  823. for (var index in this.projects) {
  824. if (this.projects[index].project_id == this.form.project_id) {
  825. this.projects[index].count++
  826. break
  827. }
  828. }
  829. this.total += 1
  830. var inspections = response.data.data.inspections
  831. this.inspections = response.data.data.inspections
  832. if (inspections == null) {
  833. this.inspections = []
  834. return false
  835. }
  836. var inspectionsMap = {}
  837. this.inspectionsMap = {}
  838. for (var index in inspections) {
  839. inspectionsMap[inspections[index].item_id] =
  840. inspections[index]
  841. this.inspectionsMap[inspections[index].item_id] =
  842. inspections[index]
  843. }
  844. var items = this.project.inspection_reference
  845. for (var index in items) {
  846. if (items[index].id in inspectionsMap) {
  847. var item = {}
  848. for (var key in items[index]) {
  849. item[key] = items[index][key]
  850. }
  851. item.value = inspectionsMap[items[index].id].inspect_value
  852. item.value_direction = ''
  853. if (item.range_type == 1) {
  854. var value = parseFloat(item.value)
  855. var range_min = parseFloat(item.range_min)
  856. var range_max = parseFloat(item.range_max)
  857. if (value < range_min) {
  858. item.value_direction = '↓'
  859. } else if (value > range_max) {
  860. item.value_direction = '↑'
  861. }
  862. }
  863. this.items.push(item)
  864. }
  865. }
  866. this.resetForm(formName)
  867. this.dialogFormVisible = false
  868. this.queryParams.patient = this.patientID
  869. this.queryParams.project_id = this.project.project_id
  870. this.queryParams.page = 1
  871. this.total = 0
  872. this.fetchPatientInspections(this.queryParams)
  873. } else {
  874. this.$message.error(response.data.msg)
  875. return false
  876. }
  877. })
  878. .catch(v => {
  879. this.$message.error(v)
  880. return false
  881. })
  882. this.formLoading = false
  883. return false
  884. } else {
  885. return false
  886. }
  887. })
  888. },
  889. submitEditPicNew() {
  890. if (this.form.imgs.length == 0) {
  891. this.$message.error('未上传图片')
  892. return false
  893. }
  894. this.formLoading = true
  895. editPatientPICInspection(
  896. this.patientID,
  897. this.form
  898. )
  899. .then(response => {
  900. if (response.data.state === 1) {
  901. this.$notify({
  902. title: '成功',
  903. message: '修改成功',
  904. type: 'success',
  905. duration: 2000
  906. })
  907. this.itemDate = this.form.inspect_date
  908. this.items = []
  909. this.dialogPicFormVisible = false
  910. this.queryParams.patient = this.patientID
  911. this.queryParams.project_id = this.project.project_id
  912. this.queryParams.page = 1
  913. this.total = 0
  914. this.fetchPatientInspections(this.queryParams)
  915. } else {
  916. this.$message.error(response.data.msg)
  917. return false
  918. }
  919. })
  920. .catch(v => {
  921. this.$message.error(v)
  922. return false
  923. })
  924. this.formLoading = false
  925. },
  926. deletePic(item,index){
  927. if(item.id == 0){
  928. this.form.imgs.splice(index,1)
  929. }else{
  930. for(let index in this.form.imgs){
  931. if(item.id == this.form.imgs[index].id){
  932. this.form.imgs.splice(index,1)
  933. this.form.delete_imgs.push({
  934. id:item.id,
  935. })
  936. }
  937. }
  938. }
  939. },
  940. submitPicNew() {
  941. this.formLoading = true
  942. if (this.form.imgs.length == 0) {
  943. this.$message.error('未上传图片')
  944. return false
  945. }
  946. CreatePatientPICInspection(
  947. this.patientID,
  948. this.form
  949. )
  950. .then(response => {
  951. if (response.data.state === 1) {
  952. this.$notify({
  953. title: '成功',
  954. message: '新增成功',
  955. type: 'success',
  956. duration: 2000
  957. })
  958. this.itemDate = this.form.inspect_date
  959. this.items = []
  960. for (var index in this.projects) {
  961. if (this.projects[index].project_id == this.form.project_id) {
  962. this.projects[index].count++
  963. break
  964. }
  965. }
  966. this.total += 1
  967. // var inspections = response.data.data.inspections
  968. // this.inspections = response.data.data.inspections
  969. // if (inspections == null) {
  970. // this.inspections = []
  971. // return false
  972. // }
  973. // var inspectionsMap = {}
  974. // this.inspectionsMap = {}
  975. //
  976. // var items = this.project.inspection_reference
  977. // for (var index in items) {
  978. // if (items[index].id in inspectionsMap) {
  979. // var item = {}
  980. // for (var key in items[index]) {
  981. // item[key] = items[index][key]
  982. // }
  983. // item.value = inspectionsMap[items[index].id].inspect_value
  984. // item.value_direction = ''
  985. // this.items.push(item)
  986. // }
  987. // }
  988. this.dialogPicFormVisible = false
  989. this.queryParams.patient = this.patientID
  990. this.queryParams.project_id = this.project.project_id
  991. this.queryParams.page = 1
  992. this.total = 0
  993. this.fetchPatientInspections(this.queryParams)
  994. } else {
  995. this.$message.error(response.data.msg)
  996. return false
  997. }
  998. })
  999. .catch(v => {
  1000. this.$message.error(v)
  1001. return false
  1002. })
  1003. this.formLoading = false
  1004. },
  1005. fetchInspectionReference() {
  1006. fetchInspectionReference(this.patientID)
  1007. .then(response => {
  1008. if (response.data.state == 1) {
  1009. var reference = response.data.data.reference
  1010. var patient_info = response.data.data.patient_info
  1011. this.projects = reference
  1012. this.patient_info = patient_info
  1013. this.pageLoading = false
  1014. this.form.remind_cycle = this.patient_info.remind_cycle
  1015. } else {
  1016. this.$message.error(response.data.msg)
  1017. return false
  1018. }
  1019. })
  1020. .catch(v => {
  1021. })
  1022. },
  1023. setCurrent(row) {
  1024. this.$refs.singleTable.setCurrentRow(row)
  1025. },
  1026. resetForm(formName) {
  1027. this.$refs[formName].resetFields()
  1028. },
  1029. handleCurrentChange(row) {
  1030. this.itemDate = ''
  1031. this.form.method = 'add'
  1032. if (typeof row === 'undefined' || row == null) {
  1033. this.project = null
  1034. this.items = []
  1035. this.itemName = '请选择项目'
  1036. } else {
  1037. this.itemLoading = true
  1038. this.project = row
  1039. this.items = row.inspection_reference
  1040. this.itemName = row.project_name
  1041. this.queryParams.patient = this.patientID
  1042. this.queryParams.project_id = this.project.project_id
  1043. this.queryParams.page = 1
  1044. this.total = 0
  1045. this.fetchPatientInspections(this.queryParams)
  1046. }
  1047. },
  1048. handleCurrentChangePage(val) {
  1049. this.itemLoading = true
  1050. this.queryParams.page = val
  1051. this.fetchPatientInspections(this.queryParams)
  1052. },
  1053. fetchPatientInspections(params) {
  1054. this.items = []
  1055. this.isPic = false
  1056. fetchPatientInspections(params)
  1057. .then(response => {
  1058. if (response.data.state == 1) {
  1059. var inspections = response.data.data.inspections
  1060. this.total = response.data.data.total
  1061. this.itemDate = response.data.data.date
  1062. this.inspections = response.data.data.inspections
  1063. if (inspections == null) {
  1064. this.inspections = []
  1065. return false
  1066. }
  1067. var inspectionsMap = {}
  1068. this.inspectionsMap = {}
  1069. for (var index in inspections) {
  1070. inspectionsMap[inspections[index].item_id] = inspections[index]
  1071. this.inspectionsMap[inspections[index].item_id] = inspections[index]
  1072. }
  1073. var items = this.project.inspection_reference
  1074. for (var index in items) {
  1075. var item = {}
  1076. for (var key in items[index]) {
  1077. item[key] = items[index][key]
  1078. }
  1079. if (item.item_id > 0) {
  1080. if (inspectionsMap[items[index].item_id] == undefined) {
  1081. item.value = inspectionsMap[items[index].id].inspect_value
  1082. item.item_name = inspectionsMap[items[index].id].item_name
  1083. } else {
  1084. item.value = inspectionsMap[items[index].item_id].inspect_value
  1085. item.item_name = inspectionsMap[items[index].item_id].item_name
  1086. }
  1087. } else {
  1088. item.value = inspectionsMap[items[index].id].inspect_value
  1089. item.item_name = inspectionsMap[items[index].id].item_name
  1090. }
  1091. // item["inspect_desc"] = inspectionsMap[items[index].id].inspect_desc
  1092. // item["inspect_type"] = inspectionsMap[items[index].id].inspect_type
  1093. item.value_direction = ''
  1094. if (item.range_type == 1) {
  1095. var value = parseFloat(item.value)
  1096. var range_min = parseFloat(item.range_min)
  1097. var range_max = parseFloat(item.range_max)
  1098. if (value < range_min) {
  1099. item.value_direction = '↓'
  1100. } else if (value > range_max) {
  1101. item.value_direction = '↑'
  1102. }
  1103. }
  1104. this.items.push(item)
  1105. if(item.value.indexOf("http") >= 0){
  1106. this.isPic = true
  1107. }
  1108. }
  1109. }
  1110. })
  1111. .catch(v => {
  1112. })
  1113. setTimeout(() => {
  1114. this.itemLoading = false
  1115. }, 1000)
  1116. }
  1117. },
  1118. created() {
  1119. const id = this.$route.query && this.$route.query.id
  1120. this.patientID = parseInt(id)
  1121. if (isNaN(this.patientID) || this.patientID <= 0) {
  1122. this.$notify.error({
  1123. title: '错误',
  1124. message: '无效的id'
  1125. })
  1126. this.$router.push('/patients/patients')
  1127. }
  1128. this.fetchInspectionReference()
  1129. }
  1130. }
  1131. </script>
  1132. <style>
  1133. #oictable ::-webkit-scrollbar {
  1134. height: 15px;
  1135. }
  1136. </style>
  1137. <style>
  1138. #user-inspection-order td {
  1139. border-bottom: 0px !important;
  1140. border-right: 0px !important;
  1141. }
  1142. #user-inspection-order th {
  1143. border-right: 0px !important;
  1144. }
  1145. #user-inspection-form .el-form-item__content {
  1146. line-height: 0 !important;
  1147. }
  1148. .el-table td,
  1149. .el-table th.is-leaf,
  1150. .el-table--border,
  1151. .el-table--group {
  1152. border-color: #d0d3da;
  1153. }
  1154. .el-table--border::after,
  1155. .el-table--group::after,
  1156. .el-table::before {
  1157. background-color: #d0d3da;
  1158. }
  1159. </style>