finish_dialog.vue 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  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" 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="下机时间 :" :prop="isName('下机时间')"
  14. :rules="isCheckmust('下机时间')" style="width:275px">
  15. <el-date-picker
  16. type="datetime"
  17. format="yyyy-MM-dd HH:mm"
  18. value-format="yyyy-MM-dd HH:mm"
  19. placeholder="选择时间"
  20. v-model="end_time"
  21. style="width:100%;"
  22. ></el-date-picker>
  23. </el-form-item>
  24. <el-form-item label="穿刺处血肿:" :prop="isName('穿刺处血肿')"
  25. :rules="isCheckmust('穿刺处血肿')" v-if="isShowFiled('穿刺处血肿')" :label-width="150">
  26. <el-radio-group v-model="form.puncture_point_haematoma">
  27. <el-radio :label="1">有</el-radio>
  28. <el-radio :label="2">无</el-radio>
  29. </el-radio-group>
  30. </el-form-item>
  31. <el-form-item label="内瘘: " :prop="isName('内瘘')"
  32. :rules="isCheckmust('内瘘')" v-if="isShowFiled('内瘘')">
  33. <el-input v-model="form.internal_fistula" readonly @focus="showInnerDialog('7')" style="width:200px"></el-input>
  34. </el-form-item>
  35. <el-form-item label="导管: " :prop="isName('导管')"
  36. :rules="isCheckmust('导管')" v-if="isShowFiled('导管')">
  37. <el-input v-model="form.catheter" @focus="showInnerDialog('4')" style="width:200px"></el-input>
  38. </el-form-item>
  39. <el-form-item label="透析器凝血: " :prop="isName('透析器凝血')"
  40. :rules="isCheckmust('透析器凝血')" v-if="isShowFiled('透析器凝血')">
  41. <el-input
  42. style="width:200px"
  43. v-model="form.cruor"
  44. readonly
  45. @focus="showInnerDialog('1')"
  46. ></el-input>
  47. </el-form-item>
  48. <el-form-item label="宣教知识:" :prop="isName('宣教知识')"
  49. :rules="isCheckmust('宣教知识')" v-if="isShowFiled('宣教知识')">
  50. <el-select @change="dialysisAfterTeachSelectChange" v-model="form.mission_id">
  51. <el-option
  52. v-for="(item, index) in education"
  53. :label="item.text"
  54. :value="item.value"
  55. :key="index"
  56. ></el-option>
  57. </el-select>
  58. </el-form-item>
  59. <el-row :gutter="20">
  60. <el-col v-if="isShowFiled('宣教知识')">
  61. <el-form-item :prop="isName('宣教知识')"
  62. :rules="isCheckmust('宣教知识')">
  63. <el-input
  64. type="textarea"
  65. v-model="form.mission"
  66. :rows="4"
  67. ></el-input>
  68. </el-form-item>
  69. </el-col>
  70. </el-row>
  71. <el-form-item>
  72. <el-button v-if="(dialysis_order.id != 0 && dialysis_order.stage == 1)" @click="submit('form')" :loading="loading"
  73. type="primary">执行下机
  74. </el-button>
  75. <el-button
  76. v-if="dialysis_order.stage == 2 "
  77. type="primary" @click="modifyFinish('form')">修改下机
  78. </el-button>
  79. </el-form-item>
  80. </el-form>
  81. </el-dialog>
  82. <multi-select-box
  83. :propsForm="InnerDialogProps"
  84. v-on:dialog-comfirm="innerDialogComfirm"
  85. v-on:dialog-cancle="innerDialogCancle"
  86. ></multi-select-box>
  87. <el-dialog
  88. title="提示"
  89. :visible.sync="infoDialogVisible"
  90. width="30%">
  91. <span>
  92. <el-form>
  93. <el-row>
  94. <span>申请日期:</span>
  95. <span>
  96. <el-date-picker
  97. type="datetime"
  98. format="yyyy-MM-dd HH:mm"
  99. value-format="yyyy-MM-dd HH:mm"
  100. placeholder="选择时间"
  101. v-model="selected_date"
  102. ></el-date-picker>
  103. </span>
  104. </el-row>
  105. <el-row>
  106. <span>备注:</span>
  107. <span>
  108. <el-input v-model="remark" style="width:200px"></el-input>
  109. </span>
  110. </el-row>
  111. </el-form>
  112. </span>
  113. <span slot="footer" class="dialog-footer">
  114. <el-button @click="infoDialogVisible = false">取 消</el-button>
  115. <el-button type="primary" @click="saveInformation">确 定</el-button>
  116. </span>
  117. </el-dialog>
  118. </div>
  119. </template>
  120. <script>
  121. import axios from 'axios'
  122. import { finishDialysis,PostModifyFinishDialysis } from '@/api/dialysis_record'
  123. import { saveInformation } from '@/api/dialysis'
  124. import { parseTime } from '@/utils'
  125. import multiSelectBox from './MultiSelectBox'
  126. import request from '@/utils/request'
  127. import store from "@/store";
  128. import { getDataConfig } from '@/utils/data'
  129. export default {
  130. components: {
  131. multiSelectBox
  132. },
  133. name: 'FinishDialog',
  134. data() {
  135. return {
  136. showTxt:'',
  137. hasPermission:true,
  138. visible: false,
  139. loading: false,
  140. creator: 0,
  141. patient_id: 0,
  142. schedule_date: 0,
  143. isPremission:false,
  144. end_time: '',
  145. isVisibility: false,
  146. form: {
  147. nurse_id: 0,
  148. puncture_point_haematoma:2,
  149. internal_fistula:"",
  150. catheter:"",
  151. cruor:"",
  152. mission:"",
  153. mission_id:"",
  154. },
  155. internal_fistula: [],
  156. InnerDialogProps: {
  157. values: [],
  158. visibility: false,
  159. isShowTextArea: true,
  160. customContent: '',
  161. titles: '',
  162. type: '' // 不同弹框类型,用来匹配数据
  163. },
  164. catheter: [],
  165. cruorOptions: [],
  166. required:false,
  167. education:[],
  168. infoDialogVisible:false,
  169. selected_date:"",
  170. pickerOptions: {
  171. disabledDate(time) {
  172. return time.getTime() > Date.now()
  173. }
  174. },
  175. remark:""
  176. }
  177. },
  178. props: {
  179. prescription: { // 透析处方
  180. type: Object,
  181. },
  182. dialysis_order: {
  183. type: Object
  184. },
  185. schedule: {
  186. type: Object
  187. },
  188. admins: {
  189. type: Array
  190. }, special_premission: {
  191. type: Array,
  192. },
  193. patient:{
  194. type: Object
  195. }
  196. },
  197. created() {
  198. this.education = getDataConfig('education', 'education')
  199. this.internal_fistula = getDataConfig('hemodialysis', 'internal_fistula')
  200. this.catheter = getDataConfig('hemodialysis', 'catheter')
  201. this.cruorOptions = getDataConfig('hemodialysis', 'cruor')
  202. },
  203. watch: {
  204. 'dialysis_order.id': function() {
  205. if (this.dialysis_order.id == 0) {
  206. this.form.nurse_id = 0
  207. } else if (this.dialysis_order.stage == 1) {
  208. this.form.nurse_id = this.$store.getters.xt_user.user.id
  209. } else {
  210. console.log("orde32332323232332",this.dialysis_order)
  211. this.form.nurse_id = this.dialysis_order.finish_nurse
  212. this.form.catheter = this.dialysis_order.catheter
  213. this.form.cruor = this.dialysis_order.cruor
  214. this.form.internal_fistula = this.dialysis_order.blood_access_internal_fistula
  215. this.form.puncture_point_haematoma = this.dialysis_order.puncture_point_haematoma
  216. this.form.mission = this.dialysis_order.mission
  217. }
  218. },
  219. patient:{
  220. handler(newVal){
  221. this.patient_id = newVal.id
  222. },
  223. deep:true
  224. }
  225. },
  226. methods: {
  227. isName(name) {
  228. let filedList = store.getters.xt_user.fileds;
  229. for (let i = 0; i < filedList.length; i++) {
  230. if (filedList[i].module == 9 && filedList[i].filed_name_cn == name) {
  231. return filedList[i].filed_name;
  232. }
  233. }
  234. },
  235. isCheckmust(name) {
  236. let filedList = store.getters.xt_user.fileds;
  237. for (let i = 0; i < filedList.length; i++) {
  238. if (
  239. filedList[i].module == 9 &&
  240. filedList[i].filed_name_cn == name &&
  241. filedList[i].is_write == 1
  242. ) {
  243. return [{ required: true ,message:`请输入${name}` }];
  244. }
  245. }
  246. },
  247. dialysisAfterTeachSelectChange: function(values) {
  248. if (this.form.mission == '') {
  249. this.form.mission = values
  250. } else {
  251. if (this.form.mission.indexOf(values) == -1) {
  252. if (
  253. this.form.mission
  254. .charAt(this.form.mission.length - 1)
  255. .indexOf('。') == -1
  256. ) {
  257. this.form.mission =
  258. this.form.mission + ',' + values
  259. } else {
  260. this.form.mission =
  261. this.form.mission + values
  262. }
  263. }
  264. }
  265. },
  266. isShowFiled(name) {
  267. var filedList = store.getters.xt_user.fileds
  268. for (let i = 0; i < filedList.length; i++) {
  269. if (filedList[i].module == 9 && filedList[i].filed_name_cn == name && filedList[i].is_show == 1) {
  270. return true
  271. }
  272. if (filedList[i].module == 9 && filedList[i].filed_name_cn == name && filedList[i].is_write!=undefined && filedList[i].is_write == 1) {
  273. this.required = true
  274. }
  275. }
  276. this.required = false
  277. return false
  278. },
  279. isWrite(name){
  280. var filedList = store.getters.xt_user.fileds
  281. for (let i = 0; i < filedList.length; i++) {
  282. if (filedList[i].module == 9 && filedList[i].filed_name_cn == name && filedList[i].is_write == 1) {
  283. return true
  284. }
  285. }
  286. return false
  287. },
  288. show: function(record) {
  289. this.record = record
  290. console.log("下机",record)
  291. this.getPermission()
  292. this.visible = true
  293. var nowDate = new Date()
  294. var nowYear = nowDate.getFullYear()
  295. var nowMonth = nowDate.getMonth() + 1
  296. var nowDay = nowDate.getDate()
  297. var nowHours = nowDate.getHours()
  298. var nowMinutes = nowDate.getMinutes()
  299. var time =
  300. nowYear +
  301. '-' +
  302. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  303. '-' +
  304. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (nowHours < 10 ? '0' + nowHours : nowHours) + ':' + (nowMinutes < 10 ? '0' + nowMinutes : nowMinutes)
  305. if(this.$route.query.patient_id){
  306. this.patient_id = this.$route.query.patient_id
  307. }
  308. this.schedule_date = this.$route.query.date
  309. if (this.dialysis_order.id == 0) {
  310. this.form.nurse_id = 0
  311. } else if (this.dialysis_order.stage == 1) {
  312. this.form.nurse_id = this.$store.getters.xt_user.user.id
  313. } else {
  314. this.form.nurse_id = this.dialysis_order.finish_nurse
  315. }
  316. if (this.dialysis_order.finish_creator > 0) {
  317. for (let i = 0; i < this.special_premission.length; i++) {
  318. if (this.$store.getters.xt_user.user.id == this.special_premission[i].admin_user_id) {
  319. this.isPremission = true
  320. }
  321. }
  322. }
  323. if (this.dialysis_order.finish_creator > 0) {
  324. this.creator = this.dialysis_order.finish_creator
  325. }
  326. if (this.dialysis_order.id == "") {
  327. //没有上下机记录
  328. this.end_time = this.dialysis_order.finish_creator == 0 ? time : this.getTime(this.dialysis_order.end_time, '{y}-{m}-{d} {h}:{i}')
  329. } else {
  330. if (this.dialysis_order.start_time > 0) {
  331. if (this.prescription.id != "") {
  332. let endTime = 0;
  333. endTime =
  334. this.dialysis_order.start_time +
  335. this.prescription.dialysis_duration_hour * 3600 +
  336. this.prescription.dialysis_duration_minute * 60;
  337. this.end_time = parseTime(endTime, "{y}-{m}-{d} {h}:{i}");
  338. } else {
  339. this.end_time =
  340. parseTime(Date.parse(new Date()) / 1000, "{y}-{m}-{d} {h}:{i}")
  341. }
  342. if (this.dialysis_order.end_time > 0) {
  343. this.end_time =
  344. parseTime(this.dialysis_order.end_time, "{y}-{m}-{d} {h}:{i}");
  345. }
  346. } else {
  347. this.end_time = this.dialysis_order.finish_creator == 0 ? time : this.getTime(this.dialysis_order.end_time, '{y}-{m}-{d} {h}:{i}')
  348. }
  349. }
  350. },
  351. hide: function() {
  352. this.visible = false
  353. },
  354. modifyFinish:function(formName){
  355. this.$refs[formName].validate(valid=>{
  356. if(valid){
  357. if(this.isWrite("穿刺处血肿") == true && this.form.puncture_point_haematoma == ""){
  358. this.$message.error("请选择穿刺处血肿")
  359. return
  360. }
  361. if(this.isWrite("内瘘") == true && this.form.internal_fistula == ""){
  362. this.$message.error("请选择内瘘")
  363. return
  364. }
  365. if(this.isWrite("导管") == true && this.form.catheter == ""){
  366. this.$message.error("请选择导管")
  367. return
  368. }
  369. if(this.isWrite("透析器凝血") == true && this.form.cruor == ""){
  370. this.$message.error("请选择透析器凝血")
  371. return
  372. }
  373. let ParamsQuery = {};
  374. ParamsQuery["id"] = this.dialysis_order.id;
  375. ParamsQuery["nurse"] = this.form.nurse_id;
  376. ParamsQuery["end_time"] = this.end_time;
  377. ParamsQuery["mode"] = "2"
  378. ParamsQuery["puncture_point_haematoma"] = parseInt(this.form.puncture_point_haematoma)
  379. ParamsQuery["internal_fistula"] = this.form.internal_fistula
  380. ParamsQuery["catheter"] = this.form.catheter
  381. ParamsQuery["cruor"] = this.form.cruor
  382. ParamsQuery["mission"] = this.form.mission
  383. ParamsQuery["mission_id"] = this.form.mission_id
  384. if(this.dialysis_order.finish_creator != this.$store.getters.xt_user.user.id){
  385. ParamsQuery["mode"] = "3"
  386. }
  387. PostModifyFinishDialysis(ParamsQuery).then(response => {
  388. if (response.data.state == 0) {
  389. this.$message.error(response.data.msg)
  390. if(response.data.code == 600000008){
  391. this.infoDialogVisible = true
  392. }
  393. return false;
  394. } else {
  395. this.$message.success("修改成功")
  396. var record = this.dialysis_order;
  397. for (const key in response.data.data.dialysis_order) {
  398. this.$set(record, key, response.data.data.dialysis_order[key]);
  399. }
  400. console.log(response.data.data.after)
  401. this.$emit('assessmentAfterDislysis', response.data.data.after)
  402. }
  403. });
  404. }
  405. })
  406. },
  407. submit: function(formName) {
  408. this.$refs[formName].validate(valid=>{
  409. if(valid){
  410. if(this.isWrite("穿刺处血肿") == true && this.form.puncture_point_haematoma == ""){
  411. this.$message.error("请选择穿刺处血肿")
  412. return
  413. }
  414. if(this.isWrite("内瘘") == true && this.form.internal_fistula == ""){
  415. this.$message.error("请选择内瘘")
  416. return
  417. }
  418. if(this.isWrite("导管") == true && this.form.catheter == ""){
  419. this.$message.error("请选择导管")
  420. return
  421. }
  422. if(this.isWrite("透析器凝血") == true && this.form.cruor == ""){
  423. this.$message.error("请选择透析器凝血")
  424. return
  425. }
  426. this.loading = true
  427. let mode = "1"
  428. console.log("fomr",this.form.mission_id)
  429. 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,this.form.mission,this.form.mission_id).then(rs => {
  430. this.loading = false
  431. var resp = rs.data
  432. if (resp.state == 1) {
  433. var dialysis_order = resp.data.dialysis_order
  434. var this_order = this.dialysis_order
  435. for (const key in dialysis_order) {
  436. this.$set(this_order, key, dialysis_order[key])
  437. }
  438. let orgId = parseInt(sessionStorage.getItem("org_id"));
  439. this.hide()
  440. this.$emit('assessmentAfterDislysis', resp.data.assessmentAfterDislysis)
  441. } else {
  442. this.$message.error(resp.msg)
  443. if(response.data.code == 600000008){
  444. this.infoDialogVisible = true
  445. }
  446. }
  447. })
  448. }else{
  449. return false
  450. }
  451. })
  452. }, getTime(value, temp) {
  453. if (value != undefined) {
  454. return parseTime(value, temp)
  455. }
  456. return ''
  457. },
  458. getPermission(){
  459. request.get("/api/func_per/get",{
  460. params:{
  461. create_url:"/api/dialysis/finish?mode=1",
  462. modify_url:"/api/finish_dialysis/modify?mode=2",
  463. modify_other_url:"/api/finish_dialysis/modify?mode=3",
  464. module:6
  465. }
  466. }).then(res => {
  467. if(res.data.state == 0){
  468. this.hasPermission = false
  469. }else if(res.data.state == 1){
  470. if(this.record.id != "" && this.record.creater != 0){//有数据
  471. if(this.record.creater == this.$store.getters.xt_user.user.id){//创建人是自己
  472. if(res.data.data.is_has_modify == false){
  473. this.hasPermission = false
  474. this.showTxt = "你没有修改执行下机权限"
  475. }
  476. }else{//创建人不是自己
  477. if(res.data.data.is_has_modify_other == false){
  478. this.hasPermission = false
  479. this.showTxt = "你没有修改他人执行下机权限"
  480. }
  481. }
  482. }else if(this.record.id == "" || this.record.creater == 0){
  483. if(res.data.data.is_has_create == false){
  484. this.hasPermission = false
  485. this.showTxt = "你没有执行下机权限"
  486. }
  487. }
  488. }
  489. })
  490. },
  491. showInnerDialog: function(val) {
  492. this.InnerDialogProps.visibility = true
  493. switch (val) {
  494. case '7': // 内瘘
  495. this.InnerDialogProps.values = this.internal_fistula
  496. this.InnerDialogProps.titles = '内瘘'
  497. this.InnerDialogProps.type = 'internal_fistula'
  498. this.InnerDialogProps.selected = this.form.internal_fistula
  499. this.InnerDialogProps.isShowTextArea = false
  500. break
  501. case '4': // 导管
  502. this.InnerDialogProps.values = this.catheter
  503. this.InnerDialogProps.titles = '导管'
  504. this.InnerDialogProps.type = 'catheter'
  505. this.InnerDialogProps.selected = this.form.catheter
  506. this.InnerDialogProps.isShowTextArea = false
  507. break
  508. case '1':
  509. this.InnerDialogProps.values = this.cruorOptions
  510. this.InnerDialogProps.titles = '凝血'
  511. this.InnerDialogProps.type = 'cruor'
  512. this.InnerDialogProps.selected = this.form.cruor
  513. this.InnerDialogProps.isShowTextArea = false
  514. break
  515. }
  516. },
  517. innerDialogComfirm: function(val) {
  518. this.InnerDialogProps.visibility = false
  519. switch (val.type) {
  520. case 'internal_fistula':
  521. this.form.internal_fistula = val.value.join(',')
  522. break
  523. case 'catheter':
  524. this.form.catheter = val.value.join(',')
  525. break
  526. case 'cruor':
  527. this.form.cruor = val.value.join(',')
  528. break
  529. }
  530. },
  531. innerDialogCancle: function() {
  532. this.InnerDialogProps.visibility = false
  533. },
  534. saveInformation(){
  535. var params = {
  536. selected_date:this.selected_date,
  537. patient_id:this.$route.query.patient_id,
  538. record_date:this.$route.query.date,
  539. module:1,
  540. remark:this.remark,
  541. }
  542. console.log("params32222222222----",params)
  543. saveInformation(params).then(response=>{
  544. if(response.data.state == 1){
  545. var information = response.data.data.information
  546. this.$message.success("审核成功!")
  547. this.infoDialogVisible = false
  548. }
  549. })
  550. }
  551. }
  552. }
  553. </script>
  554. <style scoped>
  555. .txsj {
  556. text-align: center;
  557. margin-bottom: 20px;
  558. }
  559. .warnTxt{
  560. text-align: center;
  561. margin: 0 auto;
  562. background: #faa331;
  563. max-width: 240px;
  564. padding: 10px 20px;
  565. border-radius: 4px;
  566. margin-bottom: 10px;
  567. color:#fff;
  568. }
  569. </style>
  570. <style lang="scss">
  571. .newDialog{
  572. .el-dialog__body{
  573. padding: 10px 20px 30px;
  574. }
  575. }
  576. </style>