deskPrescription.vue 136KB

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