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

deskPrescription.vue 127KB

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