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

EditGroupAdvice.vue 98KB

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