inspection.vue 46KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427
  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. type="number"
  334. @input='changeInput(item)'
  335. >
  336. <template slot="append">{{ item.unit }}</template>
  337. </el-input>
  338. </el-form-item>
  339. <el-form-item
  340. :label="item.item_name"
  341. v-else
  342. :key="item.item_id"
  343. :prop="'formItem.' + index + '.value'"
  344. >
  345. <el-select
  346. v-model="item.value"
  347. placeholder="请选择"
  348. style="width:95%"
  349. >
  350. <el-option
  351. v-for="(optionItem, oidex) in item.select_options"
  352. :key="oidex"
  353. :label="optionItem"
  354. :value="optionItem"
  355. >
  356. </el-option>
  357. </el-select>
  358. </el-form-item>
  359. </el-col>
  360. <el-col :span="1" :key="'form-col' + index">&nbsp;</el-col>
  361. </template>
  362. </el-row>
  363. </el-form>
  364. <div slot="footer" class="dialog-footer">
  365. <el-button @click="dialogFormVisible = false">取 消</el-button>
  366. <el-button
  367. type="primary"
  368. v-if="form.method == 'add'"
  369. @click="submitNew('form')"
  370. >保 存
  371. </el-button
  372. >
  373. <el-button type="primary" v-else @click="submitEdit('form')"
  374. >保 存
  375. </el-button
  376. >
  377. </div>
  378. </el-dialog>
  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. for (var index in this.project.inspection_reference) {
  760. this.form.formItem.push({
  761. id: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].id : 0,
  762. project_id: this.project.inspection_reference[index].project_id,
  763. project_name: this.project.inspection_reference[index].project_name,
  764. item_id: this.project.inspection_reference[index].id,
  765. item: this.project.inspection_reference[index].item,
  766. item_name: this.project.inspection_reference[index].item_name,
  767. range_type: this.project.inspection_reference[index].range_type,
  768. value: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].inspect_value : '',
  769. select_options: this.project.inspection_reference[index].range_options.split(','),
  770. unit: this.project.inspection_reference[index].unit
  771. })
  772. }
  773. console.log(this.form.formItem)
  774. this.dialogFormVisible = true
  775. }
  776. },setRemindDialog(){
  777. this.dialogRemindDialogFormVisible = true
  778. },setRemind(){
  779. this.dialogRemindFormVisible = true
  780. // this.temp_remind_cycle = this.
  781. },
  782. openPic() {
  783. if (this.project == null) {
  784. this.$message.error('请先选择项目')
  785. return false
  786. }
  787. this.form.pic_method = 'add'
  788. this.formTitle = '新增' + this.project.project_name
  789. this.form.project_id = this.project.project_id
  790. this.form.imgs=[]
  791. this.form.delete_imgs=[]
  792. if(this.form.project_id == 14) {
  793. this.form.remind_cycle = this.patient_info.remind_cycle
  794. }
  795. var today = new Date()
  796. this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
  797. this.form.formItem = []
  798. for (var index in this.project.inspection_reference) {
  799. // var formItem = this.project.inspection_reference[index];
  800. // formItem["value"] = '';
  801. // if (formItem.range_type==2) {
  802. // formItem["select_options"] = formItem.range_options.split(",");
  803. // }
  804. this.form.formItem.push({
  805. id: 0,
  806. project_id: this.project.inspection_reference[index].project_id,
  807. project_name: this.project.inspection_reference[index].project_name,
  808. item_id: this.project.inspection_reference[index].id,
  809. item: this.project.inspection_reference[index].item,
  810. item_name: this.project.inspection_reference[index].item_name,
  811. range_type: this.project.inspection_reference[index].range_type,
  812. value: '',
  813. select_options: this.project.inspection_reference[index].range_options.split(','),
  814. unit: this.project.inspection_reference[index].unit
  815. })
  816. }
  817. console.log('form.formItem', this.form.formItem)
  818. this.dialogPicFormVisible = true
  819. },
  820. openNew() {
  821. if (this.project == null) {
  822. this.$message.error('请先选择项目')
  823. return false
  824. }
  825. this.form.method = 'add'
  826. this.formTitle = '新增' + this.project.project_name
  827. this.form.project_id = this.project.project_id
  828. if(this.form.project_id == 14) {
  829. this.form.remind_cycle = this.patient_info.remind_cycle
  830. }
  831. // this.form.remind_cycle = this.patient_info.remind_cycle
  832. var today = new Date()
  833. this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
  834. this.form.formItem = []
  835. for (var index in this.project.inspection_reference) {
  836. // var formItem = this.project.inspection_reference[index];
  837. // formItem["value"] = '';
  838. // if (formItem.range_type==2) {
  839. // formItem["select_options"] = formItem.range_options.split(",");
  840. // }
  841. this.form.formItem.push({
  842. id: 0,
  843. project_id: this.project.inspection_reference[index].project_id,
  844. project_name: this.project.inspection_reference[index].project_name,
  845. item_id: this.project.inspection_reference[index].id,
  846. item: this.project.inspection_reference[index].item,
  847. item_name: this.project.inspection_reference[index].item_name,
  848. range_type: this.project.inspection_reference[index].range_type,
  849. value: '',
  850. select_options: this.project.inspection_reference[
  851. index
  852. ].range_options.split(','),
  853. unit: this.project.inspection_reference[index].unit
  854. })
  855. }
  856. console.log('form.formItem', this.form.formItem)
  857. this.dialogFormVisible = true
  858. },
  859. submitEdit(formName) {
  860. this.$refs[formName].validate(valid => {
  861. if (valid) {
  862. this.formLoading = true
  863. if (this.form.formItem.length == 0) {
  864. this.$message.error('未填写项目')
  865. return false
  866. }
  867. for (var index in this.form.formItem) {
  868. this.form.formItem[index].value = '' + this.form.formItem[index].value
  869. }
  870. EditPatientInspection(this.patientID, this.form, this.form.remind_cycle, this.form.inspect_date, this.form.project_id).then(response => {
  871. if (response.data.state == 1) {
  872. this.$notify({
  873. title: '成功',
  874. message: '修改成功',
  875. type: 'success',
  876. duration: 2000
  877. })
  878. this.patient_info.remind_cycle =
  879. response.data.data.remind_cycle
  880. this.itemDate = this.form.inspect_date
  881. this.items = []
  882. var inspections = response.data.data.inspections
  883. this.inspections = response.data.data.inspections
  884. if (inspections == null) {
  885. this.inspections = []
  886. return false
  887. }
  888. var inspectionsMap = {}
  889. this.inspectionsMap = {}
  890. for (var index in inspections) {
  891. inspectionsMap[inspections[index].item_id] =
  892. inspections[index]
  893. this.inspectionsMap[inspections[index].item_id] =
  894. inspections[index]
  895. }
  896. var items = this.project.inspection_reference
  897. console.log('itmes', items)
  898. for (var index in items) {
  899. if (items[index].id in inspectionsMap) {
  900. var item = {}
  901. for (var key in items[index]) {
  902. item[key] = items[index][key]
  903. }
  904. item.value = inspectionsMap[items[index].id].inspect_value
  905. item.value_direction = ''
  906. if (item.range_type == 1) {
  907. var value = parseFloat(item.value)
  908. var range_min = parseFloat(item.range_min)
  909. var range_max = parseFloat(item.range_max)
  910. if (value < range_min) {
  911. item.value_direction = '↓'
  912. } else if (value > range_max) {
  913. item.value_direction = '↑'
  914. }
  915. }
  916. this.items.push(item)
  917. }
  918. }
  919. this.resetForm(formName)
  920. this.dialogFormVisible = false
  921. } else {
  922. this.$message.error(response.data.msg)
  923. return false
  924. }
  925. })
  926. .catch(v => {
  927. this.$message.error(v)
  928. return false
  929. })
  930. this.formLoading = false
  931. return false
  932. } else {
  933. return false
  934. }
  935. })
  936. },
  937. submitNew(formName) {
  938. this.$refs[formName].validate(valid => {
  939. if (valid) {
  940. this.formLoading = true
  941. if (this.form.formItem.length == 0) {
  942. this.$message.error('未填写项目')
  943. return false
  944. }
  945. for (var index in this.form.formItem) {
  946. this.form.formItem[index].value =
  947. '' + this.form.formItem[index].value
  948. }
  949. CreatePatientInspection(
  950. this.patientID,
  951. this.form,
  952. this.form.remind_cycle
  953. )
  954. .then(response => {
  955. if (response.data.state == 1) {
  956. this.$notify({
  957. title: '成功',
  958. message: '新增成功',
  959. type: 'success',
  960. duration: 2000
  961. })
  962. // this.form.remind_reycle = response.data.data.remind_reycc
  963. this.patient_info.remind_cycle =
  964. response.data.data.remind_cycle
  965. console.log(this.patient_info.remind_cycle)
  966. this.itemDate = this.form.inspect_date
  967. this.items = []
  968. for (var index in this.projects) {
  969. if (this.projects[index].project_id == this.form.project_id) {
  970. this.projects[index].count++
  971. break
  972. }
  973. }
  974. this.total += 1
  975. var inspections = response.data.data.inspections
  976. this.inspections = response.data.data.inspections
  977. if (inspections == null) {
  978. this.inspections = []
  979. return false
  980. }
  981. var inspectionsMap = {}
  982. this.inspectionsMap = {}
  983. for (var index in inspections) {
  984. inspectionsMap[inspections[index].item_id] =
  985. inspections[index]
  986. this.inspectionsMap[inspections[index].item_id] =
  987. inspections[index]
  988. }
  989. var items = this.project.inspection_reference
  990. for (var index in items) {
  991. if (items[index].id in inspectionsMap) {
  992. var item = {}
  993. for (var key in items[index]) {
  994. item[key] = items[index][key]
  995. }
  996. item.value = inspectionsMap[items[index].id].inspect_value
  997. item.value_direction = ''
  998. if (item.range_type == 1) {
  999. var value = parseFloat(item.value)
  1000. var range_min = parseFloat(item.range_min)
  1001. var range_max = parseFloat(item.range_max)
  1002. if (value < range_min) {
  1003. item.value_direction = '↓'
  1004. } else if (value > range_max) {
  1005. item.value_direction = '↑'
  1006. }
  1007. }
  1008. this.items.push(item)
  1009. }
  1010. }
  1011. this.resetForm(formName)
  1012. this.dialogFormVisible = false
  1013. this.queryParams.patient = this.patientID
  1014. this.queryParams.project_id = this.project.project_id
  1015. this.queryParams.page = 1
  1016. this.total = 0
  1017. this.fetchPatientInspections(this.queryParams)
  1018. } else {
  1019. this.$message.error(response.data.msg)
  1020. return false
  1021. }
  1022. })
  1023. .catch(v => {
  1024. this.$message.error(v)
  1025. return false
  1026. })
  1027. this.formLoading = false
  1028. return false
  1029. } else {
  1030. return false
  1031. }
  1032. })
  1033. },
  1034. submitEditPicNew() {
  1035. if (this.form.imgs.length == 0) {
  1036. this.$message.error('未上传图片')
  1037. return false
  1038. }
  1039. this.formLoading = true
  1040. editPatientPICInspection(
  1041. this.patientID,
  1042. this.form
  1043. )
  1044. .then(response => {
  1045. if (response.data.state === 1) {
  1046. this.$notify({
  1047. title: '成功',
  1048. message: '修改成功',
  1049. type: 'success',
  1050. duration: 2000
  1051. })
  1052. this.itemDate = this.form.inspect_date
  1053. this.items = []
  1054. this.dialogPicFormVisible = false
  1055. this.queryParams.patient = this.patientID
  1056. this.queryParams.project_id = this.project.project_id
  1057. this.queryParams.page = 1
  1058. this.total = 0
  1059. this.fetchPatientInspections(this.queryParams)
  1060. } else {
  1061. this.$message.error(response.data.msg)
  1062. return false
  1063. }
  1064. })
  1065. .catch(v => {
  1066. this.$message.error(v)
  1067. return false
  1068. })
  1069. this.formLoading = false
  1070. },
  1071. deletePic(item,index){
  1072. if(item.id == 0){
  1073. this.form.imgs.splice(index,1)
  1074. }else{
  1075. for(let index in this.form.imgs){
  1076. if(item.id == this.form.imgs[index].id){
  1077. this.form.imgs.splice(index,1)
  1078. this.form.delete_imgs.push({
  1079. id:item.id,
  1080. })
  1081. }
  1082. }
  1083. }
  1084. },
  1085. submitPicNew() {
  1086. this.formLoading = true
  1087. if (this.form.imgs.length == 0) {
  1088. this.$message.error('未上传图片')
  1089. return false
  1090. }
  1091. console.log("form",this.form)
  1092. CreatePatientPICInspection(
  1093. this.patientID,
  1094. this.form
  1095. ).then(response => {
  1096. if (response.data.state === 1) {
  1097. this.$notify({
  1098. title: '成功',
  1099. message: '新增成功',
  1100. type: 'success',
  1101. duration: 2000
  1102. })
  1103. this.itemDate = this.form.inspect_date
  1104. this.items = []
  1105. for (var index in this.projects) {
  1106. if (this.projects[index].project_id == this.form.project_id) {
  1107. this.projects[index].count++
  1108. break
  1109. }
  1110. }
  1111. this.total += 1
  1112. // var inspections = response.data.data.inspections
  1113. // this.inspections = response.data.data.inspections
  1114. // if (inspections == null) {
  1115. // this.inspections = []
  1116. // return false
  1117. // }
  1118. // var inspectionsMap = {}
  1119. // this.inspectionsMap = {}
  1120. //
  1121. // var items = this.project.inspection_reference
  1122. // for (var index in items) {
  1123. // if (items[index].id in inspectionsMap) {
  1124. // var item = {}
  1125. // for (var key in items[index]) {
  1126. // item[key] = items[index][key]
  1127. // }
  1128. // item.value = inspectionsMap[items[index].id].inspect_value
  1129. // item.value_direction = ''
  1130. // this.items.push(item)
  1131. // }
  1132. // }
  1133. this.dialogPicFormVisible = false
  1134. this.queryParams.patient = this.patientID
  1135. this.queryParams.project_id = this.project.project_id
  1136. this.queryParams.page = 1
  1137. this.total = 0
  1138. this.fetchPatientInspections(this.queryParams)
  1139. } else {
  1140. this.$message.error(response.data.msg)
  1141. return false
  1142. }
  1143. })
  1144. .catch(v => {
  1145. this.$message.error(v)
  1146. return false
  1147. })
  1148. this.formLoading = false
  1149. },
  1150. fetchInspectionReference() {
  1151. fetchInspectionReference(this.patientID)
  1152. .then(response => {
  1153. if (response.data.state == 1) {
  1154. var reference = response.data.data.reference
  1155. var patient_info = response.data.data.patient_info
  1156. this.projects = reference
  1157. this.patient_info = patient_info
  1158. this.pageLoading = false
  1159. // this.form.remind_cycle = this.patient_info.remind_cycle
  1160. } else {
  1161. this.$message.error(response.data.msg)
  1162. return false
  1163. }
  1164. })
  1165. .catch(v => {
  1166. })
  1167. },
  1168. setCurrent(row) {
  1169. this.$refs.singleTable.setCurrentRow(row)
  1170. },
  1171. resetForm(formName) {
  1172. this.$refs[formName].resetFields()
  1173. },
  1174. handleCurrentChange(row) {
  1175. console.log("row-2-23-23-",row)
  1176. this.itemDate = ''
  1177. this.form.method = 'add'
  1178. if (typeof row === 'undefined' || row == null) {
  1179. this.project = null
  1180. this.items = []
  1181. this.itemName = '请选择项目'
  1182. } else {
  1183. this.itemLoading = true
  1184. this.project = row
  1185. this.items = row.inspection_reference
  1186. this.itemName = row.project_name
  1187. this.queryParams.patient = this.patientID
  1188. this.queryParams.project_id = this.project.project_id
  1189. this.queryParams.page = 1
  1190. this.total = 0
  1191. console.log("wowowowowow")
  1192. this.fetchPatientInspections(this.queryParams)
  1193. }
  1194. },
  1195. handleCurrentChangePage(val) {
  1196. this.itemLoading = true
  1197. this.queryParams.page = val
  1198. this.fetchPatientInspections(this.queryParams)
  1199. },
  1200. fetchPatientInspections(params) {
  1201. this.items = []
  1202. this.isPic = false
  1203. fetchPatientInspections(params)
  1204. .then(response => {
  1205. if (response.data.state == 1) {
  1206. var inspections = response.data.data.inspections
  1207. this.total = response.data.data.total
  1208. this.itemDate = response.data.data.date
  1209. let remind = response.data.data.remind
  1210. let config = response.data.data.config
  1211. this.record_id = config.id
  1212. if(config.id > 0){
  1213. if(config.is_open == 1){
  1214. this.is_open = true
  1215. }else{
  1216. this.is_open = false
  1217. }
  1218. }else{
  1219. this.is_open = false
  1220. }
  1221. if(remind.id > 0 && remind.remind_cycle > 0){
  1222. this.temp_remind_cycle = remind.remind_cycle
  1223. }else{
  1224. this.temp_remind_cycle = ""
  1225. }
  1226. this.inspections = response.data.data.inspections
  1227. console.log("this.inpections",this.inspections)
  1228. if (inspections == null) {
  1229. this.inspections = []
  1230. return false
  1231. }
  1232. var inspectionsMap = {}
  1233. this.inspectionsMap = {}
  1234. for (var index in inspections) {
  1235. inspectionsMap[inspections[index].item_id] = inspections[index]
  1236. this.inspectionsMap[inspections[index].item_id] = inspections[index]
  1237. }
  1238. console.log("inspectionsMap",this.inspectionsMap)
  1239. var items = this.project.inspection_reference
  1240. console.log("时间",items)
  1241. for (var index in items) {
  1242. console.log("obj",items[index])
  1243. // console.log("inspectionsMap",inspectionsMap[items[index].item_id])
  1244. var item = {}
  1245. for (var key in items[index]) {
  1246. // console.log("key",key,items[index][key])
  1247. // console.log("item[key]",item[key])
  1248. item[key] = items[index][key]
  1249. }
  1250. if (item.item_id > 0) {
  1251. if (typeof(inspectionsMap[parseInt(items[index].item_id)]) == "undefined") {
  1252. if(this.org_id == 10121 || this.org_id ==10278 || this.org_id ==10138){
  1253. item.value = inspectionsMap[items[index].id].inspect_value
  1254. item.item_name = inspectionsMap[items[index].id].item_name
  1255. }else{
  1256. item.value = ""
  1257. item.item_name = ""
  1258. }
  1259. } else {
  1260. item.value = inspectionsMap[items[index].item_id].inspect_value
  1261. item.item_name = inspectionsMap[items[index].item_id].item_name
  1262. }
  1263. } else {
  1264. if(typeof(inspectionsMap[parseInt(items[index].id)]) == "undefined"){
  1265. continue
  1266. }
  1267. item.value = inspectionsMap[items[index].id].inspect_value
  1268. item.item_name = inspectionsMap[items[index].id].item_name
  1269. }
  1270. // item["inspect_desc"] = inspectionsMap[items[index].id].inspect_desc
  1271. // item["inspect_type"] = inspectionsMap[items[index].id].inspect_type
  1272. item.value_direction = ''
  1273. if (item.range_type == 1) {
  1274. var value = parseFloat(item.value)
  1275. var range_min = parseFloat(item.range_min)
  1276. var range_max = parseFloat(item.range_max)
  1277. if (value < range_min) {
  1278. item.value_direction = '↓'
  1279. } else if (value > range_max) {
  1280. item.value_direction = '↑'
  1281. }
  1282. }
  1283. console.log("items23233232",item)
  1284. if(this.org_id!=10503){
  1285. if(item.item_name!=""){
  1286. this.items.push(item)
  1287. }
  1288. }else{
  1289. this.items.push(item)
  1290. }
  1291. console.log("items232232332wo",item.value.indexOf('http'))
  1292. if(item.value.indexOf("http") <0){
  1293. this.isPic = true
  1294. }
  1295. if(this.org_id!=10503){
  1296. this.isPic = false
  1297. }
  1298. console.log("woowwoow",this.isPic)
  1299. console.log("isPicwowowow",this.items)
  1300. }
  1301. }
  1302. })
  1303. .catch(v => {
  1304. })
  1305. setTimeout(() => {
  1306. this.itemLoading = false
  1307. }, 1000)
  1308. }
  1309. },
  1310. created() {
  1311. const id = this.$route.query && this.$route.query.id
  1312. this.org_id = this.$store.getters.xt_user.org.id,
  1313. this.patientID = parseInt(id)
  1314. if (isNaN(this.patientID) || this.patientID <= 0) {
  1315. this.$notify.error({
  1316. title: '错误',
  1317. message: '无效的id'
  1318. })
  1319. this.$router.push('/patients/patients')
  1320. }
  1321. this.fetchInspectionReference()
  1322. }
  1323. }
  1324. </script>
  1325. <style>
  1326. #oictable ::-webkit-scrollbar {
  1327. height: 15px;
  1328. }
  1329. </style>
  1330. <style>
  1331. #user-inspection-order td {
  1332. border-bottom: 0px !important;
  1333. border-right: 0px !important;
  1334. }
  1335. #user-inspection-order th {
  1336. border-right: 0px !important;
  1337. }
  1338. #user-inspection-form .el-form-item__content {
  1339. line-height: 0 !important;
  1340. }
  1341. .el-table td,
  1342. .el-table th.is-leaf,
  1343. .el-table--border,
  1344. .el-table--group {
  1345. border-color: #d0d3da;
  1346. }
  1347. .el-table--border::after,
  1348. .el-table--group::after,
  1349. .el-table::before {
  1350. background-color: #d0d3da;
  1351. }
  1352. </style>