computer_dialog.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <div>
  3. <el-dialog title="透析上机" :visible.sync="visible" width="854px" :modal-append-to-body="false">
  4. <el-form :model="form" label-width="100px">
  5. <el-form-item label="班次">
  6. <el-select v-model="schedual_type" placeholder="请选择班次" @change="changeSchedualType">
  7. <el-option v-for="(item, index) in schedules_type" :key="index" :value="item.id"
  8. :label="item.name"></el-option>
  9. </el-select>
  10. </el-form-item>
  11. <el-form-item label="上机床位">
  12. <el-select v-model="form.bed_id" placeholder="请选择上机床位">
  13. <el-option v-for="(bed, index) in zone_beds" :key="index" :value="bed.id" :label="bed.number"></el-option>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item label="上机护士">
  17. <el-select v-model="form.nurse_id" placeholder="请选择上机护士">
  18. <el-option v-for="(admin, index) in admins" :key="index" :value="admin.id" :label="admin.name"></el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="穿刺护士">
  22. <el-select v-model="form.puncture_nurse_id" placeholder="请选择穿刺护士">
  23. <el-option v-for="(admin, index) in admins" :key="index" :value="admin.id" :label="admin.name"></el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="引血(ml/min)" v-if="template_id == 6">
  27. <el-input type="number" v-model="form.blood_drawing" style="width:200px;"></el-input>
  28. </el-form-item>
  29. <el-form-item label="上机时间 :" style="width:300px">
  30. <el-date-picker
  31. type="datetime"
  32. format="yyyy-MM-dd HH:mm"
  33. value-format="yyyy-MM-dd HH:mm"
  34. placeholder="选择时间"
  35. v-model="form.start_time"
  36. style="width:100%;"
  37. ></el-date-picker>
  38. </el-form-item>
  39. <el-form-item>
  40. <el-button v-if="dialysis_order.id == 0" @click="submit" type="primary" :loading="loading">执行上机</el-button>
  41. <el-button v-else type="info" :disabled="true">已上机</el-button>
  42. <el-button
  43. v-if="dialysis_order.id > 0 && (isPremission || this.$store.getters.xt_user.user.id == this.creator)"
  44. type="primary" @click="editOrder">修改上机
  45. </el-button>
  46. </el-form-item>
  47. </el-form>
  48. </el-dialog>
  49. </div>
  50. </template>
  51. <script>
  52. import { GetSchedualNumber, PostModifyStartDialysis, startDialysis } from '@/api/dialysis_record'
  53. import { parseTime } from '@/utils'
  54. export default {
  55. name: 'ComputerDialog',
  56. data() {
  57. return {
  58. zone_beds: [],
  59. visible: false,
  60. loading: false,
  61. template_id: 0,
  62. patient_id: 0,
  63. schedule_date: 0,
  64. start_time: 0,
  65. creator: 0,
  66. form: {
  67. bed_id: '',
  68. nurse_id: '',
  69. start_time: '',
  70. puncture_nurse_id: '',
  71. blood_drawing: 100
  72. },
  73. schedual_type: 0,
  74. schedules_type: [
  75. { id: 1, name: '上午' },
  76. { id: 2, name: '下午' },
  77. { id: 3, name: '晚上' }
  78. ], // 该排班的区里的床位
  79. isPremission: false
  80. }
  81. },
  82. props: {
  83. dialysis_order: {
  84. type: Object
  85. },
  86. schedule: {
  87. type: Object
  88. },
  89. admins: {
  90. type: Array
  91. },
  92. device_numbers: {
  93. type: Array
  94. },
  95. special_premission: {
  96. type: Array
  97. }
  98. }, mounted() {
  99. },
  100. created() {
  101. this.template_id = this.$store.getters.xt_user.template_info.template_id
  102. this.patient_id = this.$route.query.patient_id
  103. this.schedule_date = this.$route.query.date
  104. this.form.nurse_id = this.dialysis_order.id == 0 ? this.$store.getters.xt_user.user.id : this.dialysis_order.start_nurse
  105. this.form.puncture_nurse_id = this.dialysis_order.id == 0 ? this.$store.getters.xt_user.user.id : this.dialysis_order.puncture_nurse
  106. if (this.form.puncture_nurse_id == 0) {
  107. this.form.puncture_nurse_id = this.$store.getters.xt_user.user.id
  108. }
  109. },
  110. watch: {
  111. 'schedule.id': function() {
  112. },
  113. 'dialysis_order.id': function() {
  114. this.form.nurse_id = this.dialysis_order.id == 0 ? this.$store.getters.xt_user.user.id : this.dialysis_order.start_nurse
  115. this.form.puncture_nurse_id = this.dialysis_order.id == 0 ? this.$store.getters.xt_user.user.id : this.dialysis_order.puncture_nurse
  116. var nowDate = new Date()
  117. var nowYear = nowDate.getFullYear()
  118. var nowMonth = nowDate.getMonth() + 1
  119. var nowDay = nowDate.getDate()
  120. var nowHours = nowDate.getHours()
  121. var nowMinutes = nowDate.getMinutes()
  122. var nowSeconds = nowDate.getSeconds()
  123. var time =
  124. nowYear +
  125. '-' +
  126. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  127. '-' +
  128. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (nowHours < 10 ? '0' + nowHours : nowHours) + ':' + (nowMinutes < 10 ? '0' + nowMinutes : nowMinutes)
  129. this.form.start_time = this.dialysis_order.id == 0 ? time : this.getTime(this.dialysis_order.start_time, '{y}-{m}-{d} {h}:{i}')
  130. }
  131. },
  132. computed: {},
  133. methods: {
  134. changeSchedualType: function(schedual_type) {
  135. let ParamsQuery = {}
  136. ParamsQuery['schedual_type'] = schedual_type
  137. GetSchedualNumber(ParamsQuery).then(response => {
  138. if (response.data.state == 0) {
  139. return false
  140. } else {
  141. this.temp_device_numbers = response.data.data.number
  142. for (let index = 0; index < this.temp_device_numbers.length; index++) {
  143. const device_number = this.temp_device_numbers[index]
  144. this.temp_device_numbers[index]['number'] = device_number['zone_name'] + '-' + device_number['number']
  145. }
  146. this.zone_beds = this.temp_device_numbers
  147. this.form.bed_id = this.zone_beds[0].id
  148. }
  149. })
  150. },
  151. GetSchedualNumber: function() {
  152. let ParamsQuery = {}
  153. ParamsQuery['schedual_type'] = this.schedual_type
  154. GetSchedualNumber(ParamsQuery).then(response => {
  155. if (response.data.state == 0) {
  156. this.$message.error(response.data.msg)
  157. return false
  158. } else {
  159. this.temp_device_numbers = response.data.data.number
  160. for (let index = 0; index < this.temp_device_numbers.length; index++) {
  161. const device_number = this.temp_device_numbers[index]
  162. this.temp_device_numbers[index]['number'] = device_number['zone_name'] + '-' + device_number['number']
  163. }
  164. this.zone_beds = this.temp_device_numbers
  165. this.form.bed_id = this.dialysis_order.id == 0 ? this.schedule.bed_id : this.dialysis_order.bed_id
  166. if (this.dialysis_order.id == 0) {
  167. let isFilter = true
  168. for (let i = 0; i < this.zone_beds.length; i++) {
  169. if (this.zone_beds[i].id == this.schedule.bed_id) {
  170. isFilter = false
  171. }
  172. }
  173. if (isFilter) {
  174. this.form.bed_id = this.zone_beds[0].id
  175. }
  176. } else {
  177. for (let i = 0; i < this.device_numbers.length; i++) {
  178. if (this.device_numbers[i].id == this.dialysis_order.bed_id) {
  179. let obj = {}
  180. obj = this.device_numbers[i]
  181. if (obj['number'].indexOf(this.device_numbers[i]['zone_name']) == -1) {
  182. obj['number'] = this.device_numbers[i]['zone_name'] + '-' + this.device_numbers[i]['number']
  183. }
  184. this.zone_beds.unshift(obj)
  185. this.zone_beds.sort((a, b) => a.id - b.id)
  186. }
  187. }
  188. }
  189. }
  190. })
  191. },
  192. getTime(value, temp) {
  193. if (value != undefined) {
  194. return parseTime(value, temp)
  195. }
  196. return ''
  197. },
  198. show: function() {
  199. this.visible = true
  200. var nowDate = new Date()
  201. var nowYear = nowDate.getFullYear()
  202. var nowMonth = nowDate.getMonth() + 1
  203. var nowDay = nowDate.getDate()
  204. var nowHours = nowDate.getHours()
  205. var nowMinutes = nowDate.getMinutes()
  206. var nowSeconds = nowDate.getSeconds()
  207. if (this.dialysis_order.id != 0) {
  208. this.form.start_time = this.getTime(this.dialysis_order.start_time, '{y}-{m}-{d} {h}:{i}')
  209. } else {
  210. this.form.start_time =
  211. nowYear +
  212. '-' +
  213. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  214. '-' +
  215. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (nowHours < 10 ? '0' + nowHours : nowHours) + ':' + (nowMinutes < 10 ? '0' + nowMinutes : nowMinutes)
  216. }
  217. if (this.dialysis_order.id == 0) {
  218. let now = new Date()
  219. let hour = now.getHours()
  220. if (hour >= 6 && hour < 12) {
  221. this.schedual_type = 1
  222. } else if (hour >= 12 && hour < 18) {
  223. this.schedual_type = 2
  224. } else if (hour >= 18) {
  225. this.schedual_type = 3
  226. }
  227. } else {
  228. this.schedual_type = this.dialysis_order.schedual_type
  229. }
  230. if (this.dialysis_order.id > 0) {
  231. for (let i = 0; i < this.special_premission.length; i++) {
  232. if (this.$store.getters.xt_user.user.id == this.special_premission[i].admin_user_id) {
  233. this.isPremission = true
  234. }
  235. }
  236. }
  237. if (this.dialysis_order.id > 0) {
  238. if (this.dialysis_order.creator == 0) {
  239. this.creator = this.dialysis_order.start_nurse
  240. } else {
  241. this.creator = this.dialysis_order.creator
  242. }
  243. }
  244. this.GetSchedualNumber()
  245. },
  246. hide: function() {
  247. this.visible = false
  248. },
  249. submit: function() {
  250. if (this.form.start_time == '' || this.form.start_time == null) {
  251. this.$message.error('开始时间不能为空')
  252. return
  253. }
  254. console.log(this.dialysis_order)
  255. this.loading = true
  256. let mode = '1'
  257. startDialysis(this.patient_id, parseTime(this.schedule_date, '{y}-{m}-{d}'), this.form.nurse_id, this.form.bed_id, this.form.lood_drawing, this.form.puncture_nurse_id, this.form.start_time, this.schedual_type, mode).then(rs => {
  258. this.loading = false
  259. var resp = rs.data
  260. if (resp.state == 1) {
  261. var resp_dialysis_order = resp.data.dialysis_order
  262. var this_order = this.dialysis_order
  263. for (const key in resp_dialysis_order) {
  264. this.$set(this_order, key, resp_dialysis_order[key])
  265. }
  266. this.hide()
  267. this.$emit('monitor', resp.data.monitor)
  268. this.$message.success('上机成功')
  269. } else {
  270. this.$message.error(resp.msg)
  271. }
  272. })
  273. }, editOrder() {
  274. let ParamsQuery = {}
  275. ParamsQuery['schedual_type'] = this.schedual_type
  276. ParamsQuery['id'] = this.dialysis_order.id
  277. ParamsQuery['nurse'] = this.form.nurse_id
  278. ParamsQuery['bed'] = this.form.bed_id
  279. ParamsQuery['start_time'] = this.form.start_time
  280. ParamsQuery['puncture_nurse'] = this.form.puncture_nurse_id
  281. ParamsQuery['mode'] = "2"
  282. if (this.dialysis_order.creator != this.$store.getters.xt_user.user.id) {
  283. ParamsQuery['mode'] = "3"
  284. }
  285. PostModifyStartDialysis(ParamsQuery).then(rs => {
  286. var resp = rs.data
  287. if (resp.state == 1) {
  288. this.$message.success('修改成功')
  289. var resp_dialysis_order = resp.data.dialysis_order
  290. var this_order = this.dialysis_order
  291. for (const key in resp_dialysis_order) {
  292. this.$set(this_order, key, resp_dialysis_order[key])
  293. this.$emit('assessmentAfterDislysis', resp.data.after)
  294. }
  295. } else {
  296. this.$message.error(resp.msg)
  297. }
  298. })
  299. }
  300. }
  301. }
  302. </script>
  303. <style scoped>
  304. .txsj {
  305. text-align: center;
  306. margin-bottom: 20px;
  307. }
  308. </style>