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

deskPrescription.vue 135KB

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