deskPrescription.vue 154KB

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