血透系统PC前端

EditGroupAdvice.vue 74KB

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