druguseTemplate.vue 117KB

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