dialysisSolution.1.vue 38KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004
  1. <template>
  2. <div class="patient-container">
  3. <patient-sidebar :id="patientID" defaultActive="2-1"></patient-sidebar>
  4. <div class="patient-app-container app-container">
  5. <div class="Total">
  6. <!-- <div class="plan" >透析计划</div> -->
  7. <table-title title="透析计划"></table-title>
  8. <div class="sum">
  9. <!-- <span>透析总频率:<el-input :value="totalrate" disabled style="width:180px"></el-input></span> -->
  10. <el-button type="primary" icon="el-icon-plus" size="medium" @click="openNew">新增计划</el-button>
  11. </div>
  12. </div>
  13. <el-table :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" ref="solutionTable" :data="tableData" border fit highlight-current-row
  14. @current-change="tableCurrentChange"
  15. style="width: 100%">
  16. <el-table-column
  17. type="index"
  18. align="center"
  19. label="序号"
  20. min-width="60">
  21. </el-table-column>
  22. <el-table-column
  23. prop="mode_name"
  24. align="center"
  25. label="透析模式"
  26. min-width="50">
  27. <template slot-scope="scope" >
  28. <span v-if="scope.row.parent_id === 0" >{{scope.row.mode_name}}</span>
  29. <span v-else >--</span>
  30. </template>
  31. </el-table-column>
  32. <el-table-column
  33. prop="period"
  34. label="频率"
  35. align="center"
  36. min-width="50">
  37. <template slot-scope="scope" >
  38. <span v-if="scope.row.parent_id === 0" >{{scope.row.period}}{{scope.row.times}}</span>
  39. <span v-else >--</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column
  43. prop="name"
  44. label="处方名"
  45. align="center"
  46. min-width="50">
  47. <template slot-scope="scope" >
  48. <span >{{scope.row.name}}{{scope.row.sub_name}}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column
  52. prop="doctor"
  53. label="医生"
  54. align="center"
  55. min-width="110">
  56. <template slot-scope="scope" >
  57. <span >{{getDoctorName(scope.row.doctor)}}</span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column
  61. prop="updated_time"
  62. align="center"
  63. label="更新日期"
  64. min-width="60">
  65. <template slot-scope="scope">
  66. <span>{{scope.row.updated_time | parseTime('{y}-{m}-{d}')}}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column
  70. prop="state"
  71. label="状态"
  72. align="center"
  73. min-width="40">
  74. <template slot-scope="scope" >
  75. <span v-if="scope.row.initiate_mode==1">启用</span>
  76. <span v-else-if="scope.row.initiate_mode==2">停用</span>
  77. <span v-else>未知</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="操作" align="center" min-width="140">
  81. <template slot-scope="scope">
  82. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  83. <el-button
  84. size="small"
  85. type="primary"
  86. @click="openEdit(scope.$index, scope.row)" v-if="scope.row.parent_id===0"></el-button>
  87. </el-tooltip>
  88. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  89. <el-button
  90. size="small"
  91. type="primary"
  92. @click="openChildEdit(scope.$index, scope.row)" v-else></el-button>
  93. </el-tooltip>
  94. <el-tooltip class="item" effect="dark" content="新增" placement="top">
  95. <el-button
  96. size="small"
  97. type="success"
  98. @click="openNewChild(scope.$index, scope.row)" v-if="scope.row.parent_id===0"></el-button>
  99. </el-tooltip>
  100. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  101. <el-button
  102. size="small"
  103. type="danger"
  104. @click="handleDelete(scope.$index, scope.row)"></el-button>
  105. </el-tooltip>
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. <div style="margin-top:30px;">
  110. <div class="Total">
  111. <div class="sure">
  112. <el-button type="text" v-if="solution_detail.affirm_state==1" size="small" icon="el-icon-success">已确认</el-button>
  113. <el-button type="text" v-else size="small" style="color:#E6A23C" icon="el-icon-error">未确认</el-button>
  114. <el-button type="primary" :disabled="solution_detail.id>0?false:true" @click="submitSolution('solution_detail')" size="small" icon="el-icon-check">确认</el-button>
  115. </div>
  116. <div class="plan">
  117. <span>透析处方名:{{current_solution.name}}{{current_solution.sub_name}}</span>
  118. <span>频率:{{current_solution.period}}{{current_solution.times}}</span>
  119. <span>医生:{{getDoctorName(current_solution.doctor)}}</span>
  120. </div>
  121. </div>
  122. <el-form ref="solution_detail" :model="solution_detail" class="form-table" label-width="160px" style="padding-top:22px;">
  123. <el-row :gutter="20" >
  124. <el-col style="" :span="6" >
  125. <el-form-item label="透析时长(h):">
  126. <el-input v-model="solution_detail.dialysis_duration"></el-input>
  127. </el-form-item>
  128. </el-col>
  129. <el-col style="" :span="6" >
  130. <el-form-item label="置换方式:" >
  131. <el-select v-model="solution_detail.replacement_way" :disabled="current_model.replacement_way==1?false:true" >
  132. <el-option v-for="item in replacementWays" :label="item.name" :key="item.id" :value="item.id"></el-option>
  133. </el-select>
  134. </el-form-item>
  135. </el-col>
  136. <el-col style="" :span="6" >
  137. <el-form-item label="收费套餐:">
  138. <el-select v-model="solution_detail.mode_id" disabled >
  139. <el-option v-for="item in modeOptions" :label="item.name" :key="item.id" :value="item.id"></el-option>
  140. </el-select>
  141. </el-form-item>
  142. </el-col>
  143. <el-col style="" :span="6" >
  144. <el-form-item label="血流量:">
  145. <el-input v-model="solution_detail.blood_flow_volume" :disabled="current_model.blood_flow_volume==1?false:true"></el-input>
  146. </el-form-item>
  147. </el-col>
  148. <el-col style="" :span="6">
  149. <el-form-item label="血透器:">
  150. <el-select v-model="solution_detail.hemodialysis_machine" placeholder="" :disabled="current_model.hemodialysis_machine==1?false:true">
  151. <el-option v-for="item in hemodialysis_machines" :label="item.name" :key="item.id" :value="item.id"></el-option>
  152. </el-select>
  153. </el-form-item>
  154. </el-col>
  155. <el-col style="" :span="6">
  156. <el-form-item label="血滤器:" >
  157. <el-select v-model="solution_detail.blood_filter" placeholder="" :disabled="current_model.blood_filter==1?false:true">
  158. <el-option v-for="item in blood_filters" :label="item.name" :key="item.id" :value="item.id"></el-option>
  159. </el-select>
  160. </el-form-item>
  161. </el-col>
  162. <el-col style="" :span="6">
  163. <el-form-item label="灌流器:">
  164. <el-select v-model="solution_detail.perfusion_apparatus" placeholder="" :disabled="current_model.perfusion_apparatus==1?false:true">
  165. <el-option v-for="item in perfusion_apparatus" :label="item.name" :key="item.id" :value="item.id"></el-option>
  166. </el-select>
  167. </el-form-item>
  168. </el-col>
  169. <el-col style="" :span="6">
  170. <el-form-item label="透析液流量(ml/min): " :disabled="current_model.dialysate_flow==1?false:true">
  171. <el-input v-model="solution_detail.dialysate_flow"></el-input>
  172. </el-form-item>
  173. </el-col>
  174. <el-col style="" :span="6">
  175. <el-form-item label="钾(mmol/L): ">
  176. <el-input v-model="solution_detail.kalium" :disabled="current_model.kalium==1?false:true"></el-input>
  177. </el-form-item>
  178. </el-col>
  179. <el-col style="" :span="6">
  180. <el-form-item label="钠(mmol/L): ">
  181. <el-input v-model="solution_detail.sodium" :disabled="current_model.sodium==1?false:true"></el-input>
  182. </el-form-item>
  183. </el-col>
  184. <el-col style="" :span="6">
  185. <el-form-item label="钙(mmol/L): ">
  186. <el-input v-model="solution_detail.calcium" :disabled="current_model.calcium==1?false:true"></el-input>
  187. </el-form-item>
  188. </el-col>
  189. <el-col style="" :span="6" >
  190. <el-form-item label="碳酸氢根(mmol/L): ">
  191. <el-input v-model="solution_detail.bicarbonate" :disabled="current_model.bicarbonate==1?false:true"></el-input>
  192. </el-form-item>
  193. </el-col>
  194. <el-col style="" :span="6">
  195. <el-form-item label="抗凝剂:">
  196. <el-select v-model="solution_detail.anticoagulant" @change="changeThisAnticoagulant" >
  197. <el-option v-for="item in anticoagulantsConfit" :label="item.name" :key="item.id" :value="item.id"></el-option>
  198. </el-select>
  199. </el-form-item>
  200. </el-col>
  201. <el-col style="" :span="6" v-if="anticoagulant.shouji != -1">
  202. <el-form-item :label="'首剂('+anticoagulant.shouji_unit+'): '">
  203. <el-input v-model="solution_detail.anticoagulant_shouji" :disabled="anticoagulant.shouji==1?false:true"></el-input>
  204. </el-form-item>
  205. </el-col>
  206. <el-col style="" :span="6" v-if="anticoagulant.weichi != -1">
  207. <el-form-item :label="'维持('+anticoagulant.weichi_unit+'): '">
  208. <el-input v-model="solution_detail.anticoagulant_weichi" :disabled="anticoagulant.weichi==1?false:true"></el-input>
  209. </el-form-item>
  210. </el-col>
  211. <el-col style="" :span="6" v-if="anticoagulant.zongliang != -1">
  212. <el-form-item :label="'总量('+anticoagulant.zongliang_unit+'): '">
  213. <el-input v-model="solution_detail.anticoagulant_zongliang" :disabled="anticoagulant.zongliang==1?false:true" ></el-input>
  214. </el-form-item>
  215. </el-col>
  216. <el-col style="" :span="6" v-if="anticoagulant.gaimingcheng != -1">
  217. <el-form-item :label="'钙('+anticoagulant.gaimingcheng_unit+'): '">
  218. <el-input v-model="solution_detail.anticoagulant_gaimingcheng" :disabled="anticoagulant.gaimingcheng==1?false:true" placeholder="钙名称" ></el-input>
  219. </el-form-item>
  220. </el-col>
  221. <el-col style="" :span="6" v-if="anticoagulant.gaijiliang != -1">
  222. <el-form-item >
  223. <el-input v-model="solution_detail.anticoagulant_gaijiliang" :disabled="anticoagulant.gaijiliang==1?false:true" placeholder="钙剂量"></el-input>
  224. </el-form-item>
  225. </el-col>
  226. </el-row>
  227. </el-form>
  228. </div>
  229. </div>
  230. <el-dialog
  231. :title="isEdit?'编辑透析方案':'新增透析方案'"
  232. :visible.sync="dialogVisible"
  233. width="1010px">
  234. <el-form ref="addPlan" :model="addPlan" :rules="addPlanRules" label-width="85px">
  235. <el-row :gutter="20">
  236. <el-col style="" :span="12" >
  237. <el-form-item label="透析模式:" prop="mode">
  238. <el-select v-model="addPlan.mode" @change="addPlanModeChange" :disabled="isEdit?true:false" >
  239. <el-option v-for="item in modeOptions" :label="item.name" :key="item.id" :value="item.id"></el-option>
  240. </el-select>
  241. </el-form-item>
  242. </el-col>
  243. <el-col style="" :span="12" >
  244. <el-form-item label="频率:" prop="type">
  245. <el-radio-group v-model="addPlan.type">
  246. <el-radio v-for="item in timeOptions" @change="addPlanTypeChange" :label="item.value" :key="item.value" :value="item.value">{{item.label}}</el-radio>
  247. </el-radio-group>
  248. </el-form-item>
  249. </el-col>
  250. </el-row>
  251. <el-form-item label="周期:" prop="period" >
  252. <el-select v-model="addPlan.period" >
  253. <el-option v-for="item in periodOptions" :label="item.label" :key="item.value" :value="item.value"></el-option>
  254. </el-select>
  255. </el-form-item>
  256. <el-form-item label="次数:" prop="times" >
  257. <el-select v-model="addPlan.times" >
  258. <el-option v-for="item in numOptions" :label="item.label" :key="item.value" :value="item.value"></el-option>
  259. </el-select>
  260. </el-form-item>
  261. <el-form-item label="状态:" prop="initiate_mode" >
  262. <el-select v-model="addPlan.initiate_mode" >
  263. <el-option v-for="item in stateOptions" :label="item.label" :key="item.value" :value="item.value"></el-option>
  264. </el-select>
  265. </el-form-item>
  266. <el-form-item label="医生:" prop="doctor">
  267. <el-select v-model="addPlan.doctor" >
  268. <el-option v-for="item in doctorOptions" :label="item.name" :key="item.id" :value="item.id"></el-option>
  269. </el-select>
  270. </el-form-item>
  271. <el-form-item label="首次透析:" prop="first_dialysis" v-if="addPlan.type==2">
  272. <el-date-picker v-model="addPlan.first_dialysis" type="date" placeholder="选择日期" :suffix-icon="'el-icon-menu'" format="yyyy-MM-dd" value-format="yyyy-MM-dd"></el-date-picker>
  273. </el-form-item>
  274. </el-form>
  275. <span slot="footer" class="dialog-footer">
  276. <el-button type="warning" @click="submitEditSolution('addPlan')" v-if="isEdit">保 存</el-button>
  277. <el-button type="primary" @click="submitNewSolution('addPlan')" v-else>保 存</el-button>
  278. <el-button @click="dialogVisible = false">取 消</el-button>
  279. </span>
  280. </el-dialog>
  281. <el-dialog :title="isChildEdit?'编辑子方案':'新增子方案'" width="40%" :visible.sync="dialogFormVisible" >
  282. <el-form :model="childPlan" ref="childPlan" :rules="addChildPlanRules" :label-width="formLabelWidth" >
  283. <el-form-item label="透析模式:" >
  284. <el-input v-model="childPlan.mode" :disabled="true" style="width:40%;"></el-input>
  285. </el-form-item>
  286. <el-form-item label="频率:" >
  287. <el-input v-model="childPlan.frequency" :disabled="true" style="width:40%;" ></el-input>
  288. </el-form-item>
  289. <el-form-item label="处方名:" prop="sub_name" >
  290. <el-input v-model="childPlan.name" :disabled="true" style="width:19%;" ></el-input>
  291. <el-input v-model="childPlan.sub_name" placeholder="请输入数字" style="width:19%;" :disabled="isChildEdit?true:false" ></el-input>
  292. </el-form-item>
  293. <el-form-item label="状态:" prop="initiate_mode" >
  294. <el-select v-model="childPlan.initiate_mode" >
  295. <el-option v-for="item in stateOptions" :label="item.label" :key="item.value" :value="item.value"></el-option>
  296. </el-select>
  297. </el-form-item>
  298. <el-form-item label="医生:" prop="doctor" >
  299. <el-select v-model="childPlan.doctor" >
  300. <el-option v-for="item in doctorOptions" :label="item.name" :key="item.id" :value="item.id"></el-option>
  301. </el-select>
  302. </el-form-item>
  303. </el-form>
  304. <div slot="footer" class="dialog-footer">
  305. <el-button type="primary" @click="submitEditChildSolution('childPlan')" v-if="isChildEdit">保 存</el-button>
  306. <el-button type="primary" @click="submitNewChildSolution('childPlan')" v-else>保 存</el-button>
  307. <el-button @click="dialogFormVisible = false">取 消</el-button>
  308. </div>
  309. </el-dialog>
  310. </div>
  311. </template>
  312. <script>
  313. import tableTitle from "./components/tableTitle";
  314. import PatientSidebar from './components/PatientSidebar';
  315. import { fetchAllDoctorAndNurse } from "@/api/doctor";
  316. import {createPatientDialysisSolution,fetchPatientDialysisSolutions,editPatientDialysisSolution,createChildPatientDialysisSolution,editChildPatientDialysisSolution,editDialysisSolutionDetail,deleteDialysisSolution} from "@/api/patient";
  317. import {uParseTime,calculateAnticoagulantZL} from "@/utils/tools";
  318. const periodWeek = [
  319. { value: "每周", label: "每周" },
  320. { value: "两周", label: "两周" },
  321. { value: "三周", label: "三周" },
  322. { value: "四周", label: "四周" },
  323. ];
  324. const periodDay = [
  325. { value: "2天", label: "2天" },
  326. { value: "3天", label: "3天" },
  327. { value: "4天", label: "4天" },
  328. { value: "5天", label: "5天" },
  329. { value: "10天", label: "10天" },
  330. { value: "15天", label: "15天" },
  331. { value: "30天", label: "30天" },
  332. ];
  333. const numOptionsWeek = [
  334. { value: "1次", label: "1次" },
  335. { value: "2次", label: "2次" },
  336. { value: "3次", label: "3次" },
  337. { value: "4次", label: "4次" },
  338. { value: "5次", label: "5次" },
  339. { value: "6次", label: "6次" },
  340. { value: "7次", label: "7次" },
  341. ];
  342. const numOptionsDay = [
  343. { value: "1次", label: "1次" },
  344. ];
  345. export default {
  346. name: "Dialysis",
  347. data() {
  348. var checkFirstDialysis = (rule, value, callback)=>{
  349. if (this.addPlan.type == 2 && !value) {
  350. return callback(new Error('请选择首次透析!'));
  351. }
  352. callback();
  353. };
  354. var checkSubName = (rule, value, callback)=>{
  355. var pattern = /^\d*$/
  356. if (!pattern.test(value)) {
  357. return callback(new Error('只填写0-9的数字'));
  358. }
  359. callback();
  360. };
  361. return {
  362. isEdit:false,
  363. isChildEdit:false,
  364. totalrate:"无/两周一次",
  365. patientID:0,
  366. dialogVisible: false,
  367. dialogFormVisible: false,
  368. formLabelWidth: "80px",
  369. formInputWidth: "80px",
  370. total:0,
  371. tableData: null,
  372. form: {
  373. name: "",
  374. region: "",
  375. date1: "",
  376. date2: "",
  377. delivery: false,
  378. type: [],
  379. resource: "",
  380. desc: ""
  381. },
  382. addPlan: {
  383. mode:"",
  384. mode_name:"",
  385. sub_name:"",
  386. id:0,
  387. parent_id:0,
  388. type: "",
  389. period: "",
  390. times: "",
  391. initiate_mode:"",
  392. doctor: "",
  393. first_dialysis:"",
  394. },
  395. childPlan: {
  396. mode: "",
  397. frequency: "",
  398. name: "",
  399. parent_id:0,
  400. sub_name: "",
  401. initiate_mode: "",
  402. doctor: ""
  403. },
  404. modeOptions: null,
  405. anticoagulantsSet: {
  406. type:1,
  407. },
  408. replacementWays: null,
  409. anticoagulantsConfit: null,
  410. timeOptions: [
  411. { value: 1, label: "按周" },
  412. { value: 2, label: "按日" }
  413. ],
  414. periodOptions: periodWeek,
  415. numOptions: numOptionsWeek,
  416. stateOptions: [
  417. { value: 1, label: "启用" },
  418. { value: 2, label: "停用" }
  419. ],
  420. doctorOptions: null,
  421. current_index:-1,
  422. addPlanRules:{
  423. mode:[{ required: true, message: "请选择透析模式", trigger: "blur" }],
  424. type:[{ required: true, message: "请选择频率", trigger: "blur" }],
  425. period:[{ required: true, message: "请选择周期", trigger: "blur" }],
  426. times:[{ required: true, message: "请选择次数", trigger: "blur" }],
  427. initiate_mode:[{ required: true, message: "请选择状态", trigger: "blur" }],
  428. doctor:[{ required: true, message: "请选择医生", trigger: "blur" }],
  429. first_dialysis:[{ validator: checkFirstDialysis, trigger: "blur" }],
  430. },
  431. addChildPlanRules:{
  432. sub_name:[{ required: true, message: "请填写处方名", trigger: "blur" },{validator:checkSubName,trigger:"blur"}],
  433. initiate_mode:[{ required: true, message: "请选择状态", trigger: "blur" }],
  434. doctor:[{ required: true, message: "请选择医生", trigger: "blur" }],
  435. },
  436. current_model:{id:0, name:"",dialysis_duration:2, replacement_way:2,hemodialysis_machine:2,blood_filter:2,perfusion_apparatus:2,blood_flow_volume:2,dialysate_flow:2,kalium:2,sodium:2,calcium:2,bicarbonate:2},
  437. current_solution:{
  438. id:0,
  439. name:"",
  440. sub_name:"",
  441. period:"",
  442. times:"",
  443. doctor:0,
  444. },
  445. anticoagulant:{id:0, name:"", type:1, shouji:1, weichi:1, zongliang:1, gaimingcheng:-1, gaijiliang:-1, shouji_unit:"mg", weichi_unit:"mg/h", zongliang_unit:"mg", gaimingcheng_unit:"", gaijiliang_unit:""},
  446. blood_filters:null,
  447. perfusion_apparatus:null,
  448. hemodialysis_machines:null,
  449. solution_detail:{
  450. id:0,
  451. affirm_state:0,
  452. dialysis_duration:"",
  453. replacement_way:"",
  454. mode_id:"",
  455. blood_flow_volume:"",
  456. hemodialysis_machine:"",
  457. blood_filter:"",
  458. perfusion_apparatus:"",
  459. dialysate_flow:"",
  460. kalium:"",
  461. sodium:"",
  462. calcium:"",
  463. bicarbonate:"",
  464. anticoagulant:"",
  465. anticoagulant_shouji:"",
  466. anticoagulant_weichi:"",
  467. anticoagulant_zongliang:"",
  468. anticoagulant_gaimingcheng:"",
  469. anticoagulant_gaijiliang:"",
  470. },
  471. };
  472. },
  473. watch:{
  474. "solution_detail.dialysis_duration":function(){
  475. this.solution_detail.anticoagulant_zongliang=calculateAnticoagulantZL(this.anticoagulantsSet.type,
  476. this.solution_detail.anticoagulant_shouji,
  477. this.solution_detail.dialysis_duration,
  478. this.solution_detail.anticoagulant_weichi
  479. );
  480. },
  481. "solution_detail.anticoagulant_shouji":function(){
  482. this.solution_detail.anticoagulant_zongliang=calculateAnticoagulantZL(this.anticoagulantsSet.type,
  483. this.solution_detail.anticoagulant_shouji,
  484. this.solution_detail.dialysis_duration,
  485. this.solution_detail.anticoagulant_weichi
  486. );
  487. },
  488. "solution_detail.anticoagulant_weichi":function(){
  489. this.solution_detail.anticoagulant_zongliang=calculateAnticoagulantZL(this.anticoagulantsSet.type,
  490. this.solution_detail.anticoagulant_shouji,
  491. this.solution_detail.dialysis_duration,
  492. this.solution_detail.anticoagulant_weichi
  493. );
  494. },
  495. },
  496. components: {
  497. tableTitle,PatientSidebar
  498. },
  499. methods: {
  500. tableCurrentChange(current){
  501. if (typeof(current)=='undefined' || current == null) {
  502. this.current_solution={
  503. id:0,
  504. name:"",
  505. sub_name:"",
  506. period:"",
  507. times:"",
  508. doctor:0,
  509. };
  510. this.solution_detail={
  511. id:0,
  512. affirm_state:0,
  513. dialysis_duration:"",
  514. replacement_way:"",
  515. mode_id:"",
  516. blood_flow_volume:"",
  517. hemodialysis_machine:"",
  518. blood_filter:"",
  519. perfusion_apparatus:"",
  520. dialysate_flow:"",
  521. kalium:"",
  522. sodium:"",
  523. calcium:"",
  524. bicarbonate:"",
  525. anticoagulant:"",
  526. anticoagulant_shouji:"",
  527. anticoagulant_weichi:"",
  528. anticoagulant_zongliang:"",
  529. anticoagulant_gaimingcheng:"",
  530. anticoagulant_gaijiliang:"",
  531. };
  532. return;
  533. }
  534. this.current_solution = current;
  535. this.setCurrentMode(current.mode_id);
  536. this.solution_detail={
  537. id:this.current_solution.id,
  538. affirm_state:this.current_solution.affirm_state,
  539. dialysis_duration:this.current_solution.dialysis_duration!=0?this.current_solution.dialysis_duration:"",
  540. replacement_way:this.current_solution.replacement_way != 0?this.current_solution.replacement_way:"",
  541. mode_id:this.current_solution.mode_id,
  542. blood_flow_volume:this.current_solution.blood_flow_volume != 0?this.current_solution.blood_flow_volume:"",
  543. hemodialysis_machine:this.current_solution.hemodialysis_machine!=0?this.current_solution.hemodialysis_machine:"",
  544. blood_filter:this.current_solution.blood_filter!=0?this.current_solution.blood_filter:"",
  545. perfusion_apparatus:this.current_solution.perfusion_apparatus!=0?this.current_solution.perfusion_apparatus:"",
  546. dialysate_flow:this.current_solution.dialysate_flow!=0?this.current_solution.dialysate_flow:"",
  547. kalium:this.current_solution.kalium!=0?this.current_solution.kalium:"",
  548. sodium:this.current_solution.sodium!=0?this.current_solution.sodium:"",
  549. calcium:this.current_solution.calcium!=0?this.current_solution.calcium:"",
  550. bicarbonate:this.current_solution.bicarbonate!=0?this.current_solution.bicarbonate:"",
  551. anticoagulant:this.current_solution.anticoagulant!=0?this.current_solution.anticoagulant:"",
  552. anticoagulant_shouji:this.current_solution.anticoagulant_shouji!=0?this.current_solution.anticoagulant_shouji:"",
  553. anticoagulant_weichi:this.current_solution.anticoagulant_weichi!=0?this.current_solution.anticoagulant_weichi:"",
  554. anticoagulant_zongliang:this.current_solution.anticoagulant_zongliang!=0?this.current_solution.anticoagulant_zongliang:"",
  555. };
  556. },
  557. handleDelete(index, row) {
  558. if (row.use_state==1) {
  559. this.$message.error("方案已被使用,不能删除");
  560. return false;
  561. }
  562. this.$confirm('确定删除'+row.name+row.sub_name+'方案吗?', '提示', {
  563. confirmButtonText: '确定',
  564. cancelButtonText: '取消',
  565. type: 'warning'
  566. }).then(() => {
  567. deleteDialysisSolution(row.id).then(response=>{
  568. if (response.data.state == 0) {
  569. this.$message.error(response.data.msg);
  570. return false;
  571. } else {
  572. this.$notify({
  573. title: "成功",
  574. message: "修改方案成功",
  575. type: "success",
  576. duration: 2000
  577. });
  578. // this.tableData.splice(index,1);
  579. if (row.parent_id>0) {
  580. this.tableData.splice(index,1);
  581. }else {
  582. var resetTableData = this.tableData;
  583. this.tableData = [];
  584. var that = this;
  585. resetTableData.forEach(function(item, itemindex){
  586. if (item.id != row.id && item.parent_id != row.id) {
  587. that.tableData.push(item);
  588. }
  589. });
  590. }
  591. }
  592. });
  593. });
  594. },
  595. submitSolution(formName){
  596. editDialysisSolutionDetail(this.patientID, this.solution_detail.id, this.solution_detail).then(response=>{
  597. if (response.data.state == 0) {
  598. this.$message.error(response.data.msg);
  599. return false;
  600. } else {
  601. this.$notify({
  602. title: "成功",
  603. message: "修改方案成功",
  604. type: "success",
  605. duration: 2000
  606. });
  607. var thisSolution = response.data.data.solution;
  608. var spliceIndex = -1;
  609. for (let index = this.tableData.length-1; ; index--) {
  610. if(this.tableData[index].id === thisSolution.id) {
  611. spliceIndex = index;
  612. break;
  613. }
  614. }
  615. if (spliceIndex > -1) {
  616. var newIndex = spliceIndex + 1;
  617. if (newIndex === this.tableData.length) {
  618. this.tableData.pop();
  619. this.tableData.push(thisSolution);
  620. }else {
  621. var swapData = this.tableData.splice(newIndex);
  622. this.tableData.pop();
  623. this.tableData.push(thisSolution);
  624. this.tableData = this.tableData.concat(swapData);
  625. }
  626. }
  627. this.solution_detail.affirm_state = thisSolution.affirm_state;
  628. this.$refs.solutionTable.setCurrentRow(this.tableData[spliceIndex]);
  629. }
  630. });
  631. },
  632. submitEditChildSolution(formName){
  633. this.$refs[formName].validate(valid=>{
  634. if(valid) {
  635. var editData = {
  636. initiate_mode: this.childPlan.initiate_mode,
  637. doctor:this.childPlan.doctor
  638. }
  639. editChildPatientDialysisSolution(this.patientID, this.childPlan.id, editData).then(response=>{
  640. if (response.data.state == 0) {
  641. this.$message.error(response.data.msg);
  642. return false;
  643. } else {
  644. this.$notify({
  645. title: "成功",
  646. message: "修改方案成功",
  647. type: "success",
  648. duration: 2000
  649. });
  650. this.$refs[formName].resetFields();
  651. this.dialogFormVisible = false;
  652. this.tableData[this.current_index].doctor = response.data.data.solution.doctor;
  653. this.tableData[this.current_index].updated_time = response.data.data.solution.updated_time;
  654. this.tableData[this.current_index].initiate_mode = response.data.data.solution.initiate_mode;
  655. this.current_index = -1;
  656. return false;
  657. }
  658. });
  659. }
  660. });
  661. },
  662. submitNewChildSolution(formName) {
  663. this.$refs[formName].validate(valid=>{
  664. if(valid) {
  665. var createData = {
  666. parent_id: this.childPlan.parent_id,
  667. sub_name: this.childPlan.sub_name,
  668. initiate_mode: this.childPlan.initiate_mode,
  669. doctor:this.childPlan.doctor
  670. }
  671. createChildPatientDialysisSolution(this.patientID,createData).then(response=>{
  672. if (response.data.state == 0) {
  673. this.$message.error(response.data.msg);
  674. return false;
  675. } else {
  676. this.$notify({
  677. title: "成功",
  678. message: "创建方案成功",
  679. type: "success",
  680. duration: 2000
  681. });
  682. this.$refs[formName].resetFields();
  683. var spliceIndex = -1;
  684. for (let index = this.tableData.length-1; ; index--) {
  685. if(this.tableData[index].parent_id === createData.parent_id) {
  686. spliceIndex = index;
  687. break;
  688. }else if (this.tableData[index].id === createData.parent_id) {
  689. spliceIndex = index;
  690. break;
  691. }
  692. }
  693. if (spliceIndex > -1) {
  694. spliceIndex += 1;
  695. if (spliceIndex === this.tableData.length) {
  696. this.tableData.push(response.data.data.solution);
  697. }else {
  698. var swapData = this.tableData.splice(spliceIndex);
  699. this.tableData.push(response.data.data.solution);
  700. this.tableData = this.tableData.concat(swapData);
  701. }
  702. }
  703. this.dialogFormVisible = false;
  704. return false;
  705. }
  706. });
  707. }
  708. });
  709. },
  710. submitEditSolution(formName){
  711. this.$refs[formName].validate(valid=>{
  712. if(valid) {
  713. editPatientDialysisSolution(this.patientID,this.addPlan.id, this.addPlan).then(response=>{
  714. if (response.data.state == 0) {
  715. this.$message.error(response.data.msg);
  716. return false;
  717. } else {
  718. this.$notify({
  719. title: "成功",
  720. message: "修改方案成功",
  721. type: "success",
  722. duration: 2000
  723. });
  724. this.$refs[formName].resetFields();
  725. this.dialogVisible = false;
  726. this.tableData[this.current_index].period = response.data.data.solution.period;
  727. this.tableData[this.current_index].times = response.data.data.solution.times;
  728. this.tableData[this.current_index].doctor = response.data.data.solution.doctor;
  729. this.tableData[this.current_index].updated_time = response.data.data.solution.updated_time;
  730. this.tableData[this.current_index].initiate_mode = response.data.data.solution.initiate_mode;
  731. this.current_index = -1;
  732. return false;
  733. }
  734. });
  735. }
  736. });
  737. },
  738. submitNewSolution(formName){
  739. this.$refs[formName].validate(valid=>{
  740. if(valid) {
  741. createPatientDialysisSolution(this.patientID,this.addPlan).then(response=>{
  742. if (response.data.state == 0) {
  743. this.$message.error(response.data.msg);
  744. return false;
  745. } else {
  746. this.$notify({
  747. title: "成功",
  748. message: "创建方案成功",
  749. type: "success",
  750. duration: 2000
  751. });
  752. this.$refs[formName].resetFields();
  753. this.dialogVisible = false;
  754. this.tableData.push(response.data.data.solution);
  755. return false;
  756. }
  757. });
  758. }
  759. });
  760. },
  761. handleEdit(index, row) {
  762. console.log(index, row);
  763. },
  764. openEdit(index, row) {
  765. this.current_index = index;
  766. this.addPlan.id = row.id
  767. this.addPlan.mode = row.mode_id
  768. this.addPlan.mode_name = row.mode_name
  769. this.addPlan.parent_id = row.parent_id
  770. this.addPlan.type = row.type
  771. this.addPlan.period = row.period
  772. this.addPlan.times = row.times
  773. this.addPlan.initiate_mode = row.initiate_mode
  774. this.addPlan.doctor = row.doctor
  775. this.addPlan.first_dialysis = uParseTime(row.first_dialysis, "{y}-{m}-{d}");
  776. this.addPlanTypeChange();
  777. this.dialogVisible = true;
  778. this.isEdit=true;
  779. },
  780. openNew(){
  781. this.current_index = -1;
  782. this.addPlan = {
  783. mode:"",
  784. mode_name:"",
  785. id:0,
  786. type: 1,
  787. period: "",
  788. times: "",
  789. initiate_mode:"",
  790. doctor: "",
  791. first_dialysis:"",
  792. };
  793. this.addPlanTypeChange();
  794. this.dialogVisible = true;
  795. this.isEdit=false;
  796. },
  797. openNewChild(index, row){
  798. this.childPlan = {
  799. mode: row.mode_name,
  800. frequency: row.period + row.times,
  801. name: row.name,
  802. parent_id:row.id,
  803. sub_name: "",
  804. initiate_mode: "",
  805. doctor: ""
  806. }
  807. this.isChildEdit = false;
  808. this.dialogFormVisible = true;
  809. },
  810. openChildEdit(index, row) {
  811. this.childPlan = {
  812. mode: row.mode_name,
  813. frequency: row.period + row.times,
  814. name: row.name,
  815. parent_id:row.parent_id,
  816. id:row.id,
  817. sub_name: row.sub_name,
  818. initiate_mode: row.initiate_mode,
  819. doctor: row.doctor
  820. }
  821. this.current_index = index;
  822. this.isChildEdit = true;
  823. this.dialogFormVisible = true;
  824. },
  825. fetchAllDoctorAndNurse() {
  826. fetchAllDoctorAndNurse().then(response => {
  827. if (response.data.state == 1) {
  828. this.doctorOptions = response.data.data.doctors;
  829. }
  830. });
  831. },
  832. fetchPatientDialysisSolutions(){
  833. fetchPatientDialysisSolutions(this.patientID).then(response=>{
  834. if (response.data.state == 1) {
  835. this.tableData = response.data.data.solutions;
  836. }
  837. });
  838. },
  839. addPlanTypeChange(){
  840. if (this.addPlan.type == 1) {
  841. this.periodOptions = periodWeek;
  842. this.numOptions = numOptionsWeek;
  843. }else {
  844. this.addPlan.type == 2;
  845. this.periodOptions = periodDay;
  846. this.numOptions = numOptionsDay;
  847. }
  848. },
  849. changeThisAnticoagulant(){
  850. var thismode = parseInt(this.solution_detail.anticoagulant);
  851. if (isNaN(thismode) || thismode <=0) {
  852. return false;
  853. }
  854. if (typeof(this.anticoagulantsConfit[thismode]) == 'undefined' || this.anticoagulantsConfit[thismode]==null) {
  855. return false;
  856. }
  857. this.anticoagulant = this.anticoagulantsConfit[thismode];
  858. },
  859. addPlanModeChange(){
  860. var thismode = parseInt(this.addPlan.mode);
  861. if (isNaN(thismode) || thismode <=0) {
  862. return false;
  863. }
  864. if (typeof(this.modeOptions[thismode]) == 'undefined' || this.modeOptions[thismode]==null) {
  865. return false;
  866. }
  867. // this.current_model = this.modeOptions[thismode];
  868. this.addPlan.mode_name = this.modeOptions[thismode].name;
  869. },
  870. setCurrentMode(id){
  871. if (typeof(this.modeOptions[id]) == 'undefined' || this.modeOptions[id]==null) {
  872. return false;
  873. }
  874. this.current_model = this.modeOptions[id];
  875. },
  876. getDoctorName(doctorid){
  877. var name = "";
  878. if (this.doctorOptions==null) {
  879. return name;
  880. }
  881. if (typeof(this.doctorOptions.length) == "undefined") {
  882. return name;
  883. }
  884. var leng = this.doctorOptions.length;
  885. if (leng==0) {
  886. return name;
  887. }
  888. for (let index = 0; index < leng; index++) {
  889. if (this.doctorOptions[index].id == doctorid) {
  890. name = this.doctorOptions[index].name;
  891. break;
  892. }
  893. }
  894. return name;
  895. }
  896. },
  897. created(){
  898. const id = this.$route.params && this.$route.params.id;
  899. this.patientID = parseInt(id);
  900. if (isNaN(this.patientID) || this.patientID <= 0) {
  901. this.$notify.error({
  902. title: "错误",
  903. message: "无效的id"
  904. });
  905. this.$router.back(-1);
  906. }
  907. this.modeOptions = this.$store.getters.treatment_mode;
  908. this.anticoagulantsSet = this.$store.getters.anticoagulants_set;
  909. this.replacementWays = this.$store.getters.replacement_ways;
  910. this.anticoagulantsConfit = this.$store.getters.anticoagulants_confit;
  911. this.blood_filters = this.$store.getters.blood_filters;
  912. this.perfusion_apparatus = this.$store.getters.perfusion_apparatus;
  913. this.hemodialysis_machines = this.$store.getters.hemodialysis_machines;
  914. this.fetchAllDoctorAndNurse();
  915. this.fetchPatientDialysisSolutions();
  916. }
  917. };
  918. </script>
  919. <style rel="stylesheet/scss" lang="scss" scoped>
  920. .Total {
  921. .sure {
  922. float: right;
  923. margin: 5px 10px 0 0;
  924. }
  925. .plan {
  926. font-size: 15px;
  927. color: #6caef7;
  928. background: #ecf5ff;
  929. height: 42px;
  930. line-height: 42px;
  931. border: 1px #ebeef5 solid;
  932. width: 100%;
  933. padding-left: 15px;
  934. span {
  935. margin: 0 20px 0 0;
  936. }
  937. }
  938. }
  939. .form-table {
  940. border: 1px #ebeef5 solid;
  941. padding-bottom: 20px;
  942. .el-col-6{
  943. width: 380px;
  944. }
  945. .el-row {
  946. margin: 0 !important;
  947. .el-form-item {
  948. margin-bottom: 12px;
  949. .el-form-item__content {
  950. .el-select {
  951. width: 100%;
  952. }
  953. }
  954. }
  955. }
  956. }
  957. </style>