Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

DoctorAdviceDialog.vue 58KB

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