inspection.vue 47KB

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