血透系统pad前端

ComputerDialog.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. <template>
  2. <div>
  3. <div class="Dialog" v-show="!selecting">
  4. <div class="DialogTit">
  5. <span @click="close()" class="iconfont">&#xe6e9;</span>
  6. <h1 class="name">透析上机</h1>
  7. <span class="success" v-if="this.record.id == 0 || this.$store.getters.user.user.id != this.creator"></span>
  8. <span class="success" @click="modify()" v-if="isPremission|| this.$store.getters.user.user.id == this.creator">修改</span>
  9. </div>
  10. <div class="DialogContent ">
  11. <div class="item" @click="select_type">
  12. <h2 class="name">班次</h2>
  13. <div class="content">
  14. <span class="text" style="width: 100px">{{getSchedualType(this.schedual_type)}}</span>
  15. <span class="iconfont">&#xe6f9;</span>
  16. </div>
  17. </div>
  18. <div class="item" @click="select_bed">
  19. <h2 class="name">上机床位</h2>
  20. <div class="content">
  21. <span class="text" style="width: 100px">{{ device_number_map[bed_id].number }}</span>
  22. <span class="iconfont">&#xe6f9;</span>
  23. </div>
  24. </div>
  25. <div class="item" @click="select_nurse">
  26. <h2 class="name">上机护士</h2>
  27. <div class="content">
  28. <span class="text" style="width: 100px">{{ admin_map[nurse_id].name }}</span>
  29. <span class="iconfont">&#xe6f9;</span>
  30. </div>
  31. </div>
  32. <div class="item" @click="select_puncture_nurse">
  33. <h2 class="name">穿刺者</h2>
  34. <div class="content">
  35. <span class="text" style="width: 100px" v-if="admin_map[puncture_nurse_id]">{{ admin_map[puncture_nurse_id].name}}</span>
  36. <span class="iconfont">&#xe6f9;</span>
  37. </div>
  38. </div>
  39. <div class="item" v-if="template_id == 6">
  40. <label class="name" for="xll">引血(ml/min)</label>
  41. <div class="content">
  42. <input type="tel" @focus="inputFocus" id="xll" v-model="blood_drawing"/>
  43. </div>
  44. </div>
  45. <div class="item">
  46. <h2 class="name">上机时间</h2>
  47. <div class="content">
  48. <span class="text" style="width: 100px" @click="selectStartTimeAction">{{ start_time_str }}</span>
  49. <span class="iconfont">&#xe6f9;</span>
  50. </div>
  51. </div>
  52. <div class="perform">
  53. <button @click="commitInfo" v-if="(record == null || record.id == '')">执行上机</button>
  54. <button :disabled="true" style="background-color:lightgray;" v-else>已上机</button>
  55. </div>
  56. </div>
  57. </div>
  58. <two-menu ref="selector"></two-menu>
  59. <mt-datetime-picker
  60. ref="start_time_picker"
  61. type="datetime"
  62. @confirm="didSelectStartTime"
  63. v-model="start_time"
  64. ></mt-datetime-picker>
  65. </div>
  66. </template>
  67. <script>
  68. import {startDialysis,PostModifyStartDialysis,GetSchedualNumber} from '@/api/dialysis'
  69. import {Toast} from 'vant'
  70. import {parseTime} from '@/utils'
  71. import TwoMenu from './TwoMenu'
  72. export default {
  73. name: 'ComputerDialog',
  74. components: {
  75. TwoMenu
  76. },
  77. data () {
  78. return {
  79. start_time: new Date(),
  80. selecting: false,
  81. start_time_str: '',
  82. bed_id: 0,
  83. nurse_id: 0,
  84. puncture_nurse_id: 0,
  85. isPremission: false,
  86. zone_beds: [], // 该排班的区里的床位
  87. creator: 0,
  88. template_id: 0,
  89. temp_device_numbers:[],
  90. blood_drawing:100,
  91. schedual_type:0,
  92. schedules_type: [
  93. {id: 1, name:"上午"},
  94. {id: 2, name:"下午"},
  95. {id: 3, name:"晚上"},
  96. ], // 该排班的区里的床位
  97. }
  98. },
  99. props: {
  100. schedule: {
  101. type: Object,
  102. },
  103. patient_prop: {
  104. type: Object,
  105. },
  106. record: {
  107. type: Object,
  108. },
  109. admins: {
  110. type: Array,
  111. },
  112. device_numbers: {
  113. type: Array,
  114. },
  115. admin_map: {
  116. type: Object,
  117. },
  118. device_number_map: {
  119. type: Object,
  120. },
  121. special_premission: {
  122. type: Array,
  123. },
  124. }, mounted () {
  125. },
  126. created () {
  127. this.temp_device_numbers = this.device_numbers
  128. if (this.record.id == 0) {
  129. this.start_time_str = parseTime(this.start_time, '{y}-{m}-{d} {h}:{i}') + ':00'
  130. let now = new Date()
  131. let hour = now.getHours()
  132. if (hour >= 6 && hour < 12){
  133. this.schedual_type = 1
  134. }else if(hour >= 12 && hour < 18){
  135. this.schedual_type = 2
  136. }else if(hour >= 18){
  137. this.schedual_type = 3
  138. }
  139. } else {
  140. if (this.record.start_time == 0) {
  141. this.start_time_str = parseTime(this.start_time, '{y}-{m}-{d} {h}:{i}') + ':00'
  142. this.schedual_type = this.record.schedual_type
  143. } else {
  144. this.start_time_str = parseTime(this.record.start_time, '{y}-{m}-{d} {h}:{i}') + ':00'
  145. this.schedual_type = this.record.schedual_type
  146. }
  147. }
  148. this.GetSchedualNumber()
  149. this.template_id = this.$store.getters.user.template_info.template_id;
  150. var date = this.$route.query && this.$route.query.date
  151. date *= 1000
  152. var newDate = new Date(date)
  153. var y = newDate.getFullYear()
  154. var m = newDate.getMonth() + 1
  155. var d = newDate.getDate()
  156. if (isNaN(y) || isNaN(m) || isNaN(d)) {
  157. newDate = new Date()
  158. y = newDate.getFullYear()
  159. m = newDate.getMonth() + 1
  160. d = newDate.getDate()
  161. }
  162. this.record_date = y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d)
  163. this.bed_id = (this.record == null || this.record.id == '') ? this.schedule.bed_id : this.record.bed_id
  164. this.nurse_id = (this.record == null || this.record.id == '') ? this.$store.getters.user.user.id : this.record.start_nurse
  165. this.puncture_nurse_id = (this.record == null || this.record.id == '') ? this.$store.getters.user.user.id : this.record.puncture_nurse
  166. if (this.puncture_nurse_id == 0) {
  167. this.puncture_nurse_id = this.$store.getters.user.user.id
  168. }
  169. // var beds = []
  170. // for (let index = 0; index < this.device_numbers.length; index++) {
  171. // const device_number = this.device_numbers[index]
  172. // if (device_number.zone_id == this.schedule.partition_id) {
  173. // beds.push(device_number)
  174. // }
  175. // }
  176. // this.zone_beds = beds
  177. for (let index = 0; index < this.temp_device_numbers.length; index++) {
  178. const device_number = this.temp_device_numbers[index]
  179. this.temp_device_numbers[index]['number'] = device_number['zone_name']+'-'+device_number['number']
  180. }
  181. this.zone_beds = this.temp_device_numbers
  182. if (this.record.id > 0) {
  183. for (let i = 0; i < this.special_premission.length; i++) {
  184. if (this.$store.getters.user.user.id == this.special_premission[i].admin_user_id) {
  185. this.isPremission = true
  186. }
  187. }
  188. }
  189. if (this.record.id > 0) {
  190. if (this.record.creator == 0) {
  191. this.creator = this.record.start_nurse
  192. } else {
  193. this.creator = this.record.creator
  194. }
  195. }
  196. },
  197. methods: {
  198. getSchedualType:function(type){
  199. for (let i = 0; i < this.schedules_type.length; i++){
  200. if(this.schedules_type[i].id == type){
  201. return this.schedules_type[i].name
  202. }
  203. }
  204. },
  205. select_type:function(){
  206. if (this.record.id != 0) {
  207. var creator = 0
  208. if (this.record.creator == 0) {
  209. creator = this.record.start_nurse
  210. } else {
  211. creator = this.record.creator
  212. }
  213. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  214. this.selecting = true
  215. var t = this
  216. this.$refs.selector.showSingleSelect(this.schedules_type, this.schedual_type, '选择班次', 'name', 'id', function (select_id) {
  217. t.schedual_type = select_id
  218. let ParamsQuery = {}
  219. ParamsQuery['schedual_type'] = select_id
  220. GetSchedualNumber(ParamsQuery).then(response => {
  221. if (response.data.state == 0) {
  222. Toast.fail(response.data.msg)
  223. return false
  224. } else {
  225. t.temp_device_numbers = response.data.data.number
  226. for (let index = 0; index < t.temp_device_numbers.length; index++) {
  227. const device_number = t.temp_device_numbers[index]
  228. t.temp_device_numbers[index]['number'] = device_number['zone_name']+'-'+device_number['number']
  229. }
  230. t.zone_beds = t.temp_device_numbers
  231. t.bed_id = t.zone_beds[0].id
  232. }
  233. })
  234. }, function () {
  235. t.selecting = false
  236. })
  237. } else {
  238. return
  239. }
  240. }
  241. this.selecting = true
  242. var t = this
  243. this.$refs.selector.showSingleSelect(this.schedules_type, this.schedual_type, '选择班次', 'name', 'id', function (select_id) {
  244. t.schedual_type = select_id
  245. let ParamsQuery = {}
  246. ParamsQuery['schedual_type'] = select_id
  247. GetSchedualNumber(ParamsQuery).then(response => {
  248. if (response.data.state == 0) {
  249. Toast.fail(response.data.msg)
  250. return false
  251. } else {
  252. t.zone_beds = []
  253. t.temp_device_numbers = response.data.data.number
  254. for (let index = 0; index < t.temp_device_numbers.length; index++) {
  255. const device_number = t.temp_device_numbers[index]
  256. t.temp_device_numbers[index]['number'] = device_number['zone_name']+'-'+device_number['number']
  257. }
  258. t.zone_beds = t.temp_device_numbers
  259. t.bed_id = t.zone_beds[0].id
  260. }
  261. })
  262. }, function () {
  263. t.selecting = false
  264. })
  265. },
  266. GetSchedualNumber:function(){
  267. let ParamsQuery = {}
  268. ParamsQuery['schedual_type'] = this.schedual_type
  269. GetSchedualNumber(ParamsQuery).then(response => {
  270. if (response.data.state == 0) {
  271. Toast.fail(response.data.msg)
  272. return false
  273. } else {
  274. this.temp_device_numbers = response.data.data.number
  275. for (let index = 0; index < this.temp_device_numbers.length; index++) {
  276. const device_number = this.temp_device_numbers[index]
  277. this.temp_device_numbers[index]['number'] = device_number['zone_name']+'-'+device_number['number']
  278. }
  279. this.zone_beds = this.temp_device_numbers
  280. }
  281. })
  282. },
  283. inputFocus: function (event) {
  284. var input = event.target
  285. setTimeout(function () {
  286. input.scrollIntoView()
  287. }, 0)
  288. if (input.setSelectionRange) {
  289. setTimeout(function () {
  290. input.setSelectionRange(0, input.value.length)
  291. }, 0)
  292. } else if (input.createTextRange) {
  293. var rng = input.createTextRange()
  294. rng.move('character', input.value.length)
  295. rng.select()
  296. }
  297. },
  298. modify(){
  299. let ParamsQuery = {}
  300. ParamsQuery['schedual_type'] = this.schedual_type
  301. ParamsQuery['id'] = this.record.id
  302. ParamsQuery['nurse'] = this.nurse_id
  303. ParamsQuery['bed'] = this.bed_id
  304. ParamsQuery['start_time'] = this.start_time_str
  305. ParamsQuery['puncture_nurse'] = this.puncture_nurse_id
  306. PostModifyStartDialysis(ParamsQuery).then(response => {
  307. if (response.data.state == 0) {
  308. Toast.fail(response.data.msg)
  309. return false
  310. } else {
  311. Toast.success('修改成功')
  312. this.$emit('did_start', response.data.data.dialysis_order)
  313. var record = this.record
  314. for (const key in response.data.data.dialysis_order) {
  315. this.$set(record, key, response.data.data.dialysis_order[key])
  316. }
  317. }
  318. }).catch(error => {
  319. Toast.fail("请求失败")
  320. });
  321. },
  322. didSelectStartTime: function (time) {
  323. this.start_time_str = parseTime(time, '{y}-{m}-{d} {h}:{i}') + ':00'
  324. },
  325. selectStartTimeAction: function () {
  326. if (this.record.id != 0) {
  327. var creator = 0
  328. if (this.record.creator == 0) {
  329. creator = this.record.start_nurse
  330. } else {
  331. creator = this.record.creator
  332. }
  333. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  334. this.$refs.start_time_picker.open()
  335. } else {
  336. return
  337. }
  338. }
  339. this.$refs.start_time_picker.open()
  340. },
  341. commitInfo: function () {
  342. Toast.loading({forbidClick: true, duration: 0})
  343. let ParamsQuery = {}
  344. ParamsQuery['schedual_type'] = this.schedual_type
  345. ParamsQuery['patient_id'] = this.patient_prop.id
  346. ParamsQuery['record_date'] = this.record_date
  347. ParamsQuery['nurse'] = this.nurse_id
  348. ParamsQuery['bed'] = this.bed_id
  349. ParamsQuery['start_time'] = this.start_time_str
  350. ParamsQuery['puncture_nurse'] = this.puncture_nurse_id
  351. ParamsQuery['blood_drawing'] = this.blood_drawing
  352. startDialysis(ParamsQuery).then(response => {
  353. if (response.data.state == 0) {
  354. Toast.fail(response.data.msg)
  355. return false
  356. } else {
  357. Toast.success('上机成功')
  358. var monitor = response.data.data.monitor
  359. this.$emit('did_add_monitor', monitor)
  360. this.$emit('did_start', response.data.data.dialysis_order)
  361. var record = this.record
  362. for (const key in response.data.data.dialysis_order) {
  363. this.$set(record, key, response.data.data.dialysis_order[key])
  364. // this.record[key] = response.data.data.dialysis_order[key]
  365. }
  366. }
  367. }).catch(error => {
  368. Toast.fail("请求失败")
  369. });
  370. },
  371. close: function () {
  372. this.$emit('close')
  373. },
  374. select_bed: function () {
  375. if (this.record.id != 0) {
  376. var creator = 0
  377. if (this.record.creator == 0) {
  378. creator = this.record.start_nurse
  379. } else {
  380. creator = this.record.creator
  381. }
  382. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  383. this.selecting = true
  384. var t = this
  385. this.$refs.selector.showSingleSelect(this.zone_beds, this.bed_id, '选择床位号', 'number', 'id', function (select_id) {
  386. t.bed_id = select_id
  387. }, function () {
  388. t.selecting = false
  389. })
  390. } else {
  391. return
  392. }
  393. }
  394. this.selecting = true
  395. var t = this
  396. this.$refs.selector.showSingleSelect(this.zone_beds, this.bed_id, '选择床位号', 'number', 'id', function (select_id) {
  397. t.bed_id = select_id
  398. }, function () {
  399. t.selecting = false
  400. })
  401. },
  402. select_nurse: function () {
  403. if (this.record.id != 0) {
  404. var creator = 0
  405. if (this.record.creator == 0) {
  406. creator = this.record.start_nurse
  407. } else {
  408. creator = this.record.creator
  409. }
  410. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  411. this.selecting = true
  412. var t = this
  413. this.$refs.selector.showSingleSelect(this.admins, this.nurse_id, '选择上机护士', 'name', 'id', function (select_id) {
  414. t.nurse_id = select_id
  415. }, function () {
  416. t.selecting = false
  417. })
  418. } else {
  419. return
  420. }
  421. }
  422. this.selecting = true
  423. var t = this
  424. this.$refs.selector.showSingleSelect(this.admins, this.nurse_id, '选择上机护士', 'name', 'id', function (select_id) {
  425. t.nurse_id = select_id
  426. }, function () {
  427. t.selecting = false
  428. })
  429. }, select_puncture_nurse: function () {
  430. if (this.record.id != 0) {
  431. var creator = 0
  432. if (this.record.creator == 0) {
  433. creator = this.record.start_nurse
  434. } else {
  435. creator = this.record.creator
  436. }
  437. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  438. this.selecting = true
  439. var t = this
  440. this.$refs.selector.showSingleSelect(this.admins, this.puncture_nurse_id, '选择穿刺护士', 'name', 'id', function (select_id) {
  441. t.puncture_nurse_id = select_id
  442. }, function () {
  443. t.selecting = false
  444. })
  445. } else {
  446. return
  447. }
  448. }
  449. this.selecting = true
  450. var t = this
  451. this.$refs.selector.showSingleSelect(this.admins, this.puncture_nurse_id, '选择穿刺护士', 'name', 'id', function (select_id) {
  452. t.puncture_nurse_id = select_id
  453. }, function () {
  454. t.selecting = false
  455. })
  456. },
  457. open: function () {
  458. this.selecting = false
  459. this.$refs.selector.hide()
  460. }
  461. }, watch: {
  462. 'record.id': function (val) {
  463. if (val > 0) {
  464. for (let i = 0; i < this.special_premission.length; i++) {
  465. if (this.$store.getters.user.user.id == this.special_premission[i].admin_user_id) {
  466. this.isPremission = true
  467. }
  468. }
  469. if (this.record.creator == 0) {
  470. this.creator = this.record.start_nurse
  471. } else {
  472. this.creator = this.record.creator
  473. }
  474. }
  475. }
  476. }
  477. }
  478. </script>
  479. <style style="stylesheet/scss" lang="scss" scoped>
  480. .perform {
  481. text-align: center;
  482. font-size: 0.3rem;
  483. padding-top: 2rem;
  484. .crew {
  485. color: $pgh-color;
  486. }
  487. button {
  488. background: $main-color;
  489. color: #fff;
  490. font-size: 0.45rem;
  491. text-align: center;
  492. width: 3rem;
  493. height: 1.2rem;
  494. line-height: 1.2rem;
  495. border-radius: 4px;
  496. margin-top: 10px;
  497. }
  498. }
  499. </style>