inspection.vue 45KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419
  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("")
  605. this.form.imgs.push({
  606. img_url: this.qiniuDomain + res.url + '?imageView2/2/w/500/h/500/q/90',
  607. desc: '',
  608. id: 0
  609. })
  610. this.loading.close()
  611. },
  612. changeInput(item) {
  613. if (item.item_name == '血清铁' || item.item_name == '总铁结合力') {
  614. let index1 = ''
  615. let index2 = ''
  616. this.form.formItem.map((it, index) => {
  617. if (this.form.formItem[index].item_name == '血清铁') {
  618. index1 = index
  619. }
  620. if (this.form.formItem[index].item_name == '总铁结合力') {
  621. index2 = index
  622. }
  623. if (it.item_name == '转铁蛋白饱和度(计算)') {
  624. it.value = (parseFloat(this.form.formItem[index1].value) / parseFloat(this.form.formItem[index2].value)) * 100
  625. }
  626. })
  627. }
  628. },
  629. deleteInspection() {
  630. if (this.project == null || this.itemDate == '') {
  631. this.$message.error('请先选择删除删除的记录')
  632. return false
  633. }
  634. this.$confirm('确认删除此记录?', '删除', {
  635. confirmButtonText: '确定',
  636. cancelButtonText: '取消',
  637. type: 'warning'
  638. })
  639. .then(() => {
  640. var params = {
  641. patient: this.patientID,
  642. date: this.itemDate,
  643. project_id: this.project.project_id
  644. }
  645. DeletePatientInspection(params).then(response => {
  646. if (response.data.state == 0) {
  647. this.$message.error(response.data.msg)
  648. return false
  649. } else {
  650. this.$notify({
  651. title: '成功',
  652. message: '删除成功',
  653. type: 'success',
  654. duration: 2000
  655. })
  656. for (var index in this.projects) {
  657. if (this.projects[index].project_id == params.project_id) {
  658. this.projects[index].count--
  659. break
  660. }
  661. }
  662. this.total -= 1
  663. this.itemDate = ''
  664. this.items = []
  665. if (this.total > 0) {
  666. this.queryParams.page = 1
  667. this.fetchPatientInspections(this.queryParams)
  668. }
  669. }
  670. })
  671. })
  672. .catch(() => {
  673. })
  674. },submitRemindDialog(){
  675. var temp_is_open = 0
  676. if(this.is_open){
  677. temp_is_open = 1
  678. }else{
  679. temp_is_open = 0
  680. }
  681. setRemindDialog(this.record_id,temp_is_open).then(response => {
  682. if (response.data.state == 0) {
  683. this.$message.error(response.data.msg)
  684. return false
  685. } else {
  686. this.record_id = response.data.data.config.id
  687. if(response.data.data.config.is_open == 1){
  688. this.is_open = true
  689. }else{
  690. this.is_open = false
  691. }
  692. this.$notify({
  693. title: '成功',
  694. message: '设置成功',
  695. type: 'success',
  696. duration: 2000
  697. })
  698. this.dialogRemindDialogFormVisible = false
  699. }
  700. })
  701. },submitNewRemind(){
  702. // console.log(this.is_open)
  703. var params = {
  704. patient: this.patientID,
  705. project_id: this.project.project_id,
  706. remind_cycle: this.temp_remind_cycle
  707. }
  708. setRemind(params).then(response => {
  709. if (response.data.state == 0) {
  710. this.$message.error(response.data.msg)
  711. return false
  712. } else {
  713. this.$notify({
  714. title: '成功',
  715. message: '设置成功',
  716. type: 'success',
  717. duration: 2000
  718. })
  719. this.dialogRemindFormVisible = false
  720. }
  721. })
  722. }, openEdit() {
  723. if (this.project == null) {
  724. this.$message.error('请先选择项目')
  725. return false
  726. }
  727. if(this.isPic){
  728. this.form.pic_method = 'edit'
  729. this.formTitle = '修改' + this.project.project_name
  730. this.form.project_id = this.project.project_id
  731. this.form.inspect_date = this.itemDate
  732. this.form.old_inspect_date = this.itemDate
  733. this.form.imgs = []
  734. this.form.delete_imgs = []
  735. for(var index in this.inspections){
  736. this.form.imgs.push({
  737. id: this.inspections[index].id,
  738. img_url: this.inspections[index].inspect_value,
  739. desc: this.inspections[index].item_name
  740. })
  741. }
  742. console.log(this.form.imgs)
  743. this.dialogPicFormVisible = true
  744. }else{
  745. console.log("22222")
  746. this.form.method = 'edit'
  747. this.formTitle = '修改' + this.project.project_name
  748. this.form.project_id = this.project.project_id
  749. this.form.inspect_date = this.itemDate
  750. this.form.old_inspect_date = this.itemDate
  751. if(this.form.project_id == 14) {
  752. this.form.remind_cycle = this.patient_info.remind_cycle
  753. }else{
  754. this.form.remind_cycle =""
  755. }
  756. console.log(this.form.remind_cycle)
  757. this.form.formItem = []
  758. for (var index in this.project.inspection_reference) {
  759. this.form.formItem.push({
  760. id: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].id : 0,
  761. project_id: this.project.inspection_reference[index].project_id,
  762. project_name: this.project.inspection_reference[index].project_name,
  763. item_id: this.project.inspection_reference[index].id,
  764. item: this.project.inspection_reference[index].item,
  765. item_name: this.project.inspection_reference[index].item_name,
  766. range_type: this.project.inspection_reference[index].range_type,
  767. value: this.project.inspection_reference[index].id in this.inspectionsMap ? this.inspectionsMap[this.project.inspection_reference[index].id].inspect_value : '',
  768. select_options: this.project.inspection_reference[index].range_options.split(','),
  769. unit: this.project.inspection_reference[index].unit
  770. })
  771. }
  772. console.log(this.form.formItem)
  773. this.dialogFormVisible = true
  774. }
  775. },setRemindDialog(){
  776. this.dialogRemindDialogFormVisible = true
  777. },setRemind(){
  778. this.dialogRemindFormVisible = true
  779. // this.temp_remind_cycle = this.
  780. },
  781. openPic() {
  782. if (this.project == null) {
  783. this.$message.error('请先选择项目')
  784. return false
  785. }
  786. this.form.pic_method = 'add'
  787. this.formTitle = '新增' + this.project.project_name
  788. this.form.project_id = this.project.project_id
  789. this.form.imgs=[]
  790. this.form.delete_imgs=[]
  791. if(this.form.project_id == 14) {
  792. this.form.remind_cycle = this.patient_info.remind_cycle
  793. }
  794. var today = new Date()
  795. this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
  796. this.form.formItem = []
  797. for (var index in this.project.inspection_reference) {
  798. // var formItem = this.project.inspection_reference[index];
  799. // formItem["value"] = '';
  800. // if (formItem.range_type==2) {
  801. // formItem["select_options"] = formItem.range_options.split(",");
  802. // }
  803. this.form.formItem.push({
  804. id: 0,
  805. project_id: this.project.inspection_reference[index].project_id,
  806. project_name: this.project.inspection_reference[index].project_name,
  807. item_id: this.project.inspection_reference[index].id,
  808. item: this.project.inspection_reference[index].item,
  809. item_name: this.project.inspection_reference[index].item_name,
  810. range_type: this.project.inspection_reference[index].range_type,
  811. value: '',
  812. select_options: this.project.inspection_reference[index].range_options.split(','),
  813. unit: this.project.inspection_reference[index].unit
  814. })
  815. }
  816. console.log('form.formItem', this.form.formItem)
  817. this.dialogPicFormVisible = true
  818. },
  819. openNew() {
  820. if (this.project == null) {
  821. this.$message.error('请先选择项目')
  822. return false
  823. }
  824. this.form.method = 'add'
  825. this.formTitle = '新增' + this.project.project_name
  826. this.form.project_id = this.project.project_id
  827. if(this.form.project_id == 14) {
  828. this.form.remind_cycle = this.patient_info.remind_cycle
  829. }
  830. // this.form.remind_cycle = this.patient_info.remind_cycle
  831. var today = new Date()
  832. this.form.inspect_date = uParseTime(today, '{y}-{m}-{d} {h}:{i}')
  833. this.form.formItem = []
  834. for (var index in this.project.inspection_reference) {
  835. // var formItem = this.project.inspection_reference[index];
  836. // formItem["value"] = '';
  837. // if (formItem.range_type==2) {
  838. // formItem["select_options"] = formItem.range_options.split(",");
  839. // }
  840. this.form.formItem.push({
  841. id: 0,
  842. project_id: this.project.inspection_reference[index].project_id,
  843. project_name: this.project.inspection_reference[index].project_name,
  844. item_id: this.project.inspection_reference[index].id,
  845. item: this.project.inspection_reference[index].item,
  846. item_name: this.project.inspection_reference[index].item_name,
  847. range_type: this.project.inspection_reference[index].range_type,
  848. value: '',
  849. select_options: this.project.inspection_reference[
  850. index
  851. ].range_options.split(','),
  852. unit: this.project.inspection_reference[index].unit
  853. })
  854. }
  855. console.log('form.formItem', this.form.formItem)
  856. this.dialogFormVisible = true
  857. },
  858. submitEdit(formName) {
  859. this.$refs[formName].validate(valid => {
  860. if (valid) {
  861. this.formLoading = true
  862. if (this.form.formItem.length == 0) {
  863. this.$message.error('未填写项目')
  864. return false
  865. }
  866. for (var index in this.form.formItem) {
  867. this.form.formItem[index].value = '' + this.form.formItem[index].value
  868. }
  869. EditPatientInspection(this.patientID, this.form, this.form.remind_cycle, this.form.inspect_date, this.form.project_id).then(response => {
  870. if (response.data.state == 1) {
  871. this.$notify({
  872. title: '成功',
  873. message: '修改成功',
  874. type: 'success',
  875. duration: 2000
  876. })
  877. this.patient_info.remind_cycle =
  878. response.data.data.remind_cycle
  879. this.itemDate = this.form.inspect_date
  880. this.items = []
  881. var inspections = response.data.data.inspections
  882. this.inspections = response.data.data.inspections
  883. if (inspections == null) {
  884. this.inspections = []
  885. return false
  886. }
  887. var inspectionsMap = {}
  888. this.inspectionsMap = {}
  889. for (var index in inspections) {
  890. inspectionsMap[inspections[index].item_id] =
  891. inspections[index]
  892. this.inspectionsMap[inspections[index].item_id] =
  893. inspections[index]
  894. }
  895. var items = this.project.inspection_reference
  896. console.log('itmes', items)
  897. for (var index in items) {
  898. if (items[index].id in inspectionsMap) {
  899. var item = {}
  900. for (var key in items[index]) {
  901. item[key] = items[index][key]
  902. }
  903. item.value = inspectionsMap[items[index].id].inspect_value
  904. item.value_direction = ''
  905. if (item.range_type == 1) {
  906. var value = parseFloat(item.value)
  907. var range_min = parseFloat(item.range_min)
  908. var range_max = parseFloat(item.range_max)
  909. if (value < range_min) {
  910. item.value_direction = '↓'
  911. } else if (value > range_max) {
  912. item.value_direction = '↑'
  913. }
  914. }
  915. this.items.push(item)
  916. }
  917. }
  918. this.resetForm(formName)
  919. this.dialogFormVisible = false
  920. } else {
  921. this.$message.error(response.data.msg)
  922. return false
  923. }
  924. })
  925. .catch(v => {
  926. this.$message.error(v)
  927. return false
  928. })
  929. this.formLoading = false
  930. return false
  931. } else {
  932. return false
  933. }
  934. })
  935. },
  936. submitNew(formName) {
  937. this.$refs[formName].validate(valid => {
  938. if (valid) {
  939. this.formLoading = true
  940. if (this.form.formItem.length == 0) {
  941. this.$message.error('未填写项目')
  942. return false
  943. }
  944. for (var index in this.form.formItem) {
  945. this.form.formItem[index].value =
  946. '' + this.form.formItem[index].value
  947. }
  948. CreatePatientInspection(
  949. this.patientID,
  950. this.form,
  951. this.form.remind_cycle
  952. )
  953. .then(response => {
  954. if (response.data.state == 1) {
  955. this.$notify({
  956. title: '成功',
  957. message: '新增成功',
  958. type: 'success',
  959. duration: 2000
  960. })
  961. // this.form.remind_reycle = response.data.data.remind_reycc
  962. this.patient_info.remind_cycle =
  963. response.data.data.remind_cycle
  964. console.log(this.patient_info.remind_cycle)
  965. this.itemDate = this.form.inspect_date
  966. this.items = []
  967. for (var index in this.projects) {
  968. if (this.projects[index].project_id == this.form.project_id) {
  969. this.projects[index].count++
  970. break
  971. }
  972. }
  973. this.total += 1
  974. var inspections = response.data.data.inspections
  975. this.inspections = response.data.data.inspections
  976. if (inspections == null) {
  977. this.inspections = []
  978. return false
  979. }
  980. var inspectionsMap = {}
  981. this.inspectionsMap = {}
  982. for (var index in inspections) {
  983. inspectionsMap[inspections[index].item_id] =
  984. inspections[index]
  985. this.inspectionsMap[inspections[index].item_id] =
  986. inspections[index]
  987. }
  988. var items = this.project.inspection_reference
  989. for (var index in items) {
  990. if (items[index].id in inspectionsMap) {
  991. var item = {}
  992. for (var key in items[index]) {
  993. item[key] = items[index][key]
  994. }
  995. item.value = inspectionsMap[items[index].id].inspect_value
  996. item.value_direction = ''
  997. if (item.range_type == 1) {
  998. var value = parseFloat(item.value)
  999. var range_min = parseFloat(item.range_min)
  1000. var range_max = parseFloat(item.range_max)
  1001. if (value < range_min) {
  1002. item.value_direction = '↓'
  1003. } else if (value > range_max) {
  1004. item.value_direction = '↑'
  1005. }
  1006. }
  1007. this.items.push(item)
  1008. }
  1009. }
  1010. this.resetForm(formName)
  1011. this.dialogFormVisible = false
  1012. this.queryParams.patient = this.patientID
  1013. this.queryParams.project_id = this.project.project_id
  1014. this.queryParams.page = 1
  1015. this.total = 0
  1016. this.fetchPatientInspections(this.queryParams)
  1017. } else {
  1018. this.$message.error(response.data.msg)
  1019. return false
  1020. }
  1021. })
  1022. .catch(v => {
  1023. this.$message.error(v)
  1024. return false
  1025. })
  1026. this.formLoading = false
  1027. return false
  1028. } else {
  1029. return false
  1030. }
  1031. })
  1032. },
  1033. submitEditPicNew() {
  1034. if (this.form.imgs.length == 0) {
  1035. this.$message.error('未上传图片')
  1036. return false
  1037. }
  1038. this.formLoading = true
  1039. editPatientPICInspection(
  1040. this.patientID,
  1041. this.form
  1042. )
  1043. .then(response => {
  1044. if (response.data.state === 1) {
  1045. this.$notify({
  1046. title: '成功',
  1047. message: '修改成功',
  1048. type: 'success',
  1049. duration: 2000
  1050. })
  1051. this.itemDate = this.form.inspect_date
  1052. this.items = []
  1053. this.dialogPicFormVisible = false
  1054. this.queryParams.patient = this.patientID
  1055. this.queryParams.project_id = this.project.project_id
  1056. this.queryParams.page = 1
  1057. this.total = 0
  1058. this.fetchPatientInspections(this.queryParams)
  1059. } else {
  1060. this.$message.error(response.data.msg)
  1061. return false
  1062. }
  1063. })
  1064. .catch(v => {
  1065. this.$message.error(v)
  1066. return false
  1067. })
  1068. this.formLoading = false
  1069. },
  1070. deletePic(item,index){
  1071. if(item.id == 0){
  1072. this.form.imgs.splice(index,1)
  1073. }else{
  1074. for(let index in this.form.imgs){
  1075. if(item.id == this.form.imgs[index].id){
  1076. this.form.imgs.splice(index,1)
  1077. this.form.delete_imgs.push({
  1078. id:item.id,
  1079. })
  1080. }
  1081. }
  1082. }
  1083. },
  1084. submitPicNew() {
  1085. this.formLoading = true
  1086. if (this.form.imgs.length == 0) {
  1087. this.$message.error('未上传图片')
  1088. return false
  1089. }
  1090. CreatePatientPICInspection(
  1091. this.patientID,
  1092. this.form
  1093. )
  1094. .then(response => {
  1095. if (response.data.state === 1) {
  1096. this.$notify({
  1097. title: '成功',
  1098. message: '新增成功',
  1099. type: 'success',
  1100. duration: 2000
  1101. })
  1102. this.itemDate = this.form.inspect_date
  1103. this.items = []
  1104. for (var index in this.projects) {
  1105. if (this.projects[index].project_id == this.form.project_id) {
  1106. this.projects[index].count++
  1107. break
  1108. }
  1109. }
  1110. this.total += 1
  1111. // var inspections = response.data.data.inspections
  1112. // this.inspections = response.data.data.inspections
  1113. // if (inspections == null) {
  1114. // this.inspections = []
  1115. // return false
  1116. // }
  1117. // var inspectionsMap = {}
  1118. // this.inspectionsMap = {}
  1119. //
  1120. // var items = this.project.inspection_reference
  1121. // for (var index in items) {
  1122. // if (items[index].id in inspectionsMap) {
  1123. // var item = {}
  1124. // for (var key in items[index]) {
  1125. // item[key] = items[index][key]
  1126. // }
  1127. // item.value = inspectionsMap[items[index].id].inspect_value
  1128. // item.value_direction = ''
  1129. // this.items.push(item)
  1130. // }
  1131. // }
  1132. this.dialogPicFormVisible = false
  1133. this.queryParams.patient = this.patientID
  1134. this.queryParams.project_id = this.project.project_id
  1135. this.queryParams.page = 1
  1136. this.total = 0
  1137. this.fetchPatientInspections(this.queryParams)
  1138. } else {
  1139. this.$message.error(response.data.msg)
  1140. return false
  1141. }
  1142. })
  1143. .catch(v => {
  1144. this.$message.error(v)
  1145. return false
  1146. })
  1147. this.formLoading = false
  1148. },
  1149. fetchInspectionReference() {
  1150. fetchInspectionReference(this.patientID)
  1151. .then(response => {
  1152. if (response.data.state == 1) {
  1153. var reference = response.data.data.reference
  1154. var patient_info = response.data.data.patient_info
  1155. this.projects = reference
  1156. this.patient_info = patient_info
  1157. this.pageLoading = false
  1158. // this.form.remind_cycle = this.patient_info.remind_cycle
  1159. } else {
  1160. this.$message.error(response.data.msg)
  1161. return false
  1162. }
  1163. })
  1164. .catch(v => {
  1165. })
  1166. },
  1167. setCurrent(row) {
  1168. this.$refs.singleTable.setCurrentRow(row)
  1169. },
  1170. resetForm(formName) {
  1171. this.$refs[formName].resetFields()
  1172. },
  1173. handleCurrentChange(row) {
  1174. console.log("row-2-23-23-",row)
  1175. this.itemDate = ''
  1176. this.form.method = 'add'
  1177. if (typeof row === 'undefined' || row == null) {
  1178. this.project = null
  1179. this.items = []
  1180. this.itemName = '请选择项目'
  1181. } else {
  1182. this.itemLoading = true
  1183. this.project = row
  1184. this.items = row.inspection_reference
  1185. this.itemName = row.project_name
  1186. this.queryParams.patient = this.patientID
  1187. this.queryParams.project_id = this.project.project_id
  1188. this.queryParams.page = 1
  1189. this.total = 0
  1190. console.log("wowowowowow")
  1191. this.fetchPatientInspections(this.queryParams)
  1192. }
  1193. },
  1194. handleCurrentChangePage(val) {
  1195. this.itemLoading = true
  1196. this.queryParams.page = val
  1197. this.fetchPatientInspections(this.queryParams)
  1198. },
  1199. fetchPatientInspections(params) {
  1200. this.items = []
  1201. this.isPic = false
  1202. fetchPatientInspections(params)
  1203. .then(response => {
  1204. if (response.data.state == 1) {
  1205. var inspections = response.data.data.inspections
  1206. this.total = response.data.data.total
  1207. this.itemDate = response.data.data.date
  1208. let remind = response.data.data.remind
  1209. let config = response.data.data.config
  1210. this.record_id = config.id
  1211. if(config.id > 0){
  1212. if(config.is_open == 1){
  1213. this.is_open = true
  1214. }else{
  1215. this.is_open = false
  1216. }
  1217. }else{
  1218. this.is_open = false
  1219. }
  1220. if(remind.id > 0 && remind.remind_cycle > 0){
  1221. this.temp_remind_cycle = remind.remind_cycle
  1222. }else{
  1223. this.temp_remind_cycle = ""
  1224. }
  1225. this.inspections = response.data.data.inspections
  1226. console.log("this.inpections",this.inspections)
  1227. if (inspections == null) {
  1228. this.inspections = []
  1229. return false
  1230. }
  1231. var inspectionsMap = {}
  1232. this.inspectionsMap = {}
  1233. for (var index in inspections) {
  1234. inspectionsMap[inspections[index].item_id] = inspections[index]
  1235. this.inspectionsMap[inspections[index].item_id] = inspections[index]
  1236. }
  1237. console.log("inspectionsMap",this.inspectionsMap)
  1238. var items = this.project.inspection_reference
  1239. console.log("i5ems2323232wo",items)
  1240. for (var index in items) {
  1241. console.log("obj",items[index])
  1242. // console.log("inspectionsMap",inspectionsMap[items[index].item_id])
  1243. var item = {}
  1244. for (var key in items[index]) {
  1245. // console.log("key",key,items[index][key])
  1246. // console.log("item[key]",item[key])
  1247. item[key] = items[index][key]
  1248. }
  1249. if (item.item_id > 0) {
  1250. if (typeof(inspectionsMap[parseInt(items[index].item_id)]) == "undefined") {
  1251. if(this.org_id == 10121 || this.org_id == 0 ){
  1252. item.value = inspectionsMap[items[index].id].inspect_value
  1253. item.item_name = inspectionsMap[items[index].id].item_name
  1254. }else{
  1255. item.value = ""
  1256. item.item_name = ""
  1257. }
  1258. } else {
  1259. item.value = inspectionsMap[items[index].item_id].inspect_value
  1260. item.item_name = inspectionsMap[items[index].item_id].item_name
  1261. }
  1262. } else {
  1263. item.value = inspectionsMap[items[index].id].inspect_value
  1264. item.item_name = inspectionsMap[items[index].id].item_name
  1265. }
  1266. // item["inspect_desc"] = inspectionsMap[items[index].id].inspect_desc
  1267. // item["inspect_type"] = inspectionsMap[items[index].id].inspect_type
  1268. item.value_direction = ''
  1269. if (item.range_type == 1) {
  1270. var value = parseFloat(item.value)
  1271. var range_min = parseFloat(item.range_min)
  1272. var range_max = parseFloat(item.range_max)
  1273. if (value < range_min) {
  1274. item.value_direction = '↓'
  1275. } else if (value > range_max) {
  1276. item.value_direction = '↑'
  1277. }
  1278. }
  1279. // console.log("items23233232",item)
  1280. if(item.item_name!=""){
  1281. this.items.push(item)
  1282. }
  1283. console.log("items232232332wo",this.items)
  1284. if(item.value.indexOf("http") >= 0){
  1285. this.isPic = true
  1286. }
  1287. }
  1288. }
  1289. })
  1290. .catch(v => {
  1291. })
  1292. setTimeout(() => {
  1293. this.itemLoading = false
  1294. }, 1000)
  1295. }
  1296. },
  1297. created() {
  1298. const id = this.$route.query && this.$route.query.id
  1299. this.org_id = this.$store.getters.xt_user.org.id,
  1300. this.patientID = parseInt(id)
  1301. if (isNaN(this.patientID) || this.patientID <= 0) {
  1302. this.$notify.error({
  1303. title: '错误',
  1304. message: '无效的id'
  1305. })
  1306. this.$router.push('/patients/patients')
  1307. }
  1308. this.fetchInspectionReference()
  1309. }
  1310. }
  1311. </script>
  1312. <style>
  1313. #oictable ::-webkit-scrollbar {
  1314. height: 15px;
  1315. }
  1316. </style>
  1317. <style>
  1318. #user-inspection-order td {
  1319. border-bottom: 0px !important;
  1320. border-right: 0px !important;
  1321. }
  1322. #user-inspection-order th {
  1323. border-right: 0px !important;
  1324. }
  1325. #user-inspection-form .el-form-item__content {
  1326. line-height: 0 !important;
  1327. }
  1328. .el-table td,
  1329. .el-table th.is-leaf,
  1330. .el-table--border,
  1331. .el-table--group {
  1332. border-color: #d0d3da;
  1333. }
  1334. .el-table--border::after,
  1335. .el-table--group::after,
  1336. .el-table::before {
  1337. background-color: #d0d3da;
  1338. }
  1339. </style>