druguseTemplate.vue 118KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991
  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.id"
  807. ></el-option>
  808. </el-select>
  809. </el-col>
  810. </el-form-item>
  811. </el-col>
  812. <el-col :span="12">
  813. <!--bug619-->
  814. <!-- <el-button @click="lili">调试</el-button>-->
  815. <el-form-item label="给药途径 :" prop="delivery_way">
  816. <el-select
  817. v-model="templateForm.delivery_way"
  818. filterable
  819. clearable
  820. allow-create
  821. placeholder="请选择(输入可搜索)"
  822. style="width:100%"
  823. >
  824. <el-option
  825. v-for="item in drugways"
  826. :key="item.id"
  827. :label="item.name "
  828. :value="item.name"
  829. ></el-option>
  830. </el-select>
  831. </el-form-item>
  832. </el-col>
  833. <el-col :span="12">
  834. <el-form-item label="执行频率 :" prop="execution_frequency">
  835. <el-select
  836. v-model="templateForm.execution_frequency"
  837. clearable
  838. allow-create
  839. filterable
  840. placeholder="请选择(输入可搜索)"
  841. style="width:100%"
  842. >
  843. <el-option
  844. v-for="item in executionFrequencyOptions"
  845. :key="item.id"
  846. :label="item.name"
  847. :value="item.name"
  848. ></el-option>
  849. </el-select>
  850. </el-form-item>
  851. </el-col>
  852. <el-col :span="24" v-if="form.advice_type == 1">
  853. <el-form-item label="周期提醒 :">
  854. <el-radio-group v-model="templateForm.frequency_type">
  855. <el-radio :label="1">每次必推</el-radio>
  856. <el-radio :label="2">天数频率</el-radio>
  857. <el-radio :label="3">星期频率</el-radio>
  858. </el-radio-group>
  859. </el-form-item>
  860. </el-col>
  861. <el-col :span="12" v-if="templateForm.frequency_type == 2">
  862. <el-form-item prop="day_count">
  863. <el-input style="width: 50px" v-model="templateForm.day_count"></el-input>&nbsp;
  864. 天/一次
  865. </el-form-item>
  866. </el-col>
  867. <el-col :span="24" v-if="templateForm.frequency_type == 3">
  868. <el-form-item>
  869. <el-checkbox-group v-model="templateForm.weekday">
  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 label="周六" name="type"></el-checkbox>
  876. <el-checkbox label="周日" name="type"></el-checkbox>
  877. </el-checkbox-group>
  878. </el-form-item>
  879. </el-col>
  880. </el-row>
  881. </el-form>
  882. <div slot="footer" class="dialog-footer">
  883. <el-button @click="cancelHandleTwo">取消</el-button>
  884. <el-button type="primary" @click="submitTemplateTwo('templateForm')">保 存</el-button>
  885. </div>
  886. </el-dialog>
  887. <!--<el-dialog title="编辑医嘱" :visible.sync="templateEditFormTwoVisible" width="700px">-->
  888. <!--<el-form-->
  889. <!--ref="templateFormEdit"-->
  890. <!--:rules="templateEditRules"-->
  891. <!--:model="templateFormEdit"-->
  892. <!--label-width="90px"-->
  893. <!--&gt;-->
  894. <!--<el-form-item label="医嘱名称 :" required prop="advice_name">-->
  895. <!--<el-input v-model="templateFormEdit.advice_name" style="width:50%"></el-input>-->
  896. <!--</el-form-item>-->
  897. <!--<el-row>-->
  898. <!--<el-col :span="12">-->
  899. <!--<el-form-item label="药品规格 :" prop="drug_spec">-->
  900. <!--<el-col :span="8">-->
  901. <!--<el-input v-model="templateFormEdit.drug_spec"></el-input>-->
  902. <!--</el-col>-->
  903. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  904. <!--<el-col :span="14">-->
  905. <!--<el-select-->
  906. <!--v-model="templateFormEdit.drug_spec_unit"-->
  907. <!--filterable-->
  908. <!--clearable-->
  909. <!--allow-create-->
  910. <!--placeholder="选择"-->
  911. <!--&gt;-->
  912. <!--<el-option-->
  913. <!--v-for="item in unitsOption"-->
  914. <!--:key="item.id"-->
  915. <!--:label="item.name "-->
  916. <!--:value="item.name"-->
  917. <!--&gt;</el-option>-->
  918. <!--</el-select>-->
  919. <!--</el-col>-->
  920. <!--</el-form-item>-->
  921. <!--</el-col>-->
  922. <!--<el-col :span="12">-->
  923. <!--<el-form-item label="单次用量 :" prop="single_dose">-->
  924. <!--<el-col :span="8">-->
  925. <!--<el-input v-model="templateFormEdit.single_dose"></el-input>-->
  926. <!--</el-col>-->
  927. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  928. <!--<el-col :span="14">-->
  929. <!--<el-select-->
  930. <!--v-model="templateFormEdit.single_dose_unit"-->
  931. <!--filterable-->
  932. <!--clearable-->
  933. <!--allow-create-->
  934. <!--placeholder="选择"-->
  935. <!--&gt;-->
  936. <!--<el-option-->
  937. <!--v-for="item in unitsOption"-->
  938. <!--:key="item.id"-->
  939. <!--:label="item.name "-->
  940. <!--:value="item.name"-->
  941. <!--&gt;</el-option>-->
  942. <!--</el-select>-->
  943. <!--</el-col>-->
  944. <!--</el-form-item>-->
  945. <!--</el-col>-->
  946. <!--<el-col :span="12">-->
  947. <!--<el-form-item label="开药数量 :" prop="prescribing_number">-->
  948. <!--<el-col :span="8">-->
  949. <!--<el-input v-model="templateFormEdit.prescribing_number"></el-input>-->
  950. <!--</el-col>-->
  951. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  952. <!--<el-col :span="14">-->
  953. <!--<el-select-->
  954. <!--v-model="templateFormEdit.prescribing_number_unit"-->
  955. <!--filterable-->
  956. <!--clearable-->
  957. <!--allow-create-->
  958. <!--placeholder="选择"-->
  959. <!--&gt;-->
  960. <!--<el-option-->
  961. <!--v-for="item in unitsOption"-->
  962. <!--:key="item.id"-->
  963. <!--:label="item.name "-->
  964. <!--:value="item.name"-->
  965. <!--&gt;</el-option>-->
  966. <!--</el-select>-->
  967. <!--</el-col>-->
  968. <!--</el-form-item>-->
  969. <!--</el-col>-->
  970. <!--<el-col :span="12">-->
  971. <!--<el-form-item label="给药途径 :" prop="delivery_way">-->
  972. <!--<el-select-->
  973. <!--v-model="templateFormEdit.delivery_way"-->
  974. <!--filterable-->
  975. <!--clearable-->
  976. <!--allow-create-->
  977. <!--placeholder="请选择(输入可搜索)"-->
  978. <!--style="width:90%"-->
  979. <!--&gt;-->
  980. <!--<el-option-->
  981. <!--v-for="item in drugways"-->
  982. <!--:key="item.id"-->
  983. <!--:label="item.name "-->
  984. <!--:value="item.name"-->
  985. <!--&gt;</el-option>-->
  986. <!--</el-select>-->
  987. <!--</el-form-item>-->
  988. <!--</el-col>-->
  989. <!--</el-row>-->
  990. <!--<el-row>-->
  991. <!--<el-col :span="12">-->
  992. <!--<el-form-item label="执行频率 :" prop="execution_frequency">-->
  993. <!--<el-select-->
  994. <!--v-model="templateFormEdit.execution_frequency"-->
  995. <!--clearable-->
  996. <!--allow-create-->
  997. <!--filterable-->
  998. <!--placeholder="请选择(输入可搜索)"-->
  999. <!--style="width:90%"-->
  1000. <!--&gt;-->
  1001. <!--<el-option-->
  1002. <!--v-for="item in executionFrequencyOptions"-->
  1003. <!--:key="item.id"-->
  1004. <!--:label="item.name"-->
  1005. <!--:value="item.name"-->
  1006. <!--&gt;</el-option>-->
  1007. <!--</el-select>-->
  1008. <!--</el-form-item>-->
  1009. <!--</el-col>-->
  1010. <!--</el-row>-->
  1011. <!--</el-form>-->
  1012. <!--<div slot="footer" class="dialog-footer">-->
  1013. <!--<el-button @click="cancelEditHandleTwo">取消</el-button>-->
  1014. <!--<el-button type="primary" @click="submitEditTemplateTwo('templateFormEdit')">保 存</el-button>-->
  1015. <!--</div>-->
  1016. <!--</el-dialog>-->
  1017. </div>
  1018. </el-tab-pane>
  1019. <el-tab-pane label="给药途径">
  1020. <div class="">
  1021. <div class="filter-container">
  1022. <el-button
  1023. class="filter-item"
  1024. style="margin-left: 10px;"
  1025. @click="handleCreateDrugWay"
  1026. type="primary"
  1027. icon="el-icon-circle-plus-outline"
  1028. size="small"
  1029. >{{$t('table.add')}}
  1030. </el-button>
  1031. </div>
  1032. <el-table
  1033. :data="drugways"
  1034. border
  1035. fit
  1036. :row-style="{ color: '#303133' }"
  1037. :header-cell-style="{
  1038. backgroundColor: 'rgb(245, 247, 250)',
  1039. color: '#606266'
  1040. }"
  1041. highlight-current-row
  1042. style="width: 100%;min-height:500px;"
  1043. >
  1044. <el-table-column align="center" label="名称">
  1045. <template slot-scope="scope">
  1046. <span>{{scope.row.name}}</span>
  1047. </template>
  1048. </el-table-column>
  1049. <el-table-column
  1050. align="center"
  1051. :label="$t('table.actions')"
  1052. width="230"
  1053. class-name="small-padding fixed-width"
  1054. >
  1055. <template slot-scope="scope">
  1056. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  1057. <el-button
  1058. v-show="scope.row.org_id!=0"
  1059. type="primary"
  1060. size="small"
  1061. icon="el-icon-edit-outline"
  1062. @click="handleUpdateDrugWay(scope.row, scope.$index)"
  1063. >
  1064. </el-button>
  1065. <el-button
  1066. v-show="scope.row.org_id!=0"
  1067. size="small"
  1068. type="danger"
  1069. icon="el-icon-delete"
  1070. @click="handleDeleteDrugWay(scope.row, scope.$index)"
  1071. >
  1072. </el-button>
  1073. </template>
  1074. </el-table-column>
  1075. </el-table>
  1076. <el-dialog :title="dialogTitle" :visible.sync="drugwayFormVisible" width="700px">
  1077. <el-form
  1078. ref="drugwayForm"
  1079. :rules="drugwayRules"
  1080. :model="drugwayForm"
  1081. label-width="90px"
  1082. >
  1083. <el-form-item label="给药途径 :" required prop="name">
  1084. <el-input v-model="drugwayForm.name" placeholder="给药途径"></el-input>
  1085. </el-form-item>
  1086. </el-form>
  1087. <div slot="footer" class="dialog-footer">
  1088. <el-button @click="drugwayFormVisible = false">取消</el-button>
  1089. <el-button type="primary" @click="submitDrugWay('drugwayForm')">保 存</el-button>
  1090. </div>
  1091. </el-dialog>
  1092. </div>
  1093. </el-tab-pane>
  1094. <el-tab-pane label="执行频率">
  1095. <div class="">
  1096. <div class="filter-container">
  1097. <el-button
  1098. class="filter-item"
  1099. style="margin-left: 10px;"
  1100. @click="handleCreateEF"
  1101. type="primary"
  1102. icon="el-icon-circle-plus-outline"
  1103. size="small"
  1104. >{{$t('table.add')}}
  1105. </el-button>
  1106. </div>
  1107. <el-table
  1108. :data="executionFrequencyOptions"
  1109. border
  1110. fit
  1111. :row-style="{ color: '#303133' }"
  1112. :header-cell-style="{
  1113. backgroundColor: 'rgb(245, 247, 250)',
  1114. color: '#606266'
  1115. }"
  1116. highlight-current-row
  1117. style="width: 100%;min-height:500px;"
  1118. >
  1119. <el-table-column align="center" label="名称">
  1120. <template slot-scope="scope">
  1121. <span>{{scope.row.name}}</span>
  1122. </template>
  1123. </el-table-column>
  1124. <el-table-column
  1125. align="center"
  1126. :label="$t('table.actions')"
  1127. width="230"
  1128. class-name="small-padding fixed-width"
  1129. >
  1130. <template slot-scope="scope">
  1131. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  1132. <el-button
  1133. v-show="scope.row.org_id!=0"
  1134. type="primary"
  1135. size="small"
  1136. icon="el-icon-edit-outline"
  1137. @click="handleUpdateEF(scope.row, scope.$index)"
  1138. >
  1139. </el-button>
  1140. <el-button
  1141. v-show="scope.row.org_id!=0"
  1142. size="small"
  1143. type="danger"
  1144. icon="el-icon-delete"
  1145. @click="handleDeleteEF(scope.row, scope.$index)"
  1146. >
  1147. </el-button>
  1148. </template>
  1149. </el-table-column>
  1150. </el-table>
  1151. <el-dialog :title="dialogTitle" :visible.sync="efFormVisible" width="700px">
  1152. <el-form ref="efForm" :rules="efRules" :model="efForm" label-width="90px">
  1153. <el-form-item label="执行频率 :" required prop="name">
  1154. <el-input v-model="efForm.name" placeholder="执行频率"></el-input>
  1155. </el-form-item>
  1156. </el-form>
  1157. <div slot="footer" class="dialog-footer">
  1158. <el-button @click="efFormVisible = false">取消</el-button>
  1159. <el-button type="primary" @click="submitEF('efForm')">保 存</el-button>
  1160. </div>
  1161. </el-dialog>
  1162. </div>
  1163. </el-tab-pane>
  1164. </el-tabs>
  1165. </div>
  1166. </div>
  1167. </template>
  1168. <style>
  1169. @import "../../../static/css/table_row.css";
  1170. .filter-item {
  1171. float: right;
  1172. }
  1173. </style>
  1174. <script>
  1175. import {
  1176. CreateAdviceTemplate,
  1177. CreateDrugDic,
  1178. CreateDrugWay,
  1179. CreateExecutionFrequency,
  1180. CreateSingleAdviceTemplate,
  1181. CreateSubAdvice,
  1182. DeleteAdviceTemplate,
  1183. DeleteDrugDic,
  1184. DeleteDrugWay,
  1185. DeleteExecutionFrequency,
  1186. DeleteParentAdviceTemplate,
  1187. getAllAdviceConfig,
  1188. getAllAdviceTemplate,
  1189. postAdviceTemplate,
  1190. UpdateAdviceTemplate,
  1191. UpdateDrugDic,
  1192. UpdateDrugWay,
  1193. UpdateExecutionFrequency,
  1194. updateTemplateName,
  1195. getDoctorAdviceConfig,
  1196. postDoctorAdviceConfig,
  1197. PostInitAdviceTemplate,
  1198. getDoctorInitConfig,
  1199. } from '@/api/advice'
  1200. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  1201. import { getDataConfig } from '@/utils/data'
  1202. import { getSelfMedicalList } from "@/api/drug/drug"
  1203. export default {
  1204. name: 'tab',
  1205. components: { BreadCrumb },
  1206. data() {
  1207. return {
  1208. day_count: '',
  1209. crumbs: [
  1210. { path: false, name: '管理中心' },
  1211. { path: 'data/druguse', name: '医嘱模版' }
  1212. ],
  1213. rowIndex: -1,
  1214. current_template_id: 0,
  1215. currentObject: {},
  1216. tempArr: [],
  1217. sameRowArr: [],
  1218. advice_content_name: '',
  1219. table_current_index: -1,
  1220. adviceTableData: [],
  1221. templateName: '',
  1222. adviceTableDataTwo: [],
  1223. table_current_index_two: -1,
  1224. currentIndex: -1,
  1225. isEdit: false,
  1226. dialogTitle: '',
  1227. is_open_remind:0,
  1228. is_init:0,
  1229. isAddChild: false,
  1230. parent_id: 0,
  1231. editDialogTitle: '编辑医嘱',
  1232. drugdicFormVisible: false,
  1233. drugwayFormVisible: false,
  1234. templateFormVisible: false,
  1235. templateTableTwoVisible: false,
  1236. templateEditFormVisible: false,
  1237. edit_advice_name: '',
  1238. templateTableVisible: false,
  1239. templateFormTwoVisible: false,
  1240. templateEditFormTwoVisible: false,
  1241. efFormVisible: false,
  1242. activeName: 'drugdic',
  1243. hoverOrderArr: [],
  1244. createdTimes: 0,
  1245. drugdics: [],
  1246. adviceTemplates: [],
  1247. current_template_name: '',
  1248. editForm: {
  1249. name: ''
  1250. },
  1251. loading:false,
  1252. drugways: [],
  1253. executionFrequencyOptions: [],
  1254. drugdicRules: {
  1255. name: [{ required: true, message: '请填写医嘱内容' }]
  1256. },
  1257. formRules: {
  1258. name: [
  1259. { required: true, message: '请输入模版名称', trigger: 'blur' }
  1260. ],
  1261. advice_type: [
  1262. { required: true, message: '请选择模版类型', trigger: 'change' }
  1263. ]
  1264. },
  1265. drugwayRules: {
  1266. name: [{ required: true, message: '请填写给药途径' }]
  1267. },
  1268. efRules: {
  1269. name: [{ required: true, message: '请填写执行频率' }]
  1270. },
  1271. templateRules: {
  1272. advice_name: [{ required: true, message: '请填写医嘱内容' }]
  1273. },
  1274. templateEditRules: {
  1275. advice_name: [{ required: true, message: '请填写医嘱内容' }]
  1276. },
  1277. templateForm: {
  1278. frequency_type: 1,
  1279. day_count: '',
  1280. weekday: [],
  1281. drug_spec: '',
  1282. drug_spec_unit: '',
  1283. advice_name: '',
  1284. advice_desc: '',
  1285. single_dose: '',
  1286. single_dose_unit: '',
  1287. prescribing_number: '',
  1288. prescribing_number_unit: '',
  1289. delivery_way: '',
  1290. execution_frequency: '',
  1291. id: 0,
  1292. drug_id:0,
  1293. way:0
  1294. },
  1295. dialogConfigVisible:false,
  1296. templateFormEdit: {
  1297. frequency_type: 0,
  1298. day_count: '',
  1299. weekday: [],
  1300. week_days: '',
  1301. drug_spec: '',
  1302. drug_spec_unit: '',
  1303. advice_name: '',
  1304. advice_desc: '',
  1305. single_dose: '',
  1306. single_dose_unit: '',
  1307. prescribing_number: '',
  1308. prescribing_number_unit: '',
  1309. delivery_way: '',
  1310. execution_frequency: '',
  1311. id: 0
  1312. },
  1313. drugdicForm: {
  1314. name: '',
  1315. spec: '',
  1316. spec_unit: '',
  1317. form: '',
  1318. form_unit: '',
  1319. id: 0
  1320. },
  1321. form: {
  1322. name: '',
  1323. advice_type: 0,
  1324. sort:"",
  1325. },
  1326. drugwayForm: {
  1327. name: '',
  1328. id: 0
  1329. },
  1330. efForm: {
  1331. name: '',
  1332. id: 0
  1333. },
  1334. drugforms: [
  1335. { lable: 1, name: '胶囊' },
  1336. { lable: 2, name: '注射剂' },
  1337. { lable: 3, name: '片剂' },
  1338. { lable: 4, name: '注射液' },
  1339. { lable: 5, name: '栓剂' },
  1340. { lable: 6, name: '膏' },
  1341. { lable: 7, name: '颗粒剂' },
  1342. { lable: 8, name: '粉剂' },
  1343. { lable: 9, name: '口服液' },
  1344. { lable: 10, name: '干混悬剂' },
  1345. { lable: 11, name: '丸剂' },
  1346. { lable: 12, name: '气雾剂' },
  1347. { lable: 13, name: '内服溶液' },
  1348. { lable: 14, name: '外用溶液' },
  1349. { lable: 15, name: '软膏剂' },
  1350. { lable: 16, name: '胶剂' }
  1351. ],
  1352. medicals:[],
  1353. drugSpec:[],
  1354. all_drug:[],
  1355. current_drug_name:"",
  1356. current_drug_spec: "",
  1357. drug_id: 0,
  1358. src_type:"",
  1359. way:0
  1360. }
  1361. },
  1362. created() {
  1363. this.getAdviceConfig()
  1364. this.unitsOption = getDataConfig('hemodialysis', 'units')
  1365. this.getDoctorAdviceConfig()
  1366. this.getDoctorInitConfig()
  1367. //获取自备药
  1368. this.getSelfMedicalList()
  1369. },
  1370. methods: {
  1371. lili(){
  1372. console.log()
  1373. },
  1374. initAdvice(){
  1375. this.$confirm('是否进行医嘱初始化操作?', '提示', {
  1376. confirmButtonText: '确定',
  1377. cancelButtonText: '取消',
  1378. type: 'warning'
  1379. }).then(() => {
  1380. let params = {
  1381. is_init:1
  1382. }
  1383. this.loading = true
  1384. PostInitAdviceTemplate(params).then(response => {
  1385. if (response.data.state == 1) {
  1386. this.is_init = response.data.data.init_config.is_init
  1387. this.getAdviceConfig()
  1388. this.loading = false
  1389. } else {
  1390. this.loading = false
  1391. this.$message.error(response.data.msg)
  1392. }
  1393. })
  1394. }).catch(() => {
  1395. this.loading = false
  1396. });
  1397. },
  1398. getDoctorAdviceConfig(){
  1399. getDoctorAdviceConfig().then(response => {
  1400. if (response.data.state == 1) {
  1401. this.is_open_remind = response.data.data.config.is_open_remind
  1402. } else {
  1403. this.$message.error(response.data.msg)
  1404. }
  1405. })
  1406. },
  1407. getDoctorInitConfig(){
  1408. getDoctorInitConfig().then(response => {
  1409. if (response.data.state == 1) {
  1410. if(response.data.data.advice_init == null){
  1411. this.is_init = 0
  1412. }else{
  1413. this.is_init = response.data.data.advice_init.is_init
  1414. }
  1415. } else {
  1416. this.$message.error(response.data.msg)
  1417. }
  1418. })
  1419. },
  1420. adviceNameShow({ row, column, rowIndex, columnIndex }) {
  1421. if (columnIndex == 1) {
  1422. return 'templateadvicenamedisplay'
  1423. } else {
  1424. return ''
  1425. }
  1426. },
  1427. showCreatedTimes() {
  1428. this.createdTimes = this.createdTimes + 1
  1429. },
  1430. handleUpdateDrugDic(row, index) {
  1431. this.currentIndex = index
  1432. this.drugdicForm = {
  1433. name: row.name,
  1434. spec: row.spec,
  1435. spec_unit: row.spec_unit,
  1436. form: row.form,
  1437. form_unit: row.form_unit,
  1438. id: row.id
  1439. }
  1440. this.drugdicFormVisible = true
  1441. this.dialogTitle = '编辑医嘱模版'
  1442. this.isEdit = true
  1443. },
  1444. handleCreateDrugDic() {
  1445. this.drugdicForm = {
  1446. name: '',
  1447. spec: '',
  1448. spec_unit: '',
  1449. form: '',
  1450. form_unit: '',
  1451. id: 0
  1452. }
  1453. this.drugdicFormVisible = true
  1454. this.dialogTitle = '新增医嘱模版'
  1455. this.isEdit = false
  1456. },
  1457. cancelHandle(formName) {
  1458. this.table_current_index = -1
  1459. this.resetForm(formName)
  1460. if (this.isAddChild) {
  1461. this.templateFormVisible = false
  1462. } else {
  1463. this.templateFormVisible = false
  1464. this.templateTableVisible = true
  1465. }
  1466. },
  1467. handleCreateTemplate() {
  1468. this.form.advice_type = 0
  1469. this.templateTableVisible = true
  1470. },
  1471. newRecordAction() {
  1472. console.log("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
  1473. this.dialogTitle = '新增医嘱内容'
  1474. this.advice_content_name = '医嘱内容'
  1475. this.isEdit = false
  1476. this.parent_id = 0
  1477. this.isAddChild = false
  1478. this.templateTableVisible = false
  1479. this.templateFormVisible = true
  1480. },
  1481. deleteRecordAction: function() {
  1482. if (this.table_current_index == -1) {
  1483. this.$message.error('请选择一条医嘱记录')
  1484. return
  1485. }
  1486. this.$confirm('删除记录', '是否删除该医嘱记录', {
  1487. confirmButtonText: '确 定',
  1488. cancelButtonText: '取 消',
  1489. type: 'warning'
  1490. }).then(() => {
  1491. this.adviceTableData.splice(this.table_current_index, 1)
  1492. this.table_current_index = -1
  1493. }).catch(() => {
  1494. })
  1495. },
  1496. tableRow({ row, rowIndex }) {
  1497. // 把每一行的索引放进row
  1498. row.index = rowIndex
  1499. },
  1500. onRowClick(row, event, column) {
  1501. this.table_current_index = row.index
  1502. },
  1503. modifyRecordAction: function() {
  1504. if (this.table_current_index == -1) {
  1505. this.$message.error('请选择一条医嘱记录')
  1506. return
  1507. }
  1508. this.isEdit = true
  1509. const adviceTable = this.adviceTableData[this.table_current_index]
  1510. for (var index in adviceTable) {
  1511. this.templateForm[index] = adviceTable[index]
  1512. }
  1513. this.templateForm.weekday = adviceTable.weekdays.split(',')
  1514. this.templateFormVisible = true
  1515. this.templateTableVisible = false
  1516. this.dialogTitle = '编辑医嘱内容'
  1517. this.advice_content_name = '医嘱内容'
  1518. }, cancelTableHandle: function() {
  1519. this.$confirm('放弃编辑', '是否放弃编辑,已编辑的数据将无法恢复', {
  1520. confirmButtonText: '确 定',
  1521. cancelButtonText: '取 消',
  1522. type: 'warning'
  1523. }).then(() => {
  1524. this.adviceTableData = []
  1525. this.form.name = ''
  1526. this.templateFormVisible = false
  1527. this.templateTableVisible = false
  1528. }).catch(() => {
  1529. })
  1530. },
  1531. //添加医嘱模版
  1532. submitTableTemplate(formName) {
  1533. if (this.adviceTableData.length <= 0) {
  1534. this.$message.error('至少添加一条医嘱信息')
  1535. return
  1536. }
  1537. const params = {
  1538. 'data': this.adviceTableData
  1539. }
  1540. let name = encodeURIComponent(this.form.name)
  1541. console.log("params",params)
  1542. let sort = this.form.sort
  1543. postAdviceTemplate(params, name,sort, this.form.advice_type).then(response => {
  1544. if (response.data.state == 0) {
  1545. this.$message.error(response.data.msg)
  1546. return false
  1547. } else {
  1548. this.$message.success('添加模版成功')
  1549. var template = response.data.data.template
  1550. if (template.DoctorAdviceTemplate.length > 0) {
  1551. for (let i = 0; i < template.DoctorAdviceTemplate.length; i++) {
  1552. const object = {}
  1553. const DoctorAdviceTemplate = template.DoctorAdviceTemplate[i]
  1554. for (const key in DoctorAdviceTemplate) {
  1555. object[key] = DoctorAdviceTemplate[key]
  1556. }
  1557. object['name'] = template.name
  1558. object['isNoSub'] = 2
  1559. object['sort'] = template.sort
  1560. this.adviceTemplates.unshift(object)
  1561. }
  1562. }
  1563. this.handleSpanTempArr()
  1564. this.form.name = ''
  1565. this.adviceTableData = []
  1566. this.templateFormVisible = false
  1567. this.templateTableVisible = false
  1568. }
  1569. })
  1570. },
  1571. resetForm(formName) {
  1572. this.$refs[formName].resetFields()
  1573. },
  1574. handleDeleteDrugDic(row, index) {
  1575. this.$confirm('确认删除此医嘱模板?', '删除', {
  1576. confirmButtonText: '确 定',
  1577. cancelButtonText: '取 消',
  1578. type: 'warning'
  1579. })
  1580. .then(() => {
  1581. DeleteDrugDic(row.id).then(response => {
  1582. if (response.data.state == 0) {
  1583. this.$message.error(response.data.msg)
  1584. return false
  1585. } else {
  1586. this.$message.success('删除成功')
  1587. this.drugdics.splice(index, 1)
  1588. }
  1589. })
  1590. })
  1591. .catch(() => {
  1592. })
  1593. },
  1594. handleDeleteAdviceTemplate(row, index) {
  1595. this.$confirm('确认删除此医嘱模板?', '删除', {
  1596. confirmButtonText: '确 定',
  1597. cancelButtonText: '取 消',
  1598. type: 'warning'
  1599. })
  1600. .then(() => {
  1601. DeleteParentAdviceTemplate(row.template_id).then(response => {
  1602. if (response.data.state == 0) {
  1603. this.$message.error(response.data.msg)
  1604. return false
  1605. } else {
  1606. this.$message.success('删除成功')
  1607. // console.log(this.adviceTemplates.length)
  1608. // for(let i = 0;i < this.adviceTemplates.length; i++){
  1609. // if(this.adviceTemplates[i].template_id == row.template_id){
  1610. // this.adviceTemplates.splice(i,1);
  1611. // }
  1612. // }
  1613. this.getAdviceConfig()
  1614. }
  1615. })
  1616. })
  1617. .catch(() => {
  1618. })
  1619. },
  1620. submitDrugDic(formName) {
  1621. this.$refs[formName].validate(valid => {
  1622. if (valid) {
  1623. if (this.isEdit) {
  1624. UpdateDrugDic(this.drugdicForm.id, this.drugdicForm).then(
  1625. response => {
  1626. if (response.data.state == 0) {
  1627. this.$message.error(response.data.msg)
  1628. return false
  1629. } else {
  1630. this.$message.success('修改成功')
  1631. this.drugdicFormVisible = false
  1632. this.resetForm(formName)
  1633. var drugdic = response.data.data.drugdic
  1634. this.drugdics[this.currentIndex].name = drugdic.name
  1635. this.drugdics[this.currentIndex].spec = drugdic.spec
  1636. this.drugdics[this.currentIndex].spec_unit =
  1637. drugdic.spec_unit
  1638. this.drugdics[this.currentIndex].form = drugdic.form
  1639. this.drugdics[this.currentIndex].form_unit =
  1640. drugdic.form_unit
  1641. this.drugdics[this.currentIndex].updated_time =
  1642. drugdic.updated_time
  1643. this.currentIndex = -1
  1644. return false
  1645. }
  1646. }
  1647. )
  1648. } else {
  1649. CreateDrugDic(this.drugdicForm).then(response => {
  1650. if (response.data.state == 0) {
  1651. this.$message.error(response.data.msg)
  1652. return false
  1653. } else {
  1654. this.$message.success('添加成功')
  1655. this.drugdicFormVisible = false
  1656. this.resetForm(formName)
  1657. this.drugdics.unshift(response.data.data.drugdic)
  1658. return false
  1659. }
  1660. })
  1661. }
  1662. }
  1663. })
  1664. },
  1665. handleSelect1(){
  1666. this.templateForm.drug_id = val.id
  1667. this.templateForm.way = 1
  1668. },
  1669. handleSelect(val){
  1670. console.log("val23232li",val)
  1671. this.templateForm.drug_id = val.id
  1672. this.templateForm.way = 1
  1673. var tmp = val.drug_specs[0]
  1674. console.log("tmp",tmp)
  1675. console.log("unitsOption",this.unitsOption)
  1676. this.templateForm.advice_desc = tmp.dose+tmp.dose_unit+"*"+tmp.min_number+tmp.min_unit+"/"//药品规格
  1677. this.templateForm.drug_spec_unit = tmp.max_unit
  1678. this.templateForm.prescribing_number = tmp.prescribing_number//开药数量
  1679. this.templateForm.prescribing_number_unit = tmp.prescribing_number_unit
  1680. this.templateForm.single_dose = tmp.single_dose//单次用量
  1681. this.templateForm.single_dose_unit = tmp.drug_dose_unit
  1682. this.templateForm.delivery_way = tmp.delivery_way//给药途径
  1683. this.templateForm.execution_frequency = tmp.execution_frequency//执行频率
  1684. this.templateForm.drug_id = tmp.id
  1685. },
  1686. submitTemplate(formName) {
  1687. // if(this.src_type == ""){
  1688. // this.templateForm.way = 0
  1689. // this.templateForm.drug_id = 0
  1690. // }
  1691. if(this.src_type == 2){ //自备药
  1692. var arr = this.templateForm.advice_name.split("(自备药)")
  1693. this.templateForm.advice_name = arr[0]
  1694. }
  1695. // console.log("2222",this.templateForm)
  1696. this.$refs[formName].validate(valid => {
  1697. this.templateForm.single_dose = parseFloat(this.templateForm.single_dose)
  1698. this.templateForm.prescribing_number = parseFloat(this.templateForm.prescribing_number)
  1699. if (isNaN(this.templateForm.single_dose)) {
  1700. this.templateForm.single_dose = 0
  1701. }
  1702. if (isNaN(this.templateForm.prescribing_number)) {
  1703. this.templateForm.prescribing_number = 0
  1704. }
  1705. if (valid) {
  1706. const templateFormTwo = {}
  1707. templateFormTwo.template_id = this.current_template_id
  1708. templateFormTwo.advice_name = this.templateForm.advice_name
  1709. templateFormTwo.advice_desc = this.templateForm.advice_desc
  1710. templateFormTwo.drug_spec = this.templateForm.drug_spec
  1711. templateFormTwo.drug_spec_unit = this.templateForm.drug_spec_unit
  1712. templateFormTwo.single_dose = this.templateForm.single_dose
  1713. templateFormTwo.single_dose_unit = this.templateForm.single_dose_unit
  1714. templateFormTwo.prescribing_number = this.templateForm.prescribing_number
  1715. templateFormTwo.prescribing_number_unit = this.templateForm.prescribing_number_unit
  1716. templateFormTwo.delivery_way = this.templateForm.delivery_way
  1717. templateFormTwo.execution_frequency = this.templateForm.execution_frequency
  1718. templateFormTwo.parent_id = this.parent_id
  1719. templateFormTwo.drug_id = this.templateForm.drug_id
  1720. templateFormTwo.way = this.templateForm.way
  1721. if (this.isAddChild) {
  1722. CreateSubAdvice(templateFormTwo).then(response => {
  1723. if (response.data.state == 0) {
  1724. this.$message.error(response.data.msg)
  1725. this.closeform()
  1726. return false
  1727. } else {
  1728. this.$message.success('添加成功')
  1729. var spliceIndex = -1
  1730. for (let index = this.adviceTemplates.length - 1; ; index--) {
  1731. if (this.adviceTemplates[index].parent_id === templateFormTwo.parent_id) {
  1732. spliceIndex = index
  1733. break
  1734. } else if (this.adviceTemplates[index].id === templateFormTwo.parent_id) {
  1735. spliceIndex = index
  1736. break
  1737. }
  1738. }
  1739. if (spliceIndex > -1) {
  1740. spliceIndex += 1
  1741. if (spliceIndex === this.adviceTemplates.length) {
  1742. const template = response.data.data.template
  1743. template['isNoSub'] = 2
  1744. this.adviceTemplates.push(template)
  1745. } else {
  1746. const template = response.data.data.template
  1747. template['isNoSub'] = 2
  1748. var swapData = this.adviceTemplates.splice(spliceIndex)
  1749. this.adviceTemplates.push(template)
  1750. this.adviceTemplates = this.adviceTemplates.concat(swapData)
  1751. }
  1752. }
  1753. this.handleSpanTempArr()
  1754. this.templateFormVisible = false
  1755. this.resetForm(formName)
  1756. this.closeform()
  1757. return false
  1758. }
  1759. })
  1760. } else {
  1761. const templateFormTwo = {}
  1762. templateFormTwo.advice_name = this.templateForm.advice_name
  1763. templateFormTwo.advice_desc = this.templateForm.advice_desc
  1764. templateFormTwo.drug_spec = this.templateForm.drug_spec
  1765. templateFormTwo.drug_spec_unit = this.templateForm.drug_spec_unit
  1766. templateFormTwo.single_dose = this.templateForm.single_dose
  1767. templateFormTwo.single_dose_unit = this.templateForm.single_dose_unit
  1768. templateFormTwo.prescribing_number = this.templateForm.prescribing_number
  1769. templateFormTwo.prescribing_number_unit = this.templateForm.prescribing_number_unit
  1770. templateFormTwo.delivery_way = this.templateForm.delivery_way
  1771. templateFormTwo.execution_frequency = this.templateForm.execution_frequency
  1772. templateFormTwo.parent_id = this.parent_id
  1773. templateFormTwo.drug_id = this.templateForm.drug_id
  1774. templateFormTwo.way = this.templateForm.way
  1775. if (this.templateForm.frequency_type == 1) {
  1776. templateFormTwo.frequency_type = this.templateForm.frequency_type
  1777. templateFormTwo.day_count = '0'
  1778. templateFormTwo.weekdays = ''
  1779. } else if (this.templateForm.frequency_type == 2) {
  1780. templateFormTwo.frequency_type = this.templateForm.frequency_type
  1781. templateFormTwo.day_count = this.templateForm.day_count
  1782. templateFormTwo.weekdays = ''
  1783. } else if (this.templateForm.frequency_type == 3) {
  1784. templateFormTwo.frequency_type = this.templateForm.frequency_type
  1785. templateFormTwo.day_count = '0'
  1786. templateFormTwo.weekdays = this.templateForm.weekday.filter(function(s) {
  1787. return s && s.trim()
  1788. }).join(',')
  1789. }
  1790. this.templateForm.advice_name = ''
  1791. this.templateForm.advice_desc = ''
  1792. this.templateForm.frequency_type = 1
  1793. this.templateForm.day_count = ''
  1794. this.templateForm.weekday = []
  1795. console.log(templateFormTwo)
  1796. if (this.isEdit) {
  1797. for (let i = 0; i < this.adviceTableData.length; i++) {
  1798. if (i == this.table_current_index) {
  1799. this.adviceTableData[i].advice_name = templateFormTwo.advice_name
  1800. this.adviceTableData[i].advice_desc = templateFormTwo.advice_desc
  1801. this.adviceTableData[i].drug_spec = templateFormTwo.drug_spec
  1802. this.adviceTableData[i].drug_spec_unit = templateFormTwo.drug_spec_unit
  1803. this.adviceTableData[i].single_dose = templateFormTwo.single_dose
  1804. this.adviceTableData[i].single_dose_unit = templateFormTwo.single_dose_unit
  1805. this.adviceTableData[i].prescribing_number = templateFormTwo.prescribing_number
  1806. this.adviceTableData[i].prescribing_number_unit = templateFormTwo.prescribing_number_unit
  1807. this.adviceTableData[i].delivery_way = templateFormTwo.delivery_way
  1808. this.adviceTableData[i].execution_frequency = templateFormTwo.execution_frequency
  1809. this.adviceTableData[i].frequency_type = templateFormTwo.frequency_type
  1810. this.adviceTableData[i].day_count = templateFormTwo.day_count
  1811. this.adviceTableData[i].weekdays = templateFormTwo.weekdays
  1812. this.adviceTableData[i].drug_id = templateFormTwo.drug_id
  1813. this.adviceTableData[i].way = templateFormTwo.way
  1814. }
  1815. }
  1816. } else {
  1817. this.adviceTableData.unshift(templateFormTwo)
  1818. console.log(this.adviceTableData)
  1819. }
  1820. this.templateFormVisible = false
  1821. this.templateTableVisible = true
  1822. }
  1823. this.$refs[formName].resetFields()
  1824. }
  1825. })
  1826. },
  1827. handleCreateDrugWay() {
  1828. this.drugwayForm = {
  1829. name: '',
  1830. id: 0
  1831. }
  1832. this.drugwayFormVisible = true
  1833. this.dialogTitle = '新增给药途径'
  1834. this.isEdit = false
  1835. },
  1836. handleUpdateDrugWay(row, index) {
  1837. this.currentIndex = index
  1838. this.drugwayForm = {
  1839. name: row.name,
  1840. id: row.id
  1841. }
  1842. this.drugwayFormVisible = true
  1843. this.dialogTitle = '编辑给药途径'
  1844. this.isEdit = true
  1845. },
  1846. submitDrugWay(formName) {
  1847. this.$refs[formName].validate(valid => {
  1848. if (valid) {
  1849. if (this.isEdit) {
  1850. UpdateDrugWay(this.drugwayForm.id, this.drugwayForm).then(
  1851. response => {
  1852. if (response.data.state == 0) {
  1853. this.$message.error(response.data.msg)
  1854. return false
  1855. } else {
  1856. this.$message.success('修改成功')
  1857. this.drugwayFormVisible = false
  1858. this.resetForm(formName)
  1859. var drugway = response.data.data.drugway
  1860. this.drugways[this.currentIndex].name = drugway.name
  1861. this.drugways[this.currentIndex].updated_time =
  1862. drugway.updated_time
  1863. this.currentIndex = -1
  1864. return false
  1865. }
  1866. }
  1867. )
  1868. } else {
  1869. CreateDrugWay(this.drugwayForm).then(response => {
  1870. if (response.data.state == 0) {
  1871. this.$message.error(response.data.msg)
  1872. return false
  1873. } else {
  1874. this.$message.success('添加成功')
  1875. this.drugwayFormVisible = false
  1876. this.resetForm(formName)
  1877. this.drugways.unshift(response.data.data.drugway)
  1878. return false
  1879. }
  1880. })
  1881. }
  1882. }
  1883. })
  1884. },
  1885. handleDeleteDrugWay(row, index) {
  1886. this.$confirm('确认删除此给药途径?', '删除', {
  1887. confirmButtonText: '确 定',
  1888. cancelButtonText: '取 消',
  1889. type: 'warning'
  1890. })
  1891. .then(() => {
  1892. DeleteDrugWay(row.id).then(response => {
  1893. if (response.data.state == 0) {
  1894. this.$message.error(response.data.msg)
  1895. return false
  1896. } else {
  1897. this.$message.success('删除成功')
  1898. this.drugways.splice(index, 1)
  1899. }
  1900. })
  1901. })
  1902. .catch(() => {
  1903. })
  1904. },
  1905. handleCreateEF() {
  1906. this.efForm = {
  1907. name: '',
  1908. id: 0
  1909. }
  1910. this.efFormVisible = true
  1911. this.dialogTitle = '新增执行频率'
  1912. this.isEdit = false
  1913. },
  1914. handleUpdateEF(row, index) {
  1915. this.currentIndex = index
  1916. this.efForm = {
  1917. name: row.name,
  1918. id: row.id
  1919. }
  1920. this.efFormVisible = true
  1921. this.dialogTitle = '编辑执行频率'
  1922. this.isEdit = true
  1923. },
  1924. submitEF(formName) {
  1925. this.$refs[formName].validate(valid => {
  1926. if (valid) {
  1927. if (this.isEdit) {
  1928. UpdateExecutionFrequency(this.efForm.id, this.efForm).then(
  1929. response => {
  1930. if (response.data.state == 0) {
  1931. this.$message.error(response.data.msg)
  1932. return false
  1933. } else {
  1934. this.$message.success('修改成功')
  1935. this.efFormVisible = false
  1936. this.resetForm(formName)
  1937. var ef = response.data.data.ef
  1938. this.executionFrequencyOptions[this.currentIndex].name =
  1939. ef.name
  1940. this.executionFrequencyOptions[
  1941. this.currentIndex
  1942. ].updated_time = ef.updated_time
  1943. this.currentIndex = -1
  1944. return false
  1945. }
  1946. }
  1947. )
  1948. } else {
  1949. CreateExecutionFrequency(this.efForm).then(response => {
  1950. if (response.data.state == 0) {
  1951. this.$message.error(response.data.msg)
  1952. return false
  1953. } else {
  1954. this.$message.success('添加成功')
  1955. this.efFormVisible = false
  1956. this.resetForm(formName)
  1957. this.executionFrequencyOptions.unshift(response.data.data.ef)
  1958. return false
  1959. }
  1960. })
  1961. }
  1962. }
  1963. })
  1964. },
  1965. handleDeleteEF(row, index) {
  1966. this.$confirm('确认删除此执行频率?', '删除', {
  1967. confirmButtonText: '确 定',
  1968. cancelButtonText: '取 消',
  1969. type: 'warning'
  1970. })
  1971. .then(() => {
  1972. DeleteExecutionFrequency(row.id).then(response => {
  1973. if (response.data.state == 0) {
  1974. this.$message.error(response.data.msg)
  1975. return false
  1976. } else {
  1977. this.$message.error('删除成功')
  1978. this.executionFrequencyOptions.splice(index, 1)
  1979. }
  1980. })
  1981. })
  1982. .catch(() => {
  1983. })
  1984. },
  1985. getAdviceConfig() {
  1986. this.adviceTemplates = []
  1987. getAllAdviceConfig().then(response => {
  1988. if (response.data.state == 1) {
  1989. this.drugways = response.data.data.drugways
  1990. this.executionFrequencyOptions = response.data.data.efs
  1991. this.drugdics = response.data.data.drugs
  1992. const len = response.data.data.advice_templates.length
  1993. for (let i = 0; i < len; i++) {
  1994. // 对于空医嘱模版的处理
  1995. if (response.data.data.advice_templates[i] != null && response.data.data.advice_templates[i].DoctorAdviceTemplate.length == 0) {
  1996. const object = {}
  1997. object['name'] = response.data.data.advice_templates[i].name
  1998. object['isNoSub'] = 1
  1999. object['template_id'] = response.data.data.advice_templates[i].id
  2000. object['sort'] = response.data.data.advice_templates[i].sort
  2001. this.adviceTemplates.push(object)
  2002. }
  2003. // 非空模版的处理
  2004. for (let y = 0; y < response.data.data.advice_templates[i].DoctorAdviceTemplate.length; y++) {
  2005. if (response.data.data.advice_templates[i].id == response.data.data.advice_templates[i].DoctorAdviceTemplate[y].template_id) {
  2006. const object = {}
  2007. const DoctorAdviceTemplate = response.data.data.advice_templates[i].DoctorAdviceTemplate[y]
  2008. for (const key in DoctorAdviceTemplate) {
  2009. object[key] = DoctorAdviceTemplate[key]
  2010. }
  2011. object['isNoSub'] = 2
  2012. object['name'] = response.data.data.advice_templates[i].name
  2013. object['sort'] = response.data.data.advice_templates[i].sort
  2014. this.adviceTemplates.push(object)
  2015. }
  2016. }
  2017. }
  2018. this.adviceTemplates.sort(this.sortData)
  2019. console.log("列表",this.adviceTemplates)
  2020. // 处理单元格合并的数据
  2021. this.handleSpanTempArr()
  2022. }
  2023. })
  2024. }, isShow(index, row) {
  2025. if (index > 0 && row.name == this.adviceTemplates[index - 1].name) {
  2026. return false
  2027. }
  2028. return true
  2029. }, cancelEditHandle() {
  2030. // this.templateTableVisible = true
  2031. this.templateEditFormVisible = false
  2032. },
  2033. //编辑医嘱
  2034. submitEditTemplate(formName) {
  2035. // var drug_id = 0
  2036. // for(let i=0;i<this.all_drug.length;i++){
  2037. // if(this.templateFormEdit.advice_name == this.all_drug[i].drug_name){
  2038. // drug_id = this.all_drug[i].id
  2039. // }
  2040. // }
  2041. // this.templateFormEdit.drug_id = drug_id
  2042. console.log("编辑子药",this.templateFormEdit)
  2043. this.$refs[formName].validate(valid => {
  2044. this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
  2045. this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
  2046. if (isNaN(this.templateFormEdit.single_dose)) {
  2047. this.templateFormEdit.single_dose = 0
  2048. }
  2049. if (isNaN(this.templateFormEdit.prescribing_number)) {
  2050. this.templateFormEdit.prescribing_number = 0
  2051. }
  2052. if (valid) {
  2053. console.log(this.templateFormEdit)
  2054. if (this.templateFormEdit.frequency_type == 1) {
  2055. this.templateFormEdit.day_count = 0
  2056. this.templateFormEdit.week_days = ''
  2057. } else if (this.templateFormEdit.frequency_type == 2) {
  2058. this.templateFormEdit.day_count = parseInt(this.templateFormEdit.day_count)
  2059. this.templateFormEdit.week_days = ''
  2060. } else if (this.templateFormEdit.frequency_type == 3) {
  2061. this.templateFormEdit.day_count = 0
  2062. this.templateFormEdit.week_days = this.templateFormEdit.weekday.filter(function(s) {
  2063. return s && s.trim()
  2064. }).join(',')
  2065. }
  2066. UpdateAdviceTemplate(this.templateFormEdit.id, this.templateFormEdit,this.templateFormEdit.drug_id).then(
  2067. response => {
  2068. if (response.data.state == 0) {
  2069. this.$message.error(response.data.msg)
  2070. return false
  2071. } else {
  2072. this.$message.success('修改成功')
  2073. this.templateEditFormVisible = false
  2074. this.resetForm(formName)
  2075. var template = response.data.data.template
  2076. this.adviceTemplates[this.currentIndex].advice_name = template.advice_name
  2077. this.adviceTemplates[this.currentIndex].advice_desc = template.advice_desc
  2078. this.adviceTemplates[this.currentIndex].drug_spec = template.drug_spec
  2079. this.adviceTemplates[this.currentIndex].drug_spec_unit = template.drug_spec_unit
  2080. this.adviceTemplates[this.currentIndex].single_dose = template.single_dose
  2081. this.adviceTemplates[this.currentIndex].single_dose_unit = template.single_dose_unit
  2082. this.adviceTemplates[this.currentIndex].delivery_way = template.delivery_way
  2083. this.adviceTemplates[this.currentIndex].execution_frequency = template.execution_frequency
  2084. this.adviceTemplates[this.currentIndex].prescribing_number = template.prescribing_number
  2085. this.adviceTemplates[this.currentIndex].prescribing_number_unit = template.prescribing_number_unit
  2086. this.adviceTemplates[this.currentIndex].day_count = template.day_count
  2087. this.adviceTemplates[this.currentIndex].week_days = template.week_days
  2088. this.adviceTemplates[this.currentIndex].frequency_type = template.frequency_type
  2089. // this.adviceTemplates[this.currentIndex].drug_id = template.drug_id
  2090. this.currentIndex = -1
  2091. return false
  2092. }
  2093. }
  2094. )
  2095. }
  2096. })
  2097. },
  2098. drugDesc(row) {
  2099. if (row.isNoSub == 2) {
  2100. if (row.drug_spec.length <= 0) {
  2101. return ''
  2102. } else {
  2103. if (row.prescribing_number == 0) {
  2104. return row.drug_spec + '' + row.drug_spec_unit
  2105. } else {
  2106. return row.drug_spec + '' + row.drug_spec_unit + ' * ' + row.prescribing_number + row.prescribing_number_unit
  2107. }
  2108. }
  2109. }
  2110. }, drugDescTwo(row) {
  2111. if (row.drug_spec.length <= 0) {
  2112. return ''
  2113. } else {
  2114. if (row.prescribing_number == 0) {
  2115. return row.drug_spec + '' + row.drug_spec_unit
  2116. } else {
  2117. return row.drug_spec + '' + row.drug_spec_unit + ' * ' + row.prescribing_number + row.prescribing_number_unit
  2118. }
  2119. }
  2120. }, newRecordActionTwo() {
  2121. this.templateFormTwoVisible = true
  2122. }, deleteRecordActionTwo() {
  2123. if (this.table_current_index_two == -1) {
  2124. this.$message.error('请选择一条医嘱记录')
  2125. return
  2126. }
  2127. this.$confirm('删除记录', '是否删除该医嘱记录', {
  2128. confirmButtonText: '确 定',
  2129. cancelButtonText: '取 消',
  2130. type: 'warning'
  2131. }).then(() => {
  2132. const id = this.adviceTableDataTwo[this.table_current_index_two].id
  2133. const template_id = this.adviceTableDataTwo[this.table_current_index_two].template_id
  2134. DeleteAdviceTemplate(id, template_id).then(response => {
  2135. if (response.data.state == 0) {
  2136. this.$message.error(response.data.msg)
  2137. return false
  2138. } else {
  2139. this.$message.success('删除成功')
  2140. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2141. console.log(this.adviceTemplates[i].id)
  2142. if (this.adviceTemplates[i].id == this.adviceTableDataTwo[this.table_current_index_two].id) {
  2143. this.adviceTemplates.splice(i, 1)
  2144. }
  2145. }
  2146. this.adviceTableDataTwo.splice(this.table_current_index_two, 1)
  2147. this.table_current_index_two = -1
  2148. }
  2149. })
  2150. }).catch(() => {
  2151. })
  2152. }, modifyRecordActionTwo() {
  2153. if (this.table_current_index_two == -1) {
  2154. this.$message.error('请选择一条医嘱记录')
  2155. return
  2156. }
  2157. this.templateFormEdit = {
  2158. drug_spec: this.adviceTableDataTwo[this.table_current_index_two].drug_spec,
  2159. drug_spec_unit: this.adviceTableDataTwo[this.table_current_index_two].drug_spec_unit,
  2160. advice_name: this.adviceTableDataTwo[this.table_current_index_two].advice_name,
  2161. advice_desc: this.adviceTableDataTwo[this.table_current_index_two].advice_desc,
  2162. single_dose: this.adviceTableDataTwo[this.table_current_index_two].single_dose,
  2163. single_dose_unit: this.adviceTableDataTwo[this.table_current_index_two].single_dose_unit,
  2164. prescribing_number: this.adviceTableDataTwo[this.table_current_index_two].prescribing_number,
  2165. prescribing_number_unit: this.adviceTableDataTwo[this.table_current_index_two].prescribing_number_unit,
  2166. delivery_way: this.adviceTableDataTwo[this.table_current_index_two].delivery_way,
  2167. execution_frequency: this.adviceTableDataTwo[this.table_current_index_two].execution_frequency,
  2168. id: this.adviceTableDataTwo[this.table_current_index_two].id
  2169. }
  2170. this.templateEditFormTwoVisible = true
  2171. }, tableRowClassNameTwo({ row, rowIndex }) {
  2172. // 把每一行的索引放进row
  2173. row.index = rowIndex
  2174. },
  2175. onRowClickTwo(row, event, column) {
  2176. this.table_current_index_two = row.index
  2177. }, cancelHandleTwo() {
  2178. this.templateFormTwoVisible = false
  2179. },
  2180. submitTemplateTwo(formName) {
  2181. this.templateForm['template_id'] = this.current_template_id
  2182. this.templateForm['advice_type'] = this.form.advice_type
  2183. if (this.templateForm.frequency_type == 1) {
  2184. this.templateForm.day_count = 0
  2185. this.templateForm.week_days = ''
  2186. } else if (this.templateForm.frequency_type == 2) {
  2187. this.templateForm.day_count = parseInt(this.templateForm.day_count)
  2188. this.templateForm.week_days = ''
  2189. } else if (this.templateForm.frequency_type == 3) {
  2190. this.templateForm.day_count = 0
  2191. this.templateForm.week_days = this.templateForm.weekday.filter(function(s) {
  2192. return s && s.trim()
  2193. }).join(',')
  2194. this.templateForm.way = 1
  2195. }
  2196. this.templateForm.way = 1
  2197. console.log("编辑模板",this.templateForm)
  2198. // 编辑创建医嘱模版
  2199. CreateSingleAdviceTemplate(this.templateForm).then(response => {
  2200. if (response.data.state == 0) {
  2201. this.$message.error(response.data.msg)
  2202. return false
  2203. } else {
  2204. const source = response.data.data.template
  2205. const objects = {}
  2206. for (const keys in source) {
  2207. objects[keys] = source[keys]
  2208. }
  2209. objects['name'] = this.current_template_name
  2210. objects['isNoSub'] = 2
  2211. this.adviceTableDataTwo.unshift(response.data.data.template)
  2212. this.getAdviceConfig()
  2213. this.resetForm(formName)
  2214. this.templateFormTwoVisible = false
  2215. this.$message.success('添加成功')
  2216. this.templateForm.day_count = ''
  2217. this.templateForm.weekday = []
  2218. this.templateForm.frequency_type = 1
  2219. return false
  2220. }
  2221. })
  2222. }, cancelTableHandleTwo() {
  2223. this.templateTableTwoVisible = false
  2224. this.adviceTableDataTwo = []
  2225. }, cancelEditHandleTwo() {
  2226. this.templateEditFormTwoVisible = false
  2227. },
  2228. submitEditTemplateTwo(formName) {
  2229. this.$refs[formName].validate(valid => {
  2230. this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
  2231. this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
  2232. if (isNaN(this.templateFormEdit.single_dose)) {
  2233. this.templateFormEdit.single_dose = 0
  2234. }
  2235. if (isNaN(this.templateFormEdit.prescribing_number)) {
  2236. this.templateFormEdit.prescribing_number = 0
  2237. }
  2238. if (valid) {
  2239. UpdateAdviceTemplate(this.templateFormEdit.id, this.templateFormEdit).then(
  2240. response => {
  2241. if (response.data.state == 0) {
  2242. this.$message.error(response.data.msg)
  2243. return false
  2244. } else {
  2245. this.$message.success('修改成功')
  2246. this.templateEditFormTwoVisible = false
  2247. this.resetForm(formName)
  2248. var template = response.data.data.template
  2249. this.adviceTableDataTwo[this.table_current_index_two].advice_name = template.advice_name
  2250. this.adviceTableDataTwo[this.table_current_index_two].advice_desc = template.advice_desc
  2251. this.adviceTableDataTwo[this.table_current_index_two].drug_spec = template.drug_spec
  2252. this.adviceTableDataTwo[this.table_current_index_two].drug_spec_unit = template.drug_spec_unit
  2253. this.adviceTableDataTwo[this.table_current_index_two].single_dose = template.single_dose
  2254. this.adviceTableDataTwo[this.table_current_index_two].single_dose_unit = template.single_dose_unit
  2255. this.adviceTableDataTwo[this.table_current_index_two].delivery_way = template.delivery_way
  2256. this.adviceTableDataTwo[this.table_current_index_two].execution_frequency = template.execution_frequency
  2257. this.adviceTableDataTwo[this.table_current_index_two].prescribing_number = template.prescribing_number
  2258. this.adviceTableDataTwo[this.table_current_index_two].prescribing_number_unit = template.prescribing_number_unit
  2259. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2260. if (this.adviceTemplates[i].id == this.adviceTableDataTwo[this.table_current_index_two].id) {
  2261. this.adviceTemplates[i].advice_name = template.advice_name
  2262. this.adviceTemplates[i].advice_desc = template.advice_desc
  2263. this.adviceTemplates[i].drug_spec = template.drug_spec
  2264. this.adviceTemplates[i].drug_spec_unit = template.drug_spec_unit
  2265. this.adviceTemplates[i].single_dose = template.single_dose
  2266. this.adviceTemplates[i].single_dose_unit = template.single_dose_unit
  2267. this.adviceTemplates[i].delivery_way = template.delivery_way
  2268. this.adviceTemplates[i].execution_frequency = template.execution_frequency
  2269. this.adviceTemplates[i].prescribing_number = template.prescribing_number
  2270. this.adviceTemplates[i].prescribing_number_unit = template.prescribing_number_unit
  2271. }
  2272. }
  2273. return false
  2274. }
  2275. }
  2276. )
  2277. }
  2278. })
  2279. }, merge({ row, column, rowIndex, columnIndex }) {
  2280. if (columnIndex === 0 || columnIndex === 1 || columnIndex === 9) {
  2281. const _row = this.tempArr[rowIndex]
  2282. const _col = _row > 0 ? 1 : 0
  2283. return {
  2284. rowspan: _row,
  2285. colspan: _col
  2286. }
  2287. }
  2288. }, tableRowClassNames({ row, rowIndex }) {
  2289. const arr = this.hoverOrderArr
  2290. for (let i = 0; i < arr.length; i++) {
  2291. if (rowIndex == arr[i]) {
  2292. return 'success-row'
  2293. }
  2294. }
  2295. },
  2296. cellMouseEnter: function(row, column, cell, event) {
  2297. if (column.label == '模版名称') {
  2298. this.sameRowArr.forEach((arr, i) => {
  2299. if (arr.indexOf(row.index) != -1) {
  2300. this.hoverOrderArr = arr
  2301. }
  2302. })
  2303. } else if (column.label == '操作') {
  2304. this.sameRowArr.forEach((arr, i) => {
  2305. if (arr.indexOf(row.index) != -1) {
  2306. this.hoverOrderArr = arr
  2307. }
  2308. })
  2309. } else {
  2310. this.hoverOrderArr = []
  2311. }
  2312. }, cellMouseLeave: function(row, column, cell, event) {
  2313. this.hoverOrderArr = []
  2314. },
  2315. // 修改医嘱模版
  2316. openEdit(index, row) {
  2317. console.log("row22222",row)
  2318. this.hoverOrderArr = []
  2319. this.currentIndex = index
  2320. this.templateFormEdit.drug_spec_unit = row.drug_spec_unit
  2321. this.templateFormEdit.drug_spec = row.drug_spec
  2322. this.templateFormEdit.advice_desc = row.advice_desc
  2323. this.templateFormEdit.advice_name = row.advice_name
  2324. this.templateFormEdit.delivery_way = row.delivery_way
  2325. this.templateFormEdit.execution_frequency = row.execution_frequency
  2326. this.templateFormEdit.prescribing_number = row.prescribing_number
  2327. this.templateFormEdit.prescribing_number_unit = row.prescribing_number_unit
  2328. this.templateFormEdit.single_dose = row.single_dose
  2329. this.templateFormEdit.single_dose_unit = row.single_dose_unit
  2330. this.templateFormEdit.id = row.id
  2331. this.templateFormEdit.parent_id = row.parent_id
  2332. this.templateFormEdit.day_count = row.day_count
  2333. this.templateFormEdit.frequency_type = row.frequency_type
  2334. this.templateFormEdit.weekday = row.week_days.split(',')
  2335. this.templateFormEdit.drug_id = row.drug_id
  2336. this.templateFormEdit.way = row.way
  2337. this.templateEditFormVisible = true
  2338. if (row.parent_id > 0) {
  2339. this.editDialogTitle = '编辑子药'
  2340. this.edit_advice_name = '子药名称'
  2341. } else {
  2342. this.editDialogTitle = '编辑医嘱'
  2343. this.edit_advice_name = '医嘱内容'
  2344. }
  2345. },
  2346. openDelete(index, row) {
  2347. this.hoverOrderArr = []
  2348. this.$confirm('删除记录', '是否删除该医嘱', {
  2349. confirmButtonText: '确 定',
  2350. cancelButtonText: '取 消',
  2351. type: 'warning'
  2352. }).then(() => {
  2353. const id = row.id
  2354. const template_id = row.template_id
  2355. const parent_id = row.parent_id
  2356. DeleteAdviceTemplate(id, template_id, parent_id).then(response => {
  2357. if (response.data.state == 0) {
  2358. this.$message.error(response.data.msg)
  2359. return false
  2360. } else {
  2361. this.$message.success('删除成功')
  2362. if (row.parent_id > 0) { // 删除子医嘱
  2363. this.adviceTemplates.splice(index, 1)
  2364. } else { // 如果医嘱下面包含子医嘱,删除医嘱和子医嘱
  2365. // 删除子医嘱
  2366. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2367. if (this.adviceTemplates[i].parent_id == row.id) {
  2368. this.adviceTemplates.splice(i--, 1)
  2369. }
  2370. }
  2371. // 删除医嘱
  2372. this.adviceTemplates.splice(index, 1)
  2373. // 当该模版下没有医嘱的时候,创建一个空模版
  2374. let count = 0 // 用于计数
  2375. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2376. if (this.adviceTemplates[i].template_id == row.template_id) {
  2377. count = count + 1
  2378. }
  2379. }
  2380. if (count == 0) {
  2381. const object = {}
  2382. object['name'] = row.name
  2383. object['isNoSub'] = 1
  2384. object['template_id'] = row.template_id
  2385. this.adviceTemplates.splice(index, 0, object)
  2386. }
  2387. }
  2388. // 处理单元格合并的数据
  2389. this.handleSpanTempArr()
  2390. }
  2391. })
  2392. }).catch(() => {
  2393. })
  2394. }, openDeleteChild(index, row) {
  2395. this.hoverOrderArr = []
  2396. this.$confirm('删除子药', '是否删除该子药', {
  2397. confirmButtonText: '确 定',
  2398. cancelButtonText: '取 消',
  2399. type: 'warning'
  2400. }).then(() => {
  2401. const id = row.id
  2402. const template_id = row.template_id
  2403. const parent_id = row.parent_id
  2404. DeleteAdviceTemplate(id, template_id, parent_id).then(response => {
  2405. if (response.data.state == 0) {
  2406. this.$message.error(response.data.msg)
  2407. return false
  2408. } else {
  2409. this.$message.success('删除成功')
  2410. if (row.parent_id > 0) { // 删除子医嘱
  2411. this.adviceTemplates.splice(index, 1)
  2412. } else { // 如果医嘱下面包含子医嘱,删除医嘱和子医嘱
  2413. // 删除子医嘱
  2414. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2415. if (this.adviceTemplates[i].parent_id == row.id) {
  2416. this.adviceTemplates.splice(i--, 1)
  2417. }
  2418. }
  2419. // 删除医嘱
  2420. this.adviceTemplates.splice(index, 1)
  2421. // 当该模版下没有医嘱的时候,创建一个空模版
  2422. let count = 0 // 用于计数
  2423. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2424. if (this.adviceTemplates[i].template_id == row.template_id) {
  2425. count = count + 1
  2426. }
  2427. }
  2428. if (count == 0) {
  2429. const object = {}
  2430. object['name'] = row.name
  2431. object['isNoSub'] = 1
  2432. object['template_id'] = row.template_id
  2433. this.adviceTemplates.splice(index, 0, object)
  2434. }
  2435. }
  2436. // 处理单元格合并的数据
  2437. this.handleSpanTempArr()
  2438. }
  2439. })
  2440. }).catch(() => {
  2441. })
  2442. },
  2443. openNewChild(index, row) {
  2444. this.hoverOrderArr = []
  2445. this.current_template_id = row.template_id
  2446. this.parent_id = row.id
  2447. this.isAddChild = true
  2448. this.isEdit = false
  2449. this.templateFormVisible = true
  2450. this.dialogTitle = '新增子药'
  2451. this.advice_content_name = '子药名称'
  2452. },
  2453. handleSpanTempArr() {
  2454. this.tempArr = []
  2455. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2456. if (i === 0) {
  2457. this.tempArr.push(1)
  2458. this.pos = 0
  2459. } else {
  2460. // 判断当前元素与上一个元素是否相同
  2461. if (this.adviceTemplates[i].template_id === this.adviceTemplates[i - 1].template_id) {
  2462. this.tempArr[this.pos] += 1
  2463. this.tempArr.push(0)
  2464. } else {
  2465. this.tempArr.push(1)
  2466. this.pos = i
  2467. }
  2468. }
  2469. }
  2470. let sameRowArr = [], sIdx = 0
  2471. this.adviceTemplates.forEach((item, index) => {
  2472. item.index = index
  2473. if (index === 0) {
  2474. sameRowArr.push([index])
  2475. } else {
  2476. if (item.template_id === this.adviceTemplates[index - 1].template_id) {
  2477. sameRowArr[sIdx].push(index)
  2478. } else {
  2479. sIdx = sIdx + 1
  2480. sameRowArr.push([index])
  2481. }
  2482. }
  2483. })
  2484. this.sameRowArr = sameRowArr
  2485. },
  2486. handleUpdateAdviceTemplate(row, index) {
  2487. this.current_template_id = row.template_id
  2488. this.current_template_name = row.name
  2489. this.form.name = row.name
  2490. this.form.advice_type = row.advice_type
  2491. if(row.sort == 0){
  2492. row.sort = ""
  2493. }else{
  2494. this.form.sort = row.sort
  2495. }
  2496. this.templateTableTwoVisible = true
  2497. this.adviceTableDataTwo = []
  2498. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2499. if (this.adviceTemplates[i].template_id == row.template_id) {
  2500. this.adviceTableDataTwo.push(this.adviceTemplates[i])
  2501. }
  2502. }
  2503. this.getAdviceConfig()
  2504. },
  2505. modifyTemplateName() {
  2506. const params = {
  2507. template_name: this.form.name,
  2508. template_id: this.current_template_id,
  2509. sort:this.form.sort,
  2510. }
  2511. updateTemplateName(params).then(response => {
  2512. if (response.data.state == 0) {
  2513. this.$message.error(response.data.msg)
  2514. return false
  2515. } else {
  2516. this.$message.success('修改成功')
  2517. this.templateTableTwoVisible = false
  2518. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2519. if (this.adviceTemplates[i].template_id == this.current_template_id) {
  2520. this.adviceTemplates[i].name = response.data.data.template_name
  2521. }
  2522. }
  2523. }
  2524. })
  2525. }, changeRemind(val) {
  2526. let params = {
  2527. 'is_open_remind': val,
  2528. }
  2529. postDoctorAdviceConfig(params).then(response => {
  2530. if (response.data.state == 1) {
  2531. this.is_open_remind = response.data.data.is_open_remind
  2532. if (response.data.data.is_open_remind == 1) {
  2533. this.$message.success('开启成功')
  2534. } else {
  2535. this.$message.success('关闭成功')
  2536. }
  2537. } else {
  2538. this.$message.error(response.data.msg)
  2539. }
  2540. })
  2541. },
  2542. rand(min, max) {
  2543. return Math.floor(Math.random() * (max - min)) + min;
  2544. },
  2545. //
  2546. getSelfMedicalList(){
  2547. const params = {
  2548. patient_id:this.$route.query.patient_id
  2549. }
  2550. getSelfMedicalList(params).then(response=>{
  2551. if (response.data.state == 1) {
  2552. this.arr_drug = []
  2553. var medicalList = response.data.data.private_drug_list
  2554. var base_drug_list = response.data.data.base_drug_list
  2555. var base_drug_cofig = response.data.data.base_drug_config
  2556. var private_drug_cofig = response.data.data.private_drug_config
  2557. if(private_drug_cofig != null&&private_drug_cofig.drug_start == 1) {
  2558. for (let i = 0; i < medicalList.length; i++) {
  2559. if(medicalList[i].drug_specs != null) {
  2560. for (let a = 0; a < medicalList[i].drug_specs.length; a++) {
  2561. medicalList[i].drug_specs[a]['type'] = 2
  2562. }
  2563. }
  2564. let obj = {
  2565. drug_name: "",
  2566. drug_desc: "",
  2567. delivery_way: "",
  2568. execution_frequency: "",
  2569. single_dose: "",
  2570. single_dose_unit: "",
  2571. prescribing_number: "",
  2572. prescribing_number_unit: "",
  2573. type_id: "",
  2574. type: "",
  2575. custom_id: "",
  2576. drug_specs: [],
  2577. id:"",
  2578. }
  2579. medicalList[i].drug_name = medicalList[i].drug_name + "(自备药)"
  2580. obj.drug_name = medicalList[i].drug_name
  2581. obj.delivery_way = medicalList[i].delivery_way
  2582. obj.execution_frequency = medicalList[i].execution_frequency
  2583. obj.single_dose = medicalList[i].single_dose
  2584. obj.prescribing_number = medicalList[i].prescribing_number
  2585. obj.type_id = medicalList[i].id
  2586. obj.type = 2
  2587. obj.custom_id = this.rand(10000000, 99999999)
  2588. obj.drug_specs = medicalList[i].drug_specs
  2589. obj.id = medicalList[i].id
  2590. this.all_drug.push(obj)
  2591. }
  2592. }
  2593. for (let i = 0; i < base_drug_list.length; i++) {
  2594. if(base_drug_list[i].drug_specs != null) {
  2595. for (let a = 0; a < base_drug_list[i].drug_specs.length; a++) {
  2596. base_drug_list[i].drug_specs[a]['type'] = 1
  2597. }
  2598. }
  2599. let obj = {
  2600. drug_name: "",
  2601. drug_desc: "",
  2602. delivery_way: "",
  2603. execution_frequency: "",
  2604. single_dose: "",
  2605. single_dose_unit: "",
  2606. prescribing_number: "",
  2607. prescribing_number_unit: "",
  2608. type_id: "",
  2609. type: "",
  2610. custom_id: "",
  2611. drug_specs: [],
  2612. id:""
  2613. }
  2614. obj.drug_name = base_drug_list[i].drug_name
  2615. obj.delivery_way = base_drug_list[i].delivery_way
  2616. obj.execution_frequency = base_drug_list[i].execution_frequency
  2617. obj.single_dose = base_drug_list[i].single_dose
  2618. obj.prescribing_number = base_drug_list[i].prescribing_number
  2619. obj.type_id = base_drug_list[i].id
  2620. obj.type = 1
  2621. obj.custom_id = this.rand(10000000, 99999999)
  2622. obj.drug_specs = base_drug_list[i].drug_specs
  2623. obj.id = base_drug_list[i].id
  2624. this.all_drug.push(obj)
  2625. }
  2626. }
  2627. })
  2628. },
  2629. changeDrugName(name){
  2630. this.current_drug_name = name
  2631. this.templateForm.advice_desc = ''
  2632. this.drugSpec = []
  2633. for (let i = 0; i < this.all_drug.length; i++) {
  2634. if (this.all_drug[i].drug_name == name) {
  2635. this.drugSpec = this.all_drug[i].drug_specs
  2636. }
  2637. }
  2638. },
  2639. changeDrugDesc(name) {
  2640. this.current_drug_spec = name
  2641. for (let i = 0; i < this.drugSpec.length; i++) {
  2642. if (this.drugSpec[i].drug_spec == name) {
  2643. this.templateForm.advice_desc = this.drugSpec[i].drug_spec
  2644. this.templateForm.prescribing_number = this.drugSpec[i].prescribing_number.toString()
  2645. this.templateForm.single_dose = this.drugSpec[i].single_dose.toString()
  2646. this.templateForm.delivery_way = this.drugSpec[i].delivery_way.toString()
  2647. this.templateForm.execution_frequency = this.drugSpec[i].execution_frequency.toString()
  2648. this.drug_id = this.drugSpec[i].id
  2649. this.src_type = this.drugSpec[i].type
  2650. this.templateForm.drug_id = this.drugSpec[i].id
  2651. this.templateForm.single_dose_unit = this.drugSpec[i].min_unit
  2652. this.templateForm.prescribing_number_unit = this.drugSpec[i].min_unit
  2653. this.templateForm.drug_spec_unit = this.drugSpec[i].min_unit
  2654. this.templateForm.way = this.drugSpec[i].type
  2655. }
  2656. }
  2657. },
  2658. changeDrugNameTwo(name){
  2659. this.current_drug_name = name
  2660. this.templateFormEdit.advice_desc = ''
  2661. this.drugSpec = []
  2662. for (let i = 0; i < this.all_drug.length; i++) {
  2663. if (this.all_drug[i].drug_name == name) {
  2664. this.drugSpec = this.all_drug[i].drug_specs
  2665. }
  2666. }
  2667. },
  2668. hangdleSelectTwo(val){
  2669. console.log("我的223232",val)
  2670. this.templateFormEdit.drug_id = val.id
  2671. },
  2672. changeDrugDescTwo(name) {
  2673. this.current_drug_spec = name
  2674. for (let i = 0; i < this.drugSpec.length; i++) {
  2675. if (this.drugSpec[i].drug_spec == name) {
  2676. this.templateFormEdit.advice_desc = this.drugSpec[i].drug_spec
  2677. this.templateFormEdit.prescribing_number = this.drugSpec[i].prescribing_number.toString()
  2678. this.templateFormEdit.single_dose = this.drugSpec[i].single_dose.toString()
  2679. this.templateFormEdit.delivery_way = this.drugSpec[i].delivery_way.toString()
  2680. this.templateFormEdit.execution_frequency = this.drugSpec[i].execution_frequency.toString()
  2681. this.templateFormEdit.single_dose_unit = this.drugSpec[i].min_unit
  2682. this.templateFormEdit.drug_spec_unit = this.drugSpec[i].drug_spec_unit
  2683. this.templateFormEdit.prescribing_number_unit = this.drugSpec[i].prescribing_number_unit
  2684. }
  2685. }
  2686. },
  2687. querySearch(queryString, cb) {
  2688. console.log('queryString',queryString)
  2689. var restaurants = this.all_drug;
  2690. restaurants.map(item => {
  2691. item.value = item.drug_name
  2692. })
  2693. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  2694. // 调用 callback 返回建议列表的数据
  2695. console.log('results',results)
  2696. cb(results);
  2697. },
  2698. createFilter(queryString) {
  2699. return (restaurant) => {
  2700. return (restaurant.drug_name.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  2701. };
  2702. },
  2703. querySearch1(queryString, cb) {
  2704. console.log('queryString',queryString)
  2705. var restaurants = this.drugSpec;
  2706. console.log(restaurants)
  2707. restaurants.map(item => {
  2708. item.value = item.drug_spec
  2709. })
  2710. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  2711. // 调用 callback 返回建议列表的数据
  2712. console.log('results',results)
  2713. cb(results);
  2714. },
  2715. sortData(a, b) {
  2716. return a.sort - b.sort
  2717. },
  2718. hangleSelectChange(val){
  2719. console.log("==val==",val)
  2720. var tmp = val.drug_specs[0]
  2721. console.log("tmp",tmp)
  2722. this.templateForm.advice_desc=this.drugSpec[0].drug_spec
  2723. this.templateForm.drug_spec_unit=this.drugSpec[0].min_unit
  2724. this.templateForm.prescribing_number=this.drugSpec[0].prescribing_number
  2725. this.templateForm.prescribing_number_unit=this.drugSpec[0].prescribing_number_unit
  2726. this.templateForm.single_dose=this.drugSpec[0].single_dose
  2727. this.templateForm.single_dose_unit=this.drugSpec[0].min_unit
  2728. this.templateForm.delivery_way=this.drugSpec[0].delivery_way
  2729. this.templateForm.execution_frequency=this.drugSpec[0].execution_frequency
  2730. this.templateForm.advice_desc=tmp.dose+tmp.dose_unit+"*"+tmp.min_number+tmp.min_unit+"/"//药品规格
  2731. // console.log("templateForm2222222222",this.templateForm)
  2732. // console.log("all_drug",this.all_drug)
  2733. // console.log("drugSpec2222222",this.drugSpec)
  2734. this.templateForm.way = 1
  2735. this.templateForm.drug_id = val.id
  2736. },
  2737. closeform(){//清除表单数据
  2738. this.templateForm.advice_name=""
  2739. this.templateForm.advice_desc=""
  2740. this.templateForm.drug_spec_unit=""
  2741. this.templateForm.prescribing_number=""
  2742. this.templateForm.prescribing_number_unit=""
  2743. this.templateForm.single_dose=""
  2744. this.templateForm.single_dose_unit=""
  2745. this.templateForm.delivery_way=""
  2746. this.templateForm.execution_frequency=""
  2747. }
  2748. }
  2749. }
  2750. </script>
  2751. <style>
  2752. .center th .cell {
  2753. text-align: center !important;
  2754. }
  2755. .templateadvicenamedisplay .cell {
  2756. float: left;
  2757. text-align: left;
  2758. }
  2759. .el-table td,
  2760. .el-table th.is-leaf,
  2761. .el-table--border,
  2762. .el-table--group {
  2763. border-color: #d0d3da;
  2764. }
  2765. .el-table--border::after,
  2766. .el-table--group::after,
  2767. .el-table::before {
  2768. background-color: #d0d3da;
  2769. }
  2770. </style>