FastProvince.vue 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. <template>
  2. <div class="fastProvince">
  3. <el-dialog
  4. title="提示"
  5. :visible.sync="dialogVisible"
  6. width="40%"
  7. >
  8. <div style="text-align: center">
  9. <p>您选择的区域酷医云暂未对接,请联系酷医云客服,我们将免费为您实现对接</p>
  10. <img style="width: 150px;height: 150px" src="../../../assets/home/kuyi_wechat.jpg"/>
  11. <p>服务热线</p>
  12. <p style="font-size: 16px">18682078150</p>
  13. </div>
  14. <span slot="footer" class="dialog-footer">
  15. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  16. </span>
  17. </el-dialog>
  18. <div class="cell clearfix">
  19. <el-form :model="form" ref="ruleForm" label-width="40px" class="demo-ruleForm" style="text-align: center">
  20. <el-form-item label="地区">
  21. <el-select v-model="form.province" clearable filterable placeholder="请选择" @change="changeProvince" style="width:150px;">
  22. <el-option
  23. v-for="item in provinces"
  24. :key="item.id"
  25. :label="item.name"
  26. :value="item.id">
  27. </el-option>
  28. </el-select>
  29. </el-form-item>
  30. </el-form>
  31. </div>
  32. <div class="cell clearfix" style="margin-bottom:0px;">
  33. <el-form :inline="true" :model="listQuery">
  34. <el-form-item label>
  35. <el-input v-model.trim="listQuery.search" placeholder="姓名/透析号" style="width:120px"></el-input>
  36. <el-button type="primary" style="padding: 10px 6px;" @click="onSearch" icon="el-icon-search">搜索</el-button>
  37. </el-form-item>
  38. </el-form>
  39. <div class="time" style="margin-left:40px;">
  40. <ul class="newUl">
  41. <li
  42. :class="item.state == wayType ? 'active' : ''"
  43. @click="chooseWay(item.state)"
  44. v-for="item in way"
  45. :key="item.value"
  46. >{{ item.label }}</li>
  47. </ul>
  48. </div>
  49. </div>
  50. <div style="flex:1">
  51. <el-container class="newContainer">
  52. <div style="width:270px">
  53. <div class="tableTitle">患者列表</div>
  54. <div class="cell clearfix" style="margin-bottom:10px;">
  55. <el-date-picker v-model="selected_date" prefix-icon="el-icon-date" @change="handleScheduleDateChange" :editable="false" :clearable="false" style="width: 130px;margin-right:10px;" type="date" placeholder="选择日期时间" align="right" ></el-date-picker>
  56. <el-input size="small" style="width:80px;" v-model.trim="search_input" class="filter-item"/>
  57. <el-button size="small" class="filter-item" type="primary" @click="searchAction">搜索</el-button>
  58. </div>
  59. <div class="cell clearfix" style="margin-bottom:10px;">
  60. <el-select v-model="patientStateVal" placeholder="全部患者状态" style="width:130px;margin-right:10px;" @change="handleStateChange">
  61. <el-option
  62. v-for="item in patient_state"
  63. :key="item.value"
  64. :label="item.label"
  65. :value="item.value">
  66. </el-option>
  67. </el-select>
  68. <el-select v-model="treatStateVal" placeholder="全部治疗状态" style="width:130px;margin-right:10px;" @change="handleTreatChange">
  69. <el-option
  70. v-for="item in treat_state"
  71. :key="item.value"
  72. :label="item.label"
  73. :value="item.value">
  74. </el-option>
  75. </el-select>
  76. </div>
  77. <div class="cell clearfix" style="margin-bottom:10px;">
  78. <el-select v-model="scheduleStateVal" placeholder="班次" style="width:130px;margin-right:10px;" @change="handletimeType">
  79. <el-option
  80. v-for="item in schedule_options"
  81. :key="item.value"
  82. :label="item.label"
  83. :value="item.value">
  84. </el-option>
  85. </el-select>
  86. <el-select v-model="zoneVal" placeholder="分区" style="width:130px;margin-right:10px;" @change="handleZoneChange">
  87. <el-option
  88. v-for="item in zone_options"
  89. :key="item.id"
  90. :label="item.text"
  91. :value="item.id">
  92. </el-option>
  93. </el-select>
  94. </div>
  95. <div style="padding-right:20px;">
  96. <el-table
  97. ref="tab"
  98. @row-click="changePatient"
  99. highlight-current-row
  100. :data="tableData"
  101. height="500"
  102. border
  103. style="width: 100%">
  104. <el-table-column
  105. prop="date"
  106. label="患者"
  107. >
  108. <template slot-scope="scope">
  109. {{ scope.row.patient.name }}
  110. </template>
  111. </el-table-column>
  112. <el-table-column
  113. prop="name"
  114. label="状态"
  115. >
  116. <template slot-scope="scope">
  117. <div style="display:flex;align-items:center;justify-content:space-around;">
  118. <span class="tip1" v-if="scope.row.prescription == null || scope.row.prescription.creater == 0">
  119. 待开处方
  120. </span>
  121. <span class="tip2" v-if="scope.row.assessment_before_dislysis == null || scope.row.assessment_before_dislysis.weight_before == ''">
  122. 待称重
  123. </span>
  124. </div>
  125. </template>
  126. </el-table-column>
  127. </el-table>
  128. </div>
  129. </div>
  130. <basic-info v-if="wayType == 0"></basic-info>
  131. <treat-info v-if="wayType == 1"></treat-info>
  132. <dialysis-params v-if="wayType == 2"></dialysis-params>
  133. <dialysis-summary v-if="wayType == 3"></dialysis-summary>
  134. <rescue-record v-if="wayType == 4"></rescue-record>
  135. </el-container>
  136. </div>
  137. </div>
  138. </template>
  139. <script>
  140. import { GetDistrictsByUpid } from '@/api/district'
  141. import { getIsDocking } from '@/api/config'
  142. import basicInfo from "../fast/basicInfo"
  143. import treatInfo from "../fast/treatInfo"
  144. import dialysisParams from "../fast/dialysisParams"
  145. import dialysisSummary from "../fast/dialysisSummary"
  146. import rescueRecord from "../fast/rescueRecord"
  147. import {
  148. getDialysisRecordInitData,
  149. getDialysisSchedules
  150. } from "@/api/dialysis_record";
  151. import { parseTime } from "@/utils";
  152. export default {
  153. name: 'FastProvince',
  154. components:{
  155. basicInfo,
  156. treatInfo,
  157. dialysisParams,
  158. dialysisSummary,
  159. rescueRecord
  160. },
  161. data() {
  162. return {
  163. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  164. start_time: '',
  165. dialogVisible: false,
  166. end_time: '',
  167. provinces: [],
  168. citys:[],
  169. form: {
  170. province: '',
  171. city: ''
  172. },
  173. listQuery: {
  174. start_time: "",
  175. end_time: "",
  176. page: 1,
  177. limit: 10
  178. },
  179. way: [
  180. { value: 0, label: "基本信息", state: 0 },
  181. { value: 1, label: "治疗信息", state: 1 },
  182. { value: 2, label: "透析参数", state: 2 },
  183. { value: 3, label: "治疗小结", state: 3 },
  184. { value: 4, label: "抢救记录", state: 4 },
  185. ],
  186. wayType: 0,
  187. //
  188. tableData: [],
  189. selected_date: new Date(),
  190. // search_input 和 search_keyword,使输入关键字时不会经常刷新 filtedSchedules
  191. search_keyword: '', // 确定用于搜索的关键字
  192. search_input: '', // 输入中的关键字
  193. patient_state:[
  194. {value: 0,label: '全部'},
  195. {value: 1,label: '已签到'},
  196. {value: 2,label: '未签到'},
  197. {value: 3,label: '已上机'},
  198. {value: 4,label: '已下机'},
  199. ],
  200. patientStateVal: 0,
  201. treat_state:[
  202. {value: 0,label: '全部'},
  203. {value: 1,label: '待开处方'},
  204. {value: 2,label: '待开小结'},
  205. ],
  206. treatStateVal: 0,
  207. schedule_options:[
  208. {value: 0,label: '全部'},
  209. {value: 1,label: '上午'},
  210. {value: 2,label: '下午'},
  211. {value: 3,label: '晚上'},
  212. ],
  213. scheduleStateVal: 0,
  214. zone_options:[
  215. { id: 0, text: '全部' }
  216. ],
  217. zoneVal:0,
  218. }
  219. },
  220. computed:{
  221. filtedSchedules: function() {
  222. var search_keyword = this.search_keyword
  223. if (search_keyword.length > 0) {
  224. var schedules = []
  225. for (let o_i = 0; o_i < this.zone_schedules.length; o_i++) {
  226. const scheduleInfo = this.zone_schedules[o_i]
  227. var originSchedules = scheduleInfo.schedules
  228. if (originSchedules.length == 0) {
  229. continue
  230. }
  231. var filtedSchedules = []
  232. for (let s_i = 0; s_i < originSchedules.length; s_i++) {
  233. const schedule = originSchedules[s_i]
  234. if (schedule.patient.name.indexOf(search_keyword) != -1) {
  235. filtedSchedules.push(schedule)
  236. // break
  237. }
  238. }
  239. if (filtedSchedules.length > 0) {
  240. schedules.push({ zone_id: scheduleInfo.zone_id, zone_name: scheduleInfo.zone_name, schedules: filtedSchedules })
  241. }
  242. }
  243. return schedules
  244. }
  245. }
  246. },
  247. created() {
  248. this.getDistricts()
  249. var province = sessionStorage.getItem('province')
  250. if (province == null) {
  251. this.form.province = ''
  252. } else {
  253. this.form.province = parseInt(province)
  254. }
  255. this.getInitData();
  256. }, methods: {
  257. getDistricts: function() {
  258. GetDistrictsByUpid({ id: 0 }).then(response => {
  259. var res = response.data
  260. if (res.state === 1) {
  261. this.provinces = res.data.citys
  262. }
  263. }).catch(e => {
  264. })
  265. }, changeProvince(id) {
  266. getIsDocking({ config_type: 2, province: id, city: 0 }).then(response => {
  267. var res = response.data
  268. if (res.state == 1) {
  269. if (res.data.is_docking == 2) {
  270. this.$message.error('该地区尚未对接,请联系客服')
  271. this.dialogVisible = true
  272. this.form.province = ''
  273. } else {
  274. this.form.province = id
  275. this.dialogVisible = false
  276. sessionStorage.setItem('province', id)
  277. }
  278. } else {
  279. this.$message.error(res.msg)
  280. }
  281. }).catch(e => {
  282. })
  283. },
  284. chooseWay(way) {
  285. this.wayType = way;
  286. },
  287. //日期
  288. handleScheduleDateChange: function() {
  289. this.treatStateVal = 0
  290. this.patientStateVal = 0
  291. this.zoneVal = 0
  292. this.scheduleStateVal = 0
  293. this.search_keyword = this.search_input = ''
  294. // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
  295. // zone: this.zone_selected,
  296. // schedule_type: this.schedule_type_selected,
  297. // schedule_date: this.selected_date,
  298. // })
  299. this.requestDialysisSchedules()
  300. },
  301. //初始化数据
  302. getInitData: function() {
  303. getDialysisRecordInitData().then(rs => {
  304. var resp = rs.data
  305. if (resp.state == 1) {
  306. var zones = resp.data.zones
  307. var schedules = resp.data.schedules
  308. var zone_options = [{ id: 0, text: '全部' }]
  309. for (let z_i = 0; z_i < zones.length; z_i++) {
  310. const zone = zones[z_i]
  311. zone_options.push({ id: zone.id, text: zone.name })
  312. }
  313. this.zone_options = zone_options
  314. this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
  315. this.arr = this.processedDialysisSchedules(schedules, this.zone_options)
  316. this.getData()
  317. } else {
  318. this.$message.error(resp.msg)
  319. }
  320. })
  321. },
  322. // 班次
  323. handletimeType: function(index) {
  324. this.scheduleStateVal = index
  325. // this.$store.dispatch('SetScheduleTypeSelected', { schedule_type_selected: index })
  326. this.search_keyword = this.search_input = ''
  327. this.getData()
  328. },
  329. //分区
  330. handleZoneChange: function(index) {
  331. this.zoneVal = index
  332. // this.$store.dispatch('SetZoneSelected', { zone_selected: index })
  333. this.search_keyword = this.search_input = ''
  334. this.getData()
  335. },
  336. //患者状态
  337. handleStateChange: function(index) {
  338. this.patientStateVal = index
  339. // this.$store.dispatch('SetPatientStateSelected', { patient_state_selected: index })
  340. this.search_keyword = this.search_input = ''
  341. this.getData()
  342. },
  343. handleTreatChange: function(index) {
  344. this.treatStateVal = index
  345. // this.$store.dispatch('SetTreatStateSelected', { treat_state_selected: index })
  346. this.search_keyword = this.search_input = ''
  347. this.getData()
  348. },
  349. processedDialysisSchedules: function(schedules, zone_options) {
  350. var zoneMap = {}
  351. var scheduleMap = {}
  352. for (let z_i = 0; z_i < zone_options.length; z_i++) {
  353. const zone = zone_options[z_i]
  354. if (zone.id == 0) {
  355. continue
  356. }
  357. scheduleMap[zone.id] = []
  358. }
  359. for (let index = 0; index < schedules.length; index++) {
  360. const schedule = schedules[index]
  361. scheduleMap[schedule.device_number.zone.id].push(schedule)
  362. }
  363. var zone_schedules = []
  364. for (let index = 0; index < zone_options.length; index++) {
  365. const zone = zone_options[index]
  366. if (zone.id == 0) {
  367. continue
  368. }
  369. var schedules = scheduleMap[zone.id]
  370. zone_schedules.push({ zone_id: zone.id, zone_name: zone.text, schedules: schedules })
  371. }
  372. return zone_schedules
  373. },
  374. searchAction: function() {
  375. this.search_keyword = this.search_input
  376. this.scheduleStateVal = 0
  377. this.zoneVal = 0
  378. this.treatStateVal = 0
  379. this.patientStateVal = 0
  380. if(this.search_input != ''){
  381. let arr = []
  382. this.filtedSchedules.map(item => {
  383. arr.push(...item.schedules)
  384. })
  385. if(this.activeName == "first"){
  386. this.tableData = arr
  387. }else if(this.activeName == "second"){
  388. this.tableData1 = arr
  389. }
  390. }else{
  391. this.getData()
  392. }
  393. },
  394. requestDialysisSchedules: function() {
  395. var ymd = parseTime(this.selected_date, '{y}-{m}-{d}')
  396. getDialysisSchedules(ymd).then(rs => {
  397. var resp = rs.data
  398. if (resp.state == 1) {
  399. var schedules = resp.data.schedules
  400. this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
  401. let newArr = []
  402. this.zone_schedules.map(item => {
  403. newArr.push(...item.schedules)
  404. })
  405. this.tableData = newArr
  406. } else {
  407. this.$message.error(resp.msg)
  408. }
  409. })
  410. },
  411. changePatient(schedual){
  412. // console.log(schedual)
  413. // this.patient_id = schedual.patient_id;
  414. // this.date = schedual.schedule_date;
  415. // // this.getScheduleDetail();
  416. // // this.getLongAdvice();
  417. // var patient_id = schedual.patient_id;
  418. // var date = schedual.schedule_date;
  419. // this.$router.push({
  420. // path: "/dialysis/details",
  421. // query: {
  422. // patient_id: patient_id,
  423. // date: date,
  424. // patient_name: schedual.patient.name
  425. // }
  426. // });
  427. },
  428. getData(){
  429. let patientArr = []
  430. patientArr = JSON.parse(JSON.stringify(this.zone_schedules))
  431. console.log('patientArr',patientArr)
  432. let arr1 = []
  433. if(this.patientStateVal == 0){
  434. arr1 = patientArr
  435. console.log(arr1)
  436. }else if(this.patientStateVal == 1){
  437. let arr = []
  438. arr = patientArr
  439. for (let i = 0; i <arr.length; i++) {
  440. for (let j = 0; j < arr[i].schedules.length; j++) {
  441. if (arr[i].schedules.length > 0 && (arr[i].schedules[j].assessment_before_dislysis == null || arr[i].schedules[j].assessment_before_dislysis.weight_before == '' || arr[i].schedules[j].assessment_before_dislysis.diastolic_blood_pressure == '' || arr[i].schedules[j].assessment_before_dislysis.systolic_blood_pressure == '')) {
  442. // 删除元素后改变i的值
  443. arr[i].schedules.splice(j--, 1);
  444. }
  445. }
  446. }
  447. console.log("执行1",arr)
  448. arr1 = arr
  449. }else if(this.patientStateVal == 2){
  450. let arr = []
  451. arr = patientArr
  452. for (let i = 0; i < arr.length; i++) {
  453. for (let j = 0; j < arr[i].schedules.length; j++) {
  454. if (arr[i].schedules.length > 0 && (arr[i].schedules[j].assessment_before_dislysis != null && (arr[i].schedules[j].assessment_before_dislysis.weight_before != 0 || arr[i].schedules[j].assessment_before_dislysis.diastolic_blood_pressure != 0 || arr[i].schedules[j].assessment_before_dislysis.systolic_blood_pressure != 0))) {
  455. // 删除元素后改变i的值
  456. console.log('几次')
  457. arr[i].schedules.splice(j--, 1);
  458. }
  459. }
  460. }
  461. console.log("执行2",arr)
  462. arr1 = arr
  463. }else if(this.patientStateVal == 3){
  464. let arr = []
  465. arr = patientArr
  466. for (let i = 0; i <arr.length; i++) {
  467. for (let j = 0; j < arr[i].schedules.length; j++) {
  468. if (arr[i].schedules.length > 0 && (arr[i].schedules[j].dialysis_order == null || (arr[i].schedules[j].dialysis_order != null && arr[i].schedules[j].dialysis_order.stage != 1))) {
  469. // 删除元素后改变i的值
  470. arr[i].schedules.splice(j--, 1);
  471. }
  472. }
  473. }
  474. console.log("执行1",arr)
  475. arr1 = arr
  476. }else if(this.patientStateVal == 4){
  477. let arr = []
  478. arr = patientArr
  479. for (let i = 0; i < arr.length; i++) {
  480. for (let j = 0; j < arr[i].schedules.length; j++) {
  481. if (arr[i].schedules.length > 0 && (arr[i].schedules[j].dialysis_order == null || (arr[i].schedules[j].dialysis_order != null && arr[i].schedules[j].dialysis_order.stage != 2))) {
  482. // 删除元素后改变i的值
  483. arr[i].schedules.splice(j--, 1);
  484. }
  485. }
  486. }
  487. console.log("执行2",arr)
  488. arr1 = arr
  489. }
  490. let arr2 = []
  491. if(this.treatStateVal == 0){
  492. arr2 = JSON.parse(JSON.stringify(arr1))
  493. }else if(this.treatStateVal == 1){
  494. let arr = []
  495. arr = JSON.parse(JSON.stringify(arr1))
  496. for (let i = 0; i < arr.length; i++) {
  497. for (let j = 0; j < arr[i].schedules.length; j++) {
  498. if (arr[i].schedules.length > 0 && (arr[i].schedules[j].prescription != null || arr[i].schedules[j].prescription != null ? arr[i].schedules[j].prescription.creater != 0 : false)) {
  499. // 删除元素后改变i的值
  500. arr[i].schedules.splice(j--, 1);
  501. }
  502. }
  503. }
  504. arr2 = arr
  505. }else if(this.treatStateVal == 2){
  506. let arr = []
  507. arr = JSON.parse(JSON.stringify(arr1))
  508. for (let i = 0; i < arr.length; i++) {
  509. for (let j = 0; j < arr[i].schedules.length; j++) {
  510. if (arr[i].schedules.length > 0 && arr[i].schedules[j].treatment_summary != null && arr[i].schedules[j].treatment_summary.dialysis_summary != '') {
  511. // 删除元素后改变i的值
  512. arr[i].schedules.splice(j--, 1);
  513. }
  514. }
  515. }
  516. arr2 = arr
  517. }
  518. let arr3 = []
  519. if(this.scheduleStateVal == 0){
  520. arr3 = JSON.parse(JSON.stringify(arr2))
  521. }else{
  522. let arr = []
  523. arr = JSON.parse(JSON.stringify(arr2))
  524. for (let i = 0; i < arr.length; i++) {
  525. for (let j = 0; j < arr[i].schedules.length; j++) {
  526. if (this.scheduleStateVal != arr[i].schedules[j].schedule_type) {
  527. // 删除元素后改变i的值
  528. arr[i].schedules.splice(j--, 1);
  529. }
  530. }
  531. }
  532. arr3 = arr
  533. console.log("上午",arr)
  534. }
  535. let arr4 = []
  536. if(this.zoneVal == 0){
  537. arr4 = JSON.parse(JSON.stringify(arr3))
  538. }else{
  539. let arr = []
  540. arr = JSON.parse(JSON.stringify(arr3))
  541. for (let i = 0; i < arr.length; i++) {
  542. if (this.zoneVal != arr[i].zone_id) {
  543. // 删除元素后改变i的值
  544. arr.splice(i--, 1);
  545. }
  546. }
  547. arr4 = arr
  548. }
  549. let newArr = []
  550. arr4.map(item => {
  551. newArr.push(...item.schedules)
  552. })
  553. this.tableData = newArr
  554. console.log('table',this.tableData)
  555. },
  556. }
  557. }
  558. </script>
  559. <style lang="scss" scoped>
  560. .fastProvince{
  561. .newUl{
  562. li{
  563. padding:10px 20px !important;
  564. }
  565. }
  566. }
  567. .tableTitle {
  568. font-size: 16px;
  569. color: #000;
  570. font-weight: bold;
  571. line-height: 40px;
  572. }
  573. </style>
  574. <style lang="scss">
  575. .fastProvince{
  576. .el-form-item{
  577. margin-bottom: 0;
  578. }
  579. // .el-button--medium{
  580. // padding: 10px 6px;
  581. // }
  582. }
  583. .newContainer{
  584. .el-date-editor{
  585. .el-input__inner{
  586. padding-right:0px;
  587. }
  588. }
  589. }
  590. </style>