血透系统pad前端

OrdersDialog_olddddd.vue 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997
  1. <template>
  2. <div>
  3. <div class="Dialog" v-show="index==0" style="width: 16.8rem;">
  4. <div class="DialogTit" @click="$emit('orderDialog')">
  5. <span class="iconfont">&#xe6e9;</span>
  6. <h1 class="name">临时医嘱</h1>
  7. <span class="success">&nbsp;</span>
  8. <!-- <span class="success" @click="$emit('orderDialog')">完成</span> -->
  9. </div>
  10. <div class="DialogContent choose" id="dialogTop">
  11. <div class="content clearfix">
  12. <div class="yzNav" style="width:80%;">
  13. <span @click="openNewAdvice">新增医嘱</span>
  14. <!-- <span>修改医嘱</span> -->
  15. <span @click="deleteAdvice">删除医嘱</span>
  16. <span @click="execAdvice">执行医嘱</span>
  17. <span @click="checkAdvice">医嘱核对</span>
  18. <span @click="openNewChild">添加子药</span>
  19. </div>
  20. <table class="table">
  21. <tr @click="selectRow(-1, null)">
  22. <th width="12%">开嘱医生</th>
  23. <th width="18%">开始时间</th>
  24. <th width="30%">医嘱内容</th>
  25. <th width="15%">执行时间</th>
  26. <th width="12%">执行护士</th>
  27. <th width="12%">核对人员</th>
  28. </tr>
  29. <tr
  30. v-for="(advice,index) in adviceList"
  31. :key="index"
  32. :value="advice.advice_name"
  33. @click="selectRow(index, advice)"
  34. :class="index==currentIndex?rowClass:''"
  35. >
  36. <td>
  37. <span v-if="advice.parent_id==0">{{getXuserName(advice.advice_doctor)}}</span>
  38. <span v-else></span>
  39. </td>
  40. <td>
  41. <span
  42. v-if="advice.parent_id==0"
  43. >{{ uParseTime(advice.start_time, "{y}-{m}-{d} {h}:{i}")}}</span>
  44. <span v-else></span>
  45. </td>
  46. <td>
  47. <span>{{advice.advice_name }}</span>
  48. <span
  49. v-if="advice.prescribing_number"
  50. >{{advice.prescribing_number}}{{advice.prescribing_number_unit}}</span>
  51. <!-- <span >{{advice.advice_desc}}</span> -->
  52. <span
  53. v-if="advice.single_dose"
  54. >单次用量 {{advice.single_dose}}{{advice.single_dose_unit}}</span>
  55. <span>{{advice.delivery_way}}</span>
  56. <span>{{advice.execution_frequency}}</span>
  57. </td>
  58. <td>
  59. <span
  60. v-if="advice.execution_time!=0"
  61. >{{ uParseTime(advice.execution_time, "{y}-{m}-{d} {h}:{i}")}}</span>
  62. </td>
  63. <td>
  64. <span v-if="advice.parent_id==0">{{getXuserName(advice.execution_staff)}}</span>
  65. </td>
  66. <td>{{getXuserName(advice.checker)}}</td>
  67. </tr>
  68. </table>
  69. </div>
  70. <!-- <div class="footer">
  71. 开嘱医生:{{doctor}} 医生
  72. </div>-->
  73. </div>
  74. </div>
  75. <div class="Dialog" v-show="index==2&&isShowDialog">
  76. <div class="DialogTit">
  77. <div class="back" @click="index=0">
  78. <span class="iconfont">&#xe720;</span>返回
  79. </div>
  80. <h1 class="name">编辑医嘱</h1>
  81. <span class="success" @click="submitNewAdvice">完成</span>
  82. </div>
  83. <div class="DialogContent choose advice-top" id="advice-top">
  84. <div class="content clearfix">
  85. <div>
  86. <div class="cell">
  87. <label>医嘱类型</label>
  88. <!-- <input type="text" class="inputBox" disabled value="临时"> -->
  89. <el-input ref="advice_type" value="临时" disabled></el-input>
  90. </div>
  91. <div class="cell">
  92. <label>医嘱时间</label>
  93. <el-input v-model="adviceForm.advice_date" readonly></el-input>
  94. <!-- <input type="text" class="inputBox" v-model="adviceForm.advice_date" readonly> -->
  95. </div>
  96. <div class="cell">
  97. <label>开始时间</label>
  98. <el-input v-model="adviceForm.start_time" readonly @focus="chooseTime"></el-input>
  99. <!-- <input type="text" class="inputBox" v-model="adviceForm.start_time" readonly @click="chooseTime"> -->
  100. </div>
  101. <div class="cell">
  102. <label>医嘱名称</label>
  103. <el-input v-model="adviceForm.advice_name"></el-input>
  104. <!-- <el-input v-model="adviceForm.advice_name" readonly @focus="showSubMenu('advice_name')" ></el-input> -->
  105. <!-- <el-select v-model="adviceForm.advice_name" @change="changeAdviceName" filterable placeholder="请选择(输入可搜索)" >
  106. <el-option v-for="item in drugOptions" :key="item.id" :label="item.name" :value="item.id">
  107. <span >{{ item.name }}</span>
  108. <span >{{ item.spec }}</span>
  109. </el-option>
  110. </el-select>-->
  111. </div>
  112. <div class="cell">
  113. <label>给药途径</label>
  114. <el-input
  115. v-model="adviceForm.delivery_way"
  116. readonly
  117. @focus="showSubMenu('delivery_way')"
  118. :disabled="adviceForm.parent_id==0?false:true"
  119. ></el-input>
  120. <!-- <el-select v-model="adviceForm.delivery_way" :disabled="adviceForm.parent_id==0?false:true" filterable placeholder="请选择(输入可搜索)" >
  121. <el-option v-for="item in deliveryWayOptions" :key="item.id" :label="item.name " :value="item.name">
  122. </el-option>
  123. </el-select>-->
  124. </div>
  125. <div class="cell">
  126. <label>执行频率</label>
  127. <!-- <el-select v-model="adviceForm.execution_frequency" :disabled="adviceForm.parent_id==0?false:true" filterable placeholder="请选择(输入可搜索)" >
  128. <el-option v-for="item in executionFrequencyOptions" :key="item.id" :label="item.name " :value="item.name">
  129. </el-option>
  130. </el-select>-->
  131. <el-input
  132. v-model="adviceForm.execution_frequency"
  133. readonly
  134. @focus="showSubMenu('execution_frequency')"
  135. :disabled="adviceForm.parent_id==0?false:true"
  136. ></el-input>
  137. </div>
  138. <div class="cell">
  139. <label>医嘱描述</label>
  140. <!-- <input type="text" class="inputBox" v-model="adviceForm.advice_desc"> -->
  141. <el-input v-model="adviceForm.advice_desc"></el-input>
  142. </div>
  143. <div class="cell">
  144. <label>单次用量</label>
  145. <input
  146. type="number"
  147. class="inputBox"
  148. style="width:60%"
  149. v-model="adviceForm.single_dose"
  150. >
  151. <input
  152. type="text"
  153. readonly
  154. class="inputBox"
  155. style="width:35%"
  156. v-model="adviceForm.single_dose_unit"
  157. @focus="showSubMenu('single_dose_unit')"
  158. >
  159. </div>
  160. <div class="cell">
  161. <label>开药数量</label>
  162. <input
  163. type="number"
  164. class="inputBox"
  165. style="width:60%"
  166. v-model="adviceForm.prescribing_number"
  167. >
  168. <input
  169. type="text"
  170. readonly
  171. class="inputBox"
  172. style="width:35%"
  173. v-model="adviceForm.prescribing_number_unit"
  174. @focus="showSubMenu('prescribing_number_unit')"
  175. >
  176. </div>
  177. <div class="cell width">
  178. <label>开嘱医生:</label>
  179. <span>{{doctor}}</span>
  180. </div>
  181. <!-- <div class="cell width center">
  182. <button @click="submitNewAdvice">提交</button>
  183. <button class="smt-danger" @click="index=0">返回</button>
  184. </div>-->
  185. </div>
  186. </div>
  187. <!-- <div class="footer">
  188. 开嘱医生:{{doctor}} 医生
  189. </div>-->
  190. </div>
  191. </div>
  192. <add-new-order-dialog
  193. v-show="index==1&&isShowDialog"
  194. @back-action="index = 0"
  195. :patient_id="patient.id"
  196. :delivery_way_options="deliveryWayOptions"
  197. :execution_frequency_options="executionFrequencyOptions"
  198. :single_dose_unit_options="unitsOption"
  199. :prescribing_number_unit_options="unitsOption"
  200. :drug_spec_unit_options="unitsOption"
  201. :advice_templates="adviceTemplates"
  202. @did-create-advices="didCreateAdvices"
  203. ></add-new-order-dialog>
  204. <mt-datetime-picker ref="picker" type="datetime" @confirm="handleConfirm" v-model="nowTime"></mt-datetime-picker>
  205. <mt-datetime-picker
  206. ref="exec_time"
  207. type="datetime"
  208. @confirm="handleExecTime"
  209. v-model="nowExecTime"
  210. ></mt-datetime-picker>
  211. <check-box-sub-menu
  212. :visibility="visibility"
  213. v-on:menu-cancle="menuCancle"
  214. v-on:menu-comfirm="menuComfirm"
  215. :propsForm="propForm"
  216. ></check-box-sub-menu>
  217. </div>
  218. </template>
  219. <script>
  220. import { Dialog, DatetimePicker, Toast } from "vant";
  221. import {
  222. getAdviceConfig,
  223. CreateDoctorAdvice,
  224. DeleteDoctorAdvice,
  225. ExecDoctorAdvice,
  226. CheckDoctorAdvice
  227. } from "@/api/advice";
  228. import { uParseTime } from "@/utils/tools";
  229. import CheckBoxSubMenu from "./subMenu/checkBoxSubMenu";
  230. import { getDataConfig } from "@/utils/data";
  231. import AddNewOrderDialog from "./new_order/AddNewOrders";
  232. export default {
  233. name: "OrdersDialog",
  234. data() {
  235. return {
  236. isShowDialog: true,
  237. visibility: false,
  238. propForm: {
  239. title: "",
  240. list: [],
  241. optionList: [],
  242. isMultiple: 2,
  243. result: [], //选中的值
  244. type: 1, //用来区分不同子菜单,方便对返回值进行赋值
  245. selectId: 0
  246. },
  247. showDeliveryWayBtn: false,
  248. showAdviceNameBtn: false,
  249. showExecutionFrequencyBtn: false,
  250. rowClass: "row-class-active",
  251. currentIndex: -1,
  252. currentRow: null,
  253. title: "临时医嘱",
  254. index: 0,
  255. doctor: "",
  256. adviceTemplates: [],
  257. adviceTemplateMaps: {},
  258. drugOptions: {},
  259. deliveryWayOptions: [],
  260. deliveryWayOjb: {},
  261. executionFrequencyOptions: [],
  262. executionFrequencyObj: {},
  263. unitsOption: [],
  264. unitsObj: [],
  265. record_date: "",
  266. nowTime: new Date(),
  267. nowExecTime: new Date(),
  268. patient: {
  269. id: 0
  270. },
  271. admin_users: [],
  272. adviceForm: {
  273. id: 0,
  274. advice_type: 2,
  275. advice_date: "",
  276. start_time: "",
  277. advice_name: "",
  278. advice_desc: "",
  279. single_dose: "",
  280. single_dose_unit: "",
  281. prescribing_number: "",
  282. prescribing_number_unit: "",
  283. delivery_way: "",
  284. execution_frequency: "",
  285. advice_doctor: "",
  286. remark: "",
  287. parent_id: 0
  288. },
  289. adviceList: [],
  290. parent_id: 0
  291. };
  292. },
  293. methods: {
  294. didCreateAdvices: function(advices) {
  295. for (let index = 0; index < advices.length; index++) {
  296. const advice = advices[index];
  297. this.adviceList.push(advice);
  298. this.$emit("new_create", advice);
  299. }
  300. this.index = 0;
  301. },
  302. showSubMenu: function(val) {
  303. switch (val) {
  304. case "advice_name":
  305. this.propForm.type = 1;
  306. this.isShowDialog = false;
  307. this.propForm.title = "选择";
  308. this.visibility = true;
  309. this.propForm.list = [];
  310. this.propForm.optionList = this.adviceTemplateMaps;
  311. this.propForm.isMultiple = 1;
  312. this.propForm.selectId = this.adviceForm.template_id;
  313. break;
  314. case "delivery_way":
  315. this.propForm.type = 2;
  316. this.isShowDialog = false;
  317. this.propForm.title = "选择";
  318. this.visibility = true;
  319. this.propForm.list = [];
  320. this.propForm.optionList = this.deliveryWayOptions;
  321. this.propForm.isMultiple = 1;
  322. this.propForm.selectId = this.adviceForm.jjtj_id;
  323. break;
  324. case "execution_frequency":
  325. this.propForm.type = 3;
  326. this.isShowDialog = false;
  327. this.propForm.title = "选择";
  328. this.visibility = true;
  329. this.propForm.list = [];
  330. this.propForm.optionList = this.executionFrequencyOptions;
  331. this.propForm.isMultiple = 1;
  332. this.propForm.selectId = this.adviceForm.zxpl_id;
  333. break;
  334. case "single_dose_unit":
  335. this.propForm.type = 4;
  336. this.isShowDialog = false;
  337. this.propForm.title = "选择";
  338. this.visibility = true;
  339. this.propForm.list = [];
  340. this.propForm.optionList = this.unitsOption;
  341. this.propForm.isMultiple = 1;
  342. this.propForm.selectId = this.adviceForm.sdu_id;
  343. break;
  344. case "prescribing_number_unit":
  345. this.propForm.type = 5;
  346. this.isShowDialog = false;
  347. this.propForm.title = "选择";
  348. this.visibility = true;
  349. this.propForm.list = [];
  350. this.propForm.optionList = this.unitsOption;
  351. this.propForm.isMultiple = 1;
  352. this.propForm.selectId = this.adviceForm.pnu_id;
  353. break;
  354. }
  355. },
  356. menuCancle: function() {
  357. this.visibility = false;
  358. this.isShowDialog = true;
  359. },
  360. menuComfirm: function(val) {
  361. this.visibility = false;
  362. this.isShowDialog = true;
  363. switch (val.type) {
  364. case 1:
  365. if (val.selectId in this.adviceTemplateMaps) {
  366. this.selectAdviceName(val.selectId);
  367. this.adviceForm.template_id = val.selectId;
  368. }
  369. break;
  370. case 2:
  371. if (val.selectId in this.deliveryWayOjb) {
  372. this.adviceForm.jjtj_id = val.selectId;
  373. this.adviceForm.delivery_way = this.deliveryWayOjb[
  374. val.selectId
  375. ].name;
  376. }
  377. break;
  378. case 3:
  379. if (val.selectId in this.executionFrequencyObj) {
  380. this.adviceForm.zxpl_id = val.selectId;
  381. this.adviceForm.execution_frequency = this.executionFrequencyObj[
  382. val.selectId
  383. ].name;
  384. }
  385. break;
  386. case 4:
  387. if (val.selectId in this.unitsObj) {
  388. this.adviceForm.sdu_id = val.selectId;
  389. this.adviceForm.single_dose_unit = this.unitsObj[val.selectId].name;
  390. }
  391. break;
  392. case 5:
  393. if (val.selectId in this.unitsObj) {
  394. this.adviceForm.pnu_id = val.selectId;
  395. this.adviceForm.prescribing_number_unit = this.unitsObj[
  396. val.selectId
  397. ].name;
  398. }
  399. break;
  400. }
  401. },
  402. selectRow(index, row) {
  403. this.currentIndex = index;
  404. this.currentRow = row;
  405. },
  406. uParseTime(time, format) {
  407. return uParseTime(time, format);
  408. },
  409. getXuserName(id) {
  410. if (id <= 0) {
  411. return "";
  412. }
  413. var name = "";
  414. if (
  415. this.admin_users == null ||
  416. typeof this.admin_users.length == "undefined"
  417. ) {
  418. return name;
  419. }
  420. var leng = this.admin_users.length;
  421. if (leng == 0) {
  422. return name;
  423. }
  424. for (let index = 0; index < leng; index++) {
  425. if (this.admin_users[index].id == id) {
  426. name = this.admin_users[index].name;
  427. break;
  428. }
  429. }
  430. return name;
  431. },
  432. submitNewAdvice() {
  433. if (this.adviceForm.advice_name.length == 0) {
  434. Toast("请填写医嘱名称");
  435. return;
  436. }
  437. if (this.adviceForm.start_time.length == 0) {
  438. Toast("请选择开始时间");
  439. return;
  440. }
  441. Toast.loading({ forbidClick: true, duration: 0 });
  442. CreateDoctorAdvice(this.patient.id, this.adviceForm).then(response => {
  443. if (response.data.state == 0) {
  444. Toast.fail(response.data.msg);
  445. return false;
  446. } else {
  447. Toast.success("添加成功");
  448. if (this.adviceForm.parent_id > 0) {
  449. var spliceIndex = -1;
  450. for (let index = this.adviceList.length - 1; ; index--) {
  451. if (
  452. this.adviceList[index].parent_id === this.adviceForm.parent_id
  453. ) {
  454. spliceIndex = index;
  455. break;
  456. } else if (
  457. this.adviceList[index].id === this.adviceForm.parent_id
  458. ) {
  459. spliceIndex = index;
  460. break;
  461. }
  462. }
  463. if (spliceIndex > -1) {
  464. spliceIndex += 1;
  465. if (spliceIndex === this.adviceList.length) {
  466. this.adviceList.push(response.data.data.advice);
  467. } else {
  468. var swapData = this.adviceList.splice(spliceIndex);
  469. this.adviceList.push(response.data.data.advice);
  470. for (var index in swapData) {
  471. this.adviceList.push(swapData[index]); // = this.doctor_advices.concat(swapData);
  472. }
  473. // this.adviceList = this.adviceList.concat(swapData);
  474. }
  475. }
  476. } else {
  477. this.adviceList.unshift(response.data.data.advice);
  478. }
  479. this.currentIndex = -1;
  480. this.currentRow = null;
  481. this.index = 0;
  482. this.$emit("new_create", response.data.data.advice);
  483. return false;
  484. }
  485. });
  486. },
  487. chooseTime() {
  488. this.$refs.picker.open();
  489. },
  490. changeAdviceName(change) {
  491. this.adviceForm.advice_name = this.drugOptions[change].name;
  492. this.adviceForm.advice_desc = this.drugOptions[change].spec;
  493. this.adviceForm.single_dose_unit = this.drugOptions[change].spec_unit;
  494. this.adviceForm.prescribing_number_unit = this.drugOptions[
  495. change
  496. ].form_unit;
  497. },
  498. selectAdviceName(key) {
  499. if (key in this.adviceTemplateMaps) {
  500. this.adviceForm.advice_name = this.adviceTemplateMaps[key].advice_name;
  501. this.adviceForm.advice_desc = this.adviceTemplateMaps[key].advice_desc;
  502. this.adviceForm.single_dose_unit = this.adviceTemplateMaps[
  503. key
  504. ].single_dose_unit;
  505. this.adviceForm.prescribing_number_unit = this.adviceTemplateMaps[
  506. key
  507. ].prescribing_number_unit;
  508. this.adviceForm.single_dose =
  509. this.adviceTemplateMaps[key].single_dose + "";
  510. this.adviceForm.prescribing_number =
  511. this.adviceTemplateMaps[key].prescribing_number + "";
  512. this.adviceForm.delivery_way = this.adviceTemplateMaps[
  513. key
  514. ].delivery_way;
  515. this.adviceForm.execution_frequency = this.adviceTemplateMaps[
  516. key
  517. ].execution_frequency;
  518. }
  519. },
  520. getAdviceConfig() {
  521. getAdviceConfig().then(response => {
  522. if (response.data.state == 1) {
  523. this.deliveryWayOptions =
  524. response.data.data.drugways === null
  525. ? []
  526. : response.data.data.drugways;
  527. this.executionFrequencyOptions =
  528. response.data.data.efs === null ? [] : response.data.data.efs;
  529. var dl = this.deliveryWayOptions.length;
  530. for (let index = 0; index < dl; index++) {
  531. this.deliveryWayOjb[
  532. this.deliveryWayOptions[index].id
  533. ] = this.deliveryWayOptions[index];
  534. }
  535. var el = this.executionFrequencyOptions.length;
  536. for (let index = 0; index < el; index++) {
  537. this.executionFrequencyObj[
  538. this.executionFrequencyOptions[index].id
  539. ] = this.executionFrequencyOptions[index];
  540. }
  541. this.adviceTemplates =
  542. response.data.data.advice_templates === null
  543. ? []
  544. : response.data.data.advice_templates;
  545. var templateLen = this.adviceTemplates.length;
  546. for (let index = 0; index < templateLen; index++) {
  547. var item = this.adviceTemplates[index];
  548. // item['name'] = item.advice_name
  549. this.$set(
  550. this.adviceTemplateMaps,
  551. this.adviceTemplates[index].id,
  552. item
  553. );
  554. }
  555. }
  556. });
  557. },
  558. handleConfirm(time) {
  559. this.adviceForm.start_time = this.handleTime(time);
  560. },
  561. handleExecTime(time) {
  562. var exceTime = this.handleTime(time);
  563. var exceParams = {
  564. id: this.currentRow.id,
  565. patient: this.patient.id,
  566. parent_id: this.currentRow.parent_id,
  567. execution_time: exceTime
  568. };
  569. Toast.loading({ forbidClick: true, duration: 0 });
  570. ExecDoctorAdvice(exceParams).then(response => {
  571. if (response.data.state == 0) {
  572. Toast.fail("执行失败!");
  573. return false;
  574. } else {
  575. Toast.success("执行成功!");
  576. var exid = response.data.data.advice.id;
  577. var pxid = response.data.data.advice.parent_id;
  578. if (pxid > 0) {
  579. exid = pxid;
  580. }
  581. this.currentRow.execution_state = 1;
  582. this.currentRow.execution_staff =
  583. response.data.data.advice.execution_staff;
  584. this.currentRow.execution_time =
  585. response.data.data.advice.execution_time;
  586. // if (exceParams.parent_id > 0) {
  587. // exid = exceParams.parent_id;
  588. // }
  589. var alen = this.adviceList.length;
  590. for (let index = 0; index < alen; index++) {
  591. if (
  592. this.adviceList[index].id == exid ||
  593. this.adviceList[index].parent_id == exid
  594. ) {
  595. this.adviceList[index].execution_state = 1;
  596. this.adviceList[index].execution_staff =
  597. response.data.data.advice.execution_staff;
  598. this.adviceList[index].execution_time = Math.round(
  599. time.getTime() / 1000
  600. );
  601. // this.adviceList[index].checker =
  602. // response.data.data.advice.checker;
  603. this.$emit("execution", this.adviceList[index]);
  604. }
  605. }
  606. return false;
  607. }
  608. });
  609. },
  610. handleTime(time) {
  611. var year = time.getFullYear();
  612. var month = time.getMonth() + 1;
  613. var day = time.getDate();
  614. var hour = time.getHours();
  615. var minute = time.getMinutes();
  616. if (month < 10) {
  617. month = "0" + month;
  618. }
  619. if (day < 10) {
  620. day = "0" + day;
  621. }
  622. if (hour < 10) {
  623. hour = "0" + hour;
  624. }
  625. if (minute < 10) {
  626. minute = "0" + minute;
  627. }
  628. return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":00";
  629. },
  630. deleteAdvice() {
  631. if (this.currentIndex < 0 || this.currentRow == null) {
  632. Toast.fail("请先选择要删除的医嘱!");
  633. return false;
  634. }
  635. Dialog.confirm({
  636. title: "医嘱删除",
  637. message: "确认删除些条医嘱?"
  638. })
  639. .then(() => {
  640. Toast.loading({ forbidClick: true, duration: 0 });
  641. DeleteDoctorAdvice(this.currentRow.id).then(response => {
  642. if (response.data.state == 0) {
  643. Toast.fail(response.data.msg);
  644. return false;
  645. } else {
  646. Toast.success("医嘱已经删除");
  647. this.deleteResetData(this.currentIndex, this.currentRow);
  648. this.$emit("delete", this.adviceList[this.currentIndex]);
  649. this.currentIndex = -1;
  650. this.currentRow = null;
  651. }
  652. });
  653. })
  654. .catch(() => {
  655. // on cancel
  656. });
  657. },
  658. deleteResetData(index, row) {
  659. if (row.parent_id > 0) {
  660. this.adviceList.splice(index, 1);
  661. } else {
  662. var spliceIndex = -1;
  663. var splitNums = 0;
  664. for (var kndex in this.adviceList) {
  665. if (this.adviceList[kndex].id == row.id) {
  666. spliceIndex = kndex;
  667. splitNums++;
  668. } else if (this.adviceList[kndex].parent_id == row.id) {
  669. splitNums++;
  670. }
  671. }
  672. this.adviceList.splice(spliceIndex, splitNums);
  673. }
  674. },
  675. checkAdvice() {
  676. if (this.currentIndex < 0 || this.currentRow == null) {
  677. Toast.fail("请先选择要核对的医嘱!");
  678. return false;
  679. }
  680. if (this.currentRow.check_state == 1) {
  681. Toast.fail("所选医嘱已核对");
  682. return false;
  683. }
  684. if (
  685. this.currentRow.execution_staff > 0 &&
  686. this.currentRow.execution_staff == this.$store.getters.user.user.id
  687. ) {
  688. Toast.fail("核对与执行不能是同一人");
  689. return false;
  690. }
  691. Dialog.confirm({
  692. title: "医嘱核对",
  693. message: "确认提交核对?"
  694. })
  695. .then(() => {
  696. Toast.loading({ forbidClick: true, duration: 0 });
  697. var params = {
  698. id: this.currentRow.id,
  699. patient: this.patient.id
  700. };
  701. CheckDoctorAdvice(params).then(response => {
  702. if (response.data.state == 0) {
  703. Toast.fail(response.data.msg);
  704. return false;
  705. } else {
  706. Toast.success("核对成功!");
  707. var exid = response.data.data.advice.id;
  708. var pxid = response.data.data.advice.parent_id;
  709. if (pxid > 0) {
  710. exid = pxid;
  711. }
  712. var alen = this.adviceList.length;
  713. this.currentRow.check_state = 1;
  714. this.currentRow.checker = response.data.data.advice.checker;
  715. this.currentRow.check_time = response.data.data.check_time;
  716. for (let index = 0; index < alen; index++) {
  717. if (
  718. this.adviceList[index].id == exid ||
  719. this.adviceList[index].parent_id == exid
  720. ) {
  721. this.adviceList[index].check_state = 1;
  722. this.adviceList[index].check_time =
  723. response.data.data.check_time;
  724. this.adviceList[index].checker =
  725. response.data.data.advice.checker;
  726. this.$emit("execution", this.adviceList[index]);
  727. }
  728. }
  729. return false;
  730. }
  731. });
  732. })
  733. .catch(() => {
  734. // on cancel
  735. });
  736. },
  737. execAdvice() {
  738. if (this.currentIndex < 0 || this.currentRow == null) {
  739. Toast.fail("请先选择要执行的医嘱!");
  740. return false;
  741. }
  742. if (
  743. this.currentRow.stop_state == 1 ||
  744. this.currentRow.execution_state == 1
  745. ) {
  746. Toast.fail("所选医嘱已停止或执行");
  747. return false;
  748. }
  749. if (
  750. this.currentRow.checker > 0 &&
  751. this.currentRow.checker == this.$store.getters.user.user.id
  752. ) {
  753. Toast.fail("核对与执行不能是同一人");
  754. return false;
  755. }
  756. this.$refs.exec_time.open();
  757. },
  758. openNewChild() {
  759. if (this.currentIndex < 0 || this.currentRow == null) {
  760. Toast.fail("请先选择要添加子药的医嘱!");
  761. return false;
  762. }
  763. if (
  764. this.currentRow.stop_state == 1 ||
  765. this.currentRow.execution_state == 1
  766. ) {
  767. Toast.fail("所选医嘱已停止或执行");
  768. return false;
  769. }
  770. this.index = 2; //1;
  771. this.adviceForm = {
  772. id: 0,
  773. advice_type: 2,
  774. advice_date: this.record_date,
  775. start_time: uParseTime(
  776. this.currentRow.start_time,
  777. "{y}-{m}-{d} {h}:{i}"
  778. ),
  779. advice_name: "",
  780. advice_desc: "",
  781. single_dose: "",
  782. single_dose_unit: "",
  783. prescribing_number: "",
  784. prescribing_number_unit: "",
  785. delivery_way: this.currentRow.delivery_way,
  786. execution_frequency: this.currentRow.execution_frequency,
  787. advice_doctor: "",
  788. remark: "",
  789. parent_id: this.currentRow.id
  790. };
  791. },
  792. openNewAdvice() {
  793. this.index = 1;
  794. this.currentIndex = -1;
  795. this.currentRow = null;
  796. this.adviceForm = {
  797. id: 0,
  798. advice_type: 2,
  799. advice_date: this.record_date,
  800. start_time: "",
  801. advice_name: "",
  802. advice_desc: "",
  803. single_dose: "",
  804. single_dose_unit: "",
  805. prescribing_number: "",
  806. prescribing_number_unit: "",
  807. delivery_way: "",
  808. execution_frequency: "",
  809. advice_doctor: "",
  810. remark: "",
  811. parent_id: 0
  812. };
  813. // document.getElementById("advice-top").scrollIntoView();
  814. // document.querySelector("#advice-top").scrollTop = 0;
  815. this.$el.querySelector("#advice-top").scrollIntoView();
  816. },
  817. open: function() {
  818. this.index = 0;
  819. this.visibility = false;
  820. this.menuCancle();
  821. this.$refs.picker.close();
  822. var dialogTop = document.querySelector("#dialogTop");
  823. if (dialogTop != null) {
  824. this.$nextTick(() => {
  825. dialogTop.scrollTop = 0;
  826. });
  827. }
  828. }
  829. },
  830. props: {
  831. patient_prop: {
  832. type: Object
  833. },
  834. advice_list_prop: {
  835. type: Array
  836. },
  837. admin_users_prop: {
  838. type: Array
  839. }
  840. },
  841. created() {
  842. var date = this.$route.query && this.$route.query.date;
  843. date *= 1000;
  844. var newDate = new Date(date);
  845. var y = newDate.getFullYear();
  846. var m = newDate.getMonth() + 1;
  847. var d = newDate.getDate();
  848. if (isNaN(y) || isNaN(m) || isNaN(d)) {
  849. newDate = new Date();
  850. y = newDate.getFullYear();
  851. m = newDate.getMonth() + 1;
  852. d = newDate.getDate();
  853. }
  854. this.record_date =
  855. y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);
  856. this.patient = this.patient_prop;
  857. this.adviceList = this.advice_list_prop;
  858. this.admin_users = this.admin_users_prop;
  859. this.doctor = this.$store.getters.user.user.user_name;
  860. this.adviceForm.advice_date = this.record_date;
  861. this.getAdviceConfig();
  862. this.unitsOption = getDataConfig("hemodialysis", "units");
  863. for (var index in this.unitsOption) {
  864. this.unitsObj[this.unitsOption[index].id] = this.unitsOption[index];
  865. }
  866. },
  867. components: {
  868. CheckBoxSubMenu,
  869. AddNewOrderDialog
  870. }
  871. };
  872. </script>
  873. <style style="stylesheet/scss" lang="scss" scoped>
  874. .DialogContent {
  875. // padding-bottom: 2.5rem !important;
  876. }
  877. .table {
  878. width: 100%;
  879. tr {
  880. th {
  881. background: $main-color;
  882. color: #fff;
  883. height: 0.88rem;
  884. line-height: 0.88rem;
  885. }
  886. td {
  887. line-height: 0.4rem;
  888. }
  889. }
  890. }
  891. .content {
  892. .cell {
  893. float: left;
  894. width: 3.42rem;
  895. // width: 100%;
  896. margin: 0.35rem 0.3rem 0 0.4rem;
  897. label {
  898. display: block;
  899. height: 0.55rem;
  900. line-height: 0.55rem;
  901. color: $pgh-color;
  902. }
  903. select {
  904. width: 100%;
  905. padding: 0.2rem 0;
  906. border: 1px $border-color solid;
  907. border-radius: 2px;
  908. padding-left: 5px;
  909. }
  910. .inputBox {
  911. border: 1px $border-color solid;
  912. border-radius: 2px;
  913. padding: 0.18rem 0;
  914. padding-left: 5px;
  915. }
  916. .textarea {
  917. width: 100%;
  918. height: 1.22rem;
  919. border: 1px $border-color solid;
  920. border-radius: 2px;
  921. padding-left: 5px;
  922. }
  923. }
  924. .width {
  925. width: 90%;
  926. @include box-sizing;
  927. margin-top: 1rem;
  928. label {
  929. display: inline-block;
  930. }
  931. button {
  932. background: $main-color;
  933. color: #fff;
  934. border-radius: 6px;
  935. width: 3rem;
  936. height: 0.9rem;
  937. line-height: 0.9rem;
  938. text-align: center;
  939. margin: 0 0.1rem 0.6rem 0.1rem;
  940. border: 1px $main-color solid;
  941. &.smt-danger {
  942. background: #fff;
  943. color: $main-color;
  944. }
  945. }
  946. }
  947. .center {
  948. text-align: center;
  949. }
  950. .row-class-active > td {
  951. background: #badcff;
  952. }
  953. }
  954. </style>