lapsoInspection.vue 47KB

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