finish_dialog.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <template>
  2. <div>
  3. <el-dialog title="透析下机" class="newDialog" :visible.sync="visible" width="854px" :modal-append-to-body="false">
  4. <!-- <div class="txsj">
  5. </div> -->
  6. <div class="warnTxt" v-if="showTxt != ''">{{ showTxt }}</div>
  7. <el-form :model="form" label-width="100px" :rules="drugdicRules" ref="form">
  8. <el-form-item label="下机护士">
  9. <el-select v-model="form.nurse_id" :disabled="!(dialysis_order.id != 0)">
  10. <el-option v-for="(admin, index) in admins" :key="index" :value="admin.id" :label="admin.name"></el-option>
  11. </el-select>
  12. </el-form-item>
  13. <el-form-item label="下机时间 :" style="width:275px">
  14. <el-date-picker
  15. type="datetime"
  16. format="yyyy-MM-dd HH:mm"
  17. value-format="yyyy-MM-dd HH:mm"
  18. placeholder="选择时间"
  19. v-model="end_time"
  20. style="width:100%;"
  21. ></el-date-picker>
  22. </el-form-item>
  23. <el-form-item label="穿刺处血肿:" v-if="isShowFiled('穿刺处血肿')" :label-width="150">
  24. <el-radio-group v-model="form.puncture_point_haematoma">
  25. <el-radio :label="1">有</el-radio>
  26. <el-radio :label="2">无</el-radio>
  27. </el-radio-group>
  28. </el-form-item>
  29. <el-form-item label="内瘘: " v-if="isShowFiled('内瘘')">
  30. <el-input v-model="form.internal_fistula" readonly @focus="showInnerDialog('7')" style="width:200px"></el-input>
  31. </el-form-item>
  32. <el-form-item label="导管: " v-if="isShowFiled('导管')">
  33. <el-input v-model="form.catheter" @focus="showInnerDialog('4')" style="width:200px"></el-input>
  34. </el-form-item>
  35. <el-form-item label="透析器凝血: " v-if="isShowFiled('透析器凝血')">
  36. <el-input
  37. style="width:200px"
  38. v-model="form.cruor"
  39. readonly
  40. @focus="showInnerDialog('1')"
  41. ></el-input>
  42. </el-form-item>
  43. <el-form-item>
  44. <el-button v-if="(dialysis_order.id != 0 && dialysis_order.stage == 1)" @click="submit('form')" :loading="loading"
  45. type="primary">执行下机
  46. </el-button>
  47. <el-button
  48. v-if="dialysis_order.stage == 2 "
  49. type="primary" @click="modifyFinish('form')">修改下机
  50. </el-button>
  51. </el-form-item>
  52. </el-form>
  53. </el-dialog>
  54. <multi-select-box
  55. :propsForm="InnerDialogProps"
  56. v-on:dialog-comfirm="innerDialogComfirm"
  57. v-on:dialog-cancle="innerDialogCancle"
  58. ></multi-select-box>
  59. </div>
  60. </template>
  61. <script>
  62. import axios from 'axios'
  63. import { finishDialysis,PostModifyFinishDialysis } from '@/api/dialysis_record'
  64. import { parseTime } from '@/utils'
  65. import multiSelectBox from './MultiSelectBox'
  66. import request from '@/utils/request'
  67. import store from "@/store";
  68. import { getDataConfig } from '@/utils/data'
  69. export default {
  70. components: {
  71. multiSelectBox
  72. },
  73. name: 'FinishDialog',
  74. data() {
  75. return {
  76. showTxt:'',
  77. hasPermission:true,
  78. visible: false,
  79. loading: false,
  80. creator: 0,
  81. patient_id: 0,
  82. schedule_date: 0,
  83. isPremission:false,
  84. end_time: '',
  85. isVisibility: false,
  86. form: {
  87. nurse_id: 0,
  88. puncture_point_haematoma:2,
  89. internal_fistula:"",
  90. catheter:"",
  91. cruor:"",
  92. },
  93. internal_fistula: [],
  94. InnerDialogProps: {
  95. values: [],
  96. visibility: false,
  97. isShowTextArea: true,
  98. customContent: '',
  99. titles: '',
  100. type: '' // 不同弹框类型,用来匹配数据
  101. },
  102. catheter: [],
  103. cruorOptions: [],
  104. drugdicRules: {
  105. internal_fistula: [{ required: true, message: "请选择内瘘" }]
  106. },
  107. required:false,
  108. }
  109. },
  110. props: {
  111. prescription: { // 透析处方
  112. type: Object,
  113. },
  114. dialysis_order: {
  115. type: Object
  116. },
  117. schedule: {
  118. type: Object
  119. },
  120. admins: {
  121. type: Array
  122. }, special_premission: {
  123. type: Array,
  124. },
  125. patient:{
  126. type: Object
  127. }
  128. },
  129. created() {
  130. this.internal_fistula = getDataConfig('hemodialysis', 'internal_fistula')
  131. this.catheter = getDataConfig('hemodialysis', 'catheter')
  132. this.cruorOptions = getDataConfig('hemodialysis', 'cruor')
  133. },
  134. watch: {
  135. 'dialysis_order.id': function() {
  136. if (this.dialysis_order.id == 0) {
  137. this.form.nurse_id = 0
  138. } else if (this.dialysis_order.stage == 1) {
  139. this.form.nurse_id = this.$store.getters.xt_user.user.id
  140. } else {
  141. console.log("orde32332323232332",this.dialysis_order)
  142. this.form.nurse_id = this.dialysis_order.finish_nurse
  143. this.form.catheter = this.dialysis_order.catheter
  144. this.form.cruor = this.dialysis_order.cruor
  145. this.form.internal_fistula = this.dialysis_order.blood_access_internal_fistula
  146. this.form.puncture_point_haematoma = this.dialysis_order.puncture_point_haematoma
  147. }
  148. },
  149. patient:{
  150. handler(newVal){
  151. this.patient_id = newVal.id
  152. },
  153. deep:true
  154. }
  155. },
  156. methods: {
  157. isShowFiled(name) {
  158. var filedList = store.getters.xt_user.fileds
  159. for (let i = 0; i < filedList.length; i++) {
  160. if (filedList[i].module == 9 && filedList[i].filed_name_cn == name && filedList[i].is_show == 1) {
  161. return true
  162. }
  163. if (filedList[i].module == 9 && filedList[i].filed_name_cn == name && filedList[i].is_write == 1) {
  164. this.required = true
  165. }
  166. }
  167. this.required = false
  168. return false
  169. },
  170. isWrite(name){
  171. var filedList = store.getters.xt_user.fileds
  172. for (let i = 0; i < filedList.length; i++) {
  173. if (filedList[i].module == 9 && filedList[i].filed_name_cn == name && filedList[i].is_write == 1) {
  174. return true
  175. }
  176. }
  177. return false
  178. },
  179. show: function(record) {
  180. this.record = record
  181. console.log("下机",record)
  182. this.getPermission()
  183. this.visible = true
  184. var nowDate = new Date()
  185. var nowYear = nowDate.getFullYear()
  186. var nowMonth = nowDate.getMonth() + 1
  187. var nowDay = nowDate.getDate()
  188. var nowHours = nowDate.getHours()
  189. var nowMinutes = nowDate.getMinutes()
  190. var time =
  191. nowYear +
  192. '-' +
  193. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  194. '-' +
  195. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (nowHours < 10 ? '0' + nowHours : nowHours) + ':' + (nowMinutes < 10 ? '0' + nowMinutes : nowMinutes)
  196. if(this.$route.query.patient_id){
  197. this.patient_id = this.$route.query.patient_id
  198. }
  199. this.schedule_date = this.$route.query.date
  200. if (this.dialysis_order.id == 0) {
  201. this.form.nurse_id = 0
  202. } else if (this.dialysis_order.stage == 1) {
  203. this.form.nurse_id = this.$store.getters.xt_user.user.id
  204. } else {
  205. this.form.nurse_id = this.dialysis_order.finish_nurse
  206. }
  207. if (this.dialysis_order.finish_creator > 0) {
  208. for (let i = 0; i < this.special_premission.length; i++) {
  209. if (this.$store.getters.xt_user.user.id == this.special_premission[i].admin_user_id) {
  210. this.isPremission = true
  211. }
  212. }
  213. }
  214. if (this.dialysis_order.finish_creator > 0) {
  215. this.creator = this.dialysis_order.finish_creator
  216. }
  217. if (this.dialysis_order.id == "") {
  218. //没有上下机记录
  219. this.end_time = this.dialysis_order.finish_creator == 0 ? time : this.getTime(this.dialysis_order.end_time, '{y}-{m}-{d} {h}:{i}')
  220. } else {
  221. if (this.dialysis_order.start_time > 0) {
  222. if (this.prescription.id != "") {
  223. let endTime = 0;
  224. endTime =
  225. this.dialysis_order.start_time +
  226. this.prescription.dialysis_duration_hour * 3600 +
  227. this.prescription.dialysis_duration_minute * 60;
  228. this.end_time = parseTime(endTime, "{y}-{m}-{d} {h}:{i}");
  229. } else {
  230. this.end_time =
  231. parseTime(Date.parse(new Date()) / 1000, "{y}-{m}-{d} {h}:{i}")
  232. }
  233. if (this.dialysis_order.end_time > 0) {
  234. this.end_time =
  235. parseTime(this.dialysis_order.end_time, "{y}-{m}-{d} {h}:{i}");
  236. }
  237. } else {
  238. this.end_time = this.dialysis_order.finish_creator == 0 ? time : this.getTime(this.dialysis_order.end_time, '{y}-{m}-{d} {h}:{i}')
  239. }
  240. }
  241. },
  242. hide: function() {
  243. this.visible = false
  244. },
  245. modifyFinish:function(formName){
  246. this.$refs[formName].validate(valid=>{
  247. if(valid){
  248. if(this.isWrite("内瘘") == true && this.form.internal_fistula == ""){
  249. this.$message.error("请选择内瘘")
  250. return
  251. }
  252. if(this.isWrite("导管") == true && this.form.catheter == ""){
  253. this.$message.error("请选择导管")
  254. return
  255. }
  256. if(this.isWrite("透析器凝血") == true && this.form.cruor == ""){
  257. this.$message.error("请选择透析器凝血")
  258. return
  259. }
  260. let ParamsQuery = {};
  261. ParamsQuery["id"] = this.dialysis_order.id;
  262. ParamsQuery["nurse"] = this.form.nurse_id;
  263. ParamsQuery["end_time"] = this.end_time;
  264. ParamsQuery["mode"] = "2"
  265. ParamsQuery["puncture_point_haematoma"] = parseInt(this.form.puncture_point_haematoma)
  266. ParamsQuery["internal_fistula"] = this.form.internal_fistula
  267. ParamsQuery["catheter"] = this.form.catheter
  268. ParamsQuery["cruor"] = this.form.cruor
  269. if(this.dialysis_order.finish_creator != this.$store.getters.xt_user.user.id){
  270. ParamsQuery["mode"] = "3"
  271. }
  272. PostModifyFinishDialysis(ParamsQuery).then(response => {
  273. if (response.data.state == 0) {
  274. this.$message.error(response.data.msg)
  275. return false;
  276. } else {
  277. this.$message.success("修改成功")
  278. var record = this.dialysis_order;
  279. for (const key in response.data.data.dialysis_order) {
  280. this.$set(record, key, response.data.data.dialysis_order[key]);
  281. }
  282. console.log(response.data.data.after)
  283. this.$emit('assessmentAfterDislysis', response.data.data.after)
  284. }
  285. });
  286. }
  287. })
  288. },
  289. submit: function(formName) {
  290. this.$refs[formName].validate(valid=>{
  291. if(valid){
  292. if(this.isWrite("内瘘") == true && this.form.internal_fistula == ""){
  293. this.$message.error("请选择内瘘")
  294. return
  295. }
  296. if(this.isWrite("导管") == true && this.form.catheter == ""){
  297. this.$message.error("请选择导管")
  298. return
  299. }
  300. if(this.isWrite("透析器凝血") == true && this.form.cruor == ""){
  301. this.$message.error("请选择透析器凝血")
  302. return
  303. }
  304. this.loading = true
  305. let mode = "1"
  306. finishDialysis(this.patient_id,this.schedule_date ? parseTime(this.schedule_date, '{y}-{m}-{d}') : parseTime(new Date(), '{y}-{m}-{d}'), this.end_time, this.form.nurse_id,mode,parseInt(this.form.puncture_point_haematoma),this.form.internal_fistula,this.form.catheter,this.form.cruor).then(rs => {
  307. this.loading = false
  308. var resp = rs.data
  309. if (resp.state == 1) {
  310. var dialysis_order = resp.data.dialysis_order
  311. var this_order = this.dialysis_order
  312. for (const key in dialysis_order) {
  313. this.$set(this_order, key, dialysis_order[key])
  314. }
  315. let orgId = parseInt(sessionStorage.getItem("org_id"));
  316. this.hide()
  317. this.$emit('assessmentAfterDislysis', resp.data.assessmentAfterDislysis)
  318. } else {
  319. this.$message.error(resp.msg)
  320. }
  321. })
  322. }
  323. })
  324. }, getTime(value, temp) {
  325. if (value != undefined) {
  326. return parseTime(value, temp)
  327. }
  328. return ''
  329. },
  330. getPermission(){
  331. request.get("/api/func_per/get",{
  332. params:{
  333. create_url:"/api/dialysis/finish?mode=1",
  334. modify_url:"/api/finish_dialysis/modify?mode=2",
  335. modify_other_url:"/api/finish_dialysis/modify?mode=3",
  336. module:6
  337. }
  338. }).then(res => {
  339. if(res.data.state == 0){
  340. this.hasPermission = false
  341. }else if(res.data.state == 1){
  342. if(this.record.id != "" && this.record.creater != 0){//有数据
  343. if(this.record.creater == this.$store.getters.xt_user.user.id){//创建人是自己
  344. if(res.data.data.is_has_modify == false){
  345. this.hasPermission = false
  346. this.showTxt = "你没有修改执行下机权限"
  347. }
  348. }else{//创建人不是自己
  349. if(res.data.data.is_has_modify_other == false){
  350. this.hasPermission = false
  351. this.showTxt = "你没有修改他人执行下机权限"
  352. }
  353. }
  354. }else if(this.record.id == "" || this.record.creater == 0){
  355. if(res.data.data.is_has_create == false){
  356. this.hasPermission = false
  357. this.showTxt = "你没有执行下机权限"
  358. }
  359. }
  360. }
  361. })
  362. },
  363. showInnerDialog: function(val) {
  364. this.InnerDialogProps.visibility = true
  365. switch (val) {
  366. case '7': // 内瘘
  367. this.InnerDialogProps.values = this.internal_fistula
  368. this.InnerDialogProps.titles = '内瘘'
  369. this.InnerDialogProps.type = 'internal_fistula'
  370. this.InnerDialogProps.selected = this.form.internal_fistula
  371. this.InnerDialogProps.isShowTextArea = false
  372. break
  373. case '4': // 导管
  374. this.InnerDialogProps.values = this.catheter
  375. this.InnerDialogProps.titles = '导管'
  376. this.InnerDialogProps.type = 'catheter'
  377. this.InnerDialogProps.selected = this.form.catheter
  378. this.InnerDialogProps.isShowTextArea = false
  379. break
  380. case '1':
  381. this.InnerDialogProps.values = this.cruorOptions
  382. this.InnerDialogProps.titles = '凝血'
  383. this.InnerDialogProps.type = 'cruor'
  384. this.InnerDialogProps.selected = this.form.cruor
  385. this.InnerDialogProps.isShowTextArea = false
  386. break
  387. }
  388. },
  389. innerDialogComfirm: function(val) {
  390. this.InnerDialogProps.visibility = false
  391. switch (val.type) {
  392. case 'internal_fistula':
  393. this.form.internal_fistula = val.value.join(',')
  394. break
  395. case 'catheter':
  396. this.form.catheter = val.value.join(',')
  397. break
  398. case 'cruor':
  399. this.form.cruor = val.value.join(',')
  400. break
  401. }
  402. },
  403. innerDialogCancle: function() {
  404. this.InnerDialogProps.visibility = false
  405. },
  406. }
  407. }
  408. </script>
  409. <style scoped>
  410. .txsj {
  411. text-align: center;
  412. margin-bottom: 20px;
  413. }
  414. .warnTxt{
  415. text-align: center;
  416. margin: 0 auto;
  417. background: #faa331;
  418. max-width: 240px;
  419. padding: 10px 20px;
  420. border-radius: 4px;
  421. margin-bottom: 10px;
  422. color:#fff;
  423. }
  424. </style>
  425. <style lang="scss">
  426. .newDialog{
  427. .el-dialog__body{
  428. padding: 10px 20px 30px;
  429. }
  430. }
  431. </style>