DoctorAdviceDialog.vue 58KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911
  1. <template>
  2. <div class="doctor-advice-box">
  3. <el-dialog
  4. :title="title"
  5. :visible.sync="isVisibility"
  6. width="1010px"
  7. @close="resetDialog"
  8. :modal-append-to-body="false"
  9. >
  10. <div class="txsj" v-show="showAdvicePanel">
  11. <el-button
  12. round
  13. @click="openGroupFrom"
  14. :loading="deleLoading"
  15. :disabled="!is_has_create"
  16. >
  17. 新增医嘱
  18. </el-button>
  19. <el-button
  20. v-if="currentRow != null"
  21. round
  22. :disabled="!is_has_exce"
  23. @click="execAdvice"
  24. :loading="deleLoading"
  25. >执行医嘱
  26. </el-button>
  27. <el-button
  28. v-else
  29. disabled
  30. round
  31. @click="execAdvice"
  32. :loading="deleLoading"
  33. >执行医嘱</el-button
  34. >
  35. <el-button
  36. v-if="currentRow != null"
  37. round
  38. :disabled="!is_has_check"
  39. @click="checkAdvice"
  40. :loading="deleLoading"
  41. >医嘱核对
  42. </el-button>
  43. <el-button
  44. v-else
  45. disabled
  46. round
  47. @click="checkAdvice"
  48. :loading="deleLoading"
  49. >医嘱核对</el-button
  50. >
  51. <el-button
  52. v-if="groupSelectRow != null"
  53. :disabled="!is_has_modify && !is_has_modify_other"
  54. round
  55. @click="openEditGroupAdvice"
  56. :loading="deleLoading"
  57. >修改医嘱
  58. </el-button>
  59. <el-button
  60. v-else
  61. disabled
  62. round
  63. @click="openEditGroupAdvice"
  64. :loading="deleLoading"
  65. >修改医嘱</el-button
  66. >
  67. <el-button
  68. v-if="groupSelectRow != null"
  69. :disabled="!is_has_del && !is_has_del_other"
  70. round
  71. @click="openDeleteGroupAdvice"
  72. :loading="deleLoading"
  73. >删除医嘱
  74. </el-button>
  75. <el-button
  76. v-else
  77. disabled
  78. round
  79. @click="openDeleteGroupAdvice"
  80. :loading="deleLoading"
  81. >删除医嘱</el-button
  82. >
  83. <!--<el-button round @click="openNewChild" :loading="deleLoading">新增子药</el-button>-->
  84. </div>
  85. <!-- 医嘱列表 -->
  86. <!--&lt;!&ndash;:header-cell-style="{ backgroundColor: 'rgb(64, 158, 255)', color: 'white'}"&ndash;&gt;@current-change="selectRow"-->
  87. <el-table
  88. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  89. :data="doctor_advices"
  90. border
  91. style="width: 100%"
  92. v-show="showAdvicePanel"
  93. ref="advices_list"
  94. :row-class-name="tableRowClassName"
  95. :span-method="objectSpanMethod"
  96. @row-click="cellMouseEnter"
  97. :cell-class-name="adviceNameShow"
  98. :modal-append-to-body="false"
  99. highlight-current-row
  100. @current-change="handleCurrentChange"
  101. >
  102. <el-table-column
  103. prop="date"
  104. label="开嘱医生"
  105. align="center"
  106. min-width="26px"
  107. >
  108. <template slot-scope="scope">
  109. <span>{{ getXuserName(scope.row.advice_doctor) }}</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column
  113. prop="start_time"
  114. label="开始时间"
  115. align="center"
  116. min-width="35px"
  117. >
  118. <template slot-scope="scope">
  119. <span>{{
  120. scope.row.start_time | parseTime("{y}-{m}-{d} {h}:{i}")
  121. }}</span>
  122. </template>
  123. </el-table-column>
  124. <el-table-column
  125. prop="advice_name"
  126. min-width="50px"
  127. label="医嘱内容"
  128. align="center"
  129. >
  130. <template slot-scope="scope">
  131. <el-dropdown trigger="click" v-if="scope.row.parent_id == 0">
  132. <span class="el-dropdown-link"
  133. >{{ getAdviceContent(scope.row, 1)
  134. }}<i class="el-icon-arrow-down el-icon--right"></i
  135. ></span>
  136. <el-dropdown-menu slot="dropdown">
  137. <el-dropdown-item
  138. @click.native="openEdit(scope.$index, scope.row)"
  139. >修改医嘱</el-dropdown-item
  140. >
  141. <el-dropdown-item
  142. @click.native="openDelete(scope.$index, scope.row)"
  143. >删除医嘱</el-dropdown-item
  144. >
  145. <el-dropdown-item
  146. @click.native="openNewChildTwo(scope.$index, scope.row)"
  147. >新增子药</el-dropdown-item
  148. >
  149. </el-dropdown-menu>
  150. </el-dropdown>
  151. <el-dropdown trigger="click" v-if="scope.row.parent_id > 0">
  152. <span class="el-dropdown-link"
  153. >&emsp;{{ getAdviceContent(scope.row, 2)
  154. }}<i class="el-icon-arrow-down el-icon--right"></i
  155. ></span>
  156. <el-dropdown-menu slot="dropdown">
  157. <el-dropdown-item
  158. @click.native="openEdit(scope.$index, scope.row)"
  159. >修改子药
  160. </el-dropdown-item>
  161. <el-dropdown-item
  162. @click.native="openDelete(scope.$index, scope.row)"
  163. >删除子药
  164. </el-dropdown-item>
  165. </el-dropdown-menu>
  166. </el-dropdown>
  167. </template>
  168. </el-table-column>
  169. <el-table-column
  170. prop="execution_time"
  171. align="center"
  172. min-width="30px"
  173. label="执行时间"
  174. sortable
  175. >
  176. <template slot-scope="scope">
  177. <span v-if="scope.row.execution_time != 0">{{
  178. scope.row.start_time | parseTime("{m}-{d} {h}:{i}")
  179. }}</span>
  180. <span v-else></span>
  181. </template>
  182. </el-table-column>
  183. <el-table-column
  184. prop="execution_staff"
  185. align="center"
  186. min-width="30px"
  187. label="执行护士"
  188. >
  189. <template slot-scope="scope">
  190. <span v-if="scope.row.parent_id == 0">{{
  191. getXuserName(scope.row.execution_staff)
  192. }}</span>
  193. <span v-else></span>
  194. </template>
  195. </el-table-column>
  196. <el-table-column
  197. v-if="template_id != 6"
  198. prop="checker"
  199. min-width="30px"
  200. align="center"
  201. label="核对人员"
  202. >
  203. <template slot-scope="scope">
  204. <span v-if="scope.row.parent_id == 0">{{
  205. getXuserName(scope.row.checker)
  206. }}</span>
  207. <span v-else></span>
  208. </template>
  209. </el-table-column>
  210. </el-table>
  211. <!-- 医嘱列表 end -->
  212. <!-- 医嘱表单 -->
  213. <el-form
  214. ref="form"
  215. :model="form"
  216. label-width="100px"
  217. v-show="showAdviceForm"
  218. >
  219. <el-row :gutter="20">
  220. <!--<el-col :span="8">-->
  221. <!--<el-form-item label="医嘱类型:">-->
  222. <!--<el-input value="临时" disabled></el-input>-->
  223. <!--</el-form-item>-->
  224. <!--</el-col>-->
  225. <!--<el-col :span="8">-->
  226. <!--<el-form-item label="医嘱时间:">-->
  227. <!--<el-input v-model="form.advice_date" readonly></el-input>-->
  228. <!--&lt;!&ndash; <el-date-picker type="date" placeholder="选择日期" v-model="form.date1" style="width: 100%;"></el-date-picker> &ndash;&gt;-->
  229. <!--</el-form-item>-->
  230. <!--</el-col>-->
  231. <el-col :span="8">
  232. <el-form-item label="开始时间:">
  233. <el-date-picker
  234. format="yyyy-MM-dd HH:mm"
  235. value-format="yyyy-MM-dd HH:mm"
  236. type="datetime"
  237. :disabled="form.parent_id == 0 ? false : true"
  238. placeholder="选择日期"
  239. v-model="form.start_time"
  240. style="width: 100%;"
  241. ></el-date-picker>
  242. </el-form-item>
  243. </el-col>
  244. <el-col :span="8">
  245. <el-form-item label="医嘱名称:">
  246. <el-input v-model="form.advice_name"></el-input>
  247. </el-form-item>
  248. </el-col>
  249. <el-col :span="8">
  250. <el-form-item label="药品规格:">
  251. <el-input
  252. v-model="form.advice_desc"
  253. style="width: 40%;"
  254. ></el-input>
  255. <el-select
  256. v-model="form.drug_spec_unit"
  257. style="width: 56%;"
  258. filterable
  259. placeholder="选择"
  260. >
  261. <el-option
  262. v-for="item in unitsOption"
  263. :key="item.id"
  264. :label="item.name"
  265. :value="item.name"
  266. >
  267. </el-option>
  268. </el-select>
  269. </el-form-item>
  270. </el-col>
  271. </el-row>
  272. <el-row :gutter="20">
  273. <el-col :span="8">
  274. <el-form-item label="开药数量:">
  275. <el-input
  276. v-model="form.prescribing_number"
  277. style="width: 40%;"
  278. ></el-input>
  279. <el-select
  280. v-model="form.prescribing_number_unit"
  281. style="width: 56%;"
  282. filterable
  283. placeholder="选择"
  284. >
  285. <el-option
  286. v-for="item in unitsOption"
  287. :key="item.id"
  288. :label="item.name"
  289. :value="item.name"
  290. >
  291. </el-option>
  292. </el-select>
  293. <!-- <el-input v-model="form.prescribing_number_unit" style="width: 40%;"></el-input> -->
  294. </el-form-item>
  295. </el-col>
  296. <el-col :span="8">
  297. <el-form-item label="单次用量:">
  298. <el-input
  299. v-model="form.single_dose"
  300. style="width: 40%;"
  301. ></el-input>
  302. <el-select
  303. v-model="form.single_dose_unit"
  304. style="width: 56%;"
  305. filterable
  306. placeholder="选择"
  307. >
  308. <el-option
  309. v-for="item in unitsOption"
  310. :key="item.id"
  311. :label="item.name"
  312. :value="item.name"
  313. >
  314. </el-option>
  315. </el-select>
  316. <!-- <el-input v-model="form.single_dose_unit" style="width: 40%;"></el-input> -->
  317. </el-form-item>
  318. </el-col>
  319. <el-col :span="8">
  320. <el-form-item label="给药途径:">
  321. <el-select
  322. v-model="form.delivery_way"
  323. :disabled="form.parent_id == 0 ? false : true"
  324. filterable
  325. placeholder="请选择(输入可搜索)"
  326. >
  327. <el-option
  328. v-for="item in deliveryWayOptions"
  329. :key="item.id"
  330. :label="item.name"
  331. :value="item.name"
  332. >
  333. </el-option>
  334. </el-select>
  335. </el-form-item>
  336. </el-col>
  337. </el-row>
  338. <el-row :gutter="20">
  339. <el-col :span="8">
  340. <el-form-item label="执行频率:">
  341. <el-select
  342. v-model="form.execution_frequency"
  343. :disabled="form.parent_id == 0 ? false : true"
  344. filterable
  345. placeholder="请选择(输入可搜索)"
  346. >
  347. <el-option
  348. v-for="item in executionFrequencyOptions"
  349. :key="item.id"
  350. :label="item.name"
  351. :value="item.name"
  352. >
  353. </el-option>
  354. </el-select>
  355. </el-form-item>
  356. </el-col>
  357. </el-row>
  358. </el-form>
  359. <div slot="footer" class="dialog-footer" v-show="showAdviceForm">
  360. <el-button @click="hideForm">取 消</el-button>
  361. <el-button
  362. type="primary"
  363. v-if="form.id == 0"
  364. @click="submitAdvice"
  365. :loading="loading"
  366. >保 存</el-button
  367. >
  368. <el-button
  369. type="primary"
  370. v-else
  371. @click="submitEditAdvice"
  372. :loading="loading"
  373. >保 存</el-button
  374. >
  375. </div>
  376. <!-- 医嘱表单 end -->
  377. </el-dialog>
  378. <el-dialog
  379. title="选择执行时间"
  380. :visible.sync="execTimeDialogVisible"
  381. width="400px"
  382. @close="closeTimePanel"
  383. :show-close="isClose"
  384. :close-on-click-modal="isClose"
  385. :close-on-press-escape="isClose"
  386. :modal-append-to-body="false"
  387. >
  388. <el-date-picker
  389. v-model="execTime"
  390. format="yyyy-MM-dd HH:mm:00"
  391. value-format="yyyy-MM-dd HH:mm:00"
  392. type="datetime"
  393. placeholder="选择执行时间"
  394. style="width:100%"
  395. >
  396. </el-date-picker>
  397. <span slot="footer" class="dialog-footer">
  398. <el-button @click="closeTimePanel" :loading="exceLoading"
  399. >取 消</el-button
  400. >
  401. <el-button type="primary" @click="submitExce" :loading="exceLoading"
  402. >保 存</el-button
  403. >
  404. </span>
  405. </el-dialog>
  406. <add-group-advice
  407. :adviceTemplates="adviceTemplates"
  408. :executionFrequencyOptions="executionFrequencyOptions"
  409. :unitsOption="unitsOption"
  410. :deliveryWayOptions="deliveryWayOptions"
  411. :adviceTemplateMaps="adviceTemplateMaps"
  412. :patientID="patient.id"
  413. :adviceTableData="doctor_advices"
  414. :recordDate="record_date"
  415. ref="addGroupForm"
  416. ></add-group-advice>
  417. <edit-group-advice
  418. :adviceTemplates="adviceTemplates"
  419. :executionFrequencyOptions="executionFrequencyOptions"
  420. :unitsOption="unitsOption"
  421. :deliveryWayOptions="deliveryWayOptions"
  422. :adviceTemplateMaps="adviceTemplateMaps"
  423. :patientID="patient.id"
  424. :adviceTableData="doctor_advices"
  425. :recordDate="record_date"
  426. ref="editGroupForm"
  427. v-on:add-new-order="addNewOrder"
  428. :admin_users="admin_users"
  429. ></edit-group-advice>
  430. </div>
  431. </template>
  432. <script>
  433. import AddGroupAdvice from "./adviceDialog/AddGroupAdvice";
  434. import EditGroupAdvice from "./adviceDialog/EditGroupAdvice";
  435. import { uParseTime } from "@/utils/tools";
  436. import {
  437. CheckDoctorAdvice,
  438. CreateDoctorAdvice,
  439. DeleteDoctorAdvice,
  440. DeleteGroupAdvice,
  441. EditDoctorAdvice,
  442. ExecDoctorAdvice,
  443. getAdviceConfig
  444. } from "@/api/advice";
  445. import { getDataConfig } from "@/utils/data";
  446. import request from "@/utils/request";
  447. export default {
  448. name: "DoctorAdviceDialog",
  449. props: {
  450. dialysis_order: {
  451. // 透析记录
  452. type: Object,
  453. default: () => {
  454. return { id: 0 };
  455. }
  456. },
  457. patient: {
  458. // 患者信息
  459. type: Object,
  460. default: () => {
  461. return { id: 0 };
  462. }
  463. },
  464. doctor_advices: {
  465. type: Array
  466. },
  467. admin_users: {
  468. // 系统用户列表
  469. type: Array,
  470. default: () => {
  471. return [];
  472. }
  473. }
  474. },
  475. data() {
  476. return {
  477. is_has_create: true,
  478. is_has_exce: true,
  479. is_has_check: true,
  480. is_has_modify_exce: true,
  481. is_has_modify: true,
  482. is_has_modify_other: true,
  483. is_has_del: true,
  484. is_has_del_other: true,
  485. tempArr: [],
  486. execTimeDialogVisible: false,
  487. currentBoxClass: "current-box-class",
  488. isClose: false,
  489. isShow: false,
  490. loading: false,
  491. sameRowArr: [],
  492. hoverOrderArr: [],
  493. isVisibility: false,
  494. record_date: "",
  495. template_id: 0,
  496. deleLoading: false,
  497. exceLoading: false,
  498. execTime: "",
  499. current_group_index: -1,
  500. title: "临时医嘱",
  501. showAdviceForm: false,
  502. showAdvicePanel: true,
  503. showNameForm: false,
  504. showGroupForm: false,
  505. showTemplateForm: false,
  506. current_template_id: -1,
  507. adviceTemplates: [],
  508. adviceTemplateMaps: {},
  509. deliveryWayOptions: [],
  510. executionFrequencyOptions: [],
  511. unitsOption: [],
  512. // admin_users: [],
  513. templateRules: {
  514. id: [{ required: true, message: "请选择医嘱模板" }]
  515. },
  516. nameRules: {
  517. advice_name: [{ required: true, message: "请填写医嘱内容" }]
  518. },
  519. form: {
  520. id: 0,
  521. advice_type: 2,
  522. advice_date: "",
  523. start_time: "",
  524. advice_name: "",
  525. advice_desc: "",
  526. single_dose: "",
  527. single_dose_unit: "",
  528. prescribing_number: "",
  529. prescribing_number_unit: "",
  530. delivery_way: "",
  531. execution_frequency: "",
  532. advice_doctor: "",
  533. remark: "",
  534. parent_id: 0
  535. },
  536. nameForm: {
  537. advice_name: "",
  538. single_dose: "",
  539. single_dose_unit: "",
  540. drug_spec: "",
  541. drug_spec_unit: "",
  542. prescribing_number: "",
  543. prescribing_number_unit: "",
  544. delivery_way: "",
  545. execution_frequency: "",
  546. isEdit: 0,
  547. index: 0
  548. },
  549. groupForm: {
  550. advice_type: 2,
  551. advice_date: "",
  552. start_time: "",
  553. adviceNames: [],
  554. advice_doctor: "",
  555. remark: "",
  556. parent_id: 0
  557. },
  558. adviceList: [],
  559. currentIndex: -1,
  560. currentRow: null,
  561. groupSelectRow: null,
  562. templateForm: { id: "" }
  563. };
  564. },
  565. watch: {
  566. "assessment_after_dislysis.id": function() {
  567. if (this.assessment_after_dislysis.id > 0) {
  568. for (var index in this.form) {
  569. this.form[index] = this.assessment_after_dislysis[index];
  570. }
  571. }
  572. },
  573. "dialysis_order.id": function() {
  574. this.form["dialysis_order_id"] = this.dialysis_order.id;
  575. },
  576. doctor_advices: function() {
  577. this.handleSpanTempArr();
  578. this.hoverOrderArr = [];
  579. this.handleStyle();
  580. }
  581. },
  582. methods: {
  583. // isPermission () {
  584. // if(this.$store.getters.xt_user.user.user_type == 3 ) {
  585. // return false
  586. // } else {
  587. // return true
  588. // }
  589. // },
  590. adviceNameShow({ row, column, rowIndex, columnIndex }) {
  591. if (columnIndex == 2) {
  592. return "dialysisadvicenamedisplay";
  593. } else {
  594. return "";
  595. }
  596. },
  597. submitEditAdvice() {
  598. if (this.form.advice_name.length == 0) {
  599. this.$message.error("请填写医嘱名称");
  600. return;
  601. }
  602. if (this.form.start_time.length == 0) {
  603. this.$message.error("请选择开始时间");
  604. return;
  605. }
  606. if (!(this.patient.id > 0)) {
  607. this.$message.error("没有选择患者");
  608. return false;
  609. }
  610. console.log(this.form);
  611. let mode = "2";
  612. if (this.form.advice_doctor != this.$store.getters.xt_user.user.id) {
  613. mode = "3";
  614. }
  615. EditDoctorAdvice(this.patient.id, this.form.id, this.form, mode).then(
  616. response => {
  617. if (response.data.state == 0) {
  618. this.$message.error(response.data.msg);
  619. return false;
  620. } else {
  621. this.$notify({
  622. title: "成功",
  623. message: "修改医嘱成功",
  624. type: "success",
  625. duration: 2000
  626. });
  627. this.showAdviceForm = false;
  628. this.showAdvicePanel = true;
  629. var advice = response.data.data.advice;
  630. // console.log("advice-------", advice);
  631. this.doctor_advices[this.currentIndex].drug_spec = advice.drug_spec;
  632. this.doctor_advices[this.currentIndex].drug_spec_unit =
  633. advice.drug_spec_unit;
  634. this.doctor_advices[this.currentIndex].start_time =
  635. advice.start_time;
  636. this.doctor_advices[this.currentIndex].advice_name =
  637. advice.advice_name;
  638. this.doctor_advices[this.currentIndex].advice_desc =
  639. advice.advice_desc;
  640. this.doctor_advices[this.currentIndex].single_dose =
  641. advice.single_dose;
  642. this.doctor_advices[this.currentIndex].single_dose_unit =
  643. advice.single_dose_unit;
  644. this.doctor_advices[this.currentIndex].delivery_way =
  645. advice.delivery_way;
  646. this.doctor_advices[this.currentIndex].execution_frequency =
  647. advice.execution_frequency;
  648. this.doctor_advices[this.currentIndex].prescribing_number =
  649. advice.prescribing_number;
  650. this.doctor_advices[this.currentIndex].prescribing_number_unit =
  651. advice.prescribing_number_unit;
  652. this.doctor_advices[this.currentIndex].advice_doctor =
  653. advice.advice_doctor;
  654. this.doctor_advices[this.currentIndex].remark = advice.remark;
  655. this.currentIndex = -1;
  656. return false;
  657. }
  658. }
  659. );
  660. },
  661. // submitGroupAdvice() {
  662. // if (this.groupForm.start_time.length == 0) {
  663. // this.$message.error('请选择开始时间')
  664. // return
  665. // }
  666. // CreateGroupAdvice(this.patient.id, this.groupForm).then(response => {
  667. // if (response.data.state == 0) {
  668. // this.$message.error(response.data.msg)
  669. // return false
  670. // } else {
  671. // this.$notify({
  672. // title: '成功',
  673. // message: '新增成功',
  674. // type: 'success',
  675. // duration: 2000
  676. // })
  677. // this.currentIndex = -1
  678. // this.currentRow = null
  679. // this.setCurrent()
  680. // this.hideGroupForm()
  681. // for (const index in response.data.data.advices) {
  682. // this.doctor_advices.unshift(response.data.data.advices[index])
  683. // }
  684. // this.groupForm = {
  685. // advice_type: 2,
  686. // advice_date: '',
  687. // start_time: '',
  688. // adviceNames: [],
  689. // advice_doctor: '',
  690. // remark: '',
  691. // parent_id: 0
  692. // }
  693. // return false
  694. // }
  695. // })
  696. // },
  697. // submitTempForm() {
  698. // var _this = this
  699. // if (this.templateForm.id.length == 0) {
  700. // this.$message.error('请选择医嘱模板')
  701. // return
  702. // }
  703. // if (_this.templateForm.id in _this.adviceTemplateMaps) {
  704. // var mapid = _this.templateForm.id
  705. // for (const index in _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate) {
  706. // var item = {
  707. // advice_name: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_name,
  708. // single_dose: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose,
  709. // single_dose_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose_unit,
  710. // drug_spec: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
  711. // drug_spec_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
  712. // prescribing_number: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number,
  713. // prescribing_number_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number_unit,
  714. // delivery_way: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].delivery_way,
  715. // execution_frequency: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
  716. // isEdit: 0,
  717. // index: 0
  718. // }
  719. // _this.groupForm.adviceNames.push(item)
  720. // }
  721. // }
  722. // this.title = '新增医嘱'
  723. // this.showTemplateForm = false
  724. // this.showGroupForm = true
  725. // },
  726. openAdviceTemplate() {
  727. this.templateForm = { id: "" };
  728. this.title = "选择医嘱模板";
  729. this.showTemplateForm = true;
  730. this.showGroupForm = false;
  731. },
  732. submitNameForm() {
  733. if (this.nameForm.advice_name.length == 0) {
  734. this.$message.error("请填写医嘱名称");
  735. return;
  736. }
  737. if (this.nameForm.isEdit) {
  738. this.groupForm.adviceNames[
  739. this.nameForm.index
  740. ].advice_name = this.nameForm.advice_name;
  741. this.groupForm.adviceNames[
  742. this.nameForm.index
  743. ].single_dose = this.nameForm.single_dose;
  744. this.groupForm.adviceNames[
  745. this.nameForm.index
  746. ].single_dose_unit = this.nameForm.single_dose_unit;
  747. this.groupForm.adviceNames[
  748. this.nameForm.index
  749. ].drug_spec = this.nameForm.drug_spec;
  750. this.groupForm.adviceNames[
  751. this.nameForm.index
  752. ].drug_spec_unit = this.nameForm.drug_spec_unit;
  753. this.groupForm.adviceNames[
  754. this.nameForm.index
  755. ].prescribing_number = this.nameForm.prescribing_number;
  756. this.groupForm.adviceNames[
  757. this.nameForm.index
  758. ].prescribing_number_unit = this.nameForm.prescribing_number_unit;
  759. this.groupForm.adviceNames[
  760. this.nameForm.index
  761. ].delivery_way = this.nameForm.delivery_way;
  762. this.groupForm.adviceNames[
  763. this.nameForm.index
  764. ].execution_frequency = this.nameForm.execution_frequency;
  765. } else {
  766. this.groupForm.adviceNames.push(this.nameForm);
  767. }
  768. this.title = "新增医嘱";
  769. this.showNameForm = false;
  770. this.showGroupForm = true;
  771. },
  772. groupClassName({ row, rowIndex }) {
  773. row.index = rowIndex;
  774. },
  775. selectGroupAdvice(row) {
  776. this.groupSelectRow = row;
  777. },
  778. openDeleteGroupAdvice() {
  779. if (this.groupSelectRow === null) {
  780. this.$message.error("未选择要删除的医嘱内容");
  781. return;
  782. }
  783. this.DeleteGroupAdvice(this.groupSelectRow.groupno);
  784. // this.$confirm('确认删除些条医嘱内容?', '删除医嘱内容', {
  785. // confirmButtonText: '确定',
  786. // cancelButtonText: '取消',
  787. // type: 'warning'
  788. // }).then(() => {
  789. // this.groupForm.adviceNames.splice(this.groupSelectRow.index, 1);
  790. // }).catch(() => {
  791. // });
  792. },
  793. openAdviceName(isEdit) {
  794. if (isEdit) {
  795. if (this.groupSelectRow === null) {
  796. this.$message.error("未选择要修改的医嘱内容");
  797. return;
  798. }
  799. this.nameForm = {
  800. advice_name: this.groupSelectRow.advice_name,
  801. single_dose: this.groupSelectRow.single_dose,
  802. single_dose_unit: this.groupSelectRow.single_dose_unit,
  803. drug_spec: this.groupSelectRow.drug_spec,
  804. drug_spec_unit: this.groupSelectRow.drug_spec_unit,
  805. prescribing_number: this.groupSelectRow.prescribing_number,
  806. prescribing_number_unit: this.groupSelectRow.prescribing_number_unit,
  807. delivery_way: this.groupSelectRow.delivery_way,
  808. execution_frequency: this.groupSelectRow.execution_frequency,
  809. isEdit: 1,
  810. index: this.groupSelectRow.index
  811. };
  812. } else {
  813. this.nameForm = {
  814. advice_name: "",
  815. single_dose: "",
  816. single_dose_unit: "",
  817. drug_spec: "",
  818. drug_spec_unit: "",
  819. prescribing_number: "",
  820. prescribing_number_unit: "",
  821. delivery_way: "",
  822. execution_frequency: "",
  823. isEdit: 0,
  824. index: 0
  825. };
  826. }
  827. this.title = "新增医嘱内容";
  828. this.showNameForm = true;
  829. this.showGroupForm = false;
  830. },
  831. tableRowClassName({ row, rowIndex }) {
  832. // if (row.stop_state == 1 || row.execution_state == 1) {
  833. // return 'stoped-row';
  834. // }
  835. // return 'success-rows'
  836. row.index = rowIndex;
  837. const arr = this.hoverOrderArr;
  838. for (let i = 0; i < arr.length; i++) {
  839. if (rowIndex == arr[i]) {
  840. return "success-row";
  841. }
  842. }
  843. },
  844. changeAdviceName(key) {
  845. if (key in this.adviceTemplateMaps) {
  846. this.form.advice_name = this.adviceTemplateMaps[key].advice_name;
  847. this.form.advice_desc = this.adviceTemplateMaps[key].advice_desc;
  848. this.form.single_dose_unit = this.adviceTemplateMaps[
  849. key
  850. ].single_dose_unit;
  851. this.form.single_dose = this.adviceTemplateMaps[key].single_dose + "";
  852. this.form.prescribing_number_unit = this.adviceTemplateMaps[
  853. key
  854. ].prescribing_number_unit;
  855. this.form.prescribing_number =
  856. this.adviceTemplateMaps[key].prescribing_number + "";
  857. this.form.delivery_way = this.adviceTemplateMaps[key].delivery_way;
  858. this.form.execution_frequency = this.adviceTemplateMaps[
  859. key
  860. ].execution_frequency;
  861. }
  862. },
  863. submitExce() {
  864. if (this.currentRow == null) {
  865. this.$message.error("请先选择要执行的医嘱!");
  866. return false;
  867. }
  868. if (this.execTime.length == 0) {
  869. this.$message.error("请选择执行时间!");
  870. return false;
  871. }
  872. var execTime = Math.round(new Date(this.execTime).getTime() / 1000);
  873. if (execTime < this.currentRow.start_time) {
  874. this.$message.error("执行医嘱不能在开始之前!");
  875. return false;
  876. }
  877. this.exceLoading = true;
  878. let mode = "6";
  879. ExecDoctorAdvice(this.patient.id, this.currentRow.id, this.execTime, mode)
  880. .then(response => {
  881. if (response.data.state == 0) {
  882. this.$message.error(response.data.msg);
  883. this.exceLoading = false;
  884. return false;
  885. } else {
  886. this.$notify({
  887. title: "成功",
  888. message: "执行医嘱成功",
  889. type: "success",
  890. duration: 2000
  891. });
  892. var exid = response.data.data.advice.id;
  893. if (response.data.data.advice.parent_id > 0) {
  894. exid = response.data.data.advice.parent_id;
  895. }
  896. // if (this.currentRow.parent_id > 0) {
  897. // exid = this.currentRow.parent_id;
  898. // }
  899. this.currentRow.execution_state = 1;
  900. this.currentRow.execution_staff =
  901. response.data.data.advice.execution_staff;
  902. this.currentRow.execution_time =
  903. response.data.data.advice.execution_time;
  904. var alen = this.doctor_advices.length;
  905. for (var index in this.doctor_advices) {
  906. if (
  907. this.doctor_advices[index].id == exid ||
  908. this.doctor_advices[index].parent_id == exid
  909. ) {
  910. this.doctor_advices[index].execution_state = 1;
  911. this.doctor_advices[index].execution_staff =
  912. response.data.data.advice.execution_staff;
  913. this.doctor_advices[index].execution_time =
  914. response.data.data.advice.execution_time;
  915. // this.doctor_advices[index].checker = response.data.data.advice.checker;
  916. break;
  917. }
  918. }
  919. this.execTimeDialogVisible = false;
  920. return false;
  921. }
  922. })
  923. .catch(() => {
  924. this.exceLoading = false;
  925. });
  926. },
  927. submitAdvice() {
  928. if (this.form.advice_name.length == 0) {
  929. this.$message.error("请填写医嘱名称");
  930. return;
  931. }
  932. if (this.form.start_time.length == 0) {
  933. this.$message.error("请选择开始时间");
  934. return;
  935. }
  936. if (!(this.patient.id > 0)) {
  937. this.$message.error("没有选择患者");
  938. return false;
  939. }
  940. let mode = "1";
  941. CreateDoctorAdvice(this.patient.id, this.form, mode)
  942. .then(response => {
  943. this.loading = false;
  944. if (response.data.state == 0) {
  945. this.$message.error(response.data.msg);
  946. return false;
  947. } else {
  948. this.$notify({
  949. title: "成功",
  950. message: "新增医嘱成功",
  951. type: "success",
  952. duration: 2000
  953. });
  954. this.currentIndex = -1;
  955. this.currentRow = null;
  956. this.setCurrent();
  957. this.hideForm();
  958. if (this.form.parent_id > 0) {
  959. var spliceIndex = -1;
  960. for (let index = this.doctor_advices.length - 1; ; index--) {
  961. if (
  962. this.doctor_advices[index].parent_id === this.form.parent_id
  963. ) {
  964. spliceIndex = index;
  965. break;
  966. } else if (
  967. this.doctor_advices[index].id === this.form.parent_id
  968. ) {
  969. spliceIndex = index;
  970. break;
  971. }
  972. }
  973. if (spliceIndex > -1) {
  974. spliceIndex += 1;
  975. if (spliceIndex === this.doctor_advices.length) {
  976. this.doctor_advices.push(response.data.data.advice);
  977. } else {
  978. var swapData = this.doctor_advices.splice(spliceIndex);
  979. this.doctor_advices.push(response.data.data.advice);
  980. for (var index in swapData) {
  981. this.doctor_advices.push(swapData[index]); // = this.doctor_advices.concat(swapData);
  982. }
  983. }
  984. }
  985. } else {
  986. this.doctor_advices.unshift(response.data.data.advice);
  987. }
  988. // this.$emit("new_create", response.data.data.advice);
  989. return false;
  990. }
  991. })
  992. .catch(v => {
  993. this.loading = false;
  994. });
  995. },
  996. openNewChildTwo(index, row) {
  997. this.currentRow = row;
  998. if (this.currentRow == null) {
  999. this.$message.error("请先选择要新增子药的医嘱!");
  1000. return false;
  1001. }
  1002. if (
  1003. this.currentRow.stop_state == 1 ||
  1004. this.currentRow.execution_state == 1
  1005. ) {
  1006. this.$message.error("所选医嘱已停止或执行");
  1007. return false;
  1008. }
  1009. this.title = "新增子药";
  1010. this.showAdviceForm = true;
  1011. this.showAdvicePanel = false;
  1012. this.form = {
  1013. id: 0,
  1014. advice_type: 2,
  1015. advice_date: this.record_date,
  1016. start_time: uParseTime(
  1017. this.currentRow.start_time,
  1018. "{y}-{m}-{d} {h}:{i}"
  1019. ),
  1020. advice_name: "",
  1021. drug_spec: "",
  1022. drug_spec_unit: "",
  1023. single_dose: "",
  1024. single_dose_unit: "",
  1025. prescribing_number: "",
  1026. prescribing_number_unit: "",
  1027. delivery_way: this.currentRow.delivery_way,
  1028. execution_frequency: this.currentRow.execution_frequency,
  1029. advice_doctor: "",
  1030. remark: "",
  1031. parent_id: this.currentRow.id
  1032. };
  1033. },
  1034. openNewChild() {
  1035. if (this.currentRow == null) {
  1036. this.$message.error("请先选择要新增子药的医嘱!");
  1037. return false;
  1038. }
  1039. if (
  1040. this.currentRow.stop_state == 1 ||
  1041. this.currentRow.execution_state == 1
  1042. ) {
  1043. this.$message.error("所选医嘱已停止或执行");
  1044. return false;
  1045. }
  1046. this.title = "新增子药";
  1047. this.showAdviceForm = true;
  1048. this.showAdvicePanel = false;
  1049. this.form = {
  1050. id: 0,
  1051. advice_type: 2,
  1052. advice_date: this.record_date,
  1053. start_time: uParseTime(
  1054. this.currentRow.start_time,
  1055. "{y}-{m}-{d} {h}:{i}"
  1056. ),
  1057. advice_name: "",
  1058. drug_spec: "",
  1059. drug_spec_unit: "",
  1060. single_dose: "",
  1061. single_dose_unit: "",
  1062. prescribing_number: "",
  1063. prescribing_number_unit: "",
  1064. delivery_way: this.currentRow.delivery_way,
  1065. execution_frequency: this.currentRow.execution_frequency,
  1066. advice_doctor: "",
  1067. remark: "",
  1068. parent_id: this.currentRow.id
  1069. };
  1070. },
  1071. openEdit(index, row) {
  1072. if (row.stop_state == 1 || row.execution_state == 1) {
  1073. this.$message.error("所选医嘱已停止或执行");
  1074. return false;
  1075. }
  1076. this.title = row.parent_id > 0 ? "编辑子药" : "编辑医嘱";
  1077. this.showAdviceForm = true;
  1078. this.showAdvicePanel = false;
  1079. this.currentIndex = index;
  1080. this.form = {
  1081. id: row.id,
  1082. advice_type: 2,
  1083. advice_date: uParseTime(row.advice_date, "{y}-{m}-{d}"),
  1084. start_time: uParseTime(row.start_time, "{y}-{m}-{d} {h}:{i}"),
  1085. advice_desc: row.advice_desc,
  1086. advice_name: row.advice_name,
  1087. drug_spec: row.drug_spec != 0 ? "" + row.drug_spec : "",
  1088. drug_spec_unit: row.drug_spec_unit,
  1089. single_dose: row.single_dose != 0 ? "" + row.single_dose : "",
  1090. single_dose_unit: row.single_dose_unit,
  1091. prescribing_number:
  1092. row.prescribing_number != 0 ? "" + row.prescribing_number : "",
  1093. prescribing_number_unit: row.prescribing_number_unit,
  1094. delivery_way: row.delivery_way,
  1095. execution_frequency: row.execution_frequency,
  1096. advice_doctor: row.advice_doctor,
  1097. remark: row.remark,
  1098. parent_id: row.parent_id
  1099. };
  1100. },
  1101. openEditGroupAdvice() {
  1102. if (this.groupSelectRow === null) {
  1103. this.$message.error("未选择要修改的医嘱内容");
  1104. return;
  1105. }
  1106. this.$refs.editGroupForm.open(this.groupSelectRow.groupno);
  1107. },
  1108. openGroupFrom() {
  1109. this.$refs.addGroupForm.open();
  1110. // this.title="新增医嘱";
  1111. // this.showGroupForm = true;
  1112. // this.showAdviceForm = false;
  1113. // this.showAdvicePanel = false;
  1114. // this.$refs.advices_list.setCurrentRow(null);
  1115. // this.currentIndex = -1;
  1116. // this.currentRow = null;
  1117. // this.groupForm.advice_date = this.record_date;
  1118. // this.form = {
  1119. // id: 0,
  1120. // advice_type: 2,
  1121. // advice_date: this.record_date,
  1122. // start_time: "",
  1123. // advice_name: "",
  1124. // advice_desc: "",
  1125. // single_dose: "",
  1126. // single_dose_unit: "",
  1127. // prescribing_number: "",
  1128. // prescribing_number_unit: "",
  1129. // delivery_way: "",
  1130. // execution_frequency: "",
  1131. // advice_doctor: "",
  1132. // remark: "",
  1133. // parent_id: 0
  1134. // };
  1135. },
  1136. checkAdvice() {
  1137. console.log(this.$store.getters.xt_user);
  1138. if (this.currentRow == null) {
  1139. this.$message.error("请先选择要核对的医嘱!");
  1140. return false;
  1141. }
  1142. if (this.currentRow.check_state == 1) {
  1143. this.$message.error("所选医嘱已核对");
  1144. return false;
  1145. }
  1146. if (
  1147. this.currentRow.execution_staff > 0 &&
  1148. this.currentRow.execution_staff == this.$store.getters.xt_user.user.id
  1149. ) {
  1150. this.$message.error("核对与执行不能是同一人");
  1151. return false;
  1152. }
  1153. this.$confirm("确认提交核对?", "医嘱核对", {
  1154. confirmButtonText: "确定",
  1155. cancelButtonText: "取消",
  1156. closeOnClickModal: false,
  1157. type: "warning"
  1158. })
  1159. .then(() => {
  1160. this.deleLoading = true;
  1161. let mode = "7";
  1162. CheckDoctorAdvice(this.patient.id, this.currentRow.id, mode).then(
  1163. response => {
  1164. if (response.data.state == 0) {
  1165. this.$message.error(response.data.msg);
  1166. this.deleLoading = false;
  1167. return false;
  1168. } else {
  1169. this.$notify({
  1170. title: "成功",
  1171. message: "核对成功",
  1172. type: "success",
  1173. duration: 2000
  1174. });
  1175. var exid = response.data.data.advice.id;
  1176. if (response.data.data.advice.parent_id > 0) {
  1177. exid = response.data.data.advice.parent_id;
  1178. }
  1179. // if (this.currentRow.parent_id > 0) {
  1180. // exid = this.currentRow.parent_id;
  1181. // }
  1182. this.currentRow.check_state = 1;
  1183. this.currentRow.check_time =
  1184. response.data.data.advice.check_time;
  1185. this.currentRow.checker = response.data.data.advice.checker;
  1186. var alen = this.doctor_advices.length;
  1187. for (var index in this.doctor_advices) {
  1188. if (
  1189. this.doctor_advices[index].id == exid ||
  1190. this.doctor_advices[index].parent_id == exid
  1191. ) {
  1192. this.doctor_advices[index].check_state = 1;
  1193. this.doctor_advices[index].check_time =
  1194. response.data.data.advice.check_time;
  1195. this.doctor_advices[index].checker =
  1196. response.data.data.advice.checker;
  1197. // break;
  1198. }
  1199. }
  1200. this.deleLoading = false;
  1201. }
  1202. }
  1203. );
  1204. })
  1205. .catch(() => {
  1206. this.deleLoading = false;
  1207. });
  1208. },
  1209. execAdvice() {
  1210. if (this.is_has_exce == false) {
  1211. this.$message.error("你没有执行医嘱的权限");
  1212. return false;
  1213. }
  1214. // if (this.currentAdvices.length <= 0) {
  1215. // return;
  1216. // }
  1217. if (this.current_select_object == 1) {
  1218. var isExecution = true;
  1219. var adviceArr = this.advice_groups[this.current_group_index].advices;
  1220. for (let i = 0; i < adviceArr.length; i++) {
  1221. if (
  1222. adviceArr[i].execution_state == 2 &&
  1223. adviceArr[i].is_selected == 1
  1224. ) {
  1225. isExecution = false;
  1226. }
  1227. }
  1228. if (isExecution) {
  1229. this.$message.error("所选医嘱已停止或执行");
  1230. return false;
  1231. }
  1232. console.log("b");
  1233. for (let i = 0; i < adviceArr.length; i++) {
  1234. if (
  1235. adviceArr[i].is_selected == 1 &&
  1236. adviceArr[i].checker > 0 &&
  1237. adviceArr[i].checker == this.$store.getters.user.admin.id
  1238. ) {
  1239. this.$message.error("核对医嘱与执行不能是同一人");
  1240. return false;
  1241. }
  1242. }
  1243. var currentAdviceIdArr = [];
  1244. for (let i = 0; i < adviceArr.length; i++) {
  1245. if (adviceArr[i].is_selected == 1) {
  1246. currentAdviceIdArr.push(adviceArr[i].id);
  1247. }
  1248. }
  1249. console.log("c");
  1250. this.currentAdviceIdsStr = currentAdviceIdArr.join(",");
  1251. this.nowExecTime = new Date(adviceArr[0].start_time * 1000);
  1252. } else {
  1253. if (!(this.current_group_index >= 0 && this.current_advice_index < 0)) {
  1254. return;
  1255. }
  1256. var isExecution = true;
  1257. var group_top_advice = this.advice_groups[this.current_group_index]
  1258. .advices[0];
  1259. var adviceArr = this.advice_groups[this.current_group_index].advices;
  1260. for (let i = 0; i < adviceArr.length; i++) {
  1261. if (
  1262. adviceArr[i].is_selected == 1 &&
  1263. adviceArr[i].execution_state == 2
  1264. ) {
  1265. isExecution = false;
  1266. }
  1267. }
  1268. if (isExecution) {
  1269. this.$message.error("所选医嘱已停止或执行");
  1270. return false;
  1271. }
  1272. for (let i = 0; i < adviceArr.length; i++) {
  1273. if (
  1274. adviceArr[i].is_selected == 1 &&
  1275. adviceArr[i].checker > 0 &&
  1276. adviceArr[i].checker == this.$store.getters.user.admin.id
  1277. ) {
  1278. this.$message.error("核对与执行不能是同一人");
  1279. return false;
  1280. }
  1281. }
  1282. this.nowExecTime = new Date(group_top_advice.start_time * 1000);
  1283. }
  1284. this.$refs.exec_time.open();
  1285. // if (this.currentRow == null) {
  1286. // this.$message.error("请先选择要执行的医嘱!");
  1287. // return false;
  1288. // }
  1289. //
  1290. // if (
  1291. // this.currentRow.stop_state == 1 ||
  1292. // this.currentRow.execution_state == 1
  1293. // ) {
  1294. // this.$message.error("所选医嘱已停止或执行");
  1295. // return false;
  1296. // }
  1297. //
  1298. // if (
  1299. // this.currentRow.checker > 0 &&
  1300. // this.currentRow.checker == this.$store.getters.xt_user.user.id
  1301. // ) {
  1302. // this.$message.error("核对与执行不能是同一人");
  1303. // return false;
  1304. // }
  1305. //
  1306. // this.execTimeDialogVisible = true;
  1307. // this.deleLoading = true;
  1308. },
  1309. DeleteGroupAdvice(groupno) {
  1310. this.$confirm("确认删除这组医嘱?", "医嘱删除", {
  1311. confirmButtonText: "确定",
  1312. cancelButtonText: "取消",
  1313. type: "warning"
  1314. })
  1315. .then(() => {
  1316. console.log(this.currentRow);
  1317. let mode = "4";
  1318. if (
  1319. this.currentRow.advice_doctor != this.$store.getters.xt_user.user.id
  1320. ) {
  1321. mode = "5";
  1322. }
  1323. DeleteGroupAdvice(groupno, mode).then(response => {
  1324. if (response.data.state == 0) {
  1325. this.$message.error(response.data.msg);
  1326. return false;
  1327. } else {
  1328. this.$notify({
  1329. title: "成功",
  1330. message: "医嘱已经删除",
  1331. type: "success",
  1332. duration: 2000
  1333. });
  1334. var alen = this.doctor_advices.length;
  1335. for (let index = alen - 1; index >= 0; index--) {
  1336. if (this.doctor_advices[index].groupno === groupno) {
  1337. this.doctor_advices.splice(index, 1);
  1338. }
  1339. }
  1340. }
  1341. });
  1342. })
  1343. .catch(() => {});
  1344. this.handleSpanTempArr();
  1345. },
  1346. openDelete(index, row) {
  1347. this.currentRow = row;
  1348. this.$confirm("确认删除此条医嘱?", "医嘱删除", {
  1349. confirmButtonText: "确定",
  1350. cancelButtonText: "取消",
  1351. closeOnClickModal: false,
  1352. type: "warning"
  1353. })
  1354. .then(() => {
  1355. this.deleLoading = true;
  1356. let mode = "4";
  1357. if (
  1358. this.currentRow.advice_doctor != this.$store.getters.xt_user.user.id
  1359. ) {
  1360. mode = "5";
  1361. }
  1362. DeleteDoctorAdvice(this.currentRow.id, mode).then(response => {
  1363. this.deleLoading = false;
  1364. if (response.data.state == 0) {
  1365. this.$message.error(response.data.msg);
  1366. return false;
  1367. } else {
  1368. this.$notify({
  1369. title: "成功",
  1370. message: "医嘱已经删除",
  1371. type: "success",
  1372. duration: 2000
  1373. });
  1374. this.deleteResetData(this.currentRow);
  1375. this.currentRow = null;
  1376. this.setCurrent();
  1377. }
  1378. });
  1379. })
  1380. .catch(() => {
  1381. this.deleLoading = false;
  1382. });
  1383. },
  1384. deleteAdvice() {
  1385. if (this.currentRow == null) {
  1386. this.$message.error("请先选择要删除的医嘱!");
  1387. return false;
  1388. }
  1389. this.$confirm("确认删除此条医嘱?", "医嘱删除", {
  1390. confirmButtonText: "确定",
  1391. cancelButtonText: "取消",
  1392. closeOnClickModal: false,
  1393. type: "warning"
  1394. })
  1395. .then(() => {
  1396. this.deleLoading = true;
  1397. let mode = "4";
  1398. if (
  1399. this.currentRow.advice_doctor != this.$store.getters.xt_user.user.id
  1400. ) {
  1401. mode = "5";
  1402. }
  1403. DeleteDoctorAdvice(this.currentRow.id, mode).then(response => {
  1404. this.deleLoading = false;
  1405. if (response.data.state == 0) {
  1406. this.$message.error(response.data.msg);
  1407. return false;
  1408. } else {
  1409. this.$notify({
  1410. title: "成功",
  1411. message: "医嘱已经删除",
  1412. type: "success",
  1413. duration: 2000
  1414. });
  1415. this.deleteResetData(this.currentRow);
  1416. this.currentRow = null;
  1417. this.setCurrent();
  1418. }
  1419. });
  1420. })
  1421. .catch(() => {
  1422. this.deleLoading = false;
  1423. });
  1424. },
  1425. deleteResetData(row) {
  1426. if (row.parent_id > 0) {
  1427. for (var index in this.doctor_advices) {
  1428. if (this.doctor_advices[index].id == row.id) {
  1429. this.doctor_advices.splice(index, 1);
  1430. break;
  1431. }
  1432. }
  1433. } else {
  1434. var spliceIndex = -1;
  1435. var splitNums = 0;
  1436. for (var index in this.doctor_advices) {
  1437. if (this.doctor_advices[index].id == row.id) {
  1438. spliceIndex = index;
  1439. splitNums++;
  1440. } else if (this.doctor_advices[index].parent_id == row.id) {
  1441. splitNums++;
  1442. }
  1443. }
  1444. this.doctor_advices.splice(spliceIndex, splitNums);
  1445. }
  1446. },
  1447. selectRow(row) {
  1448. this.currentRow = row;
  1449. },
  1450. getAdviceConfig() {
  1451. getAdviceConfig().then(response => {
  1452. if (response.data.state == 1) {
  1453. this.deliveryWayOptions =
  1454. response.data.data.drugways === null
  1455. ? []
  1456. : response.data.data.drugways;
  1457. this.executionFrequencyOptions =
  1458. response.data.data.efs === null ? [] : response.data.data.efs;
  1459. this.adviceTemplates =
  1460. response.data.data.advice_templates === null
  1461. ? []
  1462. : response.data.data.advice_templates;
  1463. var templateLen = this.adviceTemplates.length;
  1464. for (let index = 0; index < templateLen; index++) {
  1465. if (!this.adviceTemplates[index].DoctorAdviceTemplate) {
  1466. continue;
  1467. }
  1468. var DoctorAdviceTemplate = this.adviceTemplates[index]
  1469. .DoctorAdviceTemplate;
  1470. for (let i = 0; i < DoctorAdviceTemplate.length; i++) {
  1471. DoctorAdviceTemplate[i].selection = false;
  1472. }
  1473. var item = this.adviceTemplates[index];
  1474. item.DoctorAdviceTemplate = [];
  1475. var datMap = {};
  1476. for (const key in DoctorAdviceTemplate) {
  1477. if (DoctorAdviceTemplate[key].parent_id == 0) {
  1478. datMap[DoctorAdviceTemplate[key].id] =
  1479. DoctorAdviceTemplate[key];
  1480. }
  1481. }
  1482. for (const key in DoctorAdviceTemplate) {
  1483. if (DoctorAdviceTemplate[key].parent_id in datMap) {
  1484. if ("children" in datMap[DoctorAdviceTemplate[key].parent_id]) {
  1485. datMap[DoctorAdviceTemplate[key].parent_id].children.push(
  1486. DoctorAdviceTemplate[key]
  1487. );
  1488. } else {
  1489. datMap[DoctorAdviceTemplate[key].parent_id].children = [];
  1490. datMap[DoctorAdviceTemplate[key].parent_id].children.push(
  1491. DoctorAdviceTemplate[key]
  1492. );
  1493. }
  1494. }
  1495. }
  1496. for (const key in datMap) {
  1497. item.DoctorAdviceTemplate.push(datMap[key]);
  1498. }
  1499. this.$set(
  1500. this.adviceTemplateMaps,
  1501. this.adviceTemplates[index].id,
  1502. item
  1503. );
  1504. }
  1505. }
  1506. });
  1507. this.handleSpanTempArr();
  1508. this.handleStyle();
  1509. },
  1510. getXuserName(id) {
  1511. if (id <= 0) {
  1512. return "";
  1513. }
  1514. var name = "";
  1515. if (
  1516. this.admin_users == null ||
  1517. typeof this.admin_users.length === "undefined"
  1518. ) {
  1519. return name;
  1520. }
  1521. var leng = this.admin_users.length;
  1522. if (leng == 0) {
  1523. return name;
  1524. }
  1525. for (let index = 0; index < leng; index++) {
  1526. if (this.admin_users[index].id == id) {
  1527. name = this.admin_users[index].name;
  1528. break;
  1529. }
  1530. }
  1531. return name;
  1532. },
  1533. addNewOrder() {
  1534. this.$refs.addGroupForm.open();
  1535. },
  1536. show() {
  1537. this.isVisibility = true;
  1538. this.getPermission();
  1539. },
  1540. hide() {
  1541. this.isVisibility = false;
  1542. },
  1543. hideForm() {
  1544. this.title = "临时医嘱";
  1545. this.showGroupForm = false;
  1546. this.showAdviceForm = false;
  1547. this.showAdvicePanel = true;
  1548. },
  1549. hideNameForm() {
  1550. this.title = "新增医嘱";
  1551. this.showGroupForm = true;
  1552. this.showNameForm = false;
  1553. },
  1554. hideTemplateForm() {
  1555. this.title = "新增医嘱";
  1556. this.showGroupForm = true;
  1557. this.showTemplateForm = false;
  1558. },
  1559. hideGroupForm() {
  1560. this.title = "临时医嘱";
  1561. this.showAdviceForm = false;
  1562. this.showGroupForm = false;
  1563. this.showAdvicePanel = true;
  1564. },
  1565. resetDialog() {
  1566. this.hoverOrderArr = [];
  1567. this.title = "临时医嘱";
  1568. this.showAdviceForm = false;
  1569. this.showGroupForm = false;
  1570. this.showAdvicePanel = true;
  1571. this.currentRow = null;
  1572. this.groupSelectRow = null;
  1573. this.setCurrent();
  1574. },
  1575. closeTimePanel() {
  1576. this.execTimeDialogVisible = false;
  1577. this.deleLoading = false;
  1578. this.exceLoading = false;
  1579. this.execTime = "";
  1580. },
  1581. setCurrent(row) {
  1582. this.$refs.advices_list.setCurrentRow(row);
  1583. },
  1584. isShowStartTime(index, row) {
  1585. if (row.parent_id > 0) {
  1586. return false;
  1587. } else if (
  1588. index > 0 &&
  1589. row.groupno > 0 &&
  1590. row.groupno == this.doctor_advices[index - 1].groupno
  1591. ) {
  1592. return false;
  1593. }
  1594. return true;
  1595. },
  1596. mergeSpan({ row, column, rowIndex, columnIndex }) {
  1597. if (columnIndex != 2) {
  1598. const _row = this.tempArr[rowIndex];
  1599. const _col = _row > 0 ? 1 : 0;
  1600. return {
  1601. rowspan: _row,
  1602. colspan: _col
  1603. };
  1604. }
  1605. },
  1606. handleSpanTempArr() {
  1607. this.tempArr = [];
  1608. for (let i = 0; i < this.doctor_advices.length; i++) {
  1609. if (i === 0) {
  1610. this.tempArr.push(1);
  1611. this.pos = 0;
  1612. } else {
  1613. // 判断当前元素与上一个元素是否相同
  1614. if (
  1615. this.doctor_advices[i].groupno ===
  1616. this.doctor_advices[i - 1].groupno
  1617. ) {
  1618. this.tempArr[this.pos] += 1;
  1619. this.tempArr.push(0);
  1620. } else {
  1621. this.tempArr.push(1);
  1622. this.pos = i;
  1623. }
  1624. }
  1625. }
  1626. },
  1627. cellMouseEnter: function(row, column, event) {
  1628. this.currentRow = row;
  1629. this.groupSelectRow = row;
  1630. this.sameRowArr.forEach((arr, i) => {
  1631. if (arr.indexOf(row.index) != -1) {
  1632. this.hoverOrderArr = arr;
  1633. }
  1634. });
  1635. },
  1636. cellMouseLeave: function(row, column, cell, event) {
  1637. this.hoverOrderArr = [];
  1638. },
  1639. handleStyle() {
  1640. let sameRowArr = [],
  1641. sIdx = 0;
  1642. this.doctor_advices.forEach((item, index) => {
  1643. item.index = index;
  1644. if (index === 0) {
  1645. sameRowArr.push([index]);
  1646. } else {
  1647. if (item.groupno === this.doctor_advices[index - 1].groupno) {
  1648. sameRowArr[sIdx].push(index);
  1649. } else {
  1650. sIdx = sIdx + 1;
  1651. sameRowArr.push([index]);
  1652. }
  1653. }
  1654. });
  1655. this.sameRowArr = sameRowArr;
  1656. },
  1657. getAdviceContent(row, isChild) {
  1658. let tempSingleDoseDesc = "";
  1659. let tempDrugSpecDesc = "";
  1660. let tempPrescribingNumberDesc = "";
  1661. if (row.prescribing_number) {
  1662. tempPrescribingNumberDesc =
  1663. row.prescribing_number + "" + row.prescribing_number_unit;
  1664. }
  1665. if (row.single_dose) {
  1666. if (this.template_id != 6) {
  1667. tempSingleDoseDesc =
  1668. " 单次用量 " + " " + row.single_dose + "" + row.single_dose_unit;
  1669. } else {
  1670. tempSingleDoseDesc = row.single_dose + "" + row.single_dose_unit;
  1671. }
  1672. }
  1673. if (row.advice_desc) {
  1674. tempDrugSpecDesc = "(" + row.advice_desc + row.drug_spec_unit + ")";
  1675. }
  1676. if (isChild == 1) {
  1677. // 不是子药
  1678. return (
  1679. row.advice_name +
  1680. tempDrugSpecDesc +
  1681. " " +
  1682. tempPrescribingNumberDesc +
  1683. tempSingleDoseDesc +
  1684. " " +
  1685. row.delivery_way +
  1686. " " +
  1687. row.execution_frequency
  1688. );
  1689. } else {
  1690. // 是子药
  1691. return (
  1692. row.advice_name +
  1693. tempDrugSpecDesc +
  1694. " " +
  1695. tempPrescribingNumberDesc +
  1696. tempSingleDoseDesc
  1697. );
  1698. }
  1699. },
  1700. getPermission() {
  1701. request
  1702. .get("/api/func_per/get", {
  1703. params: {
  1704. create_url: "/api/patients/advice/creategroup?mode=1",
  1705. modify_url: "/api/patients/advice/edit?mode=2",
  1706. modify_other_url: "/api/patients/advice/edit?mode=3",
  1707. del_url: "/api/patients/advice/delete?mode=4",
  1708. del_other_url: "/api/patients/advice/delete?mode=5",
  1709. exce_url: "/api/patients/advice/exec?mode=6",
  1710. check_url: "/api/patients/advice/check?mode=7",
  1711. module: 4
  1712. }
  1713. })
  1714. .then(res => {
  1715. console.log(res);
  1716. if (res.data.state == 0) {
  1717. this.hasPermission = false;
  1718. } else if (res.data.state == 1) {
  1719. this.is_has_create = res.data.data.is_has_create;
  1720. this.is_has_exce = res.data.data.is_has_exce;
  1721. this.is_has_check = res.data.data.is_has_check;
  1722. this.is_has_modify = res.data.data.is_has_modify;
  1723. this.is_has_modify_other = res.data.data.is_has_modify_other;
  1724. this.is_has_modify_exce = res.data.data.is_has_modify_exce;
  1725. this.is_has_del = res.data.data.is_has_del;
  1726. this.is_has_del_other = res.data.data.is_has_del_other;
  1727. }
  1728. });
  1729. },
  1730. arraySpanMethod({ row, column, rowIndex, columnIndex }) {
  1731. if (rowIndex % 2 === 0) {
  1732. if (columnIndex === 0) {
  1733. return [1, 2];
  1734. } else if (columnIndex === 1) {
  1735. return [0, 0];
  1736. }
  1737. }
  1738. },
  1739. handleCurrentChange(val) {
  1740. console.log("val是什么", val);
  1741. },
  1742. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  1743. if (columnIndex === 0) {
  1744. if (rowIndex % 2 === 0) {
  1745. return {
  1746. rowspan: 2,
  1747. colspan: 1
  1748. };
  1749. } else {
  1750. return {
  1751. rowspan: 0,
  1752. colspan: 0
  1753. };
  1754. }
  1755. }
  1756. if (columnIndex === 1) {
  1757. if (rowIndex % 2 === 0) {
  1758. return {
  1759. rowspan: 2,
  1760. colspan: 1
  1761. };
  1762. } else {
  1763. return {
  1764. rowspan: 0,
  1765. colspan: 0
  1766. };
  1767. }
  1768. }
  1769. }
  1770. },
  1771. created() {
  1772. var date = this.$route.query && this.$route.query.date;
  1773. this.record_date = uParseTime(date, "{y}-{m}-{d}");
  1774. this.form.advice_date = this.record_date;
  1775. this.getAdviceConfig();
  1776. this.unitsOption = getDataConfig("hemodialysis", "units");
  1777. this.template_id = this.$store.getters.xt_user.template_info.template_id;
  1778. console.log("医嘱----", this.doctor_advices);
  1779. },
  1780. components: {
  1781. AddGroupAdvice,
  1782. EditGroupAdvice
  1783. }
  1784. };
  1785. </script>
  1786. <style>
  1787. @import "../../../../../static/css/table_row.css";
  1788. .txsj {
  1789. text-align: center;
  1790. margin-bottom: 20px;
  1791. }
  1792. .dialysisadvicenamedisplay .cell {
  1793. float: left;
  1794. text-align: left;
  1795. }
  1796. </style>
  1797. <!--<style scoped>-->
  1798. <!--.txsj{-->
  1799. <!--text-align: center;-->
  1800. <!--margin-bottom: 20px;-->
  1801. <!--}-->
  1802. <!--</style>-->
  1803. <!--<style rel="stylesheet/scss" lang="scss" >-->
  1804. <!--.row-class-active {-->
  1805. <!--background: #badcff;-->
  1806. <!--}-->
  1807. <!--.doctor-advice-box .current-box-class .current-row>td{-->
  1808. <!--background: #6fb5fa;-->
  1809. <!--color:#fff;-->
  1810. <!--}-->
  1811. <!--.doctor-advice-box .current-box-class .current-row:hover>td{-->
  1812. <!--background: #6fb5fa;-->
  1813. <!--}-->
  1814. <!--// .doctor-advice-box .current-box-class .stoped-row>td{-->
  1815. <!--// background: #c9c9c9;-->
  1816. <!--// color:#000;-->
  1817. <!--// }-->
  1818. <!--// .doctor-advice-box .current-box-class .stoped-row:hover>td{-->
  1819. <!--// background: #c9c9c9;-->
  1820. <!--// }-->
  1821. <!--</style>-->