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