deskPrescription.vue 119KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130
  1. <template>
  2. <div style="height: calc(100% - 58px);display: flex;flex-direction: column;margin-top: 56px;">
  3. <!-- <div style="border-top:1px solid #e5e5e5;margin-top:5px;">
  4. <div class="mainCell" style="margin-bottom:10px;float:right">
  5. <el-button size="small" @click="open(1)" type="primary" style="margin-left:10px;">保存</el-button>
  6. <el-button size="small" @click="open(2)" type="primary">打印</el-button>
  7. <el-button size="small" @click="open(4)" type="primary">选择模板</el-button>
  8. <el-button size="small" @click="open(5)" type="primary">存模板</el-button>
  9. </div>
  10. </div> -->
  11. <!-- <div class="backColor"></div> -->
  12. <div class="mainCenter" v-loading="loading">
  13. <div class="centerLeft">
  14. <el-tabs v-model="dayorMonth" @tab-click="changeDayOrMonth">
  15. <el-tab-pane label="日结" name="day"></el-tab-pane>
  16. <el-tab-pane label="月结" name="month"></el-tab-pane>
  17. </el-tabs>
  18. <el-form :model="form" ref="form" label-width="80px"
  19. style="display: flex;flex-wrap: wrap;justify-content: space-between;">
  20. <el-form-item label="姓名:" prop="name" label-position="right">
  21. <el-input v-model="patientInfo.name" placeholder="" readonly></el-input>
  22. </el-form-item>
  23. <el-form-item label="证件号: " prop="name" label-position="right">
  24. <el-input v-model="patientInfo.id_card_no" placeholder="" readonly></el-input>
  25. </el-form-item>
  26. <el-form-item label="处方类型: " prop="name" label-position="right">
  27. <el-select style="width:100%;" v-model="register_type" placeholder="">
  28. <el-option
  29. v-for="(item,index) in register"
  30. :key="index"
  31. :label="item.label"
  32. :value="item.value">
  33. </el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="疾病类型:" prop="name" label-position="right">
  37. <el-select filterable style="width:100%;" v-model="state1" placeholder="">
  38. <el-option
  39. v-for="(item,index) in sick"
  40. :key="index"
  41. :label="item.class_name"
  42. :value="item.id">
  43. </el-option>
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item label="诊断:" prop="name" label-position="right">
  47. <el-select style="width:100%;" v-model="diagnose" placeholder="">
  48. <el-option
  49. v-for="(item,index) in diagnoses"
  50. :key="index"
  51. :label="item.class_name"
  52. :value="item.id">
  53. </el-option>
  54. </el-select>
  55. </el-form-item>
  56. <el-form-item label="过敏病史: " prop="name" label-position="right">
  57. <el-autocomplete
  58. style="width:100%;"
  59. class="inline-input"
  60. v-model="state2"
  61. :fetch-suggestions="querySearch2"
  62. placeholder="请输入内容"
  63. ></el-autocomplete>
  64. </el-form-item>
  65. </el-form>
  66. <div class="tabsBox">
  67. <el-button v-if="dayorMonth == 'day'" type="text" class="addTab" @click="addCharges"
  68. icon="el-icon-circle-plus">附加收费
  69. </el-button>
  70. <div class="RP" v-if="dayorMonth == 'month'">Rp
  71. <el-date-picker
  72. v-model="start_time"
  73. prefix-icon="el-icon-date"
  74. @change="changeTime"
  75. :editable="false"
  76. style="width: 150px;"
  77. type="date"
  78. placeholder="选择开始时间"
  79. align="right"
  80. format="yyyy-MM-dd"
  81. :picker-options="pickerBeginDateBefore"
  82. value-format="yyyy-MM-dd">
  83. </el-date-picker>
  84. <span class>-</span>
  85. <el-date-picker
  86. v-model="end_time"
  87. prefix-icon="el-icon-date"
  88. @change="changeEndTime"
  89. :editable="false"
  90. :picker-options="pickerBeginDateAfter"
  91. style="width: 150px;"
  92. type="date"
  93. placeholder="选择结束时间"
  94. align="right"
  95. format="yyyy-MM-dd"
  96. value-format="yyyy-MM-dd">
  97. </el-date-picker>
  98. </div>
  99. <el-tabs v-show="dayorMonth == 'day'" class="preTabs" v-model="editableTabsValue" type="border-card"
  100. closable
  101. @tab-remove="removeTab"
  102. :before-leave="moreState" @tab-click="tabclickEvent">
  103. <el-tab-pane
  104. v-for="(item, index) in prescriptions"
  105. :key="index"
  106. :label="item.name"
  107. :name="item.name"
  108. >
  109. <div class="RP">Rp
  110. <el-date-picker
  111. v-model="item.pre_time"
  112. type="datetime"
  113. :clearable="false"
  114. format="yyyy-MM-dd HH:mm"
  115. value-format="yyyy-MM-dd HH:mm"
  116. placeholder="选择日期">
  117. </el-date-picker>
  118. <div style="float: right;margin-bottom:5px;margin-right:1%;">
  119. <el-button
  120. round
  121. size="small"
  122. @click="openLast(3)"
  123. >上一方
  124. </el-button>
  125. <el-button
  126. round
  127. size="small"
  128. @click="openNext(4)"
  129. >下一方
  130. </el-button>
  131. </div>
  132. </div>
  133. </el-tab-pane>
  134. <el-tab-pane name="more" closable v-if="dayorMonth == 'day'"><span slot="label"><i
  135. class="el-icon-plus"
  136. @click="addTab"></i></span>
  137. </el-tab-pane>
  138. <prescription-table v-if="dayorMonth == 'day'" ref="prescription_tables"
  139. :prescription="curPrescriptions"
  140. :preDrugs="preDrugs"
  141. :activeType="customTabIndex"></prescription-table>
  142. </el-tabs>
  143. <el-tabs v-show="dayorMonth == 'month'" class="preTabs" v-model="editableTabsValueTwo"
  144. type="border-card"
  145. :before-leave="moreState" @tab-click="monthTabclickEvent">
  146. <el-tab-pane
  147. v-for="(item, index) in month_prescriptions"
  148. :key="index"
  149. :label="item.name"
  150. :name="item.name"
  151. >
  152. </el-tab-pane>
  153. <month-prescription-table v-if="dayorMonth == 'month' && !isShowDayPrescription"
  154. ref="month_prescription_tables"
  155. :prescription="curMonthPrescriptions"
  156. :activeType="monthCustomTabIndex"></month-prescription-table>
  157. <day-prescription-table v-if="dayorMonth == 'month' && isShowDayPrescription"
  158. ref="month_prescription_tables" :prescription="curDayPrescriptions"
  159. :activeType="monthCustomTabIndex"></day-prescription-table>
  160. </el-tabs>
  161. </div>
  162. <div class="costBox">
  163. <div>
  164. <span><span style="color: red">*</span>医生:</span>
  165. <el-select style="margin-right:5px;width:140px;" v-model="doctorValue" placeholder=""
  166. @change="changeDoctor">
  167. <el-option
  168. v-for="(item,index) in doctors"
  169. :key="index"
  170. :label="item.user_name"
  171. :value="item.admin_user_id">
  172. </el-option>
  173. </el-select>
  174. <span> <span style="color: red">*</span>科室:</span>
  175. <el-select style="margin-right:5px;width:140px;" v-model="departmentValue" placeholder="">
  176. <el-option
  177. v-for="(item,index) in department"
  178. :key="index"
  179. :label="item.name"
  180. :value="item.id">
  181. </el-option>
  182. </el-select>
  183. <span>当前处方总价:</span>
  184. <span style="color:red;" v-if="dayorMonth == 'day'">{{getTotalOne()?getTotalOne():''}}元</span>
  185. <span style="color:red;" v-if="dayorMonth == 'month'">{{getTotalTwo()?getTotalTwo():''}}元</span>
  186. <span style="margin-left:10px;">总价:</span>
  187. <span style="color:red;" v-if="dayorMonth == 'day'">{{ getTotal()?getTotal():''}}元</span>
  188. <span style="color:red;"
  189. v-if="dayorMonth == 'month'">{{ getMonthTotal()?getMonthTotal():''}}元</span>
  190. </div>
  191. <span :class="order_status == '未收费' ? 'statusRed' : ''">{{order_status}}</span>
  192. </div>
  193. </div>
  194. <div class='centerRight'>
  195. <!-- <div class="rightTab">
  196. <p :class="rightTab == 1 ? 'activeP' : ''" @click="clickTab(1)">药品</p>
  197. <p :class="rightTab == 2 ? 'activeP' : ''" @click="clickTab(2)">项目</p>
  198. </div> -->
  199. <el-tabs class="borderCard" type="border-card" v-model="rightTab" @tab-click="clickTab"
  200. :before-leave='beforeLeave'>
  201. <el-tab-pane label="药品" :name="1">
  202. </el-tab-pane>
  203. <el-tab-pane label="项目" :name="2">
  204. </el-tab-pane>
  205. <div style="height:100%;" v-show="showOne">
  206. <el-tabs class="rightTabs" v-model="drug_activeName">
  207. <el-tab-pane label="药品列表" name="1">
  208. <div style="margin-bottom:5px;display:flex;">
  209. <el-input style="width:50%;" @input="searchAction"
  210. @keyup.enter.native='searchAction'
  211. v-model.trim="search_keyword"
  212. placeholder="请输入药品名字"></el-input>
  213. <el-select style="margin-left:5px;width:50%;" v-model="value" placeholder=""
  214. @change="changeKind">
  215. <el-option
  216. label="全部"
  217. value="0">
  218. </el-option>
  219. <el-option
  220. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  221. :key="index"
  222. :label="item.name"
  223. :value="item.id">
  224. </el-option>
  225. </el-select>
  226. </div>
  227. <div style="width: 100%;flex:1;overflow: hidden;" ref="rightTable">
  228. <el-table ref="multipleTable"
  229. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  230. :data="drugs" border @select='selectDrugs'
  231. :row-style="{ color: '#303133' }"
  232. @select-all="changeAllGoodInfoTableData"
  233. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  234. highlight-current-row>
  235. <el-table-column type="selection" width="40" align="center"></el-table-column>
  236. <el-table-column label="名称">
  237. <template slot-scope="scope">{{ scope.row.drug_name }}</template>
  238. </el-table-column>
  239. <el-table-column label="规格" width="60">
  240. <template slot-scope="scope">{{ scope.row.drug_spec }}</template>
  241. </el-table-column>
  242. <el-table-column label="库存" width="60">
  243. <template slot-scope="scope">
  244. {{scope.row.total}}{{scope.row.total?scope.row.min_unit:''}}
  245. <!--/ {{-->
  246. <!--scope.row.total * (scope.row.dose / scope.row.min_number)}}-->
  247. <!--{{(scope.row.total * (scope.row.dose /-->
  248. <!--scope.row.min_number))?scope.row.max_unit:''}}-->
  249. </template>
  250. </el-table-column>
  251. <el-table-column label="单价" width="40">
  252. <template slot-scope="scope">{{ scope.row.retail_price }}</template>
  253. </el-table-column>
  254. </el-table>
  255. <div>{{3*(2/3)}}</div>
  256. </div>
  257. </el-tab-pane>
  258. <!--<el-tab-pane label="医嘱模板" name="2">-->
  259. <!--<div style="margin-bottom:5px;">-->
  260. <!--&lt;!&ndash;<el-input style="width:50%;" v-model="input" placeholder=""></el-input>&ndash;&gt;-->
  261. <!--<el-select style="float: right;width: 49%;" v-model="value" placeholder="">-->
  262. <!--<el-option-->
  263. <!--v-for="item in options"-->
  264. <!--:key="item.value"-->
  265. <!--:label="item.label"-->
  266. <!--:value="item.value">-->
  267. <!--</el-option>-->
  268. <!--</el-select>-->
  269. <!--</div>-->
  270. <!--<div style="width: 100%;flex:1;overflow-y: auto;">-->
  271. <!--<el-table ref="multipleTableTwo" :height="multipleTableHeight != '' ? multipleTableHeight : '200'"-->
  272. <!--:data="advices_template" border-->
  273. <!--:row-style="{ color: '#303133' }"-->
  274. <!--:header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"-->
  275. <!--highlight-current-row-->
  276. <!--@select='selectTemplate'-->
  277. <!--@select-all="changeTemplateData"-->
  278. <!--&gt;-->
  279. <!--<el-table-column type="selection" width="40" align="center"></el-table-column>-->
  280. <!--<el-table-column prop="name" label="名称">-->
  281. <!--<template slot-scope="scope">{{scope.row.name}}</template>-->
  282. <!--</el-table-column>-->
  283. <!--&lt;!&ndash;<el-table-column label="规格" width="60">&ndash;&gt;-->
  284. <!--&lt;!&ndash;<template slot-scope="scope">33</template>&ndash;&gt;-->
  285. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  286. <!--&lt;!&ndash;<el-table-column label="库存" width="60">&ndash;&gt;-->
  287. <!--&lt;!&ndash;<template slot-scope="scope">22</template>&ndash;&gt;-->
  288. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  289. <!--&lt;!&ndash;<el-table-column label="单价" width="40">&ndash;&gt;-->
  290. <!--&lt;!&ndash;<template slot-scope="scope">12</template>&ndash;&gt;-->
  291. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  292. <!--</el-table>-->
  293. <!--</div>-->
  294. <!--</el-tab-pane>-->
  295. </el-tabs>
  296. </div>
  297. <div style="height:100%;" v-show="showTwo">
  298. <el-tabs class="rightTabs" v-model="activeName">
  299. <el-tab-pane label="项目列表" name="1">
  300. <div style="margin-bottom:5px;">
  301. <!--<el-input style="width:50%;" v-model="input" placeholder=""></el-input>-->
  302. <el-input style="width:50%;" @input="searchProjectAction"
  303. @keyup.enter.native='searchProjectAction'
  304. v-model.trim="search_project_keyword"
  305. placeholder="请输入项目名称"></el-input>
  306. <el-select style="float: right;width: 49%;" v-model="value" placeholder=""
  307. @change="changeClass">
  308. <el-option
  309. label="全部"
  310. value="0">
  311. </el-option>
  312. <el-option
  313. v-for="(item, index) in getDictionaryDataConfig('system','cost_classify')"
  314. :key="index"
  315. :label="item.name"
  316. :value="item.id">
  317. </el-option>
  318. </el-select>
  319. </div>
  320. <div style="width: 100%;flex:1;overflow-y: auto;">
  321. <el-table ref="tables"
  322. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  323. :data="tabProject" border @select='selectChange'
  324. :row-style="{ color: '#303133' }"
  325. @select-all="changeAllGoodInfoTableDataTwo"
  326. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  327. highlight-current-row>
  328. <el-table-column type="selection" width="40" align="center"></el-table-column>
  329. <el-table-column prop="name" label="名称">
  330. <template slot-scope="scope">{{ scope.row.project_name }}</template>
  331. </el-table-column>
  332. <el-table-column label="规格" width="60">
  333. <template slot-scope="scope">{{ scope.row.single_dose }}</template>
  334. </el-table-column>
  335. <el-table-column label="单价" width="40">
  336. <template slot-scope="scope">{{ scope.row.price }}</template>
  337. </el-table-column>
  338. </el-table>
  339. </div>
  340. </el-tab-pane>
  341. <el-tab-pane label="项目组套" name="2">
  342. <el-input style="width:50%;" @input="searchProjectTeamAction"
  343. @keyup.enter.native='searchProjectTeamAction'
  344. v-model.trim="search_project_team_keyword"
  345. placeholder="请输入项目组套名称"></el-input>
  346. <div style="width: 100%;flex:1;overflow-y: auto;">
  347. <el-table :data="tabPrjectTeam" border ref="tabProjectTeam"
  348. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  349. :row-style="{ color: '#303133' }"
  350. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  351. highlight-current-row
  352. @select='selectTeam'>
  353. <el-table-column type="selection" width="40" align="center"></el-table-column>
  354. <el-table-column prop="name" label="名称">
  355. <template slot-scope="scope">{{scope.row.project_team}}</template>
  356. </el-table-column>
  357. </el-table>
  358. </div>
  359. </el-tab-pane>
  360. </el-tabs>
  361. </div>
  362. </el-tabs>
  363. <template>
  364. <div class="comfirmBox">
  365. <!-- <div>
  366. <span>药品类型:</span>
  367. <el-select style="margin-right:5px;width:100px;" v-model="value" placeholder="" @change="changeKind">
  368. <el-option
  369. label="全部"
  370. value="0">
  371. </el-option>
  372. <el-option
  373. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  374. :key="index"
  375. :label="item.name"
  376. :value="item.id">
  377. </el-option>
  378. </el-select>
  379. </div> -->
  380. <el-button type="primary" style="width:100%;" @click="comfirm">确定添加</el-button>
  381. </div>
  382. </template>
  383. </div>
  384. </div>
  385. <additionalCharges v-on:setData="setCharge" ref='additionalCharges' :hisPatientInfo="hisPatientInfo"
  386. :patientInfo="patientInfo" :additions="additions"></additionalCharges>
  387. <select-template ref='selectTemplate'></select-template>
  388. <save-template ref='saveTemplate' v-on:save_template="saveTemplate"></save-template>
  389. <next-or-last-prescription ref='next_or_last_prescription' v-on:save="setValue"
  390. v-on:cancel="cancel"></next-or-last-prescription>
  391. <!--<next-or-last-prescription ref='next_or_last_prescription' v-on:save="setValue" v-on:cancel="cancel"></next-or-last-prescription>-->
  392. <call-prescription ref='call_prescription' v-on:call="call" v-on:call-cancel="callCancel"></call-prescription>
  393. </div>
  394. </template>
  395. <script>
  396. import MonthPrescriptionTable from '../../outpatientCharges/components/monthPrescriptionTable'
  397. import {
  398. createdTemplate,
  399. createHisPrescription,
  400. delHisPrescription,
  401. editHisPrescription,
  402. getCallHisPrescription,
  403. getDayOrMonthHisPrescription,
  404. getInitData,
  405. getNextOrLastHisPrescription,
  406. getPatientInfo,
  407. getSchedulePatientList
  408. } from '@/api/his/his'
  409. import { getDictionaryDataConfig } from '@/utils/data'
  410. import prescriptionTable from './prescriptionTable'
  411. import selectTemplate from './selectTemplate'
  412. import saveTemplate from './saveTemplate'
  413. import additionalCharges from './additionalCharges'
  414. import {
  415. addProjectTeam,
  416. getAllProjectList,
  417. getAllProjectTeam,
  418. getHisProject,
  419. getPojectListById
  420. } from '@/api/project/project'
  421. import { uParseTime } from '@/utils/tools'
  422. import NextOrLastPrescription from './nextOrLastPrescription'
  423. import CallPrescription from './callPrescription'
  424. import DayPrescriptionTable from '../../outpatientCharges/components/dayPrescriptionTable'
  425. const moment = require('moment')
  426. export default {
  427. props: {
  428. patientInfo: Object,
  429. hisPatientInfo: Object,
  430. prescriptions: Array,
  431. record_date: String,
  432. search_keyword: '',
  433. month_prescriptions: Array,
  434. isloading: false,
  435. loading: false,
  436. other_sick: {
  437. type: Array,
  438. default: function() {
  439. return []
  440. }
  441. }
  442. },
  443. components: {
  444. DayPrescriptionTable,
  445. MonthPrescriptionTable,
  446. CallPrescription,
  447. NextOrLastPrescription,
  448. selectTemplate,
  449. saveTemplate,
  450. prescriptionTable,
  451. additionalCharges
  452. },
  453. data() {
  454. return {
  455. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  456. end_time: moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  457. register: [
  458. { value: 11, label: '普通门诊' },
  459. { value: 12, label: '门诊挂号' },
  460. { value: 13, label: '急诊' },
  461. { value: 14, label: '门诊特殊病' },
  462. { value: 15, label: '门诊统筹' },
  463. { value: 16, label: '门诊慢性病' },
  464. { value: 21, label: '普通住院' }
  465. ],
  466. isLastOrNextVisible: false,
  467. multipleTableHeight: '',
  468. register_type: '',
  469. value: '0',
  470. search_project_keyword: '',
  471. search_project_team_keyword:"",
  472. form: {
  473. name: ''
  474. },
  475. drugs: [],
  476. allDrugs: [],
  477. advices_template: [],
  478. additions: [],
  479. editableTabsValueTwo: '处方1',
  480. editableTabsValue: '处方1',
  481. editableTabs: [{
  482. title: '处方1',
  483. name: '1'
  484. }],
  485. tabIndex: this.prescriptions.length,
  486. curDayPrescriptions: null,
  487. dayPrescriptions: [],
  488. currenet_inedx: 0,
  489. rightTab: 1,
  490. activeName: '1',
  491. drug_activeName: '1',
  492. curPrescriptions: null,
  493. curMonthPrescriptions: this.month_prescriptions[0],
  494. drugTableData: [],
  495. preDrugs: [],
  496. curDrugs: [],
  497. doctorOptions: [],
  498. doctorValue: '',
  499. departmentOptions: [],
  500. departmentValue: '',
  501. total: 0,
  502. request_record_date: '',
  503. state2: '',
  504. customTabIndex: 1,
  505. options: [],
  506. tabProject: [],
  507. allProject: [],
  508. strids: '',
  509. showOne: true,
  510. showTwo: false,
  511. tableData: [],
  512. tabPrjectTeam: [],
  513. allTabPrjectTeam:[],
  514. teamList: [],
  515. doctors: [],
  516. departMent: [],
  517. curStatus: 0,
  518. isShowDayPrescription: false,
  519. monthCustomTabIndex: 1,
  520. order_status: '',
  521. register_types: [
  522. { id: 1, name: '医保' },
  523. { id: 2, name: '自费' }
  524. ],
  525. pickerOptions: {
  526. disabledDate(time) {
  527. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).getTime() - 24 * 3600 * 1000
  528. return time.getTime() > Date.now() || time.getTime() < threeMonths
  529. }
  530. },
  531. department: [],
  532. sick: [],
  533. diagnoses: [],
  534. diagnose: "",
  535. state1: '',
  536. curTotal: 0,
  537. prescription_id: 0,
  538. tempDrugs: [],
  539. dayorMonth: 'day',
  540. pickerBeginDateBefore: {
  541. disabledDate: (time) => {
  542. let beginDateVal = this.end_time
  543. if (beginDateVal) {
  544. return time.getTime() > new Date(beginDateVal).getTime()
  545. }
  546. }
  547. },
  548. pickerBeginDateAfter: {
  549. disabledDate: (time) => {
  550. let beginDateVal = this.start_time
  551. if (beginDateVal) {
  552. return time.getTime() <= new Date(beginDateVal).getTime()
  553. }
  554. }
  555. },
  556. hisList: []
  557. }
  558. },
  559. methods: {
  560. changeClass(id) {
  561. this.tabProject = []
  562. if (id == 0) {
  563. this.tabProject = this.allProject
  564. } else {
  565. for (let i = 0; i < this.allProject.length; i++) {
  566. if (this.allProject[i].cost_classify == id) {
  567. this.tabProject.push(this.allProject[i])
  568. }
  569. }
  570. }
  571. },
  572. setMonthPrescription(month_prescriptions) {
  573. this.month_prescriptions = []
  574. let drug_month_prescriptions = {
  575. advices: []
  576. }
  577. let drug_ids = []
  578. let project_month_prescriptions = {
  579. project: []
  580. }
  581. let project_ids = []
  582. let addition_month_prescriptions = {
  583. addition: []
  584. }
  585. let additions_ids = []
  586. for (let i = 0; i < month_prescriptions.length; i++) {
  587. if (month_prescriptions[i].type == 1) { //药品
  588. for (let a = 0; a < month_prescriptions[i].advices.length; a++) {
  589. let obj = {
  590. id: month_prescriptions[i].advices[a].drug_id,
  591. price: month_prescriptions[i].advices[a].price
  592. }
  593. drug_ids.push(obj)
  594. drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
  595. }
  596. } else if (month_prescriptions[i].type == 2) { //项目
  597. for (let a = 0; a < month_prescriptions[i].project.length; a++) {
  598. let obj = {
  599. id: month_prescriptions[i].project[a].project_id,
  600. price: month_prescriptions[i].project[a].price
  601. }
  602. project_ids.push(obj)
  603. project_month_prescriptions.project.push(month_prescriptions[i].project[a])
  604. }
  605. }
  606. //附加收费
  607. for (let a = 0; a < month_prescriptions[i].addition.length; a++) {
  608. let obj = {
  609. id: month_prescriptions[i].addition[a].item_id,
  610. price: month_prescriptions[i].addition[a].price
  611. }
  612. additions_ids.push(obj)
  613. addition_month_prescriptions.addition.push(month_prescriptions[i].addition[a])
  614. }
  615. }
  616. const obj = {}
  617. const obj1 = {}
  618. const obj2 = {}
  619. drug_ids = drug_ids.reduce((cur, next) => {
  620. obj[next.price] ? '' : obj[next.price] = true && cur.push(next)
  621. return cur
  622. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  623. project_ids = project_ids.reduce((cur, next) => {
  624. obj1[next.price] ? '' : obj1[next.price] = true && cur.push(next)
  625. return cur
  626. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  627. additions_ids = additions_ids.reduce((cur, next) => {
  628. obj2[next.price] ? '' : obj2[next.price] = true && cur.push(next)
  629. return cur
  630. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  631. let drugs = []
  632. let projects = []
  633. let additions = []
  634. for (let i = 0; i < drug_ids.length; i++) {
  635. let obj = {}
  636. let count = 0
  637. for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
  638. if (drug_ids[i].price == drug_month_prescriptions.advices[a].price) {
  639. obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name
  640. obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
  641. obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
  642. obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency
  643. obj['day'] = drug_month_prescriptions.advices[a].day
  644. // obj['prescribing_number'] = obj['prescribing_number'] + drug_month_prescriptions.advices[a].prescribing_number
  645. obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
  646. obj['medical_insurance_number'] = drug_month_prescriptions.advices[a].drug.medical_insurance_number
  647. obj['id'] = drug_month_prescriptions.advices[a].drug_id
  648. obj['single_dose_unit'] = drug_month_prescriptions.advices[a].single_dose_unit
  649. // obj['retail_price'] = obj['retail_price'] + drug_month_prescriptions.advices[a].drug.retail_price
  650. obj['retail_price'] = parseFloat(drug_month_prescriptions.advices[a].price)
  651. obj['drug'] = drug_month_prescriptions.advices[a].drug
  652. count = count + drug_month_prescriptions.advices[a].prescribing_number
  653. }
  654. }
  655. obj['prescribing_number'] = count
  656. drugs.push(obj)
  657. }
  658. for (let i = 0; i < project_ids.length; i++) {
  659. let obj = {}
  660. let count = 0
  661. for (let a = 0; a < project_month_prescriptions.project.length; a++) {
  662. if (project_ids[i].price == project_month_prescriptions.project[a].price) {
  663. if (project_month_prescriptions.project[a].type == 2) {
  664. obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification
  665. obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code
  666. obj['project_name'] = project_month_prescriptions.project[a].project.project_name
  667. } else if (project_month_prescriptions.project[a].type == 3) {
  668. obj['statistical_classification'] = ''
  669. obj['medical_code'] = project_month_prescriptions.project[a].good_info.medical_insurance_number
  670. obj['project_name'] = project_month_prescriptions.project[a].good_info.good_name
  671. }
  672. // obj['project_name'] = project_month_prescriptions.project[a].project.project_name;
  673. // obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification;
  674. obj['single_dose'] = project_month_prescriptions.project[a].single_dose
  675. obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way
  676. obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency
  677. obj['number_days'] = project_month_prescriptions.project[a].day
  678. // obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code;
  679. obj['unit'] = project_month_prescriptions.project[a].unit
  680. obj['project_id'] = project_month_prescriptions.project[a].project_id
  681. count = count + project_month_prescriptions.project[a].count
  682. // price = price + project_month_prescriptions.project[a].price
  683. obj['price'] = parseFloat(project_month_prescriptions.project[a].price)
  684. }
  685. }
  686. obj['total'] = count
  687. projects.push(obj)
  688. }
  689. for (let i = 0; i < additions_ids.length; i++) {
  690. let obj = {}
  691. let count = 0
  692. if (addition_month_prescriptions.addition) {
  693. for (let a = 0; a < addition_month_prescriptions.addition.length; a++) {
  694. if (additions_ids[i].price == addition_month_prescriptions.addition[a].price) {
  695. obj['item_name'] = addition_month_prescriptions.addition[a].item_name
  696. obj['id'] = addition_month_prescriptions.addition[a].id
  697. obj['item_id'] = addition_month_prescriptions.addition[a].item_id
  698. count = count + addition_month_prescriptions.addition[a].count
  699. obj['price'] = parseFloat(addition_month_prescriptions.addition[a].price)
  700. }
  701. }
  702. obj['count'] = count
  703. additions.push(obj)
  704. }
  705. }
  706. let p1 = {
  707. name: '处方' + 1,
  708. advices: drugs,
  709. project: [],
  710. type: 1,
  711. addition: additions
  712. }
  713. let p2 = {
  714. name: '处方' + 2,
  715. type: 2,
  716. project: projects,
  717. advices: [],
  718. addition: []
  719. }
  720. this.month_prescriptions.push(p1)
  721. this.month_prescriptions.push(p2)
  722. this.curMonthPrescriptions = this.month_prescriptions[0]
  723. },
  724. // setMonthPrescription(month_prescriptions) {
  725. // let drug_month_prescriptions = {
  726. // advices: [],
  727. // }
  728. // let drug_ids = []
  729. // let project_month_prescriptions = {
  730. // project: [],
  731. //
  732. // }
  733. // let project_ids = []
  734. //
  735. // let addition_month_prescriptions = {
  736. // addtions: [],
  737. //
  738. // }
  739. // let additions_ids = []
  740. //
  741. //
  742. // for (let i = 0; i < month_prescriptions.length; i++) {
  743. // if (month_prescriptions[i].type == 1) { //药品
  744. // for (let a = 0; a < month_prescriptions[i].advices.length; a++) {
  745. // drug_ids.push(month_prescriptions[i].advices[a].drug_id)
  746. // drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
  747. // }
  748. //
  749. // } else if (month_prescriptions[i].type == 2) { //项目
  750. // for (let a = 0; a < month_prescriptions[i].project.length; a++) {
  751. // project_ids.push(month_prescriptions[i].project[a].project_id)
  752. // project_month_prescriptions.project.push(month_prescriptions[i].project[a])
  753. // }
  754. // }
  755. // //附加收费
  756. // for (let a = 0; a < month_prescriptions[i].addition.length; a++) {
  757. // additions_ids.push(month_prescriptions[i].addition[a].item_id)
  758. // addition_month_prescriptions.addtions.push(month_prescriptions[i].addition[a])
  759. // }
  760. //
  761. // }
  762. //
  763. // console.log(drug_ids)
  764. // console.log(drug_month_prescriptions)
  765. // console.log(project_ids)
  766. // console.log(project_month_prescriptions)
  767. // console.log(additions_ids)
  768. // console.log(addition_month_prescriptions)
  769. //
  770. //
  771. // const obj = {}
  772. // const obj1 = {}
  773. // const obj2 = {}
  774. //
  775. // drug_ids = drug_ids.reduce((cur, next) => {
  776. // obj[next] ? '' : obj[next] = true && cur.push(next)
  777. // return cur
  778. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  779. // project_ids = project_ids.reduce((cur, next) => {
  780. // obj1[next] ? '' : obj1[next] = true && cur.push(next)
  781. // return cur
  782. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  783. // additions_ids = additions_ids.reduce((cur, next) => {
  784. // obj2[next] ? '' : obj2[next] = true && cur.push(next)
  785. // return cur
  786. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  787. //
  788. //
  789. // console.log(drug_ids)
  790. // console.log(project_ids)
  791. // console.log(additions_ids)
  792. //
  793. //
  794. // let drugs = []
  795. // let projects = []
  796. // let additions = []
  797. //
  798. //
  799. // for (let i = 0; i < drug_ids.length; i++) {
  800. // let obj = {}
  801. // let price = 0
  802. // let count = 0
  803. // for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
  804. // if (drug_ids[i] == drug_month_prescriptions.advices[a].drug_id) {
  805. // obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name
  806. // obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
  807. // obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
  808. // obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency
  809. // obj['day'] = drug_month_prescriptions.advices[a].day
  810. // // obj['prescribing_number'] = obj['prescribing_number'] + drug_month_prescriptions.advices[a].prescribing_number
  811. // obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
  812. // obj['medical_insurance_number'] = drug_month_prescriptions.advices[a].drug.medical_insurance_number
  813. // obj['id'] = drug_month_prescriptions.advices[a].drug_id
  814. // // obj['retail_price'] = obj['retail_price'] + drug_month_prescriptions.advices[a].drug.retail_price
  815. //
  816. //
  817. // count = count + drug_month_prescriptions.advices[a].prescribing_number
  818. // price = price + drug_month_prescriptions.advices[a].price
  819. //
  820. // }
  821. // }
  822. // obj['retail_price'] =this.formatDecimal(price,2)
  823. // obj['prescribing_number'] = count
  824. // drugs.push(obj)
  825. // }
  826. //
  827. //
  828. // for (let i = 0; i < project_ids.length; i++) {
  829. // let obj = {}
  830. // let price = 0
  831. // let count = 0
  832. // for (let a = 0; a < project_month_prescriptions.project.length; a++) {
  833. // if (project_ids[i] == project_month_prescriptions.project[a].project_id) {
  834. // obj['project_name'] = project_month_prescriptions.project[a].project.project_name
  835. // obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification
  836. // obj['single_dose'] = project_month_prescriptions.project[a].single_dose
  837. // obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way
  838. // obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency
  839. // obj['number_days'] = project_month_prescriptions.project[a].day
  840. // obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code
  841. // obj['unit'] = project_month_prescriptions.project[a].unit
  842. // obj['project_id'] = project_month_prescriptions.project[a].project_id
  843. // count = count + project_month_prescriptions.project[a].count
  844. // price = price + project_month_prescriptions.project[a].price
  845. // }
  846. // }
  847. // obj['price'] = this.formatDecimal(price,2)
  848. // obj['total'] = count
  849. // projects.push(obj)
  850. // }
  851. //
  852. //
  853. // for (let i = 0; i < additions_ids.length; i++) {
  854. // let obj = {}
  855. // let price = 0
  856. // let count = 0
  857. // for (let a = 0; a < addition_month_prescriptions.addition.length; a++) {
  858. // if (project_ids[i] == addition_month_prescriptions.addition[a].item_id) {
  859. // obj['item_name'] = addition_month_prescriptions.addition[a].item_name
  860. // obj['id'] = addition_month_prescriptions.addition[a].id
  861. // obj['item_id'] = addition_month_prescriptions.addition[a].item_id
  862. // count = count + addition_month_prescriptions.addition[a].count
  863. // price = price + addition_month_prescriptions.addition[a].price
  864. // }
  865. // }
  866. // obj['price'] = this.formatDecimal(price,2)
  867. // obj['count'] = count
  868. // additions.push(obj)
  869. // }
  870. //
  871. // console.log(drugs)
  872. // console.log(projects)
  873. // console.log(additions)
  874. //
  875. //
  876. // if (drugs.length > 0) {
  877. // let p1 = {
  878. // name: '处方' + 1,
  879. // advices: drugs,
  880. // project: [],
  881. // type: 1,
  882. // addition: additions,
  883. // }
  884. // this.month_prescriptions.push(p1)
  885. //
  886. // }
  887. //
  888. // if (projects.length > 0) {
  889. // let p2 = {
  890. // name: '处方' + 2,
  891. // type: 2,
  892. // project: projects,
  893. // advices: [],
  894. // }
  895. // this.month_prescriptions.push(p2)
  896. // }
  897. //
  898. // console.log(this.month_prescriptions)
  899. //
  900. // },
  901. formatDecimal(num, decimal) {
  902. num = num.toString()
  903. let index = num.indexOf('.')
  904. if (index !== -1) {
  905. num = num.substring(0, decimal + index + 1)
  906. } else {
  907. num = num.substring(0)
  908. }
  909. return parseFloat(num).toFixed(decimal)
  910. },
  911. changeTime(val) {
  912. if (val == this.end_time) {
  913. this.isShowDayPrescription = true
  914. } else {
  915. this.isShowDayPrescription = false
  916. }
  917. let params = {
  918. patient_id: this.patientInfo.id,
  919. start_time: val,
  920. end_time: this.end_time,
  921. p_type: 2
  922. }
  923. getDayOrMonthHisPrescription(params).then(response => {
  924. if (response.data.state == 1) {
  925. this.month_prescriptions = []
  926. if (val == this.end_time) {
  927. var day_prescription = response.data.data.day_prescription
  928. // this.month_prescriptions = day_prescription
  929. if (day_prescription.length > 0) {
  930. for (let i = 0; i < day_prescription.length; i++) {
  931. var prescription = day_prescription[i]
  932. let tempAdvice = []
  933. let tempProject = []
  934. let tempAddition = []
  935. //药品
  936. for (let b = 0; b < prescription.advices.length; b++) {
  937. let obj = {
  938. advice_id: prescription.advices[b].id,
  939. drug_name: prescription.advices[b].advice_name,
  940. single_dose: prescription.advices[b].single_dose,
  941. delivery_way: prescription.advices[b].delivery_way,
  942. execution_frequency: prescription.advices[b].execution_frequency,
  943. retail_price: prescription.advices[b].price.toString(),
  944. remark: prescription.advices[b].remark,
  945. day: prescription.advices[b].day,
  946. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  947. single_dose_unit: prescription.advices[b].single_dose_unit,
  948. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  949. medical_insurance_number: prescription.advices[b].med_list_codg,
  950. id: prescription.advices[b].drug_id,
  951. drug: prescription.advices[b].drug
  952. }
  953. tempAdvice.push(obj)
  954. }
  955. //项目
  956. for (let b = 0; b < prescription.project.length; b++) {
  957. let obj = {
  958. id: prescription.project[b].id,
  959. project_id: prescription.project[b].project_id,
  960. // project_name: prescription.project[b].project.project_name,
  961. // statistical_classification: prescription.project[b].project.statistical_classification,
  962. single_dose: prescription.project[b].single_dose,
  963. delivery_way: prescription.project[b].delivery_way,
  964. execution_frequency: prescription.project[b].execution_frequency,
  965. number_days: prescription.project[b].day,
  966. total: prescription.project[b].count.toString(),
  967. price: prescription.project[b].price,
  968. remark: prescription.project[b].remark,
  969. // medical_code: prescription.project[b].project.medical_code,
  970. unit: prescription.project[b].unit
  971. }
  972. if (prescription.project[b].type == 2) {
  973. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  974. obj['medical_code'] = prescription.project[b].project.medical_code
  975. obj['project_name'] = prescription.project[b].project.project_name
  976. } else if (prescription.project[b].type == 3) {
  977. obj['statistical_classification'] = ''
  978. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  979. obj['project_name'] = prescription.project[b].good_info.good_name
  980. }
  981. tempProject.push(obj)
  982. }
  983. //附加收费
  984. for (let b = 0; b < prescription.addition.length; b++) {
  985. let obj = {
  986. id: prescription.addition[b].id,
  987. item_name: prescription.addition[b].item_name,
  988. price: prescription.addition[b].price,
  989. count: prescription.addition[b].count,
  990. item_id: prescription.addition[b].item_id
  991. }
  992. tempAddition.push(obj)
  993. }
  994. let index = i + 1
  995. let obj = {
  996. id: prescription.id,
  997. name: '处方' + index,
  998. advices: tempAdvice,
  999. project: tempProject,
  1000. addition: tempAddition,
  1001. order_status: prescription.order_status
  1002. }
  1003. this.month_prescriptions.push(obj)
  1004. }
  1005. this.curDayPrescriptions = this.month_prescriptions[0]
  1006. }
  1007. } else {
  1008. this.setMonthPrescription(response.data.data.day_prescription)
  1009. this.curMonthPrescriptions = this.month_prescriptions[0]
  1010. }
  1011. } else {
  1012. this.$message.error(response.data.msg)
  1013. }
  1014. })
  1015. },
  1016. changeEndTime(val) {
  1017. if (val == this.start_time) {
  1018. this.isShowDayPrescription = true
  1019. } else {
  1020. this.isShowDayPrescription = false
  1021. }
  1022. let params = {
  1023. patient_id: this.patientInfo.id,
  1024. start_time: this.start_time,
  1025. end_time: val,
  1026. p_type: 2
  1027. }
  1028. getDayOrMonthHisPrescription(params).then(response => {
  1029. if (response.data.state == 1) {
  1030. this.month_prescriptions = []
  1031. if (val == this.start_time) {
  1032. var day_prescription = response.data.data.day_prescription
  1033. // this.month_prescriptions = day_prescription
  1034. if (day_prescription.length > 0) {
  1035. for (let i = 0; i < day_prescription.length; i++) {
  1036. var prescription = day_prescription[i]
  1037. let tempAdvice = []
  1038. let tempProject = []
  1039. let tempAddition = []
  1040. //药品
  1041. for (let b = 0; b < prescription.advices.length; b++) {
  1042. let obj = {
  1043. advice_id: prescription.advices[b].id,
  1044. drug_name: prescription.advices[b].advice_name,
  1045. single_dose: prescription.advices[b].single_dose,
  1046. delivery_way: prescription.advices[b].delivery_way,
  1047. execution_frequency: prescription.advices[b].execution_frequency,
  1048. retail_price: prescription.advices[b].price.toString(),
  1049. remark: prescription.advices[b].remark,
  1050. day: prescription.advices[b].day,
  1051. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1052. single_dose_unit: prescription.advices[b].single_dose_unit,
  1053. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1054. medical_insurance_number: prescription.advices[b].med_list_codg,
  1055. id: prescription.advices[b].drug_id,
  1056. drug: prescription.advices[b].drug
  1057. }
  1058. tempAdvice.push(obj)
  1059. }
  1060. //项目
  1061. for (let b = 0; b < prescription.project.length; b++) {
  1062. let obj = {
  1063. id: prescription.project[b].id,
  1064. project_id: prescription.project[b].project_id,
  1065. // project_name: prescription.project[b].project.project_name,
  1066. // statistical_classification: prescription.project[b].project.statistical_classification,
  1067. single_dose: prescription.project[b].single_dose,
  1068. delivery_way: prescription.project[b].delivery_way,
  1069. execution_frequency: prescription.project[b].execution_frequency,
  1070. number_days: prescription.project[b].day,
  1071. total: prescription.project[b].count.toString(),
  1072. price: prescription.project[b].price,
  1073. remark: prescription.project[b].remark,
  1074. // medical_code: prescription.project[b].project.medical_code,
  1075. unit: prescription.project[b].unit
  1076. }
  1077. if (prescription.project[b].type == 2) {
  1078. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  1079. obj['medical_code'] = prescription.project[b].project.medical_code
  1080. obj['project_name'] = prescription.project[b].project.project_name
  1081. } else if (prescription.project[b].type == 3) {
  1082. obj['statistical_classification'] = ''
  1083. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1084. obj['project_name'] = prescription.project[b].good_info.good_name
  1085. }
  1086. tempProject.push(obj)
  1087. }
  1088. //附加收费
  1089. for (let b = 0; b < prescription.addition.length; b++) {
  1090. let obj = {
  1091. id: prescription.addition[b].id,
  1092. item_name: prescription.addition[b].item_name,
  1093. price: prescription.addition[b].price,
  1094. count: prescription.addition[b].count,
  1095. item_id: prescription.addition[b].item_id
  1096. }
  1097. tempAddition.push(obj)
  1098. }
  1099. let index = i + 1
  1100. let obj = {
  1101. id: prescription.id,
  1102. name: '处方' + index,
  1103. advices: tempAdvice,
  1104. project: tempProject,
  1105. addition: tempAddition,
  1106. order_status: prescription.order_status
  1107. }
  1108. this.month_prescriptions.push(obj)
  1109. }
  1110. this.curDayPrescriptions = this.month_prescriptions[0]
  1111. }
  1112. } else {
  1113. this.setMonthPrescription(response.data.data.day_prescription)
  1114. this.curMonthPrescriptions = this.month_prescriptions[0]
  1115. }
  1116. } else {
  1117. this.$message.error(response.data.msg)
  1118. }
  1119. })
  1120. }, saveTemplate(val) {
  1121. let params = {
  1122. name: val.name,
  1123. mode: val.mode,
  1124. patient_id: this.patientInfo.id
  1125. }
  1126. let data = {
  1127. 'prescriptions': val.prescriptions
  1128. }
  1129. createdTemplate(params, data).then(response => {
  1130. if (response.data.state == 1) {
  1131. this.$refs.saveTemplate.hide()
  1132. this.$message.success('保存成功')
  1133. } else {
  1134. this.$message.error(response.data.msg)
  1135. }
  1136. })
  1137. },
  1138. call(val) {
  1139. this.prescriptions = []
  1140. this.prescriptions = val
  1141. for (let i = 0; i < this.prescriptions.length; i++) {
  1142. var nowDate = new Date()
  1143. var nowYear = nowDate.getFullYear()
  1144. var nowMonth = nowDate.getMonth() + 1
  1145. var nowDay = nowDate.getDate()
  1146. var hours = nowDate.getHours()
  1147. var min = nowDate.getMinutes()
  1148. var nowTime =
  1149. nowYear +
  1150. '-' +
  1151. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1152. '-' +
  1153. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1154. ':' + (min < 10 ? '0' + min : min)
  1155. this.prescriptions[i]['pre_time'] = nowTime
  1156. this.prescriptions[i].name = '处方' + (i + 1)
  1157. if (i == 0) {
  1158. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  1159. this.customTabIndex = 1
  1160. this.curStatus = 1
  1161. this.rightTab = 1
  1162. this.showOne = true
  1163. this.showTwo = false
  1164. }
  1165. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  1166. this.customTabIndex = 2
  1167. this.curStatus = 2
  1168. this.rightTab = 2
  1169. this.showTwo = true
  1170. this.showOne = false
  1171. }
  1172. }
  1173. }
  1174. this.curPrescriptions = this.prescriptions[0]
  1175. this.$refs.call_prescription.close()
  1176. this.$emit('setData', this.prescriptions)
  1177. },
  1178. callCancel() {
  1179. this.$refs.call_prescription.close()
  1180. },
  1181. cancel() {
  1182. this.$refs.next_or_last_prescription.close()
  1183. this.request_record_date = this.record_date
  1184. },
  1185. setValue(val) {
  1186. this.prescriptions = []
  1187. this.prescriptions = val
  1188. this.$refs.next_or_last_prescription.close()
  1189. var nowDate = new Date()
  1190. var nowYear = nowDate.getFullYear()
  1191. var nowMonth = nowDate.getMonth() + 1
  1192. var nowDay = nowDate.getDate()
  1193. var hours = nowDate.getHours()
  1194. var min = nowDate.getMinutes()
  1195. var nowTime =
  1196. nowYear +
  1197. '-' +
  1198. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1199. '-' +
  1200. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1201. ':' + (min < 10 ? '0' + min : min)
  1202. for (let i = 0; i < this.prescriptions.length; i++) {
  1203. this.prescriptions[i].name = '处方' + (i + 1)
  1204. this.prescriptions[i]['pre_time'] = nowTime
  1205. if (i == 0) {
  1206. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  1207. this.customTabIndex = 1
  1208. this.curStatus = 1
  1209. this.rightTab = 1
  1210. this.showOne = true
  1211. this.showTwo = false
  1212. }
  1213. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  1214. this.customTabIndex = 2
  1215. this.curStatus = 2
  1216. this.rightTab = 2
  1217. this.showTwo = true
  1218. this.showOne = false
  1219. }
  1220. }
  1221. }
  1222. this.curPrescriptions = this.prescriptions[0]
  1223. this.request_record_date = this.record_date
  1224. this.$emit('setData', this.prescriptions)
  1225. },
  1226. GetNextOrLastHisPrescription(params) {
  1227. getNextOrLastHisPrescription(params).then(response => {
  1228. if (response.data.state == 1) {
  1229. if (this.dayorMonth == 'day') {
  1230. this.$refs.next_or_last_prescription.show(response.data.data.prescriptions, this.patientInfo.name, this.patientInfo.id, this.prescriptions)
  1231. this.request_record_date = uParseTime(response.data.data.prescriptions[0].record_date, '{y}-{m}-{d}')
  1232. } else {
  1233. this.$message.error('当前处于月结,无法使用上一方或下一方功能')
  1234. }
  1235. } else {
  1236. this.$message.error(response.data.msg)
  1237. }
  1238. })
  1239. },
  1240. openLast(val) {
  1241. // if (this.curPrescriptions.order_status == 2) {
  1242. // this.$message.error('处方已经结算,无法添加')
  1243. // return
  1244. // }
  1245. if (this.patientInfo.id == 0) {
  1246. this.$message.error('请选择患者')
  1247. return
  1248. }
  1249. if (val == 1) {
  1250. this.isVisibility = false
  1251. this.request_record_date = this.record_date
  1252. let params = {
  1253. patient_id: this.patientInfo.id,
  1254. record_time: this.request_record_date,
  1255. type: 1,
  1256. p_type: 2
  1257. }
  1258. this.GetNextOrLastHisPrescription(params)
  1259. } else if (val == 3) {
  1260. let params = {
  1261. patient_id: this.patientInfo.id,
  1262. record_time: this.request_record_date,
  1263. type: 1,
  1264. p_type: 2
  1265. }
  1266. this.GetNextOrLastHisPrescription(params)
  1267. }
  1268. },
  1269. openNext(val) {
  1270. // if (this.curPrescriptions.order_status == 2) {
  1271. // this.$message.error('处方已经结算,无法添加')
  1272. // return
  1273. // }
  1274. if (this.patientInfo.id == 0) {
  1275. this.$message.error('请选择患者')
  1276. return
  1277. }
  1278. if (val == 2) {
  1279. this.isVisibility = false
  1280. this.request_record_date = this.record_date
  1281. let params = {
  1282. patient_id: this.patientInfo.id,
  1283. record_time: this.request_record_date,
  1284. type: 2,
  1285. p_type: 2
  1286. }
  1287. this.GetNextOrLastHisPrescription(params)
  1288. } else if (val == 4) {
  1289. let params = {
  1290. patient_id: this.patientInfo.id,
  1291. record_time: this.request_record_date,
  1292. type: 2,
  1293. p_type: 2
  1294. }
  1295. this.GetNextOrLastHisPrescription(params)
  1296. }
  1297. },
  1298. selectTemplate(selection, row) {
  1299. this.tempDrugs = selection
  1300. }, changeTemplateData(selection) {
  1301. this.tempDrugs = selection
  1302. },
  1303. stockInCount: function(row) {
  1304. let total = 0
  1305. if (row.stock_in != null) {
  1306. for (let i = 0; i < row.stock_in.length; i++) {
  1307. total = total + row.stock_in[i].warehousing_count
  1308. }
  1309. }
  1310. return total
  1311. },
  1312. salesReturnCount: function(row) {
  1313. let total = 0
  1314. if (row.sales_return != null) {
  1315. for (let i = 0; i < row.sales_return.length; i++) {
  1316. total = total + row.sales_return[i].count
  1317. }
  1318. }
  1319. return total
  1320. },
  1321. stockOutCount: function(row) {
  1322. let total = 0
  1323. if (row.stock_out != null) {
  1324. for (let i = 0; i < row.stock_out.length; i++) {
  1325. total = total + row.stock_out[i].count
  1326. }
  1327. }
  1328. return total
  1329. },
  1330. cancelStockCount: function(row) {
  1331. let total = 0
  1332. if (row.cancel_stock != null) {
  1333. for (let i = 0; i < row.cancel_stock.length; i++) {
  1334. total = total + row.cancel_stock[i].count
  1335. }
  1336. }
  1337. return total
  1338. },
  1339. setCharge(additional_charges) {
  1340. for (let i = 0; i < additional_charges.length; i++) {
  1341. additional_charges[i].count = 1
  1342. this.curPrescriptions.addition.push(additional_charges[i])
  1343. }
  1344. this.$refs.additionalCharges.hide()
  1345. }, searchProjectAction() {
  1346. console.log("~~~~")
  1347. console.log(this.allProject)
  1348. if (this.search_project_keyword.length == 0) {
  1349. this.tabProject = this.allProject
  1350. } else {
  1351. let arr = []
  1352. for (let i = 0; i < this.allProject.length; i++) {
  1353. if (this.allProject[i].project_name.indexOf(this.search_project_keyword) != -1) {
  1354. arr = arr.concat(this.allProject[i])
  1355. }
  1356. }
  1357. this.tabProject = arr
  1358. }
  1359. },searchProjectTeamAction(){
  1360. if (this.search_project_team_keyword.length == 0) {
  1361. this.tabPrjectTeam = this.allTabPrjectTeam
  1362. } else {
  1363. let arr = []
  1364. for (let i = 0; i < this.allTabPrjectTeam.length; i++) {
  1365. if (this.allTabPrjectTeam[i].project_team.indexOf(this.search_project_team_keyword) != -1) {
  1366. arr = arr.concat(this.allTabPrjectTeam[i])
  1367. }
  1368. }
  1369. this.tabPrjectTeam = arr
  1370. }
  1371. },
  1372. searchAction() {
  1373. if (this.search_keyword.length == 0) {
  1374. this.drugs = this.allDrugs
  1375. } else {
  1376. let arr = []
  1377. for (let i = 0; i < this.drugs.length; i++) {
  1378. if (this.drugs[i].drug_name.indexOf(this.search_keyword) != -1 || this.drugs[i].wubi.indexOf(this.search_keyword) != -1 || this.drugs[i].pinyin.indexOf(this.search_keyword) != -1) {
  1379. arr = arr.concat(this.drugs[i])
  1380. }
  1381. }
  1382. this.drugs = arr
  1383. }
  1384. },
  1385. getTotalOne() {
  1386. var total = 0
  1387. for (let i = 0; i < this.prescriptions.length; i++) {
  1388. if (this.prescriptions[i].name == this.editableTabsValue) {
  1389. if (this.prescriptions[i].advices != null) {
  1390. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  1391. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  1392. }
  1393. }
  1394. if (this.prescriptions[i].project != null) {
  1395. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1396. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  1397. }
  1398. }
  1399. if (this.prescriptions[i].addition != null) {
  1400. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  1401. total = total + this.prescriptions[i].addition[b].price * this.prescriptions[i].addition[b].count
  1402. }
  1403. }
  1404. total = Math.floor(total * 100) / 100
  1405. }
  1406. }
  1407. return total
  1408. }, getTotalTwo() {
  1409. var total = 0
  1410. for (let i = 0; i < this.month_prescriptions.length; i++) {
  1411. if (this.month_prescriptions[i].name == this.editableTabsValueTwo) {
  1412. if (this.month_prescriptions[i].advices != null) {
  1413. for (let a = 0; a < this.month_prescriptions[i].advices.length; a++) {
  1414. total = total + this.month_prescriptions[i].advices[a].retail_price * this.month_prescriptions[i].advices[a].prescribing_number
  1415. }
  1416. }
  1417. if (this.month_prescriptions[i].project != null) {
  1418. for (let b = 0; b < this.month_prescriptions[i].project.length; b++) {
  1419. total = total + this.month_prescriptions[i].project[b].price * this.month_prescriptions[i].project[b].total
  1420. }
  1421. }
  1422. if (this.month_prescriptions[i].addition != null) {
  1423. for (let b = 0; b < this.month_prescriptions[i].addition.length; b++) {
  1424. total = total + this.month_prescriptions[i].addition[b].price * this.month_prescriptions[i].addition[b].count
  1425. }
  1426. }
  1427. total = Math.floor(total * 100) / 100
  1428. }
  1429. }
  1430. return total
  1431. },
  1432. getCurTotal() {
  1433. var total = 0
  1434. if (this.curPrescriptions.type == 1) {
  1435. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  1436. total = total + this.curPrescriptions.advices[a].retail_price * this.curPrescriptions.advices[a].prescribing_number
  1437. }
  1438. return Math.floor(total * 100) / 100
  1439. } else {
  1440. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  1441. total = total + this.curPrescriptions.project[a].price * this.curPrescriptions.project[a].total
  1442. }
  1443. return Math.floor(total * 100) / 100
  1444. }
  1445. },
  1446. getTotal() {
  1447. var total = 0
  1448. for (let i = 0; i < this.prescriptions.length; i++) {
  1449. if (this.prescriptions[i].advices != null) {
  1450. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  1451. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  1452. }
  1453. }
  1454. if (this.prescriptions[i].project != null) {
  1455. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1456. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  1457. }
  1458. }
  1459. if (this.prescriptions[i].addition != null) {
  1460. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  1461. total = total + this.prescriptions[i].addition[b].price * this.prescriptions[i].addition[b].count
  1462. }
  1463. }
  1464. }
  1465. return Math.floor(total * 100) / 100
  1466. }, getMonthTotal() {
  1467. var total = 0
  1468. for (let i = 0; i < this.month_prescriptions.length; i++) {
  1469. if (this.month_prescriptions[i].advices != null) {
  1470. for (let a = 0; a < this.month_prescriptions[i].advices.length; a++) {
  1471. total = total + this.month_prescriptions[i].advices[a].retail_price * this.month_prescriptions[i].advices[a].prescribing_number
  1472. }
  1473. }
  1474. if (this.month_prescriptions[i].project != null) {
  1475. for (let b = 0; b < this.month_prescriptions[i].project.length; b++) {
  1476. total = total + this.month_prescriptions[i].project[b].price * this.month_prescriptions[i].project[b].total
  1477. }
  1478. }
  1479. if (this.month_prescriptions[i].addition != null) {
  1480. for (let b = 0; b < this.month_prescriptions[i].addition.length; b++) {
  1481. total = total + this.month_prescriptions[i].addition[b].price * this.month_prescriptions[i].addition[b].count
  1482. }
  1483. }
  1484. }
  1485. return Math.floor(total * 100) / 100
  1486. },
  1487. createFilter(queryString) {
  1488. return (restaurant) => {
  1489. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  1490. }
  1491. },
  1492. querySearch2(queryString, cb) {
  1493. var restaurants = this.other_sick
  1494. restaurants.map(item => {
  1495. item.value = item.name
  1496. })
  1497. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  1498. // 调用 callback 返回建议列表的数据
  1499. cb(results)
  1500. },
  1501. changeKind(val) {
  1502. this.drugs = []
  1503. if (val == 0) {
  1504. this.drugs = this.allDrugs
  1505. } else {
  1506. for (let i = 0; i < this.allDrugs.length; i++) {
  1507. if (this.allDrugs[i].drug_type == val) {
  1508. this.drugs.push(this.allDrugs[i])
  1509. }
  1510. }
  1511. }
  1512. },
  1513. getDictionaryDataConfig(module, filed_name) {
  1514. return getDictionaryDataConfig(module, filed_name)
  1515. },
  1516. getInitData() {
  1517. getInitData().then(response => {
  1518. if (response.data.state == 0) {
  1519. this.$message.error(response.data.msg)
  1520. return false
  1521. } else {
  1522. this.drugs = response.data.data.drugs
  1523. this.allDrugs = response.data.data.drugs
  1524. this.advices_template = response.data.data.advices_template
  1525. this.doctors = response.data.data.doctors
  1526. for (let i = 0; i < this.doctors.length; i++) {
  1527. if (this.doctors[i].user_type == 1) {
  1528. this.doctors.splice(i, 1)
  1529. }
  1530. }
  1531. this.department = response.data.data.department
  1532. this.sick = response.data.data.sick
  1533. this.diagnoses = response.data.data.diagnose
  1534. this.additions = response.data.data.additions
  1535. // var info = response.data.data.info
  1536. // if (info.user_type == 2 || info.user_type == 1) {
  1537. // this.doctorValue = info.admin_user_id
  1538. // if (info.department_id == 0) {
  1539. // if (this.department.length > 0) {
  1540. // this.departmentValue = this.department[0].id
  1541. // } else {
  1542. // this.departmentValue = ''
  1543. //
  1544. // }
  1545. // } else {
  1546. // this.departmentValue = info.department_id
  1547. // }
  1548. // }else{
  1549. // this.doctorValue = this.doctors[0].admin_user_id
  1550. // }
  1551. }
  1552. })
  1553. },
  1554. monthTabclickEvent(val) {
  1555. for (let i = 0; i < this.month_prescriptions.length; i++) {
  1556. if (this.month_prescriptions[i].name == val.name) {
  1557. if (this.dayorMonth == 'month') {
  1558. if (this.isShowDayPrescription) {
  1559. this.curDayPrescriptions = this.month_prescriptions[i]
  1560. //用来区分处方属于项目还是药品
  1561. if (this.curDayPrescriptions.advices.length > 0 && this.curDayPrescriptions.project.length == 0) {
  1562. this.monthCustomTabIndex = 1
  1563. }
  1564. if (this.curDayPrescriptions.advices.length == 0 && this.curDayPrescriptions.project.length > 0) {
  1565. this.monthCustomTabIndex = 2
  1566. }
  1567. } else {
  1568. this.curMonthPrescriptions = this.month_prescriptions[i]
  1569. //用来区分处方属于项目还是药品
  1570. if (this.curMonthPrescriptions.advices.length > 0 && this.curMonthPrescriptions.project.length == 0) {
  1571. this.monthCustomTabIndex = 1
  1572. }
  1573. if (this.curMonthPrescriptions.advices.length == 0 && this.curMonthPrescriptions.project.length > 0) {
  1574. this.monthCustomTabIndex = 2
  1575. }
  1576. }
  1577. }
  1578. this.teamList = []
  1579. this.curDrugs = []
  1580. this.$refs.multipleTable.clearSelection()
  1581. this.$refs.tables.clearSelection()
  1582. }
  1583. }
  1584. },
  1585. tabclickEvent(val) {
  1586. for (let i = 0; i < this.prescriptions.length; i++) {
  1587. if (this.prescriptions[i].name == val.name) {
  1588. this.prescription_id = this.prescriptions[i].id
  1589. this.$emit('event1', this.prescription_id)
  1590. this.curPrescriptions = this.prescriptions[i]
  1591. this.teamList = []
  1592. this.curDrugs = []
  1593. this.$refs.multipleTable.clearSelection()
  1594. this.$refs.tables.clearSelection()
  1595. //用来区分处方属于项目还是药品
  1596. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1597. this.customTabIndex = 1
  1598. this.curStatus = 1
  1599. this.rightTab = 1
  1600. this.showOne = true
  1601. this.showTwo = false
  1602. }
  1603. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1604. this.customTabIndex = 2
  1605. this.curStatus = 2
  1606. this.rightTab = 2
  1607. this.showTwo = true
  1608. this.showOne = false
  1609. }
  1610. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1611. this.customTabIndex = this.rightTab
  1612. this.curStatus = 0
  1613. }
  1614. }
  1615. }
  1616. if (this.curPrescriptions.order_status == 0) {
  1617. this.order_status = ''
  1618. }
  1619. if (this.curPrescriptions.order_status == 1) {
  1620. this.order_status = '未收费'
  1621. }
  1622. if (this.curPrescriptions.order_status == 2) {
  1623. this.order_status = '已结算'
  1624. }
  1625. if (this.curPrescriptions.order_status == 3) {
  1626. this.order_status = '已退费'
  1627. }
  1628. },
  1629. clearData() {
  1630. this.curPrescriptions = []
  1631. this.curStatus = 0
  1632. this.curDrugs = []
  1633. this.preDrugs = []
  1634. this.teamList = []
  1635. },
  1636. setData(data, info, admin_info, doctors, department, hisPatientInfo, month_data) {
  1637. this.curMonthPrescriptions = {}
  1638. this.curPrescriptions = {}
  1639. console.log(doctors)
  1640. for (let i = 0; i < doctors.length; i++) {
  1641. if (doctors[i].user_type == 1) {
  1642. doctors.splice(i, 1)
  1643. }
  1644. }
  1645. this.prescription_id = data[0].id
  1646. this.editableTabsValue = '处方1'
  1647. this.dayorMonth = 'day'
  1648. this.$emit('event1', this.prescription_id)
  1649. this.curStatus = 0
  1650. if (month_data && month_data.length > 0) {
  1651. this.curMonthPrescriptions = month_data[0]
  1652. } else {
  1653. this.curMonthPrescriptions = {}
  1654. }
  1655. if (data && data.length > 0) {
  1656. this.curPrescriptions = data[0]
  1657. } else {
  1658. this.curPrescriptions = {}
  1659. }
  1660. this.diagnose = info.diagnosis
  1661. if (this.diagnose == 0) {
  1662. this.diagnose = ""
  1663. for (let i = 0; i < this.diagnoses.length; i++) {
  1664. this.diagnose = this.diagnoses[0].id
  1665. }
  1666. }
  1667. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1668. this.curStatus = 1
  1669. this.customTabIndex = 1
  1670. this.rightTab = 1
  1671. this.showOne = true
  1672. this.showTwo = false
  1673. }
  1674. if (this.curPrescriptions.project.length > 0 && this.curPrescriptions.advices.length == 0) {
  1675. this.curStatus = 2
  1676. this.customTabIndex = 2
  1677. this.rightTab = 2
  1678. this.showOne = false
  1679. this.showTwo = true
  1680. }
  1681. this.state1 = info.sick_type
  1682. if (this.state1 == 0) {
  1683. this.state1 = ''
  1684. for (let i = 0; i < this.sick.length; i++) {
  1685. this.state1 = this.sick[0].id
  1686. }
  1687. }
  1688. this.state2 = info.sick_history
  1689. if (this.state2 == 0) {
  1690. this.state2 = ''
  1691. }
  1692. if (info.prescription_status == 0) {
  1693. this.order_status = ''
  1694. }
  1695. if (this.curPrescriptions.order_status == 1) {
  1696. this.order_status = '未收费'
  1697. }
  1698. if (this.curPrescriptions.order_status == 2) {
  1699. this.order_status = '已结算'
  1700. }
  1701. if (this.curPrescriptions.order_status == 3) {
  1702. this.order_status = '已退费'
  1703. }
  1704. if (info.id > 0) {
  1705. this.doctorValue = info.doctor_id
  1706. this.departmentValue = info.departments
  1707. } else {
  1708. if (hisPatientInfo.doctor != 0 && hisPatientInfo.department != 0) {
  1709. this.doctorValue = hisPatientInfo.doctor
  1710. this.departmentValue = hisPatientInfo.department
  1711. } else {
  1712. if (admin_info.user_type == 2) {
  1713. this.doctorValue = admin_info.admin_user_id
  1714. if (admin_info.department_id == 0) {
  1715. if (this.department.length > 0) {
  1716. if (department && department.length > 0) {
  1717. this.departmentValue = department[0].id
  1718. } else {
  1719. this.departmentValue = ''
  1720. }
  1721. } else {
  1722. this.departmentValue = ''
  1723. }
  1724. } else {
  1725. this.departmentValue = admin_info.department_id
  1726. }
  1727. } else {
  1728. this.doctorValue = doctors[0].admin_user_id
  1729. }
  1730. if (this.doctorValue == 0) {
  1731. this.doctorValue = ''
  1732. }
  1733. }
  1734. }
  1735. console.log(info.register_type)
  1736. if (info.register_type == 0) {
  1737. for (let i = 0; i < this.register.length; i++) {
  1738. this.register_type = this.register[0].value
  1739. }
  1740. } else {
  1741. this.register_type = info.register_type
  1742. }
  1743. if (this.diagnose == 0) {
  1744. this.diagnose = ""
  1745. }
  1746. },
  1747. moreState(tab, event) {
  1748. if (tab == 'more') {
  1749. return false
  1750. }
  1751. }, open_three() {
  1752. for (let i = 0; i < this.prescriptions.length; i++) {
  1753. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  1754. if (this.prescriptions[i].advices[b].prescribing_number == 0 || this.prescriptions[i].advices[b].prescribing_number == '') {
  1755. this.$message.error('药品处方总量不能为0')
  1756. return
  1757. }
  1758. }
  1759. }
  1760. for (let i = 0; i < this.prescriptions.length; i++) {
  1761. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1762. if (this.prescriptions[i].project[b].total == 0 || this.prescriptions[i].project[b].total == '') {
  1763. this.$message.error('项目处方总量不能为0')
  1764. return
  1765. }
  1766. }
  1767. }
  1768. this.$refs.saveTemplate.show(this.prescriptions)
  1769. }, open_two() {
  1770. if (this.dayorMonth == 'day') {
  1771. if (this.patientInfo == null || this.patientInfo.id == 0) {
  1772. this.$message.error('请选择患者')
  1773. return
  1774. }
  1775. let params = {
  1776. end_time: this.record_date,
  1777. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  1778. patient_id: this.patientInfo.id,
  1779. p_type: 2
  1780. }
  1781. getCallHisPrescription(params).then(response => {
  1782. if (response.data.state == 1) {
  1783. this.$refs.call_prescription.show(this.patientInfo.name, this.patientInfo.id, params.end_time, params.start_time, this.prescriptions, response.data.data.prescriptions)
  1784. } else {
  1785. this.$message.error(response.data.msg)
  1786. }
  1787. })
  1788. } else {
  1789. this.$message.error('当前属于月结状态,无法试用处方调用')
  1790. }
  1791. },
  1792. open(index, isLoading) {
  1793. if (this.dayorMonth == 'day') {
  1794. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length == 0) {
  1795. this.$message.error('请先开处方')
  1796. return
  1797. }
  1798. }
  1799. if (this.dayorMonth == 'day') {
  1800. if (this.curPrescriptions.order_status == 2) {
  1801. this.$message.error('当前处方已经结算,无法保存')
  1802. return
  1803. }
  1804. if (this.doctorValue.length <= 0) {
  1805. this.$message.error('医生不能为空')
  1806. return
  1807. }
  1808. if (this.departmentValue.length <= 0) {
  1809. this.$message.error('科室不能为空')
  1810. return
  1811. }
  1812. if (this.state1 <= 0) {
  1813. this.$message.error('疾病类型不能为空')
  1814. return
  1815. }
  1816. for (let i = 0; i < this.prescriptions.length; i++) {
  1817. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  1818. if (this.prescriptions[i].advices[b].prescribing_number == 0 || this.prescriptions[i].advices[b].prescribing_number == '') {
  1819. this.$message.error('药品处方总量不能为0')
  1820. return
  1821. }
  1822. }
  1823. }
  1824. for (let i = 0; i < this.prescriptions.length; i++) {
  1825. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1826. if (this.prescriptions[i].project[b].total == 0 || this.prescriptions[i].project[b].total == '') {
  1827. this.$message.error('项目处方总量不能为0')
  1828. return
  1829. }
  1830. }
  1831. }
  1832. if (index == 1) {
  1833. let params = {
  1834. p_type: 2,
  1835. patient_id: this.patientInfo.id,
  1836. diagnose: this.diagnose,
  1837. sick_type: this.state1,
  1838. sick_history: this.state2,
  1839. doctor: this.doctorValue,
  1840. department: this.departmentValue,
  1841. record_date: this.record_date,
  1842. his_patient_id: this.hisPatientInfo.id,
  1843. reg_type: this.register_type
  1844. }
  1845. for (let i = 0; i < this.prescriptions.length; i++) {
  1846. if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
  1847. this.prescriptions[i]['type'] = 1
  1848. }
  1849. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
  1850. this.prescriptions[i]['type'] = 2
  1851. }
  1852. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  1853. this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
  1854. this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
  1855. this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
  1856. this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
  1857. }
  1858. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1859. this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString()
  1860. this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString()
  1861. this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
  1862. this.prescriptions[i].project[b].single_dose = this.prescriptions[i].project[b].single_dose.toString()
  1863. }
  1864. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  1865. this.prescriptions[i].addition[b].id = prarseInt(this.prescriptions[i].addition[b].id)
  1866. this.prescriptions[i].addition[b].item_id = parseInt(this.prescriptions[i].addition[b].item_id)
  1867. this.prescriptions[i].addition[b].price = this.prescriptions[i].addition[b].price.toString()
  1868. this.prescriptions[i].addition[b].count = this.prescriptions[i].addition[b].count.toString()
  1869. }
  1870. }
  1871. let data = {
  1872. 'prescriptions': this.prescriptions
  1873. }
  1874. isLoading = true
  1875. createHisPrescription(data, params).then(response => {
  1876. if (response.data.state == 1) {
  1877. this.$emit('change', this.patientInfo.id)
  1878. this.$message.success('保存成功')
  1879. } else {
  1880. this.$message.error(response.data.msg)
  1881. }
  1882. })
  1883. } else if (index == 2) {
  1884. this.$router.push('/outpatientDoctorStation/print')
  1885. } else if (index == 4) {
  1886. } else if (index == 5) {
  1887. this.$refs.saveTemplate.show()
  1888. }
  1889. } else if (this.dayorMonth == 'month') {
  1890. if (this.isShowDayPrescription) {
  1891. // if (this.curDayPrescriptions.order_status == 2) {
  1892. // this.$message.error('当前处方已经结算,无法保存')
  1893. // return
  1894. // }
  1895. if (this.doctorValue.length <= 0) {
  1896. this.$message.error('医生不能为空')
  1897. return
  1898. }
  1899. if (this.departmentValue.length <= 0) {
  1900. this.$message.error('科室不能为空')
  1901. return
  1902. }
  1903. if (index == 1) {
  1904. let params = {
  1905. patient_id: this.patientInfo.id,
  1906. diagnose: this.diagnose,
  1907. sick_type: this.state1,
  1908. sick_history: this.state2,
  1909. doctor: this.doctorValue,
  1910. department: this.departmentValue,
  1911. record_date: this.end_time,
  1912. his_patient_id: this.hisPatientInfo.id,
  1913. reg_type: this.register_type,
  1914. p_type: 2
  1915. }
  1916. var month_prescriptions = this.deepClone(this.month_prescriptions)
  1917. for (let i = 0; i < month_prescriptions.length; i++) {
  1918. if (month_prescriptions[i].advices.length > 0 && month_prescriptions[i].project.length == 0) {
  1919. month_prescriptions[i]['type'] = 1
  1920. }
  1921. if (month_prescriptions[i].advices.length == 0 && month_prescriptions[i].project.length > 0) {
  1922. month_prescriptions[i]['type'] = 2
  1923. }
  1924. for (let b = 0; b < month_prescriptions[i].advices.length; b++) {
  1925. month_prescriptions[i].advices[b].single_dose = month_prescriptions[i].advices[b].single_dose.toString()
  1926. month_prescriptions[i].advices[b].prescribing_number = month_prescriptions[i].advices[b].prescribing_number.toString()
  1927. month_prescriptions[i].advices[b].retail_price = month_prescriptions[i].advices[b].retail_price.toString()
  1928. month_prescriptions[i].advices[b].day = parseInt(month_prescriptions[i].advices[b].day)
  1929. }
  1930. for (let b = 0; b < month_prescriptions[i].project.length; b++) {
  1931. month_prescriptions[i].project[b].price = month_prescriptions[i].project[b].price.toString()
  1932. month_prescriptions[i].project[b].total = month_prescriptions[i].project[b].total.toString()
  1933. month_prescriptions[i].project[b].delivery_way = month_prescriptions[i].project[b].delivery_way.toString()
  1934. }
  1935. for (let b = 0; b < month_prescriptions[i].addition.length; b++) {
  1936. month_prescriptions[i].addition[b].id = parseInt(month_prescriptions[i].addition[b].id)
  1937. month_prescriptions[i].addition[b].item_id = parseInt(month_prescriptions[i].addition[b].item_id)
  1938. month_prescriptions[i].addition[b].price = month_prescriptions[i].addition[b].price.toString()
  1939. month_prescriptions[i].addition[b].count = month_prescriptions[i].addition[b].count.toString()
  1940. }
  1941. }
  1942. let data = {
  1943. 'prescriptions': month_prescriptions
  1944. }
  1945. editHisPrescription(data, params).then(response => {
  1946. if (response.data.state == 1) {
  1947. this.month_prescriptions = month_prescriptions
  1948. this.$message.success('编辑成功')
  1949. }
  1950. })
  1951. }
  1952. }
  1953. }
  1954. },
  1955. addTab(targetName) {
  1956. // if (this.curPrescriptions.order_status == 2) {
  1957. // this.$message.error('该处方已经结算或者退费,无法继续添加处方')
  1958. // return
  1959. // }
  1960. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1961. this.$message.error('当前处方无数据,新增数据后才能新增处方')
  1962. return
  1963. }
  1964. this.tabIndex = this.prescriptions.length
  1965. ++this.tabIndex
  1966. let newTabName = '处方' + this.tabIndex
  1967. var nowDate = new Date()
  1968. var nowYear = nowDate.getFullYear()
  1969. var nowMonth = nowDate.getMonth() + 1
  1970. var nowDay = nowDate.getDate()
  1971. var hours = nowDate.getHours()
  1972. var min = nowDate.getMinutes()
  1973. var nowTime =
  1974. nowYear +
  1975. '-' +
  1976. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1977. '-' +
  1978. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1979. ':' + (min < 10 ? '0' + min : min)
  1980. this.prescriptions.push({
  1981. id: 0,
  1982. name: newTabName,
  1983. order_status: 0,
  1984. advices: [],
  1985. project: [],
  1986. addition: [],
  1987. pre_time: this.prescriptions[0].pre_time
  1988. // pre_time: nowTime
  1989. })
  1990. this.editableTabsValue = newTabName
  1991. this.curPrescriptions = this.prescriptions[this.prescriptions.length - 1]
  1992. this.curStatus = 0
  1993. if (this.curPrescriptions.order_status == 0) {
  1994. this.order_status = '未收费'
  1995. }
  1996. if (this.curPrescriptions.order_status == 1) {
  1997. this.order_status = '未收费'
  1998. }
  1999. if (this.curPrescriptions.order_status == 2) {
  2000. this.order_status = '已结算'
  2001. }
  2002. if (this.curPrescriptions.order_status == 3) {
  2003. this.order_status = '已退费'
  2004. }
  2005. },
  2006. removeTab(targetName) {
  2007. if (this.curPrescriptions.order_status == 2) {
  2008. this.$message.error('该处方已经结算,无法删除')
  2009. return
  2010. }
  2011. if (targetName == '处方1') {
  2012. this.$message.error('该处方无法删除')
  2013. return
  2014. }
  2015. this.$confirm('处方删除后不可恢复,是否确认删除', '删除', {
  2016. confirmButtonText: '确 定',
  2017. cancelButtonText: '取 消',
  2018. type: 'warning'
  2019. }).then(() => {
  2020. let id = 0
  2021. for (let i = 0; i < this.prescriptions.length; i++) {
  2022. if (this.prescriptions[i].name == targetName) {
  2023. id = this.prescriptions[i].id
  2024. }
  2025. }
  2026. if (id == 0) {
  2027. let tabs = this.prescriptions
  2028. let activeName = this.editableTabsValue
  2029. if (activeName === targetName) {
  2030. tabs.forEach((tab, index) => {
  2031. if (tab.name === targetName) {
  2032. let nextTab = tabs[index + 1] || tabs[index - 1]
  2033. if (nextTab) {
  2034. activeName = nextTab.name
  2035. }
  2036. }
  2037. })
  2038. }
  2039. this.editableTabsValue = activeName
  2040. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  2041. for (let i = 0; i < this.prescriptions.length; i++) {
  2042. if (activeName == this.prescriptions[i].name) {
  2043. this.curPrescriptions = this.prescriptions[i]
  2044. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2045. this.curStatus = 1
  2046. }
  2047. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2048. this.curStatus = 2
  2049. }
  2050. }
  2051. }
  2052. if (this.prescriptions.length == 0) {
  2053. this.curPrescriptions = []
  2054. this.curStatus = 0
  2055. }
  2056. } else {
  2057. let params = {
  2058. 'id': id
  2059. }
  2060. delHisPrescription(params).then(response => {
  2061. if (response.data.state == 1) {
  2062. this.$message.success('删除成功')
  2063. let tabs = this.prescriptions
  2064. let activeName = this.editableTabsValue
  2065. if (activeName === targetName) {
  2066. tabs.forEach((tab, index) => {
  2067. if (tab.name === targetName) {
  2068. let nextTab = tabs[index + 1] || tabs[index - 1]
  2069. if (nextTab) {
  2070. activeName = nextTab.name
  2071. }
  2072. }
  2073. })
  2074. }
  2075. this.editableTabsValue = activeName
  2076. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  2077. for (let i = 0; i < this.prescriptions.length; i++) {
  2078. if (activeName == this.prescriptions[i].name) {
  2079. this.curPrescriptions = this.prescriptions[i]
  2080. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2081. this.curStatus = 1
  2082. }
  2083. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2084. this.curStatus = 2
  2085. }
  2086. }
  2087. }
  2088. if (this.prescriptions.length == 0) {
  2089. this.curPrescriptions = []
  2090. this.curStatus = 0
  2091. }
  2092. } else {
  2093. this.$message.success(response.data.msg)
  2094. }
  2095. })
  2096. }
  2097. }).catch(() => {
  2098. })
  2099. },
  2100. beforeLeave(activeName, oldActiveName) {
  2101. let index = activeName
  2102. if (index == 1) {
  2103. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2104. return false
  2105. }
  2106. } else {
  2107. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2108. return false
  2109. }
  2110. }
  2111. },
  2112. clickTab(tab) {
  2113. let index = parseInt(tab.name)
  2114. if (index == 1) {
  2115. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2116. this.$message.error('当前处方为项目,无法切换为药品,需要新开处方')
  2117. return
  2118. }
  2119. } else {
  2120. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2121. this.$message.error('当前处方为药品,无法切换为项目,需要新开处方')
  2122. return
  2123. }
  2124. }
  2125. if (index == 1) {
  2126. this.teamList = []
  2127. this.$refs.tables.clearSelection()
  2128. this.showOne = true
  2129. this.showTwo = false
  2130. this.$nextTick(() => {
  2131. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  2132. })
  2133. this.customTabIndex = 1
  2134. }
  2135. if (index == 2) {
  2136. this.curDrugs = []
  2137. this.$refs.multipleTable.clearSelection()
  2138. this.showTwo = true
  2139. this.showOne = false
  2140. this.$nextTick(() => {
  2141. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  2142. })
  2143. this.customTabIndex = 2
  2144. }
  2145. this.rightTab = index
  2146. //用来区分处方属于项目还是药品
  2147. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2148. this.customTabIndex = 1
  2149. this.curStatus = 1
  2150. }
  2151. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2152. this.customTabIndex = 2
  2153. this.curStatus = 2
  2154. }
  2155. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  2156. // this.customTabIndex = this.rightTab
  2157. this.customTabIndex = index
  2158. this.curStatus = 0
  2159. }
  2160. }, changeAllGoodInfoTableData: function(selection) {
  2161. this.curDrugs = selection
  2162. }, addCharges() {
  2163. this.$refs.additionalCharges.show()
  2164. },
  2165. selectDrugs(selection, row) {
  2166. this.curDrugs = selection
  2167. },
  2168. comfirm() {
  2169. // if (this.curPrescriptions.order_status == 2) {
  2170. // this.$message.error('该处方已经结算,无法继续添加药品或者项目')
  2171. // this.teamList = []
  2172. // this.curDrugs = []
  2173. // this.tempDrugs = []
  2174. // this.$refs.tables.clearSelection()
  2175. // this.$refs.multipleTableTwo.clearSelection()
  2176. // this.$refs.multipleTable.clearSelection()
  2177. // return
  2178. // }
  2179. if (this.curStatus == 1 && this.rightTab == 2) {
  2180. this.$message.error('改处方是药品,无法添加项目')
  2181. this.teamList = []
  2182. this.$refs.tables.clearSelection()
  2183. return
  2184. }
  2185. if (this.curStatus == 2 && this.rightTab == 1) {
  2186. this.$message.error('改处方是项目,无法添加药品')
  2187. this.curDrugs = []
  2188. this.tempDrugs = []
  2189. this.$refs.multipleTable.clearSelection()
  2190. this.$refs.multipleTableTwo.clearSelection()
  2191. return
  2192. }
  2193. for (let i = 0; i < this.teamList.length; i++) {
  2194. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  2195. if (this.teamList[i].id == this.curPrescriptions.project[a].project_id) {
  2196. this.$message.error('当前处方存在相同的药品,无法添加相同的项目')
  2197. return
  2198. }
  2199. }
  2200. }
  2201. for (let i = 0; i < this.curDrugs.length; i++) {
  2202. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  2203. if (this.curDrugs[i].id == this.curPrescriptions.advices[a].id) {
  2204. this.$message.error('当前处方存在相同的药品,无法添加相同的药品')
  2205. return
  2206. }
  2207. }
  2208. }
  2209. let templateDrugs = []
  2210. for (let i = 0; i < this.tempDrugs.length; i++) {
  2211. for (let a = 0; a < this.tempDrugs[i].advices.length; a++) {
  2212. templateDrugs.push(this.tempDrugs[i].advices[a])
  2213. }
  2214. }
  2215. // for (let i = 0; i < templateDrugs.length; i++) {
  2216. // for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  2217. // if (this.templateDrugs[i].drug_id == this.curPrescriptions.advices[i].id) {
  2218. // this.$message.error('改处方存在相同的药品,无法添加相同的药品')
  2219. // return
  2220. //
  2221. // }
  2222. // }
  2223. // }
  2224. for (let i = 0; i < this.prescriptions.length; i++) {
  2225. if (this.prescriptions[i].name == this.editableTabsValue) {
  2226. var temp = this.deepClone(this.curDrugs)
  2227. var temp2 = this.deepClone(this.teamList)
  2228. var temp3 = this.deepClone(templateDrugs)
  2229. if (temp3.length > 0) {
  2230. for (let b = 0; b < temp3.length; b++) {
  2231. let obj = {
  2232. advice_id: 0,
  2233. id: temp3[b].id,
  2234. drug_name: temp3[b].advice_name,
  2235. single_dose: temp3[b].single_dose.toString(),
  2236. delivery_way: temp3[b].delivery_way,
  2237. execution_frequency: temp3[b].execution_frequency,
  2238. retail_price: temp3[b].drug.retail_price.toString(),
  2239. remark: '',
  2240. day: "1",
  2241. prescribing_number: temp3[b].prescribing_number,
  2242. single_dose_unit: temp3[b].drug.min_unit,
  2243. prescribing_number_unit: temp3[b].drug.max_unit,
  2244. medical_insurance_number: temp3[b].drug.medical_insurance_number
  2245. }
  2246. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  2247. obj.prescribing_number = 1
  2248. }
  2249. this.prescriptions[i].advices.push(obj)
  2250. }
  2251. this.curStatus = 1
  2252. }
  2253. if (temp.length > 0) {
  2254. for (let b = 0; b < temp.length; b++) {
  2255. let obj = {
  2256. advice_id: 0,
  2257. id: temp[b].id,
  2258. drug_name: temp[b].drug_name,
  2259. single_dose: temp[b].single_dose,
  2260. delivery_way: temp[b].delivery_way,
  2261. execution_frequency: temp[b].execution_frequency,
  2262. retail_price: temp[b].retail_price.toString(),
  2263. remark: '',
  2264. day: temp[b].drug_day ? temp[b].drug_day : 1,
  2265. prescribing_number: temp[b].prescribing_number,
  2266. single_dose_unit: temp[b].min_unit,
  2267. prescribing_number_unit: temp[b].max_unit,
  2268. medical_insurance_number: temp[b].medical_insurance_number,
  2269. drug: temp[b]
  2270. }
  2271. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  2272. obj.prescribing_number = 1
  2273. }
  2274. console.log('obj',obj)
  2275. this.prescriptions[i].advices.push(obj)
  2276. }
  2277. this.curStatus = 1
  2278. }
  2279. // if(this.activeName == 2){
  2280. //
  2281. // for(let i = 0; i<temp2.length;i++){
  2282. // for(let j=0;j<this.hisList.length;j++){
  2283. // if(temp2[i].id == this.hisList[j].project_id){
  2284. // temp2[i].total = this.hisList[j].number
  2285. // }
  2286. // }
  2287. // }
  2288. // }
  2289. if (temp2.length > 0) {
  2290. for (let b = 0; b < temp2.length; b++) {
  2291. let obj = {
  2292. id: 0,
  2293. project_id: temp2[b].id,
  2294. project_name: temp2[b].project_name,
  2295. statistical_classification: temp2[b].statistical_classification,
  2296. single_dose: temp2[b].single_dose.toString(),
  2297. delivery_way: temp2[b].delivery_way,
  2298. execution_frequency: temp2[b].execution_frequency,
  2299. number_days: temp2[b].number_days.toString(),
  2300. total: temp2[b].total,
  2301. price: temp2[b].price,
  2302. remark: '',
  2303. medical_code: temp2[b].medical_code,
  2304. unit: temp2[b].unit,
  2305. type: temp2[b].type
  2306. }
  2307. if (obj.total == 0 || obj.total == undefined) {
  2308. obj.total = 1
  2309. }
  2310. if (obj.type == 3) {
  2311. obj.single_dose = 1
  2312. }
  2313. this.prescriptions[i].project.push(obj)
  2314. }
  2315. this.curStatus = 2
  2316. }
  2317. this.curPrescriptions = this.prescriptions[i]
  2318. this.$refs.multipleTable.clearSelection()
  2319. this.$refs.tables.clearSelection()
  2320. }
  2321. }
  2322. this.curDrugs = []
  2323. this.preDrugs = []
  2324. this.teamList = []
  2325. }, changeAllGoodInfoTableDataTwo(row) {
  2326. this.teamList = row
  2327. },
  2328. selectChange(row) {
  2329. this.teamList = row
  2330. },
  2331. getlist() {
  2332. this.tabProject = []
  2333. getHisProject().then(response => {
  2334. if (response.data.state == 1) {
  2335. var project = response.data.data.project
  2336. for (let i = 0; i < project.length; i++) {
  2337. let obj = {
  2338. id: project[i].id,
  2339. project_name: project[i].project_name,
  2340. statistical_classification: project[i].statistical_classification,
  2341. single_dose: project[i].single_dose,
  2342. delivery_way: project[i].delivery_way,
  2343. execution_frequency: project[i].execution_frequency,
  2344. number_days: project[i].number_days,
  2345. price: project[i].price,
  2346. medical_code: project[i].medical_code,
  2347. unit: project[i].unit,
  2348. type: 2
  2349. }
  2350. this.tabProject.push(obj)
  2351. }
  2352. var good_info = response.data.data.good_info
  2353. for (let i = 0; i < good_info.length; i++) {
  2354. let obj = {
  2355. id: good_info[i].id,
  2356. project_name: good_info[i].good_name,
  2357. statistical_classification: 0,
  2358. single_dose: 1,
  2359. delivery_way: '',
  2360. execution_frequency: '',
  2361. number_days: 1,
  2362. price: good_info[i].retail_price,
  2363. medical_code: good_info[i].medical_insurance_number,
  2364. unit: this.getGoodUnit(good_info[i].good_unit),
  2365. type: 3
  2366. }
  2367. this.tabProject.push(obj)
  2368. }
  2369. this.allProject = this.tabProject
  2370. }
  2371. })
  2372. }, deepClone(source) {
  2373. if (!source && typeof source !== 'object') {
  2374. throw new Error('error arguments', 'shallowClone')
  2375. }
  2376. const targetObj = source.constructor === Array ? [] : {}
  2377. Object.keys(source).forEach((keys) => {
  2378. if (source[keys] && typeof source[keys] === 'object') {
  2379. targetObj[keys] = this.deepClone(source[keys])
  2380. } else {
  2381. targetObj[keys] = source[keys]
  2382. }
  2383. })
  2384. return targetObj
  2385. }, getGoodUnit(id) {
  2386. var goodUnit = this.$store.getters.good_unit
  2387. for (let i = 0; i < goodUnit.length; i++) {
  2388. if (goodUnit[i].id == id) {
  2389. return goodUnit[i].name
  2390. }
  2391. }
  2392. },
  2393. getAllProjectTeam() {
  2394. getAllProjectTeam().then(response => {
  2395. if (response.data.state == 1) {
  2396. var team = response.data.data.team
  2397. this.tabPrjectTeam = team
  2398. this.allTabPrjectTeam = team
  2399. this.projectList = team
  2400. }
  2401. })
  2402. },
  2403. selectTeam(row) {
  2404. var arr = []
  2405. for (let i = 0; i < row.length; i++) {
  2406. arr.push(row[i].item_id)
  2407. }
  2408. var ids = arr.join(',')
  2409. var strArr = ids.split(',')
  2410. var res = []//接收不重复的数据
  2411. for (var i = 0; i < strArr.length; i++) {
  2412. var flag = true
  2413. for (var j = 0; j < i; j++) {
  2414. if (strArr[i] === strArr[j]) {
  2415. flag = false
  2416. break
  2417. }
  2418. }
  2419. if (flag) {
  2420. res.push(strArr[i])
  2421. }
  2422. }
  2423. var idstr = res.join(',')
  2424. const params = {
  2425. project_id: idstr
  2426. }
  2427. getPojectListById(params).then(response => {
  2428. if (response.data.state == 1) {
  2429. this.teamList = []
  2430. var project = response.data.data.project
  2431. for (let i = 0; i < project.length; i++) {
  2432. if (project[i].type == 2 && project[i].status == 1) {
  2433. let obj = {
  2434. id: project[i].project_id,
  2435. project_name: project[i].project.project_name,
  2436. statistical_classification: project[i].project.statistical_classification,
  2437. single_dose: project[i].project.single_dose,
  2438. delivery_way: project[i].project.delivery_way,
  2439. execution_frequency: project[i].project.execution_frequency,
  2440. number_days: project[i].project.number_days,
  2441. total: project[i].number,
  2442. price: project[i].project.price,
  2443. remark: '',
  2444. medical_code: project[i].project.medical_code,
  2445. unit: project[i].project.unit,
  2446. type: project[i].type
  2447. }
  2448. if (obj.total == 0 || obj.total == undefined) {
  2449. obj.total = 1
  2450. }
  2451. this.teamList.push(obj)
  2452. } else if (project[i].type == 3 && project[i].status == 1) {
  2453. let obj = {
  2454. id: project[i].project_id,
  2455. project_name: project[i].good_info.good_name,
  2456. statistical_classification: '',
  2457. single_dose: '',
  2458. delivery_way: '',
  2459. execution_frequency: '',
  2460. number_days: '',
  2461. total: project[i].number,
  2462. price: project[i].good_info.retail_price,
  2463. remark: '',
  2464. medical_code: project[i].good_info.medical_insurance_number,
  2465. unit: project[i].good_info.unit,
  2466. type: project[i].type
  2467. }
  2468. if (obj.total == 0 || obj.total == undefined) {
  2469. obj.total = 1
  2470. }
  2471. this.teamList.push(obj)
  2472. }
  2473. }
  2474. }
  2475. })
  2476. }, changeDoctor(val) {
  2477. for (let i = 0; i < this.doctors.length; i++) {
  2478. if (this.doctors[i].admin_user_id == this.doctorValue) {
  2479. this.departmentValue = this.doctors[i].department_id
  2480. }
  2481. }
  2482. if (this.departmentValue == 0) {
  2483. this.departmentValue = ''
  2484. }
  2485. },
  2486. changeDayOrMonth(tab) {
  2487. if (this.dayorMonth == 'day') {
  2488. } else if (this.dayorMonth == 'month') {
  2489. }
  2490. },
  2491. getAllProjectList() {
  2492. getAllProjectList().then(response => {
  2493. if (response.data.state == 1) {
  2494. var hisprojectlist = response.data.data.hisprojectlist
  2495. this.hisList = hisprojectlist
  2496. }
  2497. })
  2498. },
  2499. clearSelection() {
  2500. this.$refs.tabProjectTeam.clearSelection()
  2501. }
  2502. }, mounted() {
  2503. this.request_record_date = this.record_date
  2504. this.getInitData()
  2505. //获取所有项目
  2506. this.getlist()
  2507. //获取所以项目组套
  2508. this.getAllProjectTeam()
  2509. this.getAllProjectList()
  2510. this.$nextTick(() => {
  2511. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  2512. })
  2513. },
  2514. watch: {
  2515. fullHeight(val) {
  2516. if (!this.timer) {
  2517. this.fullHeight = val
  2518. let tableHeight = val - 263
  2519. this.tableHeight = tableHeight
  2520. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  2521. this.timer = true
  2522. let that = this
  2523. setTimeout(function() {
  2524. that.timer = false
  2525. }, 400)
  2526. }
  2527. }
  2528. }
  2529. }
  2530. </script>
  2531. <style lang="scss" scoped>
  2532. .new-main-contain {
  2533. height: 100%;
  2534. display: flex;
  2535. flex-direction: column;
  2536. }
  2537. .app-container {
  2538. height: 100%;
  2539. }
  2540. .mainCell {
  2541. height: 36px;
  2542. display: flex;
  2543. align-items: center;
  2544. }
  2545. .mainLeft {
  2546. width: 200px;
  2547. height: 100%;
  2548. display: flex;
  2549. flex-direction: column;
  2550. margin-top: 2px;
  2551. .el-radio {
  2552. margin-right: 5px;
  2553. }
  2554. }
  2555. .mainRight {
  2556. margin-left: 20px;
  2557. flex: 1;
  2558. height: 100%;
  2559. display: flex;
  2560. flex-direction: column;
  2561. .cellSpan {
  2562. min-width: 80px;
  2563. display: inline-block;
  2564. margin-right: 10px;
  2565. }
  2566. }
  2567. .mainCenter {
  2568. display: flex;
  2569. flex: 1;
  2570. height: 100%;
  2571. }
  2572. .centerLeft {
  2573. flex: 1;
  2574. display: flex;
  2575. flex-direction: column;
  2576. position: relative;
  2577. .el-form-item {
  2578. width: 33%;
  2579. margin-bottom: 14px;
  2580. }
  2581. .el-form-item__label {
  2582. text-align: left;
  2583. }
  2584. }
  2585. .backColor {
  2586. background: #f6f8f9;
  2587. height: 5px;
  2588. margin-bottom: 5px;
  2589. }
  2590. .RP {
  2591. color: #409EFF;
  2592. font-size: 14px;
  2593. margin-bottom: 5px;
  2594. }
  2595. .tabsBox {
  2596. position: relative;
  2597. flex: 1;
  2598. overflow-y: auto;
  2599. margin-bottom: 60px;
  2600. /*/ / margin-top: 4 px;*/
  2601. .el-tabs__item {
  2602. padding: 0 10px;
  2603. }
  2604. }
  2605. .preTabs {
  2606. height: 100%;
  2607. display: flex;
  2608. flex-direction: column;
  2609. .el-tabs__content {
  2610. flex: 1;
  2611. overflow-y: auto;
  2612. }
  2613. }
  2614. .costBox {
  2615. width: 100%;
  2616. height: 60px;
  2617. background: #fff;
  2618. position: absolute;
  2619. bottom: 0;
  2620. display: flex;
  2621. align-items: center;
  2622. justify-content: space-between;
  2623. }
  2624. .statusRed {
  2625. color: red;
  2626. }
  2627. .addTab {
  2628. position: absolute;
  2629. right: 8px;
  2630. top: 3px;
  2631. z-index: 20;
  2632. }
  2633. .centerRight {
  2634. width: 300px;
  2635. margin-left: 10px;
  2636. display: flex;
  2637. flex-direction: column;
  2638. position: relative;
  2639. }
  2640. .rightTab {
  2641. height: 40px;
  2642. width: 100%;
  2643. border: 1px solid #d2d2d2;
  2644. box-sizing: border-box;
  2645. p {
  2646. width: 50%;
  2647. height: 40px;
  2648. line-height: 40px;
  2649. text-align: center;
  2650. background: #eee;
  2651. float: left;
  2652. }
  2653. > p:last-child {
  2654. border-left: 1px solid #d2d2d2;
  2655. float: right;
  2656. }
  2657. .activeP {
  2658. background: #409EFF;
  2659. color: #fff;
  2660. }
  2661. }
  2662. .rightTabs {
  2663. display: flex;
  2664. flex-direction: column;
  2665. }
  2666. .comfirmBox {
  2667. width: 100%;
  2668. height: 60px;
  2669. background: #fff;
  2670. position: absolute;
  2671. bottom: 0;
  2672. display: flex;
  2673. align-items: center;
  2674. justify-content: space-between;
  2675. z-index: 99;
  2676. }
  2677. .borderCard {
  2678. height: 100%;
  2679. display: flex;
  2680. flex-direction: column;
  2681. margin-bottom: 60px;
  2682. .el-tabs--border-card > .el-tabs__content {
  2683. padding: 0;
  2684. }
  2685. }
  2686. </style>
  2687. <style lang="scss">
  2688. .borderCard {
  2689. .el-tabs__nav {
  2690. width: 100%;
  2691. }
  2692. .el-tabs__item {
  2693. width: 50%;
  2694. text-align: center;
  2695. }
  2696. .el-tabs__content {
  2697. padding: 5px;
  2698. flex: 1;
  2699. }
  2700. }
  2701. .centerLeft {
  2702. .el-form-item__label {
  2703. text-align: left;
  2704. }
  2705. }
  2706. .tabsBox {
  2707. .el-tabs__item {
  2708. padding: 0 10px;
  2709. }
  2710. .el-tabs--bottom .el-tabs--left > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--bottom .el-tabs--right > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--bottom.el-tabs--border-card > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--bottom.el-tabs--card > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--top .el-tabs--left > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--top .el-tabs--right > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--top.el-tabs--border-card > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--top.el-tabs--card > .el-tabs__header .el-tabs__item:nth-child(2) {
  2711. padding: 0 10px;
  2712. }
  2713. .el-tabs--bottom .el-tabs--left > .el-tabs__header .el-tabs__item:last-child, .el-tabs--bottom .el-tabs--right > .el-tabs__header .el-tabs__item:last-child, .el-tabs--bottom.el-tabs--border-card > .el-tabs__header .el-tabs__item:last-child, .el-tabs--bottom.el-tabs--card > .el-tabs__header .el-tabs__item:last-child, .el-tabs--top .el-tabs--left > .el-tabs__header .el-tabs__item:last-child, .el-tabs--top .el-tabs--right > .el-tabs__header .el-tabs__item:last-child, .el-tabs--top.el-tabs--border-card > .el-tabs__header .el-tabs__item:last-child, .el-tabs--top.el-tabs--card > .el-tabs__header .el-tabs__item:last-child {
  2714. padding: 0 10px;
  2715. }
  2716. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  2717. padding: 0 10px;
  2718. }
  2719. }
  2720. .centerRight {
  2721. .el-tabs__nav-scroll {
  2722. display: flex;
  2723. }
  2724. .el-tabs__nav {
  2725. margin: 0 auto;
  2726. }
  2727. .el-table th .cell, .el-table td .cell {
  2728. padding: 0 2px;
  2729. }
  2730. }
  2731. .preTabs {
  2732. .el-tabs__content {
  2733. flex: 1;
  2734. overflow-y: auto;
  2735. padding: 5px 0 5px 5px;
  2736. }
  2737. }
  2738. .rightTabs {
  2739. height: 100%;
  2740. .el-tabs__nav {
  2741. width: auto;
  2742. }
  2743. .el-tabs__header {
  2744. margin-bottom: 5px;
  2745. }
  2746. .el-tabs__item {
  2747. width: auto;
  2748. text-align: inherit;
  2749. }
  2750. .el-tabs__content {
  2751. flex: 1;
  2752. overflow-y: auto;
  2753. }
  2754. .el-tab-pane {
  2755. display: flex;
  2756. flex-direction: column;
  2757. height: 100%;
  2758. }
  2759. }
  2760. #tab-more {
  2761. .el-icon-close {
  2762. display: none;
  2763. }
  2764. }
  2765. ::-webkit-scrollbar {
  2766. height: 15px;
  2767. }
  2768. </style>