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

druguseTemplate.vue 101KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. </div>
  6. <el-dialog title="透析处方长期医嘱医生确认推送提醒" :visible.sync="dialogConfigVisible">
  7. <el-form>
  8. <el-form-item label="是否开启推送:">
  9. <el-radio-group v-model="is_open_remind" @change="changeRemind">
  10. <el-radio :label="1">开启</el-radio>
  11. <el-radio :label="2">不开启</el-radio>
  12. </el-radio-group>
  13. </el-form-item>
  14. </el-form>
  15. </el-dialog>
  16. <div class="app-container">
  17. <el-tabs>
  18. <el-tab-pane label="医嘱模板 ">
  19. <div>
  20. <div class="filter-container">
  21. <el-button size="small"
  22. :loading="loading"
  23. style="float: right;"
  24. :disabled="is_init?true:false"
  25. @click="initAdvice()"
  26. type="primary">医嘱初始化
  27. </el-button>
  28. <el-button size="small"
  29. style="float: right;margin-left: 10px;margin-right: 10px"
  30. @click="dialogConfigVisible = true"
  31. type="primary">长期医嘱提醒配置
  32. </el-button>
  33. <el-button
  34. class="filter-item"
  35. style="margin-left: 10px;margin-right: 10px"
  36. @click="handleCreateTemplate"
  37. type="primary"
  38. size="small"
  39. icon="el-icon-circle-plus-outline"
  40. >{{$t('table.add')}}
  41. </el-button>
  42. </div>
  43. <el-table
  44. :data="adviceTemplates"
  45. border
  46. fit
  47. :row-style="{ color: '#303133' }"
  48. :header-cell-style="{
  49. backgroundColor: 'rgb(245, 247, 250)',
  50. color: '#606266'
  51. }"
  52. @cell-mouse-leave="cellMouseLeave"
  53. @cell-mouse-enter="cellMouseEnter"
  54. :row-class-name="tableRowClassNames"
  55. :span-method="merge"
  56. style="width: 100%;min-height:500px;"
  57. >
  58. <el-table-column
  59. prop="id"
  60. label="模版名称"
  61. align="center"
  62. width="100">
  63. <template slot-scope="scope">
  64. <span v-if="isShow(scope.$index, scope.row)">{{scope.row.name}}</span>
  65. <span v-else></span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column
  69. label="模版类型"
  70. align="center"
  71. width="100"
  72. >
  73. <template slot-scope="scope">
  74. <div>{{scope.row.advice_type == 1 ? '长期' : '临时'}}</div>
  75. </template>
  76. </el-table-column>
  77. <el-table-column
  78. prop="amount1"
  79. align="center"
  80. label="医嘱内容">
  81. <template slot-scope="scope">
  82. <el-dropdown trigger="click" v-if="scope.row.parent_id == 0">
  83. <span class="el-dropdown-link" v-if="scope.row.parent_id == 0">
  84. {{scope.row.advice_name}}<i class="el-icon-arrow-down el-icon--right"></i>
  85. </span>
  86. <el-dropdown-menu slot="dropdown">
  87. <el-dropdown-item @click.native="openEdit(scope.$index, scope.row)">修改医嘱</el-dropdown-item>
  88. <el-dropdown-item @click.native="openDelete(scope.$index, scope.row)">删除医嘱</el-dropdown-item>
  89. <el-dropdown-item @click.native="openNewChild(scope.$index, scope.row)">新增子药</el-dropdown-item>
  90. </el-dropdown-menu>
  91. </el-dropdown>
  92. <el-dropdown trigger="click" v-if="scope.row.parent_id > 0">
  93. <span class="el-dropdown-link">
  94. &emsp;&emsp;{{ scope.row.advice_name }}<i class="el-icon-arrow-down el-icon--right"></i>
  95. </span>
  96. <el-dropdown-menu slot="dropdown">
  97. <el-dropdown-item
  98. @click.native="openEdit(scope.$index, scope.row)">修改子药
  99. </el-dropdown-item>
  100. <el-dropdown-item
  101. @click.native="openDeleteChild(scope.$index, scope.row)">删除子药
  102. </el-dropdown-item>
  103. </el-dropdown-menu>
  104. </el-dropdown>
  105. </template>
  106. </el-table-column>
  107. <el-table-column
  108. prop="amount1"
  109. align="center"
  110. label="药品规格">
  111. <!-- {{drugDesc(scope.row)}} -->
  112. <template slot-scope="scope">
  113. <span v-if="scope.row.advice_desc">{{scope.row.advice_desc}}{{scope.row.drug_spec_unit}}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column
  117. prop="amount2"
  118. width="90"
  119. align="center"
  120. label="开药数量">
  121. <template slot-scope="scope" v-if="scope.row.prescribing_number != ''">
  122. <span>{{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}</span>
  123. </template>
  124. </el-table-column>
  125. <el-table-column
  126. prop="amount2"
  127. width="90"
  128. align="center"
  129. label="单次用量">
  130. <template slot-scope="scope" v-if="scope.row.single_dose != ''">
  131. <span>{{scope.row.single_dose}}{{scope.row.single_dose_unit}}</span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column
  135. prop="amount3"
  136. align="center"
  137. label="给药途径">
  138. <template slot-scope="scope" v-if="scope.row.parent_id == 0">
  139. <span>{{scope.row.delivery_way}}</span>
  140. </template>
  141. </el-table-column>
  142. <el-table-column
  143. prop="amount3"
  144. align="center"
  145. label="执行频率">
  146. <template slot-scope="scope" v-if="scope.row.parent_id == 0">
  147. <span>{{scope.row.execution_frequency}}</span>
  148. </template>
  149. </el-table-column>
  150. <el-table-column prop="blood_flow_volume" align="center" label="提醒频率">
  151. <template slot-scope="scope">
  152. <span v-if="scope.row.advice_type == 1 &&scope.row.frequency_type == 1">每次必推</span>
  153. <span v-if="scope.row.advice_type == 1&&scope.row.frequency_type == 2">{{scope.row.day_count}}天/1次</span>
  154. <span v-if="scope.row.advice_type == 1&&scope.row.frequency_type == 3">每周{{scope.row.week_days}}</span>
  155. </template>
  156. </el-table-column>
  157. <el-table-column
  158. align="center"
  159. label="操作"
  160. width="180"
  161. class-name="small-padding fixed-width"
  162. >
  163. <template slot-scope="scope">
  164. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  165. <el-button
  166. type="primary"
  167. size="small"
  168. icon="el-icon-edit-outline"
  169. v-if="isShow(scope.$index, scope.row)"
  170. @click="handleUpdateAdviceTemplate(scope.row, scope.$index)"
  171. >
  172. </el-button>
  173. </el-tooltip>
  174. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  175. <el-button
  176. size="small"
  177. type="danger"
  178. icon="el-icon-delete"
  179. @click="handleDeleteAdviceTemplate(scope.row, scope.$index)"
  180. >
  181. </el-button>
  182. </el-tooltip>
  183. </template>
  184. </el-table-column>
  185. </el-table>
  186. <!--增删改查都是本地处理的dialog-->
  187. <el-dialog title="新增医嘱模版" :visible.sync="templateTableVisible" width="700px" :close-on-click-modal="false">
  188. <div>
  189. <el-form ref="form" :model="form" :rule="formRules" label-width="100px">
  190. <el-form-item label="模版名称" style="width: 300px" prop="name">
  191. <el-input v-model="form.name"></el-input>
  192. </el-form-item>
  193. <el-form-item label="模版类型" prop="advice_type">
  194. <el-radio-group v-model="form.advice_type">
  195. <el-radio :label="0">临时</el-radio>
  196. <el-radio :label="1">长期</el-radio>
  197. </el-radio-group>
  198. </el-form-item>
  199. </el-form>
  200. <div class="txsj" style="text-align: center;margin-bottom: 30px">
  201. <el-button round @click="newRecordAction">新增医嘱内容</el-button>
  202. <el-button round @click="modifyRecordAction">修改医嘱内容</el-button>
  203. <el-button round @click="deleteRecordAction">删除医嘱内容</el-button>
  204. </div>
  205. <el-table
  206. ref="table" :data="adviceTableData"
  207. border
  208. highlight-current-row
  209. max-height="300"
  210. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  211. :row-class-name="tableRow"
  212. @row-click="onRowClick"
  213. style="width: 100%">
  214. <el-table-column label="医嘱内容" align="center" width="144">
  215. <template slot-scope="scope">
  216. {{scope.row.advice_name}}
  217. </template>
  218. </el-table-column>
  219. <el-table-column align="center" label="药品规格">
  220. <template slot-scope="scope">
  221. <span v-if="scope.row.advice_desc">{{scope.row.advice_desc}}{{scope.row.drug_spec_unit}}</span>
  222. </template>
  223. </el-table-column>
  224. <el-table-column prop="prescribing_number" align="center" label="开药数量">
  225. <template slot-scope="scope" v-if="scope.row.prescribing_number != ''">
  226. {{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}
  227. </template>
  228. </el-table-column>
  229. <el-table-column prop="single_dose" align="center" label="单次用量">
  230. <template slot-scope="scope" v-if="scope.row.single_dose != ''">
  231. {{scope.row.single_dose}}{{scope.row.single_dose_unit}}
  232. </template>
  233. </el-table-column>
  234. <el-table-column prop="breathing_rate" align="center" label="给药途径">
  235. <template slot-scope="scope">
  236. {{scope.row.delivery_way}}
  237. </template>
  238. </el-table-column>
  239. <el-table-column prop="blood_flow_volume" align="center" label="执行频率">
  240. <template slot-scope="scope">
  241. {{scope.row.execution_frequency}}
  242. </template>
  243. </el-table-column>
  244. <el-table-column prop="blood_flow_volume" align="center" label="提醒频率" v-if="form.advice_type == 1">
  245. <template slot-scope="scope">
  246. <span v-if="scope.row.advice_type == 1 &&scope.row.frequency_type == 1">每次必推</span>
  247. <span v-if="scope.row.advice_type == 1 &&scope.row.frequency_type == 2">{{scope.row.day_count}}天/1次</span>
  248. <span v-if="scope.row.advice_type == 1 &&scope.row.frequency_type == 3">每周{{scope.row.weekdays}}</span>
  249. </template>
  250. </el-table-column>
  251. </el-table>
  252. </div>
  253. <div slot="footer" class="dialog-footer">
  254. <el-button @click="cancelTableHandle">取消</el-button>
  255. <el-button type="primary" @click="submitTableTemplate('form')">保 存</el-button>
  256. </div>
  257. </el-dialog>
  258. <el-dialog :title="dialogTitle" :visible.sync="templateFormVisible" width="700px">
  259. <el-form
  260. ref="templateForm"
  261. :rules="templateRules"
  262. :model="templateForm"
  263. label-width="90px"
  264. >
  265. <el-row>
  266. <el-col :span="12">
  267. <el-form-item label="医嘱内容 :" required prop="advice_name">
  268. <el-input v-model="templateForm.advice_name"></el-input>
  269. </el-form-item>
  270. </el-col>
  271. <el-col :span="12">
  272. <el-form-item label="药品规格 :" prop="advice_desc">
  273. <el-col :span="8">
  274. <el-input v-model="templateForm.advice_desc"></el-input>
  275. </el-col>
  276. <el-col class="line" :span="2">&nbsp;</el-col>
  277. <el-col :span="14">
  278. <el-select
  279. v-model="templateForm.drug_spec_unit"
  280. filterable
  281. clearable
  282. allow-create
  283. placeholder="选择"
  284. >
  285. <el-option
  286. v-for="item in unitsOption"
  287. :key="item.id"
  288. :label="item.name "
  289. :value="item.name"
  290. ></el-option>
  291. </el-select>
  292. </el-col>
  293. </el-form-item>
  294. </el-col>
  295. <el-col :span="12">
  296. <el-form-item label="开药数量 :" prop="prescribing_number">
  297. <el-col :span="9">
  298. <el-input v-model="templateForm.prescribing_number"></el-input>
  299. </el-col>
  300. <el-col class="line" :span="1">&nbsp;</el-col>
  301. <el-col :span="14">
  302. <el-select
  303. v-model="templateForm.prescribing_number_unit"
  304. filterable
  305. clearable
  306. allow-create
  307. placeholder="选择"
  308. >
  309. <el-option
  310. v-for="item in unitsOption"
  311. :key="item.id"
  312. :label="item.name "
  313. :value="item.name"
  314. ></el-option>
  315. </el-select>
  316. </el-col>
  317. </el-form-item>
  318. </el-col>
  319. <el-col :span="12">
  320. <el-form-item label="单次用量 :" prop="single_dose">
  321. <el-col :span="9">
  322. <el-input v-model="templateForm.single_dose"></el-input>
  323. </el-col>
  324. <el-col class="line" :span="1">&nbsp;</el-col>
  325. <el-col :span="14">
  326. <el-select
  327. v-model="templateForm.single_dose_unit"
  328. filterable
  329. clearable
  330. allow-create
  331. placeholder="选择"
  332. >
  333. <el-option
  334. v-for="item in unitsOption"
  335. :key="item.id"
  336. :label="item.name "
  337. :value="item.name"
  338. ></el-option>
  339. </el-select>
  340. </el-col>
  341. </el-form-item>
  342. </el-col>
  343. <el-col :span="12" v-if="!isAddChild">
  344. <el-form-item label="给药途径 :" prop="delivery_way">
  345. <el-select
  346. v-model="templateForm.delivery_way"
  347. filterable
  348. clearable
  349. allow-create
  350. placeholder="请选择(输入可搜索)"
  351. style="width:100%"
  352. >
  353. <el-option
  354. v-for="item in drugways"
  355. :key="item.id"
  356. :label="item.name "
  357. :value="item.name"
  358. ></el-option>
  359. </el-select>
  360. </el-form-item>
  361. </el-col>
  362. <el-col :span="12" v-if="!isAddChild">
  363. <el-form-item label="执行频率 :" prop="execution_frequency">
  364. <el-select
  365. v-model="templateForm.execution_frequency"
  366. clearable
  367. allow-create
  368. filterable
  369. placeholder="请选择(输入可搜索)"
  370. style="width:100%"
  371. >
  372. <el-option
  373. v-for="item in executionFrequencyOptions"
  374. :key="item.id"
  375. :label="item.name"
  376. :value="item.name"
  377. ></el-option>
  378. </el-select>
  379. </el-form-item>
  380. </el-col>
  381. <el-col :span="24" v-if="form.advice_type&&!isAddChild">
  382. <el-form-item label="周期提醒 :">
  383. <el-radio-group v-model="templateForm.frequency_type">
  384. <el-radio :label="1">每次必推</el-radio>
  385. <el-radio :label="2">天数频率</el-radio>
  386. <el-radio :label="3">星期频率</el-radio>
  387. </el-radio-group>
  388. </el-form-item>
  389. </el-col>
  390. <el-col :span="12" v-if="templateForm.frequency_type == 2">
  391. <el-form-item prop="day_count">
  392. <el-input style="width: 50px" v-model="templateForm.day_count"></el-input>&nbsp;
  393. 天/一次
  394. </el-form-item>
  395. </el-col>
  396. <el-col :span="24" v-if="templateForm.frequency_type == 3">
  397. <el-form-item prop="weekday">
  398. <el-checkbox-group v-model="templateForm.weekday">
  399. <el-checkbox label="周一" name="type"></el-checkbox>
  400. <el-checkbox label="周二" name="type"></el-checkbox>
  401. <el-checkbox label="周三" name="type"></el-checkbox>
  402. <el-checkbox label="周四" name="type"></el-checkbox>
  403. <el-checkbox label="周五" name="type"></el-checkbox>
  404. <el-checkbox label="周六" name="type"></el-checkbox>
  405. <el-checkbox label="周日" name="type"></el-checkbox>
  406. </el-checkbox-group>
  407. </el-form-item>
  408. </el-col>
  409. </el-row>
  410. </el-form>
  411. <div slot="footer" class="dialog-footer">
  412. <el-button @click="cancelHandle('templateForm')">取消</el-button>
  413. <el-button type="primary" @click="submitTemplate('templateForm')">保 存</el-button>
  414. </div>
  415. </el-dialog>
  416. <!--TODO-->
  417. <el-dialog :title="editDialogTitle" :visible.sync="templateEditFormVisible" width="700px">
  418. <el-form
  419. ref="templateFormEdit"
  420. :rules="templateEditRules"
  421. :model="templateFormEdit"
  422. label-width="90px"
  423. >
  424. <el-row>
  425. <el-col :span="12">
  426. <el-form-item :label="edit_advice_name" required prop="advice_name">
  427. <el-input v-model="templateFormEdit.advice_name"></el-input>
  428. </el-form-item>
  429. </el-col>
  430. <el-col :span="12">
  431. <el-form-item label="药品规格 :" prop="advice_desc">
  432. <el-col :span="8">
  433. <el-input v-model="templateFormEdit.advice_desc"></el-input>
  434. </el-col>
  435. <el-col class="line" :span="1">&nbsp;</el-col>
  436. <el-col :span="14">
  437. <el-select
  438. v-model="templateFormEdit.drug_spec_unit"
  439. filterable
  440. clearable
  441. allow-create
  442. placeholder="选择"
  443. >
  444. <el-option
  445. v-for="item in unitsOption"
  446. :key="item.id"
  447. :label="item.name "
  448. :value="item.name"
  449. ></el-option>
  450. </el-select>
  451. </el-col>
  452. </el-form-item>
  453. </el-col>
  454. <el-col :span="12">
  455. <el-form-item label="开药数量 :" prop="prescribing_number">
  456. <el-col :span="9">
  457. <el-input v-model="templateFormEdit.prescribing_number"></el-input>
  458. </el-col>
  459. <el-col class="line" :span="1">&nbsp;</el-col>
  460. <el-col :span="14">
  461. <el-select
  462. v-model="templateFormEdit.prescribing_number_unit"
  463. filterable
  464. clearable
  465. allow-create
  466. placeholder="选择"
  467. >
  468. <el-option
  469. v-for="item in unitsOption"
  470. :key="item.id"
  471. :label="item.name "
  472. :value="item.name"
  473. ></el-option>
  474. </el-select>
  475. </el-col>
  476. </el-form-item>
  477. </el-col>
  478. <el-col :span="12">
  479. <el-form-item label="单次用量 :" prop="single_dose">
  480. <el-col :span="9">
  481. <el-input v-model="templateFormEdit.single_dose"></el-input>
  482. </el-col>
  483. <el-col class="line" :span="1">&nbsp;</el-col>
  484. <el-col :span="14">
  485. <el-select
  486. v-model="templateFormEdit.single_dose_unit"
  487. filterable
  488. clearable
  489. allow-create
  490. placeholder="选择"
  491. >
  492. <el-option
  493. v-for="item in unitsOption"
  494. :key="item.id"
  495. :label="item.name "
  496. :value="item.name"
  497. ></el-option>
  498. </el-select>
  499. </el-col>
  500. </el-form-item>
  501. </el-col>
  502. <el-col :span="12" v-if="templateFormEdit.parent_id == 0">
  503. <el-form-item label="给药途径 :" prop="delivery_way">
  504. <el-select
  505. v-model="templateFormEdit.delivery_way"
  506. filterable
  507. clearable
  508. allow-create
  509. placeholder="请选择(输入可搜索)"
  510. style="width:100%"
  511. >
  512. <el-option
  513. v-for="item in drugways"
  514. :key="item.id"
  515. :label="item.name "
  516. :value="item.name"
  517. ></el-option>
  518. </el-select>
  519. </el-form-item>
  520. </el-col>
  521. <el-col :span="12" v-if="templateFormEdit.parent_id == 0">
  522. <el-form-item label="执行频率 :" prop="execution_frequency">
  523. <el-select
  524. v-model="templateFormEdit.execution_frequency"
  525. clearable
  526. allow-create
  527. filterable
  528. placeholder="请选择(输入可搜索)"
  529. style="width:100%"
  530. >
  531. <el-option
  532. v-for="item in executionFrequencyOptions"
  533. :key="item.id"
  534. :label="item.name"
  535. :value="item.name"
  536. ></el-option>
  537. </el-select>
  538. </el-form-item>
  539. </el-col>
  540. <el-col :span="24">
  541. <el-form-item label="周期提醒 :">
  542. <el-radio-group v-model="templateFormEdit.frequency_type">
  543. <el-radio :label="1">每次必推</el-radio>
  544. <el-radio :label="2">天数频率</el-radio>
  545. <el-radio :label="3">星期频率</el-radio>
  546. </el-radio-group>
  547. </el-form-item>
  548. </el-col>
  549. <el-col :span="12" v-if="templateFormEdit.frequency_type == 2">
  550. <el-form-item prop="day_count">
  551. <el-input style="width: 50px" v-model="templateFormEdit.day_count"></el-input>&nbsp;
  552. 天/一次
  553. </el-form-item>
  554. </el-col>
  555. <el-col :span="24" v-if="templateFormEdit.frequency_type == 3">
  556. <el-form-item>
  557. <el-checkbox-group v-model="templateFormEdit.weekday">
  558. <el-checkbox label="周一" name="type"></el-checkbox>
  559. <el-checkbox label="周二" name="type"></el-checkbox>
  560. <el-checkbox label="周三" name="type"></el-checkbox>
  561. <el-checkbox label="周四" name="type"></el-checkbox>
  562. <el-checkbox label="周五" name="type"></el-checkbox>
  563. <el-checkbox label="周六" name="type"></el-checkbox>
  564. <el-checkbox label="周日" name="type"></el-checkbox>
  565. </el-checkbox-group>
  566. </el-form-item>
  567. </el-col>
  568. </el-row>
  569. </el-form>
  570. <div slot="footer" class="dialog-footer">
  571. <el-button @click="cancelEditHandle">取消</el-button>
  572. <el-button type="primary" @click="submitEditTemplate('templateFormEdit')">保 存</el-button>
  573. </div>
  574. </el-dialog>
  575. <!--增删改查都请求网络类型的dialog-->
  576. <el-dialog title="编辑医嘱模版" :visible.sync="templateTableTwoVisible" width="800px">
  577. <div>
  578. <!--<el-form ref="form" :model="form" :rule="formRules" label-width="100px">-->
  579. <!--<el-form-item label="模版名称" style="width: 300px" prop="name">-->
  580. <!--<el-input v-model="form.name" ></el-input>-->
  581. <!--</el-form-item>-->
  582. <!--</el-form>-->
  583. <div class="txsj" style="text-align: center;margin-bottom: 30px">
  584. <el-button round @click="newRecordActionTwo">新增医嘱内容</el-button>
  585. <!--<el-button round @click="deleteRecordActionTwo">删除医嘱内容</el-button>-->
  586. <!--<el-button round @click="modifyRecordActionTwo">修改医嘱内容</el-button>-->
  587. </div>
  588. <el-table :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" ref="table"
  589. :data="adviceTableDataTwo" border highlight-current-row max-height="300">
  590. <el-table-column label="医嘱内容">
  591. <template slot-scope="scope">
  592. <span v-if="scope.row.parent_id == 0">{{scope.row.advice_name}}</span>
  593. <span v-if="scope.row.parent_id > 0"> &emsp;{{scope.row.advice_name}}</span>
  594. </template>
  595. </el-table-column>
  596. <el-table-column align="center" label="药品规格">
  597. <!-- {{drugDesc(scope.row)}} -->
  598. <template slot-scope="scope">
  599. <span v-if="scope.row.advice_desc">{{scope.row.advice_desc}}{{scope.row.drug_spec_unit}}</span>
  600. </template>
  601. </el-table-column>
  602. <el-table-column prop="prescribing_number" align="center" label="开药数量">
  603. <template slot-scope="scope" v-if="scope.row.prescribing_number != ''">
  604. {{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}
  605. </template>
  606. </el-table-column>
  607. <el-table-column align="center" label="单次用量">
  608. <template slot-scope="scope" v-if="scope.row.single_dose != ''">
  609. {{scope.row.single_dose}}{{scope.row.single_dose_unit}}
  610. </template>
  611. </el-table-column>
  612. <el-table-column align="center" label="给药途径">
  613. <template slot-scope="scope">
  614. <span v-if="scope.row.parent_id == 0">{{scope.row.delivery_way}}</span>
  615. </template>
  616. </el-table-column>
  617. <el-table-column align="center" label="执行频率">
  618. <template slot-scope="scope">
  619. <span v-if="scope.row.parent_id == 0">{{scope.row.execution_frequency}}</span>
  620. </template>
  621. </el-table-column>
  622. <el-table-column align="center" label="提醒频率" v-if="form.advice_type == 1">
  623. <template slot-scope="scope">
  624. <span v-if="scope.row.frequency_type == 1">每次必推</span>
  625. <span v-if="scope.row.frequency_type == 2">{{scope.row.day_count}}天/1次</span>
  626. <span v-if="scope.row.frequency_type == 3">每周{{scope.row.week_days}}</span>
  627. </template>
  628. </el-table-column>
  629. </el-table>
  630. </div>
  631. <div slot="footer" class="dialog-footer">
  632. <el-button @click="cancelTableHandleTwo">取消</el-button>
  633. <el-button type="primary" @click="modifyTemplateName">保 存</el-button>
  634. </div>
  635. </el-dialog>
  636. <el-dialog title="新增医嘱" :visible.sync="templateFormTwoVisible" width="700px">
  637. <el-form
  638. ref="templateForm"
  639. :rules="templateEditRules"
  640. :model="templateForm"
  641. label-width="90px"
  642. >
  643. <el-row>
  644. <el-col :span="12">
  645. <el-form-item label="医嘱内容 :" required prop="advice_name">
  646. <el-input v-model="templateForm.advice_name"></el-input>
  647. </el-form-item>
  648. </el-col>
  649. <el-col :span="12">
  650. <el-form-item label="药品规格 :" prop="advice_desc">
  651. <el-col :span="9">
  652. <el-input v-model="templateForm.advice_desc"></el-input>
  653. </el-col>
  654. <el-col class="line" :span="1">&nbsp;</el-col>
  655. <el-col :span="14">
  656. <el-select
  657. v-model="templateForm.drug_spec_unit"
  658. filterable
  659. clearable
  660. allow-create
  661. placeholder="选择"
  662. >
  663. <el-option
  664. v-for="item in unitsOption"
  665. :key="item.id"
  666. :label="item.name "
  667. :value="item.name"
  668. ></el-option>
  669. </el-select>
  670. </el-col>
  671. </el-form-item>
  672. </el-col>
  673. <el-col :span="12">
  674. <el-form-item label="开药数量 :" prop="prescribing_number">
  675. <el-col :span="9">
  676. <el-input v-model="templateForm.prescribing_number"></el-input>
  677. </el-col>
  678. <el-col class="line" :span="1">&nbsp;</el-col>
  679. <el-col :span="14">
  680. <el-select
  681. v-model="templateForm.prescribing_number_unit"
  682. filterable
  683. clearable
  684. allow-create
  685. placeholder="选择"
  686. >
  687. <el-option
  688. v-for="item in unitsOption"
  689. :key="item.id"
  690. :label="item.name "
  691. :value="item.name"
  692. ></el-option>
  693. </el-select>
  694. </el-col>
  695. </el-form-item>
  696. </el-col>
  697. <el-col :span="12">
  698. <el-form-item label="单次用量 :" prop="single_dose">
  699. <el-col :span="9">
  700. <el-input v-model="templateForm.single_dose"></el-input>
  701. </el-col>
  702. <el-col class="line" :span="1">&nbsp;</el-col>
  703. <el-col :span="14">
  704. <el-select
  705. v-model="templateForm.single_dose_unit"
  706. filterable
  707. clearable
  708. allow-create
  709. placeholder="选择"
  710. >
  711. <el-option
  712. v-for="item in unitsOption"
  713. :key="item.id"
  714. :label="item.name "
  715. :value="item.name"
  716. ></el-option>
  717. </el-select>
  718. </el-col>
  719. </el-form-item>
  720. </el-col>
  721. <el-col :span="12">
  722. <el-form-item label="给药途径 :" prop="delivery_way">
  723. <el-select
  724. v-model="templateForm.delivery_way"
  725. filterable
  726. clearable
  727. allow-create
  728. placeholder="请选择(输入可搜索)"
  729. style="width:100%"
  730. >
  731. <el-option
  732. v-for="item in drugways"
  733. :key="item.id"
  734. :label="item.name "
  735. :value="item.name"
  736. ></el-option>
  737. </el-select>
  738. </el-form-item>
  739. </el-col>
  740. <el-col :span="12">
  741. <el-form-item label="执行频率 :" prop="execution_frequency">
  742. <el-select
  743. v-model="templateForm.execution_frequency"
  744. clearable
  745. allow-create
  746. filterable
  747. placeholder="请选择(输入可搜索)"
  748. style="width:100%"
  749. >
  750. <el-option
  751. v-for="item in executionFrequencyOptions"
  752. :key="item.id"
  753. :label="item.name"
  754. :value="item.name"
  755. ></el-option>
  756. </el-select>
  757. </el-form-item>
  758. </el-col>
  759. <el-col :span="24" v-if="form.advice_type == 1">
  760. <el-form-item label="周期提醒 :">
  761. <el-radio-group v-model="templateForm.frequency_type">
  762. <el-radio :label="1">每次必推</el-radio>
  763. <el-radio :label="2">天数频率</el-radio>
  764. <el-radio :label="3">星期频率</el-radio>
  765. </el-radio-group>
  766. </el-form-item>
  767. </el-col>
  768. <el-col :span="12" v-if="templateForm.frequency_type == 2">
  769. <el-form-item prop="day_count">
  770. <el-input style="width: 50px" v-model="templateForm.day_count"></el-input>&nbsp;
  771. 天/一次
  772. </el-form-item>
  773. </el-col>
  774. <el-col :span="24" v-if="templateForm.frequency_type == 3">
  775. <el-form-item>
  776. <el-checkbox-group v-model="templateForm.weekday">
  777. <el-checkbox label="周一" name="type"></el-checkbox>
  778. <el-checkbox label="周二" name="type"></el-checkbox>
  779. <el-checkbox label="周三" name="type"></el-checkbox>
  780. <el-checkbox label="周四" name="type"></el-checkbox>
  781. <el-checkbox label="周五" name="type"></el-checkbox>
  782. <el-checkbox label="周六" name="type"></el-checkbox>
  783. <el-checkbox label="周日" name="type"></el-checkbox>
  784. </el-checkbox-group>
  785. </el-form-item>
  786. </el-col>
  787. </el-row>
  788. </el-form>
  789. <div slot="footer" class="dialog-footer">
  790. <el-button @click="cancelHandleTwo">取消</el-button>
  791. <el-button type="primary" @click="submitTemplateTwo('templateForm')">保 存</el-button>
  792. </div>
  793. </el-dialog>
  794. <!--<el-dialog title="编辑医嘱" :visible.sync="templateEditFormTwoVisible" width="700px">-->
  795. <!--<el-form-->
  796. <!--ref="templateFormEdit"-->
  797. <!--:rules="templateEditRules"-->
  798. <!--:model="templateFormEdit"-->
  799. <!--label-width="90px"-->
  800. <!--&gt;-->
  801. <!--<el-form-item label="医嘱名称 :" required prop="advice_name">-->
  802. <!--<el-input v-model="templateFormEdit.advice_name" style="width:50%"></el-input>-->
  803. <!--</el-form-item>-->
  804. <!--<el-row>-->
  805. <!--<el-col :span="12">-->
  806. <!--<el-form-item label="药品规格 :" prop="drug_spec">-->
  807. <!--<el-col :span="8">-->
  808. <!--<el-input v-model="templateFormEdit.drug_spec"></el-input>-->
  809. <!--</el-col>-->
  810. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  811. <!--<el-col :span="14">-->
  812. <!--<el-select-->
  813. <!--v-model="templateFormEdit.drug_spec_unit"-->
  814. <!--filterable-->
  815. <!--clearable-->
  816. <!--allow-create-->
  817. <!--placeholder="选择"-->
  818. <!--&gt;-->
  819. <!--<el-option-->
  820. <!--v-for="item in unitsOption"-->
  821. <!--:key="item.id"-->
  822. <!--:label="item.name "-->
  823. <!--:value="item.name"-->
  824. <!--&gt;</el-option>-->
  825. <!--</el-select>-->
  826. <!--</el-col>-->
  827. <!--</el-form-item>-->
  828. <!--</el-col>-->
  829. <!--<el-col :span="12">-->
  830. <!--<el-form-item label="单次用量 :" prop="single_dose">-->
  831. <!--<el-col :span="8">-->
  832. <!--<el-input v-model="templateFormEdit.single_dose"></el-input>-->
  833. <!--</el-col>-->
  834. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  835. <!--<el-col :span="14">-->
  836. <!--<el-select-->
  837. <!--v-model="templateFormEdit.single_dose_unit"-->
  838. <!--filterable-->
  839. <!--clearable-->
  840. <!--allow-create-->
  841. <!--placeholder="选择"-->
  842. <!--&gt;-->
  843. <!--<el-option-->
  844. <!--v-for="item in unitsOption"-->
  845. <!--:key="item.id"-->
  846. <!--:label="item.name "-->
  847. <!--:value="item.name"-->
  848. <!--&gt;</el-option>-->
  849. <!--</el-select>-->
  850. <!--</el-col>-->
  851. <!--</el-form-item>-->
  852. <!--</el-col>-->
  853. <!--<el-col :span="12">-->
  854. <!--<el-form-item label="开药数量 :" prop="prescribing_number">-->
  855. <!--<el-col :span="8">-->
  856. <!--<el-input v-model="templateFormEdit.prescribing_number"></el-input>-->
  857. <!--</el-col>-->
  858. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  859. <!--<el-col :span="14">-->
  860. <!--<el-select-->
  861. <!--v-model="templateFormEdit.prescribing_number_unit"-->
  862. <!--filterable-->
  863. <!--clearable-->
  864. <!--allow-create-->
  865. <!--placeholder="选择"-->
  866. <!--&gt;-->
  867. <!--<el-option-->
  868. <!--v-for="item in unitsOption"-->
  869. <!--:key="item.id"-->
  870. <!--:label="item.name "-->
  871. <!--:value="item.name"-->
  872. <!--&gt;</el-option>-->
  873. <!--</el-select>-->
  874. <!--</el-col>-->
  875. <!--</el-form-item>-->
  876. <!--</el-col>-->
  877. <!--<el-col :span="12">-->
  878. <!--<el-form-item label="给药途径 :" prop="delivery_way">-->
  879. <!--<el-select-->
  880. <!--v-model="templateFormEdit.delivery_way"-->
  881. <!--filterable-->
  882. <!--clearable-->
  883. <!--allow-create-->
  884. <!--placeholder="请选择(输入可搜索)"-->
  885. <!--style="width:90%"-->
  886. <!--&gt;-->
  887. <!--<el-option-->
  888. <!--v-for="item in drugways"-->
  889. <!--:key="item.id"-->
  890. <!--:label="item.name "-->
  891. <!--:value="item.name"-->
  892. <!--&gt;</el-option>-->
  893. <!--</el-select>-->
  894. <!--</el-form-item>-->
  895. <!--</el-col>-->
  896. <!--</el-row>-->
  897. <!--<el-row>-->
  898. <!--<el-col :span="12">-->
  899. <!--<el-form-item label="执行频率 :" prop="execution_frequency">-->
  900. <!--<el-select-->
  901. <!--v-model="templateFormEdit.execution_frequency"-->
  902. <!--clearable-->
  903. <!--allow-create-->
  904. <!--filterable-->
  905. <!--placeholder="请选择(输入可搜索)"-->
  906. <!--style="width:90%"-->
  907. <!--&gt;-->
  908. <!--<el-option-->
  909. <!--v-for="item in executionFrequencyOptions"-->
  910. <!--:key="item.id"-->
  911. <!--:label="item.name"-->
  912. <!--:value="item.name"-->
  913. <!--&gt;</el-option>-->
  914. <!--</el-select>-->
  915. <!--</el-form-item>-->
  916. <!--</el-col>-->
  917. <!--</el-row>-->
  918. <!--</el-form>-->
  919. <!--<div slot="footer" class="dialog-footer">-->
  920. <!--<el-button @click="cancelEditHandleTwo">取消</el-button>-->
  921. <!--<el-button type="primary" @click="submitEditTemplateTwo('templateFormEdit')">保 存</el-button>-->
  922. <!--</div>-->
  923. <!--</el-dialog>-->
  924. </div>
  925. </el-tab-pane>
  926. <el-tab-pane label="给药途径">
  927. <div class="">
  928. <div class="filter-container">
  929. <el-button
  930. class="filter-item"
  931. style="margin-left: 10px;"
  932. @click="handleCreateDrugWay"
  933. type="primary"
  934. icon="el-icon-circle-plus-outline"
  935. size="small"
  936. >{{$t('table.add')}}
  937. </el-button>
  938. </div>
  939. <el-table
  940. :data="drugways"
  941. border
  942. fit
  943. :row-style="{ color: '#303133' }"
  944. :header-cell-style="{
  945. backgroundColor: 'rgb(245, 247, 250)',
  946. color: '#606266'
  947. }"
  948. highlight-current-row
  949. style="width: 100%;min-height:500px;"
  950. >
  951. <el-table-column align="center" label="名称">
  952. <template slot-scope="scope">
  953. <span>{{scope.row.name}}</span>
  954. </template>
  955. </el-table-column>
  956. <el-table-column
  957. align="center"
  958. :label="$t('table.actions')"
  959. width="230"
  960. class-name="small-padding fixed-width"
  961. >
  962. <template slot-scope="scope">
  963. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  964. <el-button
  965. v-show="scope.row.org_id!=0"
  966. type="primary"
  967. size="small"
  968. icon="el-icon-edit-outline"
  969. @click="handleUpdateDrugWay(scope.row, scope.$index)"
  970. >
  971. </el-button>
  972. <el-button
  973. v-show="scope.row.org_id!=0"
  974. size="small"
  975. type="danger"
  976. icon="el-icon-delete"
  977. @click="handleDeleteDrugWay(scope.row, scope.$index)"
  978. >
  979. </el-button>
  980. </template>
  981. </el-table-column>
  982. </el-table>
  983. <el-dialog :title="dialogTitle" :visible.sync="drugwayFormVisible" width="700px">
  984. <el-form
  985. ref="drugwayForm"
  986. :rules="drugwayRules"
  987. :model="drugwayForm"
  988. label-width="90px"
  989. >
  990. <el-form-item label="给药途径 :" required prop="name">
  991. <el-input v-model="drugwayForm.name" placeholder="给药途径"></el-input>
  992. </el-form-item>
  993. </el-form>
  994. <div slot="footer" class="dialog-footer">
  995. <el-button @click="drugwayFormVisible = false">取消</el-button>
  996. <el-button type="primary" @click="submitDrugWay('drugwayForm')">保 存</el-button>
  997. </div>
  998. </el-dialog>
  999. </div>
  1000. </el-tab-pane>
  1001. <el-tab-pane label="执行频率">
  1002. <div class="">
  1003. <div class="filter-container">
  1004. <el-button
  1005. class="filter-item"
  1006. style="margin-left: 10px;"
  1007. @click="handleCreateEF"
  1008. type="primary"
  1009. icon="el-icon-circle-plus-outline"
  1010. size="small"
  1011. >{{$t('table.add')}}
  1012. </el-button>
  1013. </div>
  1014. <el-table
  1015. :data="executionFrequencyOptions"
  1016. border
  1017. fit
  1018. :row-style="{ color: '#303133' }"
  1019. :header-cell-style="{
  1020. backgroundColor: 'rgb(245, 247, 250)',
  1021. color: '#606266'
  1022. }"
  1023. highlight-current-row
  1024. style="width: 100%;min-height:500px;"
  1025. >
  1026. <el-table-column align="center" label="名称">
  1027. <template slot-scope="scope">
  1028. <span>{{scope.row.name}}</span>
  1029. </template>
  1030. </el-table-column>
  1031. <el-table-column
  1032. align="center"
  1033. :label="$t('table.actions')"
  1034. width="230"
  1035. class-name="small-padding fixed-width"
  1036. >
  1037. <template slot-scope="scope">
  1038. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  1039. <el-button
  1040. v-show="scope.row.org_id!=0"
  1041. type="primary"
  1042. size="small"
  1043. icon="el-icon-edit-outline"
  1044. @click="handleUpdateEF(scope.row, scope.$index)"
  1045. >
  1046. </el-button>
  1047. <el-button
  1048. v-show="scope.row.org_id!=0"
  1049. size="small"
  1050. type="danger"
  1051. icon="el-icon-delete"
  1052. @click="handleDeleteEF(scope.row, scope.$index)"
  1053. >
  1054. </el-button>
  1055. </template>
  1056. </el-table-column>
  1057. </el-table>
  1058. <el-dialog :title="dialogTitle" :visible.sync="efFormVisible" width="700px">
  1059. <el-form ref="efForm" :rules="efRules" :model="efForm" label-width="90px">
  1060. <el-form-item label="执行频率 :" required prop="name">
  1061. <el-input v-model="efForm.name" placeholder="执行频率"></el-input>
  1062. </el-form-item>
  1063. </el-form>
  1064. <div slot="footer" class="dialog-footer">
  1065. <el-button @click="efFormVisible = false">取消</el-button>
  1066. <el-button type="primary" @click="submitEF('efForm')">保 存</el-button>
  1067. </div>
  1068. </el-dialog>
  1069. </div>
  1070. </el-tab-pane>
  1071. </el-tabs>
  1072. </div>
  1073. </div>
  1074. </template>
  1075. <style>
  1076. @import "../../../static/css/table_row.css";
  1077. .filter-item {
  1078. float: right;
  1079. }
  1080. </style>
  1081. <script>
  1082. import {
  1083. CreateAdviceTemplate,
  1084. CreateDrugDic,
  1085. CreateDrugWay,
  1086. CreateExecutionFrequency,
  1087. CreateSingleAdviceTemplate,
  1088. CreateSubAdvice,
  1089. DeleteAdviceTemplate,
  1090. DeleteDrugDic,
  1091. DeleteDrugWay,
  1092. DeleteExecutionFrequency,
  1093. DeleteParentAdviceTemplate,
  1094. getAllAdviceConfig,
  1095. getAllAdviceTemplate,
  1096. postAdviceTemplate,
  1097. UpdateAdviceTemplate,
  1098. UpdateDrugDic,
  1099. UpdateDrugWay,
  1100. UpdateExecutionFrequency,
  1101. updateTemplateName,
  1102. getDoctorAdviceConfig,
  1103. postDoctorAdviceConfig,
  1104. PostInitAdviceTemplate,
  1105. getDoctorInitConfig,
  1106. } from '@/api/advice'
  1107. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  1108. import { getDataConfig } from '@/utils/data'
  1109. export default {
  1110. name: 'tab',
  1111. components: { BreadCrumb },
  1112. data() {
  1113. return {
  1114. day_count: '',
  1115. crumbs: [
  1116. { path: false, name: '管理中心' },
  1117. { path: 'data/druguse', name: '医嘱模版' }
  1118. ],
  1119. rowIndex: -1,
  1120. current_template_id: 0,
  1121. currentObject: {},
  1122. tempArr: [],
  1123. sameRowArr: [],
  1124. advice_content_name: '',
  1125. table_current_index: -1,
  1126. adviceTableData: [],
  1127. templateName: '',
  1128. adviceTableDataTwo: [],
  1129. table_current_index_two: -1,
  1130. currentIndex: -1,
  1131. isEdit: false,
  1132. dialogTitle: '',
  1133. is_open_remind:0,
  1134. is_init:0,
  1135. isAddChild: false,
  1136. parent_id: 0,
  1137. editDialogTitle: '编辑医嘱',
  1138. drugdicFormVisible: false,
  1139. drugwayFormVisible: false,
  1140. templateFormVisible: false,
  1141. templateTableTwoVisible: false,
  1142. templateEditFormVisible: false,
  1143. edit_advice_name: '',
  1144. templateTableVisible: false,
  1145. templateFormTwoVisible: false,
  1146. templateEditFormTwoVisible: false,
  1147. efFormVisible: false,
  1148. activeName: 'drugdic',
  1149. hoverOrderArr: [],
  1150. createdTimes: 0,
  1151. drugdics: [],
  1152. adviceTemplates: [],
  1153. current_template_name: '',
  1154. editForm: {
  1155. name: ''
  1156. },
  1157. loading:false,
  1158. drugways: [],
  1159. executionFrequencyOptions: [],
  1160. drugdicRules: {
  1161. name: [{ required: true, message: '请填写医嘱内容' }]
  1162. },
  1163. formRules: {
  1164. name: [
  1165. { required: true, message: '请输入模版名称', trigger: 'blur' }
  1166. ],
  1167. advice_type: [
  1168. { required: true, message: '请选择模版类型', trigger: 'change' }
  1169. ]
  1170. },
  1171. drugwayRules: {
  1172. name: [{ required: true, message: '请填写给药途径' }]
  1173. },
  1174. efRules: {
  1175. name: [{ required: true, message: '请填写执行频率' }]
  1176. },
  1177. templateRules: {
  1178. advice_name: [{ required: true, message: '请填写医嘱内容' }]
  1179. },
  1180. templateEditRules: {
  1181. advice_name: [{ required: true, message: '请填写医嘱内容' }]
  1182. },
  1183. templateForm: {
  1184. frequency_type: 1,
  1185. day_count: '',
  1186. weekday: [],
  1187. drug_spec: '',
  1188. drug_spec_unit: '',
  1189. advice_name: '',
  1190. advice_desc: '',
  1191. single_dose: '',
  1192. single_dose_unit: '',
  1193. prescribing_number: '',
  1194. prescribing_number_unit: '',
  1195. delivery_way: '',
  1196. execution_frequency: '',
  1197. id: 0
  1198. },
  1199. dialogConfigVisible:false,
  1200. templateFormEdit: {
  1201. frequency_type: 0,
  1202. day_count: '',
  1203. weekday: [],
  1204. week_days: '',
  1205. drug_spec: '',
  1206. drug_spec_unit: '',
  1207. advice_name: '',
  1208. advice_desc: '',
  1209. single_dose: '',
  1210. single_dose_unit: '',
  1211. prescribing_number: '',
  1212. prescribing_number_unit: '',
  1213. delivery_way: '',
  1214. execution_frequency: '',
  1215. id: 0
  1216. },
  1217. drugdicForm: {
  1218. name: '',
  1219. spec: '',
  1220. spec_unit: '',
  1221. form: '',
  1222. form_unit: '',
  1223. id: 0
  1224. },
  1225. form: {
  1226. name: '',
  1227. advice_type: 0
  1228. },
  1229. drugwayForm: {
  1230. name: '',
  1231. id: 0
  1232. },
  1233. efForm: {
  1234. name: '',
  1235. id: 0
  1236. },
  1237. drugforms: [
  1238. { lable: 1, name: '胶囊' },
  1239. { lable: 2, name: '注射剂' },
  1240. { lable: 3, name: '片剂' },
  1241. { lable: 4, name: '注射液' },
  1242. { lable: 5, name: '栓剂' },
  1243. { lable: 6, name: '膏' },
  1244. { lable: 7, name: '颗粒剂' },
  1245. { lable: 8, name: '粉剂' },
  1246. { lable: 9, name: '口服液' },
  1247. { lable: 10, name: '干混悬剂' },
  1248. { lable: 11, name: '丸剂' },
  1249. { lable: 12, name: '气雾剂' },
  1250. { lable: 13, name: '内服溶液' },
  1251. { lable: 14, name: '外用溶液' },
  1252. { lable: 15, name: '软膏剂' },
  1253. { lable: 16, name: '胶剂' }
  1254. ]
  1255. }
  1256. },
  1257. created() {
  1258. this.getAdviceConfig()
  1259. this.unitsOption = getDataConfig('hemodialysis', 'units')
  1260. this.getDoctorAdviceConfig()
  1261. this.getDoctorInitConfig()
  1262. },
  1263. methods: {
  1264. initAdvice(){
  1265. this.$confirm('是否进行医嘱初始化操作?', '提示', {
  1266. confirmButtonText: '确定',
  1267. cancelButtonText: '取消',
  1268. type: 'warning'
  1269. }).then(() => {
  1270. let params = {
  1271. is_init:1
  1272. }
  1273. this.loading = true
  1274. PostInitAdviceTemplate(params).then(response => {
  1275. if (response.data.state == 1) {
  1276. this.is_init = response.data.data.init_config.is_init
  1277. this.getAdviceConfig()
  1278. this.loading = false
  1279. } else {
  1280. this.loading = false
  1281. this.$message.error(response.data.msg)
  1282. }
  1283. })
  1284. }).catch(() => {
  1285. this.loading = false
  1286. });
  1287. },
  1288. getDoctorAdviceConfig(){
  1289. getDoctorAdviceConfig().then(response => {
  1290. if (response.data.state == 1) {
  1291. this.is_open_remind = response.data.data.config.is_open_remind
  1292. } else {
  1293. this.$message.error(response.data.msg)
  1294. }
  1295. })
  1296. },
  1297. getDoctorInitConfig(){
  1298. getDoctorInitConfig().then(response => {
  1299. if (response.data.state == 1) {
  1300. if(response.data.data.advice_init == null){
  1301. this.is_init = 0
  1302. }else{
  1303. this.is_init = response.data.data.advice_init.is_init
  1304. }
  1305. } else {
  1306. this.$message.error(response.data.msg)
  1307. }
  1308. })
  1309. },
  1310. adviceNameShow({ row, column, rowIndex, columnIndex }) {
  1311. if (columnIndex == 1) {
  1312. return 'templateadvicenamedisplay'
  1313. } else {
  1314. return ''
  1315. }
  1316. },
  1317. showCreatedTimes() {
  1318. this.createdTimes = this.createdTimes + 1
  1319. },
  1320. handleUpdateDrugDic(row, index) {
  1321. this.currentIndex = index
  1322. this.drugdicForm = {
  1323. name: row.name,
  1324. spec: row.spec,
  1325. spec_unit: row.spec_unit,
  1326. form: row.form,
  1327. form_unit: row.form_unit,
  1328. id: row.id
  1329. }
  1330. this.drugdicFormVisible = true
  1331. this.dialogTitle = '编辑医嘱模版'
  1332. this.isEdit = true
  1333. },
  1334. handleCreateDrugDic() {
  1335. this.drugdicForm = {
  1336. name: '',
  1337. spec: '',
  1338. spec_unit: '',
  1339. form: '',
  1340. form_unit: '',
  1341. id: 0
  1342. }
  1343. this.drugdicFormVisible = true
  1344. this.dialogTitle = '新增医嘱模版'
  1345. this.isEdit = false
  1346. },
  1347. cancelHandle(formName) {
  1348. this.table_current_index = -1
  1349. this.resetForm(formName)
  1350. if (this.isAddChild) {
  1351. this.templateFormVisible = false
  1352. } else {
  1353. this.templateFormVisible = false
  1354. this.templateTableVisible = true
  1355. }
  1356. },
  1357. handleCreateTemplate() {
  1358. this.form.advice_type = 0
  1359. this.templateTableVisible = true
  1360. },
  1361. newRecordAction() {
  1362. this.dialogTitle = '新增医嘱内容'
  1363. this.advice_content_name = '医嘱内容'
  1364. this.isEdit = false
  1365. this.parent_id = 0
  1366. this.isAddChild = false
  1367. this.templateTableVisible = false
  1368. this.templateFormVisible = true
  1369. }, deleteRecordAction: function() {
  1370. if (this.table_current_index == -1) {
  1371. this.$message.error('请选择一条医嘱记录')
  1372. return
  1373. }
  1374. this.$confirm('删除记录', '是否删除该医嘱记录', {
  1375. confirmButtonText: '确 定',
  1376. cancelButtonText: '取 消',
  1377. type: 'warning'
  1378. }).then(() => {
  1379. this.adviceTableData.splice(this.table_current_index, 1)
  1380. this.table_current_index = -1
  1381. }).catch(() => {
  1382. })
  1383. }, tableRow({ row, rowIndex }) {
  1384. // 把每一行的索引放进row
  1385. row.index = rowIndex
  1386. },
  1387. onRowClick(row, event, column) {
  1388. this.table_current_index = row.index
  1389. }, modifyRecordAction: function() {
  1390. if (this.table_current_index == -1) {
  1391. this.$message.error('请选择一条医嘱记录')
  1392. return
  1393. }
  1394. this.isEdit = true
  1395. const adviceTable = this.adviceTableData[this.table_current_index]
  1396. for (var index in adviceTable) {
  1397. this.templateForm[index] = adviceTable[index]
  1398. }
  1399. this.templateForm.weekday = adviceTable.weekdays.split(',')
  1400. this.templateFormVisible = true
  1401. this.templateTableVisible = false
  1402. this.dialogTitle = '编辑医嘱内容'
  1403. this.advice_content_name = '医嘱内容'
  1404. }, cancelTableHandle: function() {
  1405. this.$confirm('放弃编辑', '是否放弃编辑,已编辑的数据将无法恢复', {
  1406. confirmButtonText: '确 定',
  1407. cancelButtonText: '取 消',
  1408. type: 'warning'
  1409. }).then(() => {
  1410. this.adviceTableData = []
  1411. this.form.name = ''
  1412. this.templateFormVisible = false
  1413. this.templateTableVisible = false
  1414. }).catch(() => {
  1415. })
  1416. }, submitTableTemplate(formName) {
  1417. if (this.adviceTableData.length <= 0) {
  1418. this.$message.error('至少添加一条医嘱信息')
  1419. return
  1420. }
  1421. const params = {
  1422. 'data': this.adviceTableData
  1423. }
  1424. // this.form.name = encodeURIComponent(this.form.name)
  1425. let name = encodeURIComponent(this.form.name)
  1426. postAdviceTemplate(params, name, this.form.advice_type).then(response => {
  1427. if (response.data.state == 0) {
  1428. this.$message.error(response.data.msg)
  1429. return false
  1430. } else {
  1431. this.$message.success('添加模版成功')
  1432. var template = response.data.data.template
  1433. if (template.DoctorAdviceTemplate.length > 0) {
  1434. for (let i = 0; i < template.DoctorAdviceTemplate.length; i++) {
  1435. const object = {}
  1436. const DoctorAdviceTemplate = template.DoctorAdviceTemplate[i]
  1437. for (const key in DoctorAdviceTemplate) {
  1438. object[key] = DoctorAdviceTemplate[key]
  1439. }
  1440. object['name'] = template.name
  1441. object['isNoSub'] = 2
  1442. this.adviceTemplates.unshift(object)
  1443. }
  1444. }
  1445. this.handleSpanTempArr()
  1446. this.form.name = ''
  1447. this.adviceTableData = []
  1448. this.templateFormVisible = false
  1449. this.templateTableVisible = false
  1450. }
  1451. })
  1452. },
  1453. resetForm(formName) {
  1454. this.$refs[formName].resetFields()
  1455. },
  1456. handleDeleteDrugDic(row, index) {
  1457. this.$confirm('确认删除此医嘱模板?', '删除', {
  1458. confirmButtonText: '确 定',
  1459. cancelButtonText: '取 消',
  1460. type: 'warning'
  1461. })
  1462. .then(() => {
  1463. DeleteDrugDic(row.id).then(response => {
  1464. if (response.data.state == 0) {
  1465. this.$message.error(response.data.msg)
  1466. return false
  1467. } else {
  1468. this.$message.success('删除成功')
  1469. this.drugdics.splice(index, 1)
  1470. }
  1471. })
  1472. })
  1473. .catch(() => {
  1474. })
  1475. },
  1476. handleDeleteAdviceTemplate(row, index) {
  1477. this.$confirm('确认删除此医嘱模板?', '删除', {
  1478. confirmButtonText: '确 定',
  1479. cancelButtonText: '取 消',
  1480. type: 'warning'
  1481. })
  1482. .then(() => {
  1483. DeleteParentAdviceTemplate(row.template_id).then(response => {
  1484. if (response.data.state == 0) {
  1485. this.$message.error(response.data.msg)
  1486. return false
  1487. } else {
  1488. this.$message.success('删除成功')
  1489. // console.log(this.adviceTemplates.length)
  1490. // for(let i = 0;i < this.adviceTemplates.length; i++){
  1491. // if(this.adviceTemplates[i].template_id == row.template_id){
  1492. // this.adviceTemplates.splice(i,1);
  1493. // }
  1494. // }
  1495. this.getAdviceConfig()
  1496. }
  1497. })
  1498. })
  1499. .catch(() => {
  1500. })
  1501. },
  1502. submitDrugDic(formName) {
  1503. this.$refs[formName].validate(valid => {
  1504. if (valid) {
  1505. if (this.isEdit) {
  1506. UpdateDrugDic(this.drugdicForm.id, this.drugdicForm).then(
  1507. response => {
  1508. if (response.data.state == 0) {
  1509. this.$message.error(response.data.msg)
  1510. return false
  1511. } else {
  1512. this.$message.success('修改成功')
  1513. this.drugdicFormVisible = false
  1514. this.resetForm(formName)
  1515. var drugdic = response.data.data.drugdic
  1516. this.drugdics[this.currentIndex].name = drugdic.name
  1517. this.drugdics[this.currentIndex].spec = drugdic.spec
  1518. this.drugdics[this.currentIndex].spec_unit =
  1519. drugdic.spec_unit
  1520. this.drugdics[this.currentIndex].form = drugdic.form
  1521. this.drugdics[this.currentIndex].form_unit =
  1522. drugdic.form_unit
  1523. this.drugdics[this.currentIndex].updated_time =
  1524. drugdic.updated_time
  1525. this.currentIndex = -1
  1526. return false
  1527. }
  1528. }
  1529. )
  1530. } else {
  1531. CreateDrugDic(this.drugdicForm).then(response => {
  1532. if (response.data.state == 0) {
  1533. this.$message.error(response.data.msg)
  1534. return false
  1535. } else {
  1536. this.$message.success('添加成功')
  1537. this.drugdicFormVisible = false
  1538. this.resetForm(formName)
  1539. this.drugdics.unshift(response.data.data.drugdic)
  1540. return false
  1541. }
  1542. })
  1543. }
  1544. }
  1545. })
  1546. },
  1547. submitTemplate(formName) {
  1548. this.$refs[formName].validate(valid => {
  1549. this.templateForm.single_dose = parseFloat(this.templateForm.single_dose)
  1550. this.templateForm.prescribing_number = parseFloat(this.templateForm.prescribing_number)
  1551. if (isNaN(this.templateForm.single_dose)) {
  1552. this.templateForm.single_dose = 0
  1553. }
  1554. if (isNaN(this.templateForm.prescribing_number)) {
  1555. this.templateForm.prescribing_number = 0
  1556. }
  1557. if (valid) {
  1558. const templateFormTwo = {}
  1559. templateFormTwo.template_id = this.current_template_id
  1560. templateFormTwo.advice_name = this.templateForm.advice_name
  1561. templateFormTwo.advice_desc = this.templateForm.advice_desc
  1562. templateFormTwo.drug_spec = this.templateForm.drug_spec
  1563. templateFormTwo.drug_spec_unit = this.templateForm.drug_spec_unit
  1564. templateFormTwo.single_dose = this.templateForm.single_dose
  1565. templateFormTwo.single_dose_unit = this.templateForm.single_dose_unit
  1566. templateFormTwo.prescribing_number = this.templateForm.prescribing_number
  1567. templateFormTwo.prescribing_number_unit = this.templateForm.prescribing_number_unit
  1568. templateFormTwo.delivery_way = this.templateForm.delivery_way
  1569. templateFormTwo.execution_frequency = this.templateForm.execution_frequency
  1570. templateFormTwo.parent_id = this.parent_id
  1571. if (this.isAddChild) {
  1572. CreateSubAdvice(templateFormTwo).then(response => {
  1573. if (response.data.state == 0) {
  1574. this.$message.error(response.data.msg)
  1575. return false
  1576. } else {
  1577. this.$message.success('添加成功')
  1578. var spliceIndex = -1
  1579. for (let index = this.adviceTemplates.length - 1; ; index--) {
  1580. if (this.adviceTemplates[index].parent_id === templateFormTwo.parent_id) {
  1581. spliceIndex = index
  1582. break
  1583. } else if (this.adviceTemplates[index].id === templateFormTwo.parent_id) {
  1584. spliceIndex = index
  1585. break
  1586. }
  1587. }
  1588. if (spliceIndex > -1) {
  1589. spliceIndex += 1
  1590. if (spliceIndex === this.adviceTemplates.length) {
  1591. const template = response.data.data.template
  1592. template['isNoSub'] = 2
  1593. this.adviceTemplates.push(template)
  1594. } else {
  1595. const template = response.data.data.template
  1596. template['isNoSub'] = 2
  1597. var swapData = this.adviceTemplates.splice(spliceIndex)
  1598. this.adviceTemplates.push(template)
  1599. this.adviceTemplates = this.adviceTemplates.concat(swapData)
  1600. }
  1601. }
  1602. this.handleSpanTempArr()
  1603. this.templateFormVisible = false
  1604. this.resetForm(formName)
  1605. return false
  1606. }
  1607. })
  1608. } else {
  1609. const templateFormTwo = {}
  1610. templateFormTwo.advice_name = this.templateForm.advice_name
  1611. templateFormTwo.advice_desc = this.templateForm.advice_desc
  1612. templateFormTwo.drug_spec = this.templateForm.drug_spec
  1613. templateFormTwo.drug_spec_unit = this.templateForm.drug_spec_unit
  1614. templateFormTwo.single_dose = this.templateForm.single_dose
  1615. templateFormTwo.single_dose_unit = this.templateForm.single_dose_unit
  1616. templateFormTwo.prescribing_number = this.templateForm.prescribing_number
  1617. templateFormTwo.prescribing_number_unit = this.templateForm.prescribing_number_unit
  1618. templateFormTwo.delivery_way = this.templateForm.delivery_way
  1619. templateFormTwo.execution_frequency = this.templateForm.execution_frequency
  1620. templateFormTwo.parent_id = this.parent_id
  1621. if (this.templateForm.frequency_type == 1) {
  1622. templateFormTwo.frequency_type = this.templateForm.frequency_type
  1623. templateFormTwo.day_count = '0'
  1624. templateFormTwo.weekdays = ''
  1625. } else if (this.templateForm.frequency_type == 2) {
  1626. templateFormTwo.frequency_type = this.templateForm.frequency_type
  1627. templateFormTwo.day_count = this.templateForm.day_count
  1628. templateFormTwo.weekdays = ''
  1629. } else if (this.templateForm.frequency_type == 3) {
  1630. templateFormTwo.frequency_type = this.templateForm.frequency_type
  1631. templateFormTwo.day_count = '0'
  1632. templateFormTwo.weekdays = this.templateForm.weekday.filter(function(s) {
  1633. return s && s.trim()
  1634. }).join(',')
  1635. }
  1636. this.templateForm.advice_name = ''
  1637. this.templateForm.advice_desc = ''
  1638. this.templateForm.frequency_type = 1
  1639. this.templateForm.day_count = ''
  1640. this.templateForm.weekday = []
  1641. console.log(templateFormTwo)
  1642. if (this.isEdit) {
  1643. for (let i = 0; i < this.adviceTableData.length; i++) {
  1644. if (i == this.table_current_index) {
  1645. this.adviceTableData[i].advice_name = templateFormTwo.advice_name
  1646. this.adviceTableData[i].advice_desc = templateFormTwo.advice_desc
  1647. this.adviceTableData[i].drug_spec = templateFormTwo.drug_spec
  1648. this.adviceTableData[i].drug_spec_unit = templateFormTwo.drug_spec_unit
  1649. this.adviceTableData[i].single_dose = templateFormTwo.single_dose
  1650. this.adviceTableData[i].single_dose_unit = templateFormTwo.single_dose_unit
  1651. this.adviceTableData[i].prescribing_number = templateFormTwo.prescribing_number
  1652. this.adviceTableData[i].prescribing_number_unit = templateFormTwo.prescribing_number_unit
  1653. this.adviceTableData[i].delivery_way = templateFormTwo.delivery_way
  1654. this.adviceTableData[i].execution_frequency = templateFormTwo.execution_frequency
  1655. this.adviceTableData[i].frequency_type = templateFormTwo.frequency_type
  1656. this.adviceTableData[i].day_count = templateFormTwo.day_count
  1657. this.adviceTableData[i].weekdays = templateFormTwo.weekdays
  1658. }
  1659. }
  1660. } else {
  1661. this.adviceTableData.unshift(templateFormTwo)
  1662. console.log(this.adviceTableData)
  1663. }
  1664. this.templateFormVisible = false
  1665. this.templateTableVisible = true
  1666. }
  1667. this.$refs[formName].resetFields()
  1668. }
  1669. })
  1670. },
  1671. handleCreateDrugWay() {
  1672. this.drugwayForm = {
  1673. name: '',
  1674. id: 0
  1675. }
  1676. this.drugwayFormVisible = true
  1677. this.dialogTitle = '新增给药途径'
  1678. this.isEdit = false
  1679. },
  1680. handleUpdateDrugWay(row, index) {
  1681. this.currentIndex = index
  1682. this.drugwayForm = {
  1683. name: row.name,
  1684. id: row.id
  1685. }
  1686. this.drugwayFormVisible = true
  1687. this.dialogTitle = '编辑给药途径'
  1688. this.isEdit = true
  1689. },
  1690. submitDrugWay(formName) {
  1691. this.$refs[formName].validate(valid => {
  1692. if (valid) {
  1693. if (this.isEdit) {
  1694. UpdateDrugWay(this.drugwayForm.id, this.drugwayForm).then(
  1695. response => {
  1696. if (response.data.state == 0) {
  1697. this.$message.error(response.data.msg)
  1698. return false
  1699. } else {
  1700. this.$message.success('修改成功')
  1701. this.drugwayFormVisible = false
  1702. this.resetForm(formName)
  1703. var drugway = response.data.data.drugway
  1704. this.drugways[this.currentIndex].name = drugway.name
  1705. this.drugways[this.currentIndex].updated_time =
  1706. drugway.updated_time
  1707. this.currentIndex = -1
  1708. return false
  1709. }
  1710. }
  1711. )
  1712. } else {
  1713. CreateDrugWay(this.drugwayForm).then(response => {
  1714. if (response.data.state == 0) {
  1715. this.$message.error(response.data.msg)
  1716. return false
  1717. } else {
  1718. this.$message.success('添加成功')
  1719. this.drugwayFormVisible = false
  1720. this.resetForm(formName)
  1721. this.drugways.unshift(response.data.data.drugway)
  1722. return false
  1723. }
  1724. })
  1725. }
  1726. }
  1727. })
  1728. },
  1729. handleDeleteDrugWay(row, index) {
  1730. this.$confirm('确认删除此给药途径?', '删除', {
  1731. confirmButtonText: '确 定',
  1732. cancelButtonText: '取 消',
  1733. type: 'warning'
  1734. })
  1735. .then(() => {
  1736. DeleteDrugWay(row.id).then(response => {
  1737. if (response.data.state == 0) {
  1738. this.$message.error(response.data.msg)
  1739. return false
  1740. } else {
  1741. this.$message.success('删除成功')
  1742. this.drugways.splice(index, 1)
  1743. }
  1744. })
  1745. })
  1746. .catch(() => {
  1747. })
  1748. },
  1749. handleCreateEF() {
  1750. this.efForm = {
  1751. name: '',
  1752. id: 0
  1753. }
  1754. this.efFormVisible = true
  1755. this.dialogTitle = '新增执行频率'
  1756. this.isEdit = false
  1757. },
  1758. handleUpdateEF(row, index) {
  1759. this.currentIndex = index
  1760. this.efForm = {
  1761. name: row.name,
  1762. id: row.id
  1763. }
  1764. this.efFormVisible = true
  1765. this.dialogTitle = '编辑执行频率'
  1766. this.isEdit = true
  1767. },
  1768. submitEF(formName) {
  1769. this.$refs[formName].validate(valid => {
  1770. if (valid) {
  1771. if (this.isEdit) {
  1772. UpdateExecutionFrequency(this.efForm.id, this.efForm).then(
  1773. response => {
  1774. if (response.data.state == 0) {
  1775. this.$message.error(response.data.msg)
  1776. return false
  1777. } else {
  1778. this.$message.success('修改成功')
  1779. this.efFormVisible = false
  1780. this.resetForm(formName)
  1781. var ef = response.data.data.ef
  1782. this.executionFrequencyOptions[this.currentIndex].name =
  1783. ef.name
  1784. this.executionFrequencyOptions[
  1785. this.currentIndex
  1786. ].updated_time = ef.updated_time
  1787. this.currentIndex = -1
  1788. return false
  1789. }
  1790. }
  1791. )
  1792. } else {
  1793. CreateExecutionFrequency(this.efForm).then(response => {
  1794. if (response.data.state == 0) {
  1795. this.$message.error(response.data.msg)
  1796. return false
  1797. } else {
  1798. this.$message.success('添加成功')
  1799. this.efFormVisible = false
  1800. this.resetForm(formName)
  1801. this.executionFrequencyOptions.unshift(response.data.data.ef)
  1802. return false
  1803. }
  1804. })
  1805. }
  1806. }
  1807. })
  1808. },
  1809. handleDeleteEF(row, index) {
  1810. this.$confirm('确认删除此执行频率?', '删除', {
  1811. confirmButtonText: '确 定',
  1812. cancelButtonText: '取 消',
  1813. type: 'warning'
  1814. })
  1815. .then(() => {
  1816. DeleteExecutionFrequency(row.id).then(response => {
  1817. if (response.data.state == 0) {
  1818. this.$message.error(response.data.msg)
  1819. return false
  1820. } else {
  1821. this.$message.error('删除成功')
  1822. this.executionFrequencyOptions.splice(index, 1)
  1823. }
  1824. })
  1825. })
  1826. .catch(() => {
  1827. })
  1828. },
  1829. getAdviceConfig() {
  1830. this.adviceTemplates = []
  1831. getAllAdviceConfig().then(response => {
  1832. if (response.data.state == 1) {
  1833. this.drugways = response.data.data.drugways
  1834. this.executionFrequencyOptions = response.data.data.efs
  1835. this.drugdics = response.data.data.drugs
  1836. const len = response.data.data.advice_templates.length
  1837. for (let i = 0; i < len; i++) {
  1838. // 对于空医嘱模版的处理
  1839. if (response.data.data.advice_templates[i] != null && response.data.data.advice_templates[i].DoctorAdviceTemplate.length == 0) {
  1840. const object = {}
  1841. object['name'] = response.data.data.advice_templates[i].name
  1842. object['isNoSub'] = 1
  1843. object['template_id'] = response.data.data.advice_templates[i].id
  1844. this.adviceTemplates.push(object)
  1845. }
  1846. // 非空模版的处理
  1847. for (let y = 0; y < response.data.data.advice_templates[i].DoctorAdviceTemplate.length; y++) {
  1848. if (response.data.data.advice_templates[i].id == response.data.data.advice_templates[i].DoctorAdviceTemplate[y].template_id) {
  1849. const object = {}
  1850. const DoctorAdviceTemplate = response.data.data.advice_templates[i].DoctorAdviceTemplate[y]
  1851. for (const key in DoctorAdviceTemplate) {
  1852. object[key] = DoctorAdviceTemplate[key]
  1853. }
  1854. object['isNoSub'] = 2
  1855. object['name'] = response.data.data.advice_templates[i].name
  1856. this.adviceTemplates.push(object)
  1857. }
  1858. }
  1859. }
  1860. console.log(this.adviceTemplates)
  1861. // 处理单元格合并的数据
  1862. this.handleSpanTempArr()
  1863. }
  1864. })
  1865. }, isShow(index, row) {
  1866. if (index > 0 && row.name == this.adviceTemplates[index - 1].name) {
  1867. return false
  1868. }
  1869. return true
  1870. }, cancelEditHandle() {
  1871. // this.templateTableVisible = true
  1872. this.templateEditFormVisible = false
  1873. }, submitEditTemplate(formName) {
  1874. this.$refs[formName].validate(valid => {
  1875. this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
  1876. this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
  1877. if (isNaN(this.templateFormEdit.single_dose)) {
  1878. this.templateFormEdit.single_dose = 0
  1879. }
  1880. if (isNaN(this.templateFormEdit.prescribing_number)) {
  1881. this.templateFormEdit.prescribing_number = 0
  1882. }
  1883. if (valid) {
  1884. console.log(this.templateFormEdit)
  1885. if (this.templateFormEdit.frequency_type == 1) {
  1886. this.templateFormEdit.day_count = 0
  1887. this.templateFormEdit.week_days = ''
  1888. } else if (this.templateFormEdit.frequency_type == 2) {
  1889. this.templateFormEdit.day_count = parseInt(this.templateFormEdit.day_count)
  1890. this.templateFormEdit.week_days = ''
  1891. } else if (this.templateFormEdit.frequency_type == 3) {
  1892. this.templateFormEdit.day_count = 0
  1893. this.templateFormEdit.week_days = this.templateFormEdit.weekday.filter(function(s) {
  1894. return s && s.trim()
  1895. }).join(',')
  1896. }
  1897. UpdateAdviceTemplate(this.templateFormEdit.id, this.templateFormEdit).then(
  1898. response => {
  1899. if (response.data.state == 0) {
  1900. this.$message.error(response.data.msg)
  1901. return false
  1902. } else {
  1903. this.$message.success('修改成功')
  1904. this.templateEditFormVisible = false
  1905. this.resetForm(formName)
  1906. var template = response.data.data.template
  1907. this.adviceTemplates[this.currentIndex].advice_name = template.advice_name
  1908. this.adviceTemplates[this.currentIndex].advice_desc = template.advice_desc
  1909. this.adviceTemplates[this.currentIndex].drug_spec = template.drug_spec
  1910. this.adviceTemplates[this.currentIndex].drug_spec_unit = template.drug_spec_unit
  1911. this.adviceTemplates[this.currentIndex].single_dose = template.single_dose
  1912. this.adviceTemplates[this.currentIndex].single_dose_unit = template.single_dose_unit
  1913. this.adviceTemplates[this.currentIndex].delivery_way = template.delivery_way
  1914. this.adviceTemplates[this.currentIndex].execution_frequency = template.execution_frequency
  1915. this.adviceTemplates[this.currentIndex].prescribing_number = template.prescribing_number
  1916. this.adviceTemplates[this.currentIndex].prescribing_number_unit = template.prescribing_number_unit
  1917. this.adviceTemplates[this.currentIndex].day_count = template.day_count
  1918. this.adviceTemplates[this.currentIndex].week_days = template.week_days
  1919. this.adviceTemplates[this.currentIndex].frequency_type = template.frequency_type
  1920. this.currentIndex = -1
  1921. return false
  1922. }
  1923. }
  1924. )
  1925. }
  1926. })
  1927. }, drugDesc(row) {
  1928. if (row.isNoSub == 2) {
  1929. if (row.drug_spec.length <= 0) {
  1930. return ''
  1931. } else {
  1932. if (row.prescribing_number == 0) {
  1933. return row.drug_spec + '' + row.drug_spec_unit
  1934. } else {
  1935. return row.drug_spec + '' + row.drug_spec_unit + ' * ' + row.prescribing_number + row.prescribing_number_unit
  1936. }
  1937. }
  1938. }
  1939. }, drugDescTwo(row) {
  1940. if (row.drug_spec.length <= 0) {
  1941. return ''
  1942. } else {
  1943. if (row.prescribing_number == 0) {
  1944. return row.drug_spec + '' + row.drug_spec_unit
  1945. } else {
  1946. return row.drug_spec + '' + row.drug_spec_unit + ' * ' + row.prescribing_number + row.prescribing_number_unit
  1947. }
  1948. }
  1949. }, newRecordActionTwo() {
  1950. this.templateFormTwoVisible = true
  1951. }, deleteRecordActionTwo() {
  1952. if (this.table_current_index_two == -1) {
  1953. this.$message.error('请选择一条医嘱记录')
  1954. return
  1955. }
  1956. this.$confirm('删除记录', '是否删除该医嘱记录', {
  1957. confirmButtonText: '确 定',
  1958. cancelButtonText: '取 消',
  1959. type: 'warning'
  1960. }).then(() => {
  1961. const id = this.adviceTableDataTwo[this.table_current_index_two].id
  1962. const template_id = this.adviceTableDataTwo[this.table_current_index_two].template_id
  1963. DeleteAdviceTemplate(id, template_id).then(response => {
  1964. if (response.data.state == 0) {
  1965. this.$message.error(response.data.msg)
  1966. return false
  1967. } else {
  1968. this.$message.success('删除成功')
  1969. for (let i = 0; i < this.adviceTemplates.length; i++) {
  1970. console.log(this.adviceTemplates[i].id)
  1971. if (this.adviceTemplates[i].id == this.adviceTableDataTwo[this.table_current_index_two].id) {
  1972. this.adviceTemplates.splice(i, 1)
  1973. }
  1974. }
  1975. this.adviceTableDataTwo.splice(this.table_current_index_two, 1)
  1976. this.table_current_index_two = -1
  1977. }
  1978. })
  1979. }).catch(() => {
  1980. })
  1981. }, modifyRecordActionTwo() {
  1982. if (this.table_current_index_two == -1) {
  1983. this.$message.error('请选择一条医嘱记录')
  1984. return
  1985. }
  1986. this.templateFormEdit = {
  1987. drug_spec: this.adviceTableDataTwo[this.table_current_index_two].drug_spec,
  1988. drug_spec_unit: this.adviceTableDataTwo[this.table_current_index_two].drug_spec_unit,
  1989. advice_name: this.adviceTableDataTwo[this.table_current_index_two].advice_name,
  1990. advice_desc: this.adviceTableDataTwo[this.table_current_index_two].advice_desc,
  1991. single_dose: this.adviceTableDataTwo[this.table_current_index_two].single_dose,
  1992. single_dose_unit: this.adviceTableDataTwo[this.table_current_index_two].single_dose_unit,
  1993. prescribing_number: this.adviceTableDataTwo[this.table_current_index_two].prescribing_number,
  1994. prescribing_number_unit: this.adviceTableDataTwo[this.table_current_index_two].prescribing_number_unit,
  1995. delivery_way: this.adviceTableDataTwo[this.table_current_index_two].delivery_way,
  1996. execution_frequency: this.adviceTableDataTwo[this.table_current_index_two].execution_frequency,
  1997. id: this.adviceTableDataTwo[this.table_current_index_two].id
  1998. }
  1999. this.templateEditFormTwoVisible = true
  2000. }, tableRowClassNameTwo({ row, rowIndex }) {
  2001. // 把每一行的索引放进row
  2002. row.index = rowIndex
  2003. },
  2004. onRowClickTwo(row, event, column) {
  2005. this.table_current_index_two = row.index
  2006. }, cancelHandleTwo() {
  2007. this.templateFormTwoVisible = false
  2008. }, submitTemplateTwo(formName) {
  2009. this.templateForm['template_id'] = this.current_template_id
  2010. this.templateForm['advice_type'] = this.form.advice_type
  2011. if (this.templateForm.frequency_type == 1) {
  2012. this.templateForm.day_count = 0
  2013. this.templateForm.week_days = ''
  2014. } else if (this.templateForm.frequency_type == 2) {
  2015. this.templateForm.day_count = parseInt(this.templateForm.day_count)
  2016. this.templateForm.week_days = ''
  2017. } else if (this.templateForm.frequency_type == 3) {
  2018. this.templateForm.day_count = 0
  2019. this.templateForm.week_days = this.templateForm.weekday.filter(function(s) {
  2020. return s && s.trim()
  2021. }).join(',')
  2022. }
  2023. CreateSingleAdviceTemplate(this.templateForm).then(response => {
  2024. if (response.data.state == 0) {
  2025. this.$message.error(response.data.msg)
  2026. return false
  2027. } else {
  2028. const source = response.data.data.template
  2029. const objects = {}
  2030. for (const keys in source) {
  2031. objects[keys] = source[keys]
  2032. }
  2033. objects['name'] = this.current_template_name
  2034. objects['isNoSub'] = 2
  2035. this.adviceTableDataTwo.unshift(response.data.data.template)
  2036. this.getAdviceConfig()
  2037. this.resetForm(formName)
  2038. this.templateFormTwoVisible = false
  2039. this.$message.success('添加成功')
  2040. this.templateForm.day_count = ''
  2041. this.templateForm.weekday = []
  2042. this.templateForm.frequency_type = 1
  2043. return false
  2044. }
  2045. })
  2046. }, cancelTableHandleTwo() {
  2047. this.templateTableTwoVisible = false
  2048. this.adviceTableDataTwo = []
  2049. }, cancelEditHandleTwo() {
  2050. this.templateEditFormTwoVisible = false
  2051. }, submitEditTemplateTwo(formName) {
  2052. this.$refs[formName].validate(valid => {
  2053. this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
  2054. this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
  2055. if (isNaN(this.templateFormEdit.single_dose)) {
  2056. this.templateFormEdit.single_dose = 0
  2057. }
  2058. if (isNaN(this.templateFormEdit.prescribing_number)) {
  2059. this.templateFormEdit.prescribing_number = 0
  2060. }
  2061. if (valid) {
  2062. UpdateAdviceTemplate(this.templateFormEdit.id, this.templateFormEdit).then(
  2063. response => {
  2064. if (response.data.state == 0) {
  2065. this.$message.error(response.data.msg)
  2066. return false
  2067. } else {
  2068. this.$message.success('修改成功')
  2069. this.templateEditFormTwoVisible = false
  2070. this.resetForm(formName)
  2071. var template = response.data.data.template
  2072. this.adviceTableDataTwo[this.table_current_index_two].advice_name = template.advice_name
  2073. this.adviceTableDataTwo[this.table_current_index_two].advice_desc = template.advice_desc
  2074. this.adviceTableDataTwo[this.table_current_index_two].drug_spec = template.drug_spec
  2075. this.adviceTableDataTwo[this.table_current_index_two].drug_spec_unit = template.drug_spec_unit
  2076. this.adviceTableDataTwo[this.table_current_index_two].single_dose = template.single_dose
  2077. this.adviceTableDataTwo[this.table_current_index_two].single_dose_unit = template.single_dose_unit
  2078. this.adviceTableDataTwo[this.table_current_index_two].delivery_way = template.delivery_way
  2079. this.adviceTableDataTwo[this.table_current_index_two].execution_frequency = template.execution_frequency
  2080. this.adviceTableDataTwo[this.table_current_index_two].prescribing_number = template.prescribing_number
  2081. this.adviceTableDataTwo[this.table_current_index_two].prescribing_number_unit = template.prescribing_number_unit
  2082. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2083. if (this.adviceTemplates[i].id == this.adviceTableDataTwo[this.table_current_index_two].id) {
  2084. this.adviceTemplates[i].advice_name = template.advice_name
  2085. this.adviceTemplates[i].advice_desc = template.advice_desc
  2086. this.adviceTemplates[i].drug_spec = template.drug_spec
  2087. this.adviceTemplates[i].drug_spec_unit = template.drug_spec_unit
  2088. this.adviceTemplates[i].single_dose = template.single_dose
  2089. this.adviceTemplates[i].single_dose_unit = template.single_dose_unit
  2090. this.adviceTemplates[i].delivery_way = template.delivery_way
  2091. this.adviceTemplates[i].execution_frequency = template.execution_frequency
  2092. this.adviceTemplates[i].prescribing_number = template.prescribing_number
  2093. this.adviceTemplates[i].prescribing_number_unit = template.prescribing_number_unit
  2094. }
  2095. }
  2096. return false
  2097. }
  2098. }
  2099. )
  2100. }
  2101. })
  2102. }, merge({ row, column, rowIndex, columnIndex }) {
  2103. if (columnIndex === 0 || columnIndex === 1 || columnIndex === 9) {
  2104. const _row = this.tempArr[rowIndex]
  2105. const _col = _row > 0 ? 1 : 0
  2106. return {
  2107. rowspan: _row,
  2108. colspan: _col
  2109. }
  2110. }
  2111. }, tableRowClassNames({ row, rowIndex }) {
  2112. const arr = this.hoverOrderArr
  2113. for (let i = 0; i < arr.length; i++) {
  2114. if (rowIndex == arr[i]) {
  2115. return 'success-row'
  2116. }
  2117. }
  2118. }, cellMouseEnter: function(row, column, cell, event) {
  2119. if (column.label == '模版名称') {
  2120. this.sameRowArr.forEach((arr, i) => {
  2121. if (arr.indexOf(row.index) != -1) {
  2122. this.hoverOrderArr = arr
  2123. }
  2124. })
  2125. } else if (column.label == '操作') {
  2126. this.sameRowArr.forEach((arr, i) => {
  2127. if (arr.indexOf(row.index) != -1) {
  2128. this.hoverOrderArr = arr
  2129. }
  2130. })
  2131. } else {
  2132. this.hoverOrderArr = []
  2133. }
  2134. }, cellMouseLeave: function(row, column, cell, event) {
  2135. this.hoverOrderArr = []
  2136. }, openEdit(index, row) {
  2137. console.log(row)
  2138. this.hoverOrderArr = []
  2139. this.currentIndex = index
  2140. this.templateFormEdit.drug_spec_unit = row.drug_spec_unit
  2141. this.templateFormEdit.drug_spec = row.drug_spec
  2142. this.templateFormEdit.advice_desc = row.advice_desc
  2143. this.templateFormEdit.advice_name = row.advice_name
  2144. this.templateFormEdit.delivery_way = row.delivery_way
  2145. this.templateFormEdit.execution_frequency = row.execution_frequency
  2146. this.templateFormEdit.prescribing_number = row.prescribing_number
  2147. this.templateFormEdit.prescribing_number_unit = row.prescribing_number_unit
  2148. this.templateFormEdit.single_dose = row.single_dose
  2149. this.templateFormEdit.single_dose_unit = row.single_dose_unit
  2150. this.templateFormEdit.id = row.id
  2151. this.templateFormEdit.parent_id = row.parent_id
  2152. this.templateFormEdit.day_count = row.day_count
  2153. this.templateFormEdit.frequency_type = row.frequency_type
  2154. this.templateFormEdit.weekday = row.week_days.split(',')
  2155. this.templateEditFormVisible = true
  2156. if (row.parent_id > 0) {
  2157. this.editDialogTitle = '编辑子药'
  2158. this.edit_advice_name = '子药名称'
  2159. } else {
  2160. this.editDialogTitle = '编辑医嘱'
  2161. this.edit_advice_name = '医嘱内容'
  2162. }
  2163. }, openDelete(index, row) {
  2164. this.hoverOrderArr = []
  2165. this.$confirm('删除记录', '是否删除该医嘱', {
  2166. confirmButtonText: '确 定',
  2167. cancelButtonText: '取 消',
  2168. type: 'warning'
  2169. }).then(() => {
  2170. const id = row.id
  2171. const template_id = row.template_id
  2172. const parent_id = row.parent_id
  2173. DeleteAdviceTemplate(id, template_id, parent_id).then(response => {
  2174. if (response.data.state == 0) {
  2175. this.$message.error(response.data.msg)
  2176. return false
  2177. } else {
  2178. this.$message.success('删除成功')
  2179. if (row.parent_id > 0) { // 删除子医嘱
  2180. this.adviceTemplates.splice(index, 1)
  2181. } else { // 如果医嘱下面包含子医嘱,删除医嘱和子医嘱
  2182. // 删除子医嘱
  2183. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2184. if (this.adviceTemplates[i].parent_id == row.id) {
  2185. this.adviceTemplates.splice(i--, 1)
  2186. }
  2187. }
  2188. // 删除医嘱
  2189. this.adviceTemplates.splice(index, 1)
  2190. // 当该模版下没有医嘱的时候,创建一个空模版
  2191. let count = 0 // 用于计数
  2192. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2193. if (this.adviceTemplates[i].template_id == row.template_id) {
  2194. count = count + 1
  2195. }
  2196. }
  2197. if (count == 0) {
  2198. const object = {}
  2199. object['name'] = row.name
  2200. object['isNoSub'] = 1
  2201. object['template_id'] = row.template_id
  2202. this.adviceTemplates.splice(index, 0, object)
  2203. }
  2204. }
  2205. // 处理单元格合并的数据
  2206. this.handleSpanTempArr()
  2207. }
  2208. })
  2209. }).catch(() => {
  2210. })
  2211. }, openDeleteChild(index, row) {
  2212. this.hoverOrderArr = []
  2213. this.$confirm('删除子药', '是否删除该子药', {
  2214. confirmButtonText: '确 定',
  2215. cancelButtonText: '取 消',
  2216. type: 'warning'
  2217. }).then(() => {
  2218. const id = row.id
  2219. const template_id = row.template_id
  2220. const parent_id = row.parent_id
  2221. DeleteAdviceTemplate(id, template_id, parent_id).then(response => {
  2222. if (response.data.state == 0) {
  2223. this.$message.error(response.data.msg)
  2224. return false
  2225. } else {
  2226. this.$message.success('删除成功')
  2227. if (row.parent_id > 0) { // 删除子医嘱
  2228. this.adviceTemplates.splice(index, 1)
  2229. } else { // 如果医嘱下面包含子医嘱,删除医嘱和子医嘱
  2230. // 删除子医嘱
  2231. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2232. if (this.adviceTemplates[i].parent_id == row.id) {
  2233. this.adviceTemplates.splice(i--, 1)
  2234. }
  2235. }
  2236. // 删除医嘱
  2237. this.adviceTemplates.splice(index, 1)
  2238. // 当该模版下没有医嘱的时候,创建一个空模版
  2239. let count = 0 // 用于计数
  2240. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2241. if (this.adviceTemplates[i].template_id == row.template_id) {
  2242. count = count + 1
  2243. }
  2244. }
  2245. if (count == 0) {
  2246. const object = {}
  2247. object['name'] = row.name
  2248. object['isNoSub'] = 1
  2249. object['template_id'] = row.template_id
  2250. this.adviceTemplates.splice(index, 0, object)
  2251. }
  2252. }
  2253. // 处理单元格合并的数据
  2254. this.handleSpanTempArr()
  2255. }
  2256. })
  2257. }).catch(() => {
  2258. })
  2259. },
  2260. openNewChild(index, row) {
  2261. this.hoverOrderArr = []
  2262. this.current_template_id = row.template_id
  2263. this.parent_id = row.id
  2264. this.isAddChild = true
  2265. this.isEdit = false
  2266. this.templateFormVisible = true
  2267. this.dialogTitle = '新增子药'
  2268. this.advice_content_name = '子药名称'
  2269. }, deleteRecordAction: function() {
  2270. if (this.table_current_index == -1) {
  2271. this.$message.error('请选择一条医嘱记录')
  2272. return
  2273. }
  2274. this.$confirm('删除记录', '是否删除该医嘱记录', {
  2275. confirmButtonText: '确 定',
  2276. cancelButtonText: '取 消',
  2277. type: 'warning'
  2278. }).then(() => {
  2279. this.adviceTableData.splice(this.table_current_index, 1)
  2280. this.table_current_index = -1
  2281. }).catch(() => {
  2282. })
  2283. }, handleSpanTempArr() {
  2284. this.tempArr = []
  2285. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2286. if (i === 0) {
  2287. this.tempArr.push(1)
  2288. this.pos = 0
  2289. } else {
  2290. // 判断当前元素与上一个元素是否相同
  2291. if (this.adviceTemplates[i].template_id === this.adviceTemplates[i - 1].template_id) {
  2292. this.tempArr[this.pos] += 1
  2293. this.tempArr.push(0)
  2294. } else {
  2295. this.tempArr.push(1)
  2296. this.pos = i
  2297. }
  2298. }
  2299. }
  2300. let sameRowArr = [], sIdx = 0
  2301. this.adviceTemplates.forEach((item, index) => {
  2302. item.index = index
  2303. if (index === 0) {
  2304. sameRowArr.push([index])
  2305. } else {
  2306. if (item.template_id === this.adviceTemplates[index - 1].template_id) {
  2307. sameRowArr[sIdx].push(index)
  2308. } else {
  2309. sIdx = sIdx + 1
  2310. sameRowArr.push([index])
  2311. }
  2312. }
  2313. })
  2314. this.sameRowArr = sameRowArr
  2315. }, handleUpdateAdviceTemplate(row, index) {
  2316. this.current_template_id = row.template_id
  2317. this.current_template_name = row.name
  2318. this.form.name = row.name
  2319. this.form.advice_type = row.advice_type
  2320. this.templateTableTwoVisible = true
  2321. this.adviceTableDataTwo = []
  2322. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2323. if (this.adviceTemplates[i].template_id == row.template_id) {
  2324. this.adviceTableDataTwo.push(this.adviceTemplates[i])
  2325. }
  2326. }
  2327. }, modifyTemplateName() {
  2328. const params = {
  2329. template_name: this.form.name,
  2330. template_id: this.current_template_id
  2331. }
  2332. updateTemplateName(params).then(response => {
  2333. if (response.data.state == 0) {
  2334. this.$message.error(response.data.msg)
  2335. return false
  2336. } else {
  2337. this.$message.success('修改成功')
  2338. this.templateTableTwoVisible = false
  2339. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2340. if (this.adviceTemplates[i].template_id == this.current_template_id) {
  2341. this.adviceTemplates[i].name = response.data.data.template_name
  2342. }
  2343. }
  2344. }
  2345. })
  2346. }, changeRemind(val) {
  2347. let params = {
  2348. 'is_open_remind': val,
  2349. }
  2350. postDoctorAdviceConfig(params).then(response => {
  2351. if (response.data.state == 1) {
  2352. this.is_open_remind = response.data.data.is_open_remind
  2353. if (response.data.data.is_open_remind == 1) {
  2354. this.$message.success('开启成功')
  2355. } else {
  2356. this.$message.success('关闭成功')
  2357. }
  2358. } else {
  2359. this.$message.error(response.data.msg)
  2360. }
  2361. })
  2362. },
  2363. }
  2364. }
  2365. </script>
  2366. <style>
  2367. .center th .cell {
  2368. text-align: center !important;
  2369. }
  2370. .templateadvicenamedisplay .cell {
  2371. float: left;
  2372. text-align: left;
  2373. }
  2374. .el-table td,
  2375. .el-table th.is-leaf,
  2376. .el-table--border,
  2377. .el-table--group {
  2378. border-color: #d0d3da;
  2379. }
  2380. .el-table--border::after,
  2381. .el-table--group::after,
  2382. .el-table::before {
  2383. background-color: #d0d3da;
  2384. }
  2385. </style>