finish_dialog.vue 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  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. infoDialogVisible:false,
  177. selected_date:"",
  178. }
  179. },
  180. props: {
  181. prescription: { // 透析处方
  182. type: Object,
  183. },
  184. dialysis_order: {
  185. type: Object
  186. },
  187. schedule: {
  188. type: Object
  189. },
  190. admins: {
  191. type: Array
  192. }, special_premission: {
  193. type: Array,
  194. },
  195. patient:{
  196. type: Object
  197. }
  198. },
  199. created() {
  200. this.education = getDataConfig('education', 'education')
  201. this.internal_fistula = getDataConfig('hemodialysis', 'internal_fistula')
  202. this.catheter = getDataConfig('hemodialysis', 'catheter')
  203. this.cruorOptions = getDataConfig('hemodialysis', 'cruor')
  204. },
  205. watch: {
  206. 'dialysis_order.id': function() {
  207. if (this.dialysis_order.id == 0) {
  208. this.form.nurse_id = 0
  209. } else if (this.dialysis_order.stage == 1) {
  210. this.form.nurse_id = this.$store.getters.xt_user.user.id
  211. } else {
  212. console.log("orde32332323232332",this.dialysis_order)
  213. this.form.nurse_id = this.dialysis_order.finish_nurse
  214. this.form.catheter = this.dialysis_order.catheter
  215. this.form.cruor = this.dialysis_order.cruor
  216. this.form.internal_fistula = this.dialysis_order.blood_access_internal_fistula
  217. this.form.puncture_point_haematoma = this.dialysis_order.puncture_point_haematoma
  218. this.form.mission = this.dialysis_order.mission
  219. }
  220. },
  221. patient:{
  222. handler(newVal){
  223. this.patient_id = newVal.id
  224. },
  225. deep:true
  226. }
  227. },
  228. methods: {
  229. isName(name) {
  230. let filedList = store.getters.xt_user.fileds;
  231. for (let i = 0; i < filedList.length; i++) {
  232. if (filedList[i].module == 9 && filedList[i].filed_name_cn == name) {
  233. return filedList[i].filed_name;
  234. }
  235. }
  236. },
  237. isCheckmust(name) {
  238. let filedList = store.getters.xt_user.fileds;
  239. for (let i = 0; i < filedList.length; i++) {
  240. if (
  241. filedList[i].module == 9 &&
  242. filedList[i].filed_name_cn == name &&
  243. filedList[i].is_write == 1
  244. ) {
  245. return [{ required: true ,message:`请输入${name}` }];
  246. }
  247. }
  248. },
  249. dialysisAfterTeachSelectChange: function(values) {
  250. if (this.form.mission == '') {
  251. this.form.mission = values
  252. } else {
  253. if (this.form.mission.indexOf(values) == -1) {
  254. if (
  255. this.form.mission
  256. .charAt(this.form.mission.length - 1)
  257. .indexOf('。') == -1
  258. ) {
  259. this.form.mission =
  260. this.form.mission + ',' + values
  261. } else {
  262. this.form.mission =
  263. this.form.mission + values
  264. }
  265. }
  266. }
  267. },
  268. isShowFiled(name) {
  269. var filedList = store.getters.xt_user.fileds
  270. for (let i = 0; i < filedList.length; i++) {
  271. if (filedList[i].module == 9 && filedList[i].filed_name_cn == name && filedList[i].is_show == 1) {
  272. return true
  273. }
  274. if (filedList[i].module == 9 && filedList[i].filed_name_cn == name && filedList[i].is_write!=undefined && filedList[i].is_write == 1) {
  275. this.required = true
  276. }
  277. }
  278. this.required = false
  279. return false
  280. },
  281. isWrite(name){
  282. var filedList = store.getters.xt_user.fileds
  283. for (let i = 0; i < filedList.length; i++) {
  284. if (filedList[i].module == 9 && filedList[i].filed_name_cn == name && filedList[i].is_write == 1) {
  285. return true
  286. }
  287. }
  288. return false
  289. },
  290. show: function(record) {
  291. this.record = record
  292. console.log("下机",record)
  293. this.getPermission()
  294. this.visible = true
  295. var nowDate = new Date()
  296. var nowYear = nowDate.getFullYear()
  297. var nowMonth = nowDate.getMonth() + 1
  298. var nowDay = nowDate.getDate()
  299. var nowHours = nowDate.getHours()
  300. var nowMinutes = nowDate.getMinutes()
  301. var time =
  302. nowYear +
  303. '-' +
  304. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  305. '-' +
  306. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (nowHours < 10 ? '0' + nowHours : nowHours) + ':' + (nowMinutes < 10 ? '0' + nowMinutes : nowMinutes)
  307. if(this.$route.query.patient_id){
  308. this.patient_id = this.$route.query.patient_id
  309. }
  310. this.schedule_date = this.$route.query.date
  311. if (this.dialysis_order.id == 0) {
  312. this.form.nurse_id = 0
  313. } else if (this.dialysis_order.stage == 1) {
  314. this.form.nurse_id = this.$store.getters.xt_user.user.id
  315. } else {
  316. this.form.nurse_id = this.dialysis_order.finish_nurse
  317. }
  318. if (this.dialysis_order.finish_creator > 0) {
  319. for (let i = 0; i < this.special_premission.length; i++) {
  320. if (this.$store.getters.xt_user.user.id == this.special_premission[i].admin_user_id) {
  321. this.isPremission = true
  322. }
  323. }
  324. }
  325. if (this.dialysis_order.finish_creator > 0) {
  326. this.creator = this.dialysis_order.finish_creator
  327. }
  328. if (this.dialysis_order.id == "") {
  329. //没有上下机记录
  330. this.end_time = this.dialysis_order.finish_creator == 0 ? time : this.getTime(this.dialysis_order.end_time, '{y}-{m}-{d} {h}:{i}')
  331. } else {
  332. if (this.dialysis_order.start_time > 0) {
  333. if (this.prescription.id != "") {
  334. let endTime = 0;
  335. endTime =
  336. this.dialysis_order.start_time +
  337. this.prescription.dialysis_duration_hour * 3600 +
  338. this.prescription.dialysis_duration_minute * 60;
  339. this.end_time = parseTime(endTime, "{y}-{m}-{d} {h}:{i}");
  340. } else {
  341. this.end_time =
  342. parseTime(Date.parse(new Date()) / 1000, "{y}-{m}-{d} {h}:{i}")
  343. }
  344. if (this.dialysis_order.end_time > 0) {
  345. this.end_time =
  346. parseTime(this.dialysis_order.end_time, "{y}-{m}-{d} {h}:{i}");
  347. }
  348. } else {
  349. this.end_time = this.dialysis_order.finish_creator == 0 ? time : this.getTime(this.dialysis_order.end_time, '{y}-{m}-{d} {h}:{i}')
  350. }
  351. }
  352. },
  353. hide: function() {
  354. this.visible = false
  355. },
  356. modifyFinish:function(formName){
  357. this.$refs[formName].validate(valid=>{
  358. if(valid){
  359. if(this.isWrite("穿刺处血肿") == true && this.form.puncture_point_haematoma == ""){
  360. this.$message.error("请选择穿刺处血肿")
  361. return
  362. }
  363. if(this.isWrite("内瘘") == true && this.form.internal_fistula == ""){
  364. this.$message.error("请选择内瘘")
  365. return
  366. }
  367. if(this.isWrite("导管") == true && this.form.catheter == ""){
  368. this.$message.error("请选择导管")
  369. return
  370. }
  371. if(this.isWrite("透析器凝血") == true && this.form.cruor == ""){
  372. this.$message.error("请选择透析器凝血")
  373. return
  374. }
  375. let ParamsQuery = {};
  376. ParamsQuery["id"] = this.dialysis_order.id;
  377. ParamsQuery["nurse"] = this.form.nurse_id;
  378. ParamsQuery["end_time"] = this.end_time;
  379. ParamsQuery["mode"] = "2"
  380. ParamsQuery["puncture_point_haematoma"] = parseInt(this.form.puncture_point_haematoma)
  381. ParamsQuery["internal_fistula"] = this.form.internal_fistula
  382. ParamsQuery["catheter"] = this.form.catheter
  383. ParamsQuery["cruor"] = this.form.cruor
  384. ParamsQuery["mission"] = this.form.mission
  385. ParamsQuery["mission_id"] = this.form.mission_id
  386. if(this.dialysis_order.finish_creator != this.$store.getters.xt_user.user.id){
  387. ParamsQuery["mode"] = "3"
  388. }
  389. PostModifyFinishDialysis(ParamsQuery).then(response => {
  390. if (response.data.state == 0) {
  391. this.$message.error(response.data.msg)
  392. if(response.data.code == 600000008){
  393. this.infoDialogVisible = true
  394. }
  395. return false;
  396. } else {
  397. this.$message.success("修改成功")
  398. var record = this.dialysis_order;
  399. for (const key in response.data.data.dialysis_order) {
  400. this.$set(record, key, response.data.data.dialysis_order[key]);
  401. }
  402. console.log(response.data.data.after)
  403. this.$emit('assessmentAfterDislysis', response.data.data.after)
  404. }
  405. });
  406. }
  407. })
  408. },
  409. submit: function(formName) {
  410. this.$refs[formName].validate(valid=>{
  411. if(valid){
  412. if(this.isWrite("穿刺处血肿") == true && this.form.puncture_point_haematoma == ""){
  413. this.$message.error("请选择穿刺处血肿")
  414. return
  415. }
  416. if(this.isWrite("内瘘") == true && this.form.internal_fistula == ""){
  417. this.$message.error("请选择内瘘")
  418. return
  419. }
  420. if(this.isWrite("导管") == true && this.form.catheter == ""){
  421. this.$message.error("请选择导管")
  422. return
  423. }
  424. if(this.isWrite("透析器凝血") == true && this.form.cruor == ""){
  425. this.$message.error("请选择透析器凝血")
  426. return
  427. }
  428. this.loading = true
  429. let mode = "1"
  430. console.log("fomr",this.form.mission_id)
  431. 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 => {
  432. this.loading = false
  433. var resp = rs.data
  434. if (resp.state == 1) {
  435. var dialysis_order = resp.data.dialysis_order
  436. var this_order = this.dialysis_order
  437. for (const key in dialysis_order) {
  438. this.$set(this_order, key, dialysis_order[key])
  439. }
  440. let orgId = parseInt(sessionStorage.getItem("org_id"));
  441. this.hide()
  442. this.$emit('assessmentAfterDislysis', resp.data.assessmentAfterDislysis)
  443. } else {
  444. this.$message.error(resp.msg)
  445. if(response.code == 600000008){
  446. this.infoDialogVisible = true
  447. }
  448. }
  449. })
  450. }else{
  451. return false
  452. }
  453. })
  454. }, getTime(value, temp) {
  455. if (value != undefined) {
  456. return parseTime(value, temp)
  457. }
  458. return ''
  459. },
  460. getPermission(){
  461. request.get("/api/func_per/get",{
  462. params:{
  463. create_url:"/api/dialysis/finish?mode=1",
  464. modify_url:"/api/finish_dialysis/modify?mode=2",
  465. modify_other_url:"/api/finish_dialysis/modify?mode=3",
  466. module:6
  467. }
  468. }).then(res => {
  469. if(res.data.state == 0){
  470. this.hasPermission = false
  471. }else if(res.data.state == 1){
  472. if(this.record.id != "" && this.record.creater != 0){//有数据
  473. if(this.record.creater == this.$store.getters.xt_user.user.id){//创建人是自己
  474. if(res.data.data.is_has_modify == false){
  475. this.hasPermission = false
  476. this.showTxt = "你没有修改执行下机权限"
  477. }
  478. }else{//创建人不是自己
  479. if(res.data.data.is_has_modify_other == false){
  480. this.hasPermission = false
  481. this.showTxt = "你没有修改他人执行下机权限"
  482. }
  483. }
  484. }else if(this.record.id == "" || this.record.creater == 0){
  485. if(res.data.data.is_has_create == false){
  486. this.hasPermission = false
  487. this.showTxt = "你没有执行下机权限"
  488. }
  489. }
  490. }
  491. })
  492. },
  493. showInnerDialog: function(val) {
  494. this.InnerDialogProps.visibility = true
  495. switch (val) {
  496. case '7': // 内瘘
  497. this.InnerDialogProps.values = this.internal_fistula
  498. this.InnerDialogProps.titles = '内瘘'
  499. this.InnerDialogProps.type = 'internal_fistula'
  500. this.InnerDialogProps.selected = this.form.internal_fistula
  501. this.InnerDialogProps.isShowTextArea = false
  502. break
  503. case '4': // 导管
  504. this.InnerDialogProps.values = this.catheter
  505. this.InnerDialogProps.titles = '导管'
  506. this.InnerDialogProps.type = 'catheter'
  507. this.InnerDialogProps.selected = this.form.catheter
  508. this.InnerDialogProps.isShowTextArea = false
  509. break
  510. case '1':
  511. this.InnerDialogProps.values = this.cruorOptions
  512. this.InnerDialogProps.titles = '凝血'
  513. this.InnerDialogProps.type = 'cruor'
  514. this.InnerDialogProps.selected = this.form.cruor
  515. this.InnerDialogProps.isShowTextArea = false
  516. break
  517. }
  518. },
  519. innerDialogComfirm: function(val) {
  520. this.InnerDialogProps.visibility = false
  521. switch (val.type) {
  522. case 'internal_fistula':
  523. this.form.internal_fistula = val.value.join(',')
  524. break
  525. case 'catheter':
  526. this.form.catheter = val.value.join(',')
  527. break
  528. case 'cruor':
  529. this.form.cruor = val.value.join(',')
  530. break
  531. }
  532. },
  533. innerDialogCancle: function() {
  534. this.InnerDialogProps.visibility = false
  535. },
  536. saveInformation(){
  537. var params = {
  538. selected_date:this.selected_date,
  539. patient_id:this.$route.query.patient_id,
  540. record_date:this.$route.query.date,
  541. module:1,
  542. remark:this.remark,
  543. }
  544. console.log("params32222222222----",params)
  545. saveInformation(params).then(response=>{
  546. if(response.data.state == 1){
  547. var information = response.data.data.information
  548. this.$message.success("审核成功!")
  549. this.infoDialogVisible = false
  550. }
  551. })
  552. }
  553. }
  554. }
  555. </script>
  556. <style scoped>
  557. .txsj {
  558. text-align: center;
  559. margin-bottom: 20px;
  560. }
  561. .warnTxt{
  562. text-align: center;
  563. margin: 0 auto;
  564. background: #faa331;
  565. max-width: 240px;
  566. padding: 10px 20px;
  567. border-radius: 4px;
  568. margin-bottom: 10px;
  569. color:#fff;
  570. }
  571. </style>
  572. <style lang="scss">
  573. .newDialog{
  574. .el-dialog__body{
  575. padding: 10px 20px 30px;
  576. }
  577. }
  578. </style>