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

deskPrescription.vue 158KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002
  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. console.log("诊断23333333333333",this.diagnose)
  1702. this.sick = sick
  1703. this.diagnoses = diagnoses
  1704. this.department = department
  1705. this.curMonthPrescriptions = {}
  1706. this.curPrescriptions = {}
  1707. // this.$refs.tabProjectTeam.clearSelection()
  1708. for (let i = 0; i < doctors.length; i++) {
  1709. if (doctors[i].user_type == 1) {
  1710. doctors.splice(i, 1)
  1711. }
  1712. }
  1713. this.prescription_id = data[0].id
  1714. this.editableTabsValue = '处方1'
  1715. this.dayorMonth = 'day'
  1716. this.$emit('event1', this.prescription_id)
  1717. this.curStatus = 0
  1718. if (month_data && month_data.length > 0) {
  1719. this.curMonthPrescriptions = month_data[0]
  1720. } else {
  1721. this.curMonthPrescriptions = {}
  1722. }
  1723. if (data && data.length > 0) {
  1724. this.curPrescriptions = data[0]
  1725. } else {
  1726. this.curPrescriptions = {}
  1727. }
  1728. this.is_medicine_status = this.curPrescriptions.is_medicine_status
  1729. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1730. this.curStatus = 1
  1731. this.customTabIndex = 1
  1732. this.rightTab = 1
  1733. this.showOne = true
  1734. this.showTwo = false
  1735. }
  1736. if (this.curPrescriptions.project.length > 0 && this.curPrescriptions.advices.length == 0) {
  1737. this.curStatus = 2
  1738. this.customTabIndex = 2
  1739. this.rightTab = 2
  1740. this.showOne = false
  1741. this.showTwo = true
  1742. }
  1743. if (this.curPrescriptions.project.length == 0 && this.curPrescriptions.advices.length == 0) {
  1744. this.curStatus = 1
  1745. this.customTabIndex = 1
  1746. this.rightTab = 1
  1747. this.showOne = true
  1748. this.showTwo = false
  1749. }
  1750. if (info.prescription_status == 0) {
  1751. this.order_status = ''
  1752. }
  1753. if (this.curPrescriptions.order_status == 1) {
  1754. this.order_status = '未收费'
  1755. }
  1756. if (this.curPrescriptions.order_status == 2) {
  1757. this.order_status = '已结算'
  1758. }
  1759. if (this.curPrescriptions.order_status == 3) {
  1760. this.order_status = '已退费'
  1761. }
  1762. this.state1 = info.sick_type
  1763. if (this.state1 == 0 || this.state1 == '') {
  1764. this.state1 = ''
  1765. for (let i = 0; i < this.sick.length; i++) {
  1766. this.state1 = this.sick[0].id
  1767. }
  1768. }
  1769. if (this.departmentValue == '' || this.departmentValue == 0) {
  1770. if (department.length > 0) {
  1771. this.departmentValue = department[0].id
  1772. }
  1773. }
  1774. if (info.id > 0) {
  1775. this.doctorValue = info.doctor_id
  1776. this.departmentValue = info.departments
  1777. } else {
  1778. if (admin_info.id > 0 && admin_info.user_type == 2) {
  1779. this.doctorValue = admin_info.admin_user_id
  1780. this.departmentValue = department[0].id
  1781. } else {
  1782. this.doctorValue = doctors[0].admin_user_id
  1783. this.departmentValue = department[0].id
  1784. }
  1785. }
  1786. // if (info.register_type == 0) {
  1787. // for (let i = 0; i < this.register.length; i++) {
  1788. // this.register_type = this.register[0].value
  1789. // }
  1790. // } else {
  1791. // this.register_type = info.register_type
  1792. // }
  1793. this.diagnose = []
  1794. console.log("处方----------------------------------------------",info.id)
  1795. if (info.id == 0) {
  1796. if (last_info.diagnosis.length == 0) {
  1797. this.diagnose = []
  1798. } else {
  1799. for (let i = 0; i < last_info.diagnosis.split(",").length; i++) {
  1800. if(last_info.diagnosis.split(',')[i].length > 0) {
  1801. this.diagnose.push(parseInt(last_info.diagnosis.split(',')[i]))
  1802. }
  1803. }
  1804. }
  1805. if (last_info.sick_history == 0) {
  1806. this.state2 = ''
  1807. } else {
  1808. this.state2 = last_info.sick_history
  1809. }
  1810. if(this.org_id == 10138){
  1811. this.diagnose = []
  1812. this.diagnose.push(24)
  1813. this.diagnose.push(85)
  1814. this.diagnose.push(252)
  1815. }
  1816. if(this.org_id == 10278){
  1817. this.diagnose = []
  1818. this.diagnose.push(203)
  1819. this.diagnose.push(309)
  1820. this.diagnose.push(202)
  1821. }
  1822. } else {
  1823. this.state2 = info.sick_history
  1824. if (this.state2 == 0) {
  1825. this.state2 = ''
  1826. }
  1827. if (info.diagnosis.length == 0) {
  1828. this.diagnose = []
  1829. } else {
  1830. for (let i = 0; i < info.diagnosis.split(",").length; i++) {
  1831. if(info.diagnosis.split(',')[i].length > 0) {
  1832. this.diagnose.push(parseInt(info.diagnosis.split(',')[i]))
  1833. }
  1834. }
  1835. }
  1836. }
  1837. this.state1 = info.sick_type
  1838. if (this.state1 == 0 || this.state1 == '') {
  1839. this.state1 = ''
  1840. for (let i = 0; i < this.sick.length; i++) {
  1841. this.state1 = this.sick[0].id
  1842. }
  1843. }
  1844. if (this.departmentValue == '' || this.departmentValue == 0) {
  1845. if (department.length > 0) {
  1846. this.departmentValue = department[0].id
  1847. }
  1848. }
  1849. },
  1850. setMonthData(info, admin_info, doctors, department, hisPatientInfo, month_data, last_info) {
  1851. // this.start_time = moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD')
  1852. // this.end_time = moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD')
  1853. this.start_time = moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD')
  1854. this.end_time = moment(new Date()).add('year', 0).format('YYYY-MM-DD')
  1855. this.editableTabsValueTwo = '处方1'
  1856. this.curMonthPrescriptions = {}
  1857. this.curPrescriptions = {}
  1858. // this.$refs.tabProjectTeam.clearSelection()
  1859. for (let i = 0; i < doctors.length; i++) {
  1860. if (doctors[i].user_type == 1) {
  1861. doctors.splice(i, 1)
  1862. }
  1863. }
  1864. this.editableTabsValue = '处方1'
  1865. this.curStatus = 0
  1866. if (month_data && month_data.length > 0) {
  1867. this.curMonthPrescriptions = month_data[0]
  1868. } else {
  1869. this.curMonthPrescriptions = {}
  1870. }
  1871. if (info.prescription_status == 0) {
  1872. this.order_status = ''
  1873. }
  1874. if (info.id > 0) {
  1875. this.doctorValue = info.doctor_id
  1876. this.departmentValue = info.departments
  1877. } else {
  1878. if (admin_info.id > 0 && admin_info.user_type == 2) {
  1879. this.doctorValue = admin_info.admin_user_id
  1880. this.departmentValue = this.department[0].id
  1881. } else {
  1882. this.doctorValue = this.doctors[0].admin_user_id
  1883. this.departmentValue = this.department[0].id
  1884. }
  1885. }
  1886. if (info.register_type == 0) {
  1887. for (let i = 0; i < this.register.length; i++) {
  1888. this.register_type = this.register[0].value
  1889. }
  1890. } else {
  1891. this.register_type = info.register_type
  1892. }
  1893. this.diagnose = []
  1894. if (info.id == 0) {
  1895. if (last_info.diagnosis.length == 0) {
  1896. this.diagnose = []
  1897. } else {
  1898. for (let i = 0; i < last_info.diagnosis.split(",").length; i++) {
  1899. this.diagnose.push(parseInt(last_info.diagnosis.split(',')[i]))
  1900. }
  1901. }
  1902. if (last_info.sick_history == 0) {
  1903. this.state2 = ''
  1904. } else {
  1905. this.state2 = last_info.sick_history
  1906. }
  1907. } else {
  1908. this.state2 = info.sick_history
  1909. if (this.state2 == 0) {
  1910. this.state2 = ''
  1911. }
  1912. if (info.diagnosis.length == 0) {
  1913. this.diagnose = []
  1914. } else {
  1915. for (let i = 0; i < info.diagnosis.split(",").length; i++) {
  1916. this.diagnose.push(parseInt(info.diagnosis.split(',')[i]))
  1917. }
  1918. }
  1919. }
  1920. this.state1 = info.sick_type
  1921. if (this.state1 == 0 || this.state1 == '') {
  1922. this.state1 = ''
  1923. for (let i = 0; i < this.sick.length; i++) {
  1924. this.state1 = this.sick[0].id
  1925. }
  1926. }
  1927. if (this.departmentValue == '' || this.departmentValue == 0) {
  1928. if (this.department.length > 0) {
  1929. this.departmentValue = this.department[0].id
  1930. }
  1931. }
  1932. },
  1933. moreState(tab, event) {
  1934. console.log("li222222222")
  1935. if (tab == 'more') {
  1936. return false
  1937. }
  1938. },
  1939. open_three() {
  1940. for (let i = 0; i < this.prescriptions.length; i++) {
  1941. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  1942. if (this.prescriptions[i].advices[b].prescribing_number == 0 || this.prescriptions[i].advices[b].prescribing_number == '') {
  1943. this.$message.error('药品处方总量不能为0')
  1944. return
  1945. }
  1946. }
  1947. }
  1948. for (let i = 0; i < this.prescriptions.length; i++) {
  1949. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1950. if (this.prescriptions[i].project[b].total == 0 || this.prescriptions[i].project[b].total == '') {
  1951. this.$message.error('项目处方总量不能为0')
  1952. return
  1953. }
  1954. }
  1955. }
  1956. this.$refs.saveTemplate.show(this.prescriptions)
  1957. }, open_two() {
  1958. if (this.dayorMonth == 'day') {
  1959. if (this.patientInfo == null || this.patientInfo.id == 0) {
  1960. this.$message.error('请选择患者')
  1961. return
  1962. }
  1963. let params = {
  1964. end_time: this.record_date,
  1965. start_time: moment().add(-7, 'd').format("YYYY-MM-DD"),
  1966. patient_id: this.patientInfo.id,
  1967. p_type: 2
  1968. }
  1969. getCallHisPrescription(params).then(response => {
  1970. if (response.data.state == 1) {
  1971. this.$refs.call_prescription.show(this.patientInfo.name, this.patientInfo.id, params.end_time, params.start_time, this.prescriptions, response.data.data.prescriptions)
  1972. } else {
  1973. this.$message.error(response.data.msg)
  1974. }
  1975. })
  1976. } else {
  1977. this.$message.error('当前属于月结状态,无法试用处方调用')
  1978. }
  1979. },
  1980. open(index, isLoading) {
  1981. // if(this.curStatus == 0){
  1982. // this.prescriptions = []
  1983. // }
  1984. if(!isLoading){
  1985. if (this.dayorMonth == 'day') {
  1986. for(let i = 0; i < this.prescriptions.length;i++){
  1987. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length == 0) {
  1988. this.$message.error('请先开处方')
  1989. return
  1990. }
  1991. }
  1992. }
  1993. if (this.dayorMonth == 'day') {
  1994. if (this.curPrescriptions.order_status == 2) {
  1995. this.$message.error('当前处方已经结算,无法保存')
  1996. return
  1997. }
  1998. if (this.doctorValue.length <= 0) {
  1999. this.$message.error('医生不能为空')
  2000. return
  2001. }
  2002. if (this.departmentValue.length <= 0) {
  2003. this.$message.error('科室不能为空')
  2004. return
  2005. }
  2006. if (this.state1 <= 0) {
  2007. this.$message.error('疾病类型不能为空')
  2008. return
  2009. }
  2010. if (this.diagnose.length <= 0) {
  2011. this.$message.error('诊断不能为空')
  2012. return
  2013. }
  2014. for (let i = 0; i < this.prescriptions.length; i++) {
  2015. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  2016. if (this.prescriptions[i].advices[b].prescribing_number == 0 || this.prescriptions[i].advices[b].prescribing_number == '') {
  2017. this.$message.error('药品处方总量不能为0')
  2018. return
  2019. }
  2020. }
  2021. }
  2022. for (let i = 0; i < this.prescriptions.length; i++) {
  2023. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  2024. if (this.prescriptions[i].project[b].total == 0 || this.prescriptions[i].project[b].total == '') {
  2025. this.$message.error('项目处方总量不能为0')
  2026. return
  2027. }
  2028. }
  2029. }
  2030. // for (let i = 0; i < this.prescriptions.length; i++) {
  2031. // if (this.prescriptions[i].med_type == 0 || this.prescriptions[i].med_type == '') {
  2032. // this.$message.error('处方医疗类型不能为空')
  2033. // return
  2034. // }
  2035. // }
  2036. if (index == 1) {
  2037. console.log(this.prescriptions)
  2038. for (let i = 0; i < this.prescriptions.length; i++) {
  2039. for(let b = 0; b < this.prescriptions[i].advices.length; b++){
  2040. if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].advices[b].drug.is_special_diseases != 1) {
  2041. this.$message.error(this.prescriptions[i].name.toString() +"属于特病类型处方,不能开非特病类型的药")
  2042. return
  2043. }
  2044. }
  2045. for(let c = 0; c < this.prescriptions[i].project.length; c++){
  2046. if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].project[c].type == 2 && this.prescriptions[i].project[c].project.disease_directory != 1) {
  2047. this.$message.error(this.prescriptions[i].name.toString() +"属于特病类型处方,请开特病类型的项目")
  2048. return
  2049. }
  2050. 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) {
  2051. this.$message.error(this.prescriptions[i].name.toString() +"属于特病类型处方,请开特病类型的耗材")
  2052. return
  2053. }
  2054. }
  2055. }
  2056. for (let i = 0; i < this.prescriptions.length; i++) {
  2057. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length == 0) {
  2058. this.$message.error('处方内容不能为空')
  2059. return
  2060. }
  2061. }
  2062. this.$emit('editKeepLoad', true)
  2063. let params = {
  2064. p_type: 2,
  2065. patient_id: this.patientInfo.id,
  2066. diagnose: this.diagnose.join(','),
  2067. sick_type: this.state1,
  2068. sick_history: this.state2,
  2069. doctor: this.doctorValue,
  2070. department: this.departmentValue,
  2071. record_date: this.record_date,
  2072. his_patient_id: this.hisPatientInfo.id,
  2073. reg_type: this.register_type,
  2074. }
  2075. for (let i = 0; i < this.prescriptions.length; i++) {
  2076. if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
  2077. this.prescriptions[i]['type'] = 1
  2078. }
  2079. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
  2080. this.prescriptions[i]['type'] = 2
  2081. }
  2082. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  2083. this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
  2084. this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
  2085. this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
  2086. this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
  2087. this.prescriptions[i].advices[b].groupno = parseInt(this.prescriptions[i].advices[b].groupno)
  2088. }
  2089. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  2090. if(this.prescriptions[i].advices[b].delivery_way == "" ){
  2091. this.$message.error(`处方${i+1}的${this.prescriptions[i].advices[b].drug_name}用法未填写`)
  2092. this.$emit('editKeepLoad', false)
  2093. return
  2094. }
  2095. if(this.prescriptions[i].advices[b].execution_frequency == "" ){
  2096. this.$message.error(`处方${i+1}的${this.prescriptions[i].advices[b].drug_name}频率未填写`)
  2097. this.$emit('editKeepLoad', false)
  2098. return
  2099. }
  2100. if(this.prescriptions[i].advices[b].day == NaN){
  2101. this.$message.error(`处方${i+1}的${this.prescriptions[i].advices[b].drug_name}天数未填写`)
  2102. this.$emit('editKeepLoad', false)
  2103. return
  2104. }
  2105. if(this.prescriptions[i].advices[b].day == 0){
  2106. this.$message.error(`处方${i+1}的${this.prescriptions[i].advices[b].drug_name}天数不能为0`)
  2107. this.$emit('editKeepLoad', false)
  2108. return
  2109. }
  2110. if(this.prescriptions[i].advices[b].prescribing_number == ""){
  2111. this.$message.error(`处方${i+1}的${this.prescriptions[i].advices[b].drug_name}总量未填写`)
  2112. this.$emit('editKeepLoad', false)
  2113. return
  2114. }
  2115. if(this.prescriptions[i].advices[b].prescribing_number == "0"){
  2116. this.$message.error(`处方${i+1}的${this.prescriptions[i].advices[b].drug_name}总量不能为0`)
  2117. this.$emit('editKeepLoad', false)
  2118. return
  2119. }
  2120. if(this.prescriptions[i].advices[b].prescribing_number_unit == ""){
  2121. this.$message.error(`处方${i+1}的${this.prescriptions[i].advices[b].drug_name}总量单位未填写`)
  2122. this.$emit('editKeepLoad', false)
  2123. return
  2124. }
  2125. }
  2126. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  2127. this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString()
  2128. this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString()
  2129. this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
  2130. this.prescriptions[i].project[b].single_dose = this.prescriptions[i].project[b].single_dose.toString()
  2131. }
  2132. // for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  2133. // if(this.prescriptions[i].project[b].delivery_way == "" ){
  2134. // this.$message.error(`处方${i+1}的${this.prescriptions[i].project[b].project_name}用法未填写`)
  2135. // this.$emit('editKeepLoad', false)
  2136. // return
  2137. // }
  2138. // if(this.prescriptions[i].project[b].execution_frequency == "" ){
  2139. // this.$message.error(`处方${i+1}的${this.prescriptions[i].project[b].project_name}频率未填写`)
  2140. // this.$emit('editKeepLoad', false)
  2141. // return
  2142. // }
  2143. // if(this.prescriptions[i].project[b].day == " "){
  2144. // this.$message.error(`处方${i+1}的${this.prescriptions[i].project[b].number_days}天数未填写`)
  2145. // this.$emit('editKeepLoad', false)
  2146. // return
  2147. // }
  2148. // if(this.prescriptions[i].project[b].day == "0"){
  2149. // this.$message.error(`处方${i+1}的${this.prescriptions[i].project[b].number_days}天数不能为0`)
  2150. // this.$emit('editKeepLoad', false)
  2151. // return
  2152. // }
  2153. // }
  2154. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  2155. this.prescriptions[i].addition[b].id = prarseInt(this.prescriptions[i].addition[b].id)
  2156. this.prescriptions[i].addition[b].item_id = parseInt(this.prescriptions[i].addition[b].item_id)
  2157. this.prescriptions[i].addition[b].price = this.prescriptions[i].addition[b].price.toString()
  2158. this.prescriptions[i].addition[b].count = this.prescriptions[i].addition[b].count.toString()
  2159. }
  2160. }
  2161. let data = {
  2162. 'prescriptions': this.prescriptions
  2163. }
  2164. isLoading = true
  2165. console.log('this.prescriptionsthis.prescriptions', this.prescriptions)
  2166. console.log('this.prescriptionsthis.prescriptions', params)
  2167. let num = 0
  2168. // this.prescriptions.map(item => {
  2169. // if (item.advices.length > 0) {
  2170. // item.advices.map(it => {
  2171. // if (it.drug.total <= 0) {
  2172. // num++
  2173. // setTimeout(() => {
  2174. // this.$message.error(it.drug.drug_name + '库存不足')
  2175. // }, 100)
  2176. // }
  2177. // })
  2178. // }
  2179. // })
  2180. if (num == 0) {
  2181. var arr = []//新增处方
  2182. var arr_one = []
  2183. var arr_Two = []
  2184. console.log("ooo233323233232323232",this.prescriptions)
  2185. //药品
  2186. for(let i=0;i<this.prescriptions.length;i++){
  2187. if(this.prescriptions[i].id == 0){
  2188. for(let j=0;j<this.prescriptions[i].advices.length;j++){
  2189. arr.push(this.prescriptions[i].advices[j])
  2190. }
  2191. console.log("arr99999999999999",arr)
  2192. if(arr.length > 0){
  2193. let objInfo = {};
  2194. arr.forEach((item, index) => {
  2195. let { id } = item.id;
  2196. if (!objInfo[id]) {
  2197. objInfo[id] = {
  2198. drug_id:item.drug.id,
  2199. child: [],
  2200. sum_count:item.drug.sum_count,
  2201. out_count:0,
  2202. str:item.drug.drug_name + " "+item.drug.dose + item.drug.dose_unit + "*" + item.drug.min_number + item.drug.min_unit+"/"+item.drug.max_unit,
  2203. is_user:item.drug.is_user,
  2204. };
  2205. }
  2206. });
  2207. let newArr = Object.values(objInfo);
  2208. for(let i=0;i<arr.length;i++){
  2209. for(let j=0;j<newArr.length;j++){
  2210. if(arr[i].id == newArr[j].drug_id){
  2211. newArr[j].child.push(arr[i])
  2212. }
  2213. }
  2214. }
  2215. console.log("河滨232332newArr",newArr)
  2216. if(newArr.length >0){
  2217. for(let i=0;i<newArr.length;i++){
  2218. for(let j=0;j<newArr[i].child.length;j++){
  2219. // newArr[i].child[j].prescribing_number_total = 0
  2220. 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){
  2221. newArr[i].child[j].prescribing_number_total = parseInt(newArr[i].child[j].prescribing_number) * newArr[i].child[j].drug.min_number
  2222. }
  2223. 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){
  2224. newArr[i].child[j].prescribing_number_total = parseInt(newArr[i].child[j].prescribing_number)
  2225. }
  2226. 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){
  2227. newArr[i].child[j].prescribing_number_total = parseInt(newArr[i].child[j].prescribing_number)
  2228. }
  2229. }
  2230. }
  2231. console.log("wodeshju",newArr)
  2232. for(let i=0;i<newArr.length;i++){
  2233. for(let j=0;j<newArr[i].child.length;j++){
  2234. newArr[i].out_count += newArr[i].child[j].prescribing_number_total
  2235. }
  2236. }
  2237. }
  2238. if(newArr.length > 0){
  2239. for(let i=0;i<newArr.length;i++){
  2240. if(newArr[i].is_user!=1){
  2241. if(newArr[i].out_count > newArr[i].sum_count){
  2242. this.$message.error(newArr[i].str + "库存不足,保存失败!")
  2243. isLoading = false
  2244. this.$emit('editKeepLoad', false)
  2245. return
  2246. }
  2247. }
  2248. }
  2249. }
  2250. console.log("newArr",newArr )
  2251. }
  2252. }
  2253. if(this.prescriptions[i].id > 0){ //修改处方
  2254. for(let j=0;j<this.prescriptions[i].advices.length;j++){
  2255. if(this.prescriptions[i].advices[j].advice_id == 0){ //新增列
  2256. arr_one.push(this.prescriptions[i].advices[j])
  2257. }
  2258. if(this.prescriptions[i].advices[j].advice_id >0){
  2259. arr_Two.push(this.prescriptions[i].advices[j])
  2260. }
  2261. }
  2262. console.log("编辑处方",arr_one)
  2263. if(arr_one.length > 0){
  2264. let objInfo = {};
  2265. arr_one.forEach((item, index) => {
  2266. let { id } = item.id;
  2267. if (!objInfo[id]) {
  2268. objInfo[id] = {
  2269. drug_id:item.drug.id,
  2270. child: [],
  2271. sum_count:item.drug.sum_count,
  2272. out_count:0,
  2273. str:item.drug.drug_name + " "+item.drug.dose + item.drug.dose_unit + "*" + item.drug.min_number + item.drug.min_unit+"/"+item.drug.max_unit,
  2274. is_user:item.drug.is_user,
  2275. };
  2276. }
  2277. });
  2278. let newArr = Object.values(objInfo);
  2279. console.log("newArr",newArr)
  2280. for(let i=0;i<arr_one.length;i++){
  2281. for(let j=0;j<newArr.length;j++){
  2282. if(arr_one[i].id == newArr[j].drug_id){
  2283. newArr[j].child.push(arr_one[i])
  2284. }
  2285. }
  2286. }
  2287. if(newArr.length >0){
  2288. for(let i=0;i<newArr.length;i++){
  2289. for(let j=0;j<newArr[i].child.length;j++){
  2290. if(newArr[i].child[j].prescribing_number_unit == newArr[i].child[j].drug.max_unit){
  2291. newArr[i].child[j].prescribing_number_total = parseInt(newArr[i].child[j].prescribing_number) * newArr[i].child[j].drug.min_number
  2292. }
  2293. newArr[i].out_count += newArr[i].child[j].prescribing_number_total
  2294. }
  2295. }
  2296. }
  2297. console.log("new233223322323",newArr)
  2298. if(newArr.length > 0){
  2299. for(let i=0;i<newArr.length;i++){
  2300. if(newArr[i].is_user!=1){
  2301. if(newArr[i].out_count > newArr[i].sum_count){
  2302. this.$message.error(newArr[i].str + "库存不足,保存失败!")
  2303. isLoading = false
  2304. this.$emit('editKeepLoad', false)
  2305. return
  2306. }
  2307. }
  2308. }
  2309. }
  2310. }
  2311. }
  2312. }
  2313. if(arr.length > 0){
  2314. for(let i =0;i<arr.length;i++){
  2315. if(arr[i].drug!=null){
  2316. if(arr[i].drug.is_user == 2){
  2317. if(arr[i].prescribing_number_unit != arr[i].drug.max_unit && arr[i].prescribing_number_unit!=arr[i].drug.min_unit){
  2318. this.$message.error(arr[i].drug.drug_name + " " +arr[i].drug.dose + arr[i].drug.dose_unit + "*" + arr[i].drug.min_number + arr[i].drug.min_unit+"/"+arr[i].drug.max_unit +" "+ "总量单位不统一,保存失败!")
  2319. isLoading = false
  2320. this.$emit('editKeepLoad', false)
  2321. return
  2322. }
  2323. }
  2324. }
  2325. }
  2326. }
  2327. if(arr_one.length > 0){
  2328. for(let i =0;i<arr_one.length;i++){
  2329. if(arr_one[i].drug!=null){
  2330. if(arr_one[i].drug.is_user == 2){
  2331. if(arr_one[i].prescribing_number_unit != arr_one[i].drug.max_unit && arr_one[i].prescribing_number_unit!=arr_one[i].drug.min_unit){
  2332. this.$message.error(arr_one[i].drug.drug_name + " " +arr_one[i].drug.dose + arr_one[i].drug.dose_unit + "*" + arr_one[i].drug.min_number + arr_one[i].drug.min_unit+"/"+arr_one[i].drug.max_unit +" "+ "总量单位不匹配,保存失败!")
  2333. isLoading = false
  2334. this.$emit('editKeepLoad', false)
  2335. return
  2336. }
  2337. }
  2338. }
  2339. }
  2340. }
  2341. if(arr_Two.length > 0){
  2342. for(let i =0;i<arr_Two.length;i++){
  2343. if(arr_Two[i].drug!=null){
  2344. if(arr_Two[i].drug.is_user == 2){
  2345. if(arr_Two[i].prescribing_number_unit != arr_Two[i].drug.max_unit && arr_Two[i].prescribing_number_unit!=arr_Two[i].drug.min_unit){
  2346. this.$message.error(arr_Two[i].drug.drug_name + " " +arr_Two[i].drug.dose + arr_Two[i].drug.dose_unit + "*" + arr_Two[i].drug.min_number + arr_Two[i].drug.min_unit+"/"+arr_Two[i].drug.max_unit +" "+ "总量单位不匹配,保存失败!")
  2347. isLoading = false
  2348. this.$emit('editKeepLoad', false)
  2349. return
  2350. }
  2351. }
  2352. }
  2353. }
  2354. }
  2355. if(this.org_id == 9671 || this.org_id == 9675 || this.org_id == 9679){
  2356. var project_arr = []
  2357. //耗材
  2358. for(let i=0;i<this.prescriptions.length;i++){
  2359. if(this.prescriptions[i].id == 0){
  2360. for(let j=0;j<this.prescriptions[i].project.length;j++){
  2361. if(this.prescriptions[i].project[j].type ==3){
  2362. project_arr.push(this.prescriptions[i].project[j])
  2363. }
  2364. }
  2365. }
  2366. }
  2367. if(project_arr.length > 0){
  2368. let objInfo = {};
  2369. project_arr.forEach((item, index) => {
  2370. let { project_id } = item.project_id;
  2371. if (!objInfo[project_id]) {
  2372. objInfo[project_id] = {
  2373. project_id:item.project_id,
  2374. child: [],
  2375. sum_count:item.good_info.sum_count,
  2376. out_count:0,
  2377. str:item.good_info.good_name +" "+ item.good_info.specification_name,
  2378. is_user:item.good_info.is_user,
  2379. };
  2380. }
  2381. });
  2382. let newProjectArr = Object.values(objInfo);
  2383. for(let i=0;i<project_arr.length;i++){
  2384. for(let j=0;j<newProjectArr.length;j++){
  2385. if(project_arr[i].project_id == newProjectArr[j].project_id){
  2386. newProjectArr[j].child.push(project_arr[i])
  2387. }
  2388. }
  2389. }
  2390. for(let i=0;i<newProjectArr.length;i++){
  2391. for(let j=0;j<newProjectArr[i].child.length;j++){
  2392. newProjectArr[i].out_count += parseInt(newProjectArr[i].child[j].total)
  2393. }
  2394. }
  2395. for(let i=0;i<newProjectArr.length;i++){
  2396. if(newProjectArr[i].out_count > newProjectArr[i].sum_count){
  2397. this.$message.error(newProjectArr[i].str + "库存不足,保存失败!")
  2398. isLoading = false
  2399. this.$emit('editKeepLoad', false)
  2400. return
  2401. }
  2402. }
  2403. }
  2404. }
  2405. console.log("params23332232323232323------",data)
  2406. createHisPrescription(data, params).then(response => {
  2407. if (response.data.state == 1) {
  2408. this.$emit('change', this.patientInfo.id)
  2409. this.$message.success('保存成功!')
  2410. this.$emit('editKeepLoad', false)
  2411. this.$parent.getInitData()
  2412. this.getlist()
  2413. } else {
  2414. this.$message.error(response.data.msg)
  2415. this.$emit('editKeepLoad', false)
  2416. }
  2417. })
  2418. }
  2419. }
  2420. } else if (index == 2) {
  2421. this.$router.push('/outpatientDoctorStation/print')
  2422. } else if (index == 4) {
  2423. } else if (index == 5) {
  2424. this.$refs.saveTemplate.show()
  2425. }
  2426. } else if (this.dayorMonth == 'month') {
  2427. if (this.isShowDayPrescription) {
  2428. // if (this.curDayPrescriptions.order_status == 2) {
  2429. // this.$message.error('当前处方已经结算,无法保存')
  2430. // return
  2431. // }
  2432. if (this.doctorValue.length <= 0) {
  2433. this.$message.error('医生不能为空')
  2434. return
  2435. }
  2436. if (this.departmentValue.length <= 0) {
  2437. this.$message.error('科室不能为空')
  2438. return
  2439. }
  2440. if (index == 1) {
  2441. let params = {
  2442. patient_id: this.patientInfo.id,
  2443. diagnose: this.diagnose.join(','),
  2444. sick_type: this.state1,
  2445. sick_history: this.state2,
  2446. doctor: this.doctorValue,
  2447. department: this.departmentValue,
  2448. record_date: this.end_time,
  2449. his_patient_id: this.hisPatientInfo.id,
  2450. reg_type: this.register_type,
  2451. p_type: 2
  2452. }
  2453. var month_prescriptions = this.deepClone(this.month_prescriptions)
  2454. for (let i = 0; i < month_prescriptions.length; i++) {
  2455. if (month_prescriptions[i].advices.length > 0 && month_prescriptions[i].project.length == 0) {
  2456. month_prescriptions[i]['type'] = 1
  2457. }
  2458. if (month_prescriptions[i].advices.length == 0 && month_prescriptions[i].project.length > 0) {
  2459. month_prescriptions[i]['type'] = 2
  2460. }
  2461. for (let b = 0; b < month_prescriptions[i].advices.length; b++) {
  2462. month_prescriptions[i].advices[b].single_dose = month_prescriptions[i].advices[b].single_dose.toString()
  2463. month_prescriptions[i].advices[b].prescribing_number = month_prescriptions[i].advices[b].prescribing_number.toString()
  2464. month_prescriptions[i].advices[b].retail_price = month_prescriptions[i].advices[b].retail_price.toString()
  2465. month_prescriptions[i].advices[b].day = parseInt(month_prescriptions[i].advices[b].day)
  2466. }
  2467. for (let b = 0; b < month_prescriptions[i].project.length; b++) {
  2468. month_prescriptions[i].project[b].price = month_prescriptions[i].project[b].price.toString()
  2469. month_prescriptions[i].project[b].total = month_prescriptions[i].project[b].total.toString()
  2470. month_prescriptions[i].project[b].delivery_way = month_prescriptions[i].project[b].delivery_way.toString()
  2471. }
  2472. for (let b = 0; b < month_prescriptions[i].addition.length; b++) {
  2473. month_prescriptions[i].addition[b].id = parseInt(month_prescriptions[i].addition[b].id)
  2474. month_prescriptions[i].addition[b].item_id = parseInt(month_prescriptions[i].addition[b].item_id)
  2475. month_prescriptions[i].addition[b].price = month_prescriptions[i].addition[b].price.toString()
  2476. month_prescriptions[i].addition[b].count = month_prescriptions[i].addition[b].count.toString()
  2477. }
  2478. }
  2479. let data = {
  2480. 'prescriptions': month_prescriptions
  2481. }
  2482. editHisPrescription(data, params).then(response => {
  2483. if (response.data.state == 1) {
  2484. this.month_prescriptions = month_prescriptions
  2485. this.$message.success('编辑成功')
  2486. }
  2487. })
  2488. }
  2489. }
  2490. }
  2491. },
  2492. addTab(targetName) {
  2493. console.log("this.prescriptionsaaaaaa",this.prescriptions)
  2494. for(let i = 0; i < this.prescriptions.length; i++){
  2495. if (this.prescriptions[i].is_medicine_status) {
  2496. this.$message.error('处方中包含已发药处方,无法新增')
  2497. return
  2498. }
  2499. }
  2500. // for(let i = 0; i < this.prescriptions.length; i++){
  2501. // if (this.prescriptions[i].order_status == 2 || this.prescriptions[i].order_status == 4) {
  2502. // this.$message.error('处方中包含已收费处方或者包含已经上传的处方,无法新增')
  2503. // return
  2504. // }
  2505. // }
  2506. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  2507. this.$message.error('当前处方无数据,新增数据后才能新增处方')
  2508. return
  2509. }
  2510. this.tabIndex = this.prescriptions.length
  2511. var str = this.prescriptions[this.prescriptions.length - 1].name
  2512. var reg =/[\u4e00-\u9fa5]/g;
  2513. // var str= " 阿达 adas 123132 一二三 ";
  2514. // str= str.replace(/[ ]/g, "");//去空格
  2515. // str= ;//去除中文
  2516. this.tabIndex = parseInt(str.replace(reg, ""))
  2517. ++this.tabIndex
  2518. let newTabName = '处方' + this.tabIndex
  2519. var nowDate = new Date()
  2520. var nowYear = nowDate.getFullYear()
  2521. var nowMonth = nowDate.getMonth() + 1
  2522. var nowDay = nowDate.getDate()
  2523. var hours = nowDate.getHours()
  2524. var min = nowDate.getMinutes()
  2525. var nowTime =
  2526. nowYear +
  2527. '-' +
  2528. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  2529. '-' +
  2530. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  2531. ':' + (min < 10 ? '0' + min : min)
  2532. let obj = {
  2533. id: 0,
  2534. name: newTabName,
  2535. order_status: 0,
  2536. advices: [],
  2537. project: [],
  2538. addition: [],
  2539. pre_time: this.prescriptions[0].pre_time
  2540. }
  2541. obj.med_type = 14
  2542. this.prescriptions.push(obj)
  2543. this.editableTabsValue = newTabName
  2544. this.curPrescriptions = this.prescriptions[this.prescriptions.length - 1]
  2545. this.curStatus = 0
  2546. if (this.curPrescriptions.order_status == 0) {
  2547. this.order_status = '未收费'
  2548. }
  2549. if (this.curPrescriptions.order_status == 1) {
  2550. this.order_status = '未收费'
  2551. }
  2552. if (this.curPrescriptions.order_status == 2) {
  2553. this.order_status = '已结算'
  2554. }
  2555. if (this.curPrescriptions.order_status == 3) {
  2556. this.order_status = '已退费'
  2557. }
  2558. },
  2559. removeTab(targetName) {
  2560. console.log("1111111111111111")
  2561. if (this.curPrescriptions.order_status == 2 || this.curPrescriptions.order_status == 5 || this.curPrescriptions.is_medicine_status) {
  2562. this.$message.error('该处方已经结算或者记账或者已发药,无法删除')
  2563. return
  2564. }
  2565. this.$confirm('处方删除后不可恢复,是否确认删除', '删除', {
  2566. confirmButtonText: '确 定',
  2567. cancelButtonText: '取 消',
  2568. type: 'warning'
  2569. }).then(() => {
  2570. let id = 0
  2571. console.log("this.prescriptions???",this.prescriptions)
  2572. for (let i = 0; i < this.prescriptions.length; i++) {
  2573. if (this.prescriptions[i].name == targetName) {
  2574. id = this.prescriptions[i].id
  2575. }
  2576. }
  2577. if (id == 0) {
  2578. let tabs = this.prescriptions
  2579. let activeName = this.editableTabsValue
  2580. if (activeName === targetName) {
  2581. tabs.forEach((tab, index) => {
  2582. if (tab.name === targetName) {
  2583. let nextTab = tabs[index + 1] || tabs[index - 1]
  2584. if (nextTab) {
  2585. activeName = nextTab.name
  2586. }
  2587. }
  2588. })
  2589. }
  2590. this.editableTabsValue = activeName
  2591. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  2592. for (let i = 0; i < this.prescriptions.length; i++) {
  2593. if (activeName == this.prescriptions[i].name) {
  2594. this.curPrescriptions = this.prescriptions[i]
  2595. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2596. this.curStatus = 1
  2597. }
  2598. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2599. this.curStatus = 2
  2600. }
  2601. }
  2602. }
  2603. console.log("oo233ooooosdada",this.prescriptions)
  2604. if (this.prescriptions.length == 0) {
  2605. console.log("this.curPrescrip的tions前",this.curPrescriptions)
  2606. this.curPrescriptions = []
  2607. this.curStatus = 0
  2608. console.log("this.curPrescrip的tions后",this.curPrescriptions)
  2609. }
  2610. this.$parent.getInitDataOne(this.prescriptions)
  2611. } else {
  2612. let params = {
  2613. 'id': id
  2614. }
  2615. delHisPrescription(params).then(response => {
  2616. if (response.data.state == 1) {
  2617. this.$message.success('删除成功!')
  2618. let tabs = this.prescriptions
  2619. let activeName = this.editableTabsValue
  2620. console.log("targetName",targetName)
  2621. console.log("activeName",activeName)
  2622. if (activeName === targetName) {
  2623. tabs.forEach((tab, index) => {
  2624. if (tab.name === targetName) {
  2625. let nextTab = tabs[index + 1] || tabs[index - 1]
  2626. if (nextTab) {
  2627. activeName = nextTab.name
  2628. }
  2629. }
  2630. })
  2631. }
  2632. this.editableTabsValue = activeName
  2633. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  2634. for (let i = 0; i < this.prescriptions.length; i++) {
  2635. if (activeName == this.prescriptions[i].name) {
  2636. this.curPrescriptions = this.prescriptions[i]
  2637. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2638. this.curStatus = 1
  2639. }
  2640. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2641. this.curStatus = 2
  2642. }
  2643. }
  2644. }
  2645. if (this.prescriptions.length == 0) {
  2646. this.curPrescriptions = []
  2647. this.curStatus = 0
  2648. }
  2649. this.$parent.getInitData()
  2650. this.$parent.getInitDataOne(this.prescriptions)
  2651. console.log("删除后的数据是",this.prescriptions)
  2652. } else {
  2653. this.$message.error(response.data.msg)
  2654. }
  2655. })
  2656. }
  2657. }).catch(() => {
  2658. })
  2659. },
  2660. beforeLeave(activeName, oldActiveName) {
  2661. let index = activeName
  2662. if (index == 1) {
  2663. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2664. return false
  2665. }
  2666. } else {
  2667. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2668. return false
  2669. }
  2670. }
  2671. },
  2672. clickTab(tab) {
  2673. let index = parseInt(tab.name)
  2674. if (index == 1) {
  2675. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2676. this.$message.error('当前处方为项目,无法切换为药品,需要新开处方')
  2677. return
  2678. }
  2679. } else {
  2680. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2681. this.$message.error('当前处方为药品,无法切换为项目,需要新开处方')
  2682. return
  2683. }
  2684. }
  2685. if (index == 1) {
  2686. this.teamList = []
  2687. this.$refs.tables.clearSelection()
  2688. this.showOne = true
  2689. this.showTwo = false
  2690. this.$nextTick(() => {
  2691. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  2692. })
  2693. this.customTabIndex = 1
  2694. }
  2695. if (index == 2) {
  2696. this.curDrugs = []
  2697. this.$refs.multipleTable.clearSelection()
  2698. this.showTwo = true
  2699. this.showOne = false
  2700. this.$nextTick(() => {
  2701. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  2702. })
  2703. this.customTabIndex = 2
  2704. }
  2705. this.rightTab = index
  2706. //用来区分处方属于项目还是药品
  2707. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2708. this.customTabIndex = 1
  2709. this.curStatus = 1
  2710. }
  2711. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2712. this.customTabIndex = 2
  2713. this.curStatus = 2
  2714. }
  2715. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  2716. // this.customTabIndex = this.rightTab
  2717. this.customTabIndex = index
  2718. this.curStatus = 0
  2719. }
  2720. }, changeAllGoodInfoTableData: function(selection) {
  2721. this.curDrugs = selection
  2722. }, addCharges() {
  2723. this.$refs.additionalCharges.show()
  2724. },
  2725. selectDrugs(selection, row) {
  2726. console.log("row233232233232",row)
  2727. // 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){
  2728. // if (row.count <= 0) {
  2729. // if (selection) {
  2730. // selection.forEach(row => {
  2731. // if (row.count <= 0) {
  2732. // this.$refs.multipleTable.toggleRowSelection(row)
  2733. // }
  2734. // })
  2735. // } else {
  2736. // this.$refs.multipleTable.clearSelection()
  2737. // }
  2738. // this.$message.error(row.drug_name + '库存不足')
  2739. // return
  2740. // }
  2741. // }else{
  2742. // if (row.total <= 0) {
  2743. // if (selection) {
  2744. // selection.forEach(row => {
  2745. // if (row.total <= 0) {
  2746. // this.$refs.multipleTable.toggleRowSelection(row)
  2747. // }
  2748. // })
  2749. // } else {
  2750. // this.$refs.multipleTable.clearSelection()
  2751. // }
  2752. // this.$message.error(row.drug_name + '库存不足')
  2753. // return
  2754. // }
  2755. // }
  2756. if(row.is_user!=1){
  2757. if (row.sum_count <= 0) {
  2758. if (selection) {
  2759. selection.forEach(row => {
  2760. if (row.sum_count <= 0) {
  2761. this.$refs.multipleTable.toggleRowSelection(row)
  2762. }
  2763. })
  2764. } else {
  2765. this.$refs.multipleTable.clearSelection()
  2766. }
  2767. this.$message.error(row.drug_name + '库存不足')
  2768. return
  2769. }
  2770. }
  2771. this.curDrugs = selection
  2772. },
  2773. comfirm() {
  2774. if (this.curDrugs.length > 0) {
  2775. for (let i = 0; i < this.curDrugs.length; i++) {
  2776. if (this.curPrescriptions.med_type == 14 && this.curDrugs[i].is_special_diseases != 1) {
  2777. this.$message.error('该处方属于特病类型处方,开非特病类型的药')
  2778. return
  2779. }
  2780. }
  2781. }
  2782. if (this.teamList.length > 0) {
  2783. for (let i = 0; i < this.teamList.length; i++) {
  2784. if (this.curPrescriptions.med_type == 14 && this.teamList[i].is_special_diseases != 1) {
  2785. this.$message.error('该处方属于特病类型处方,请开特病类型的项目')
  2786. // return
  2787. }
  2788. }
  2789. let arr = this.teamList
  2790. let newArr = []
  2791. arr.map(item => {
  2792. if (this.curPrescriptions.med_type != 14) {
  2793. newArr.push(item)
  2794. }
  2795. if (this.curPrescriptions.med_type == 14 && item.is_special_diseases == 1) {
  2796. newArr.push(item)
  2797. }
  2798. })
  2799. this.teamList = newArr
  2800. }
  2801. if (this.curDrugs.length == 0) {
  2802. for (let i = 0; i < this.curDrugs.length; i++) {
  2803. if (this.curPrescriptions.med_type == 14 && this.curDrugs[i].is_special_diseases != 1) {
  2804. this.$message.error('该处方属于特病类型处方,开非特病类型的药')
  2805. return
  2806. }
  2807. }
  2808. }
  2809. // if (this.curPrescriptions.order_status == 2) {
  2810. // this.$message.error('该处方已经结算,无法继续添加药品或者项目')
  2811. // this.teamList = []
  2812. // this.curDrugs = []
  2813. // this.tempDrugs = []
  2814. // this.$refs.tables.clearSelection()
  2815. // this.$refs.multipleTableTwo.clearSelection()
  2816. // this.$refs.multipleTable.clearSelection()
  2817. // return
  2818. // }
  2819. if (this.curStatus == 1 && this.rightTab == 2) {
  2820. this.$message.error('改处方是药品,无法添加项目')
  2821. this.teamList = []
  2822. this.$refs.tables.clearSelection()
  2823. return
  2824. }
  2825. if (this.curStatus == 2 && this.rightTab == 1) {
  2826. this.$message.error('改处方是项目,无法添加药品')
  2827. this.curDrugs = []
  2828. this.tempDrugs = []
  2829. this.$refs.multipleTable.clearSelection()
  2830. this.$refs.multipleTableTwo.clearSelection()
  2831. return
  2832. }
  2833. for (let i = 0; i < this.teamList.length; i++) {
  2834. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  2835. if (this.teamList[i].id == this.curPrescriptions.project[a].project_id && this.teamList[i].type == this.curPrescriptions.project[a].type) {
  2836. this.$message.error('当前处方存在相同的药品,无法添加相同的项目')
  2837. return
  2838. }
  2839. }
  2840. }
  2841. for (let i = 0; i < this.curDrugs.length; i++) {
  2842. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  2843. if (this.curDrugs[i].id == this.curPrescriptions.advices[a].id) {
  2844. this.$message.error('当前处方存在相同的药品,无法添加相同的药品')
  2845. return
  2846. }
  2847. }
  2848. }
  2849. let templateDrugs = []
  2850. for (let i = 0; i < this.tempDrugs.length; i++) {
  2851. for (let a = 0; a < this.tempDrugs[i].advices.length; a++) {
  2852. templateDrugs.push(this.tempDrugs[i].advices[a])
  2853. }
  2854. }
  2855. // for (let i = 0; i < templateDrugs.length; i++) {
  2856. // for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  2857. // if (this.templateDrugs[i].drug_id == this.curPrescriptions.advices[i].id) {
  2858. // this.$message.error('改处方存在相同的药品,无法添加相同的药品')
  2859. // return
  2860. //
  2861. // }
  2862. // }
  2863. // }
  2864. for (let i = 0; i < this.prescriptions.length; i++) {
  2865. if (this.prescriptions[i].name == this.editableTabsValue) {
  2866. var temp = this.deepClone(this.curDrugs)
  2867. var temp2 = this.deepClone(this.teamList)
  2868. var temp3 = this.deepClone(templateDrugs)
  2869. console.log("我的23323232232323232323哈哈哈哈哈哈",temp)
  2870. if (temp3.length > 0) {
  2871. for (let b = 0; b < temp3.length; b++) {
  2872. let obj = {
  2873. advice_id: 0,
  2874. id: temp3[b].id,
  2875. drug_name: temp3[b].advice_name,
  2876. single_dose: temp3[b].single_dose.toString(),
  2877. delivery_way: temp3[b].delivery_way,
  2878. execution_frequency: temp3[b].execution_frequency,
  2879. retail_price: temp3[b].drug.retail_price.toString(),
  2880. remark: '',
  2881. day: '1',
  2882. prescribing_number: temp3[b].prescribing_number,
  2883. single_dose_unit: temp3[b].drug.drug_dose_unit,
  2884. prescribing_number_unit: temp3[b].drug.prescribing_number_unit,
  2885. medical_insurance_number: temp3[b].drug.medical_insurance_number
  2886. }
  2887. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  2888. obj.prescribing_number = 1
  2889. }
  2890. this.prescriptions[i].advices.push(obj)
  2891. }
  2892. this.curStatus = 1
  2893. }
  2894. let index = 0
  2895. if (this.curPrescriptions.advices.length > 0) {
  2896. index = this.curPrescriptions.advices.length
  2897. }
  2898. if (temp.length > 0) {
  2899. for (let b = 0; b < temp.length; b++) {
  2900. if(temp[b].max_unit == temp[b].min_unit){
  2901. temp[b].retail_price = temp[b].min_price
  2902. }
  2903. let temp_index = b + 1
  2904. let obj = {
  2905. advice_id: 0,
  2906. id: temp[b].id,
  2907. drug_name: temp[b].drug_name,
  2908. single_dose: temp[b].single_dose,
  2909. delivery_way: temp[b].delivery_way,
  2910. execution_frequency: temp[b].execution_frequency,
  2911. retail_price: temp[b].prescribing_number_unit == temp[b].max_unit ? temp[b].retail_price.toString() : temp[b].min_price.toString(),
  2912. remark: '',
  2913. day: temp[b].drug_day ? temp[b].drug_day : 1,
  2914. prescribing_number: temp[b].prescribing_number,
  2915. single_dose_unit: temp[b].dose_unit,
  2916. prescribing_number_unit: temp[b].prescribing_number_unit,
  2917. medical_insurance_number: temp[b].medical_insurance_number,
  2918. drug: temp[b],
  2919. groupno: index + temp_index,
  2920. hosp_appr_flag: '1',
  2921. execution_state:2,
  2922. }
  2923. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  2924. obj.prescribing_number = 1
  2925. }
  2926. this.prescriptions[i].advices.push(obj)
  2927. }
  2928. this.curStatus = 1
  2929. }
  2930. if (temp2.length > 0) {
  2931. for (let b = 0; b < temp2.length; b++) {
  2932. let obj = {
  2933. id: 0,
  2934. project_id: temp2[b].id,
  2935. project_name: temp2[b].project_name,
  2936. statistical_classification: '',
  2937. single_dose: temp2[b].single_dose.toString(),
  2938. delivery_way: temp2[b].delivery_way,
  2939. execution_frequency: temp2[b].execution_frequency,
  2940. number_days: temp2[b].number_days.toString(),
  2941. total: temp2[b].cus_total,
  2942. price: temp2[b].price,
  2943. remark: '',
  2944. medical_code: temp2[b].medical_code,
  2945. type: temp2[b].type,
  2946. execution_state:2,
  2947. }
  2948. if (temp2[b].type == 2){
  2949. obj['project'] = temp2[b].project
  2950. obj['unit'] = temp2[b].project.unit
  2951. }else if(temp2[b].type == 3){
  2952. obj['good_info'] = temp2[b].good_info
  2953. obj['unit'] = temp2[b].good_info.packing_unit
  2954. }
  2955. if (temp2[b].team_id == undefined) {
  2956. obj['team_id'] = 0
  2957. } else {
  2958. obj['team_id'] = temp2[b].team_id
  2959. }
  2960. if (obj.total == 0 || obj.total == undefined) {
  2961. obj.total = 1
  2962. }
  2963. if (obj.type == 3) {
  2964. obj.single_dose = 1
  2965. }
  2966. console.log('项目obj', temp2)
  2967. this.prescriptions[i].project.push(obj)
  2968. }
  2969. this.curStatus = 2
  2970. }
  2971. this.curPrescriptions = this.prescriptions[i]
  2972. this.$refs.multipleTable.clearSelection()
  2973. this.$refs.tables.clearSelection()
  2974. this.clearSelection()
  2975. }
  2976. }
  2977. this.curDrugs = []
  2978. this.preDrugs = []
  2979. this.teamList = []
  2980. }, changeAllGoodInfoTableDataTwo(row) {
  2981. this.teamList = row
  2982. },
  2983. selectChange(selection, row) {
  2984. console.log('row', selection)
  2985. // 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){
  2986. // if (row.stock_count <= 0) {
  2987. // if (row.type == 3) {
  2988. // if (selection) {
  2989. // selection.forEach(row => {
  2990. // if (row.stock_count <= 0) {
  2991. // this.$refs.tables.toggleRowSelection(row)
  2992. // }
  2993. // })
  2994. // } else {
  2995. // this.$refs.tables.clearSelection()
  2996. // }
  2997. // this.$message.error(row.project_name + '库存不足')
  2998. // return
  2999. // }
  3000. // }
  3001. // }else{
  3002. // if (row.total <= 0) {
  3003. // if (row.type == 3) {
  3004. // if (selection) {
  3005. // selection.forEach(row => {
  3006. // if (row.total <= 0) {
  3007. // this.$refs.tables.toggleRowSelection(row)
  3008. // }
  3009. // })
  3010. // } else {
  3011. // this.$refs.tables.clearSelection()
  3012. // }
  3013. // this.$message.error(row.project_name + '库存不足')
  3014. // return
  3015. // }
  3016. // }
  3017. // }
  3018. if (row.stock_count <= 0) {
  3019. if (row.type == 3) {
  3020. if (selection) {
  3021. selection.forEach(row => {
  3022. if (row.stock_count <= 0) {
  3023. this.$refs.tables.toggleRowSelection(row)
  3024. }
  3025. })
  3026. } else {
  3027. this.$refs.tables.clearSelection()
  3028. }
  3029. this.$message.error(row.project_name + '库存不足')
  3030. return
  3031. }
  3032. }
  3033. this.teamList = selection
  3034. },
  3035. getlist() {
  3036. this.tabProject = []
  3037. getHisProject().then(response => {
  3038. if (response.data.state == 1) {
  3039. var project = response.data.data.project
  3040. console.log("项目列表",project)
  3041. for (let i = 0; i < project.length; i++) {
  3042. let obj = {
  3043. id: project[i].id,
  3044. project_name: project[i].project_name,
  3045. statistical_classification: '',
  3046. single_dose: project[i].single_dose,
  3047. delivery_way: project[i].delivery_way,
  3048. execution_frequency: project[i].execution_frequency,
  3049. number_days: project[i].number_days,
  3050. price: project[i].price,
  3051. medical_code: project[i].medical_code,
  3052. cus_total: 1,
  3053. unit: project[i].unit,
  3054. type: 2,
  3055. total: project[i].total,
  3056. is_special_diseases: project[i].disease_directory,
  3057. project: project[i],
  3058. stock_count:0,
  3059. }
  3060. this.tabProject.push(obj)
  3061. }
  3062. var good_info = response.data.data.good_info
  3063. for (let i = 0; i < good_info.length; i++) {
  3064. good_info[i].stock_count = 0
  3065. if(good_info[i].good_stock_in&&good_info[i].good_stock_in.length >0 ){
  3066. for(let j=0;j<good_info[i].good_stock_in.length;j++){
  3067. good_info[i].stock_count += good_info[i].good_stock_in[j].stock_count
  3068. }
  3069. }
  3070. let obj = {
  3071. id: good_info[i].id,
  3072. project_name: good_info[i].good_name,
  3073. statistical_classification: '',
  3074. single_dose: good_info[i].specification_name,
  3075. delivery_way: '',
  3076. execution_frequency: '',
  3077. number_days: 1,
  3078. cus_total: 1,
  3079. price: good_info[i].packing_price,
  3080. medical_code: good_info[i].medical_insurance_number,
  3081. unit: this.getGoodUnit(good_info[i].good_unit),
  3082. type: 3,
  3083. total: good_info[i].total,
  3084. is_special_diseases: good_info[i].is_special_diseases,
  3085. good_info: good_info[i],
  3086. stock_count:good_info[i].stock_count,
  3087. }
  3088. this.tabProject.push(obj)
  3089. }
  3090. this.allProject = this.tabProject
  3091. }
  3092. })
  3093. }, deepClone(source) {
  3094. if (!source && typeof source !== 'object') {
  3095. throw new Error('error arguments', 'shallowClone')
  3096. }
  3097. const targetObj = source.constructor === Array ? [] : {}
  3098. Object.keys(source).forEach((keys) => {
  3099. if (source[keys] && typeof source[keys] === 'object') {
  3100. targetObj[keys] = this.deepClone(source[keys])
  3101. } else {
  3102. targetObj[keys] = source[keys]
  3103. }
  3104. })
  3105. return targetObj
  3106. }, getGoodUnit(id) {
  3107. var goodUnit = this.$store.getters.good_unit
  3108. for (let i = 0; i < goodUnit.length; i++) {
  3109. if (goodUnit[i].id == id) {
  3110. return goodUnit[i].name
  3111. }
  3112. }
  3113. },
  3114. getAllProjectTeam() {
  3115. getAllProjectTeam().then(response => {
  3116. if (response.data.state == 1) {
  3117. var team = response.data.data.team
  3118. this.tabPrjectTeam = team.sort(this.compare("sort"))
  3119. this.allTabPrjectTeam = team
  3120. this.projectList = team
  3121. }
  3122. })
  3123. },
  3124. compare (property) {
  3125. return function (a, b) {
  3126. var value1 = a[property]
  3127. var value2 = b[property]
  3128. return value1 - value2
  3129. }
  3130. },
  3131. selectTeam(row) {
  3132. console.log(row)
  3133. // var arr = []
  3134. // for (let i = 0; i < row.length; i++) {
  3135. // arr.push(row[i].item_id)
  3136. // }
  3137. // console.log(arr)
  3138. // var ids = arr.join(',')
  3139. // console.log(ids)
  3140. // var strArr = ids.split(',')
  3141. // console.log(strArr)
  3142. // var res = []//接收不重复的数据
  3143. //
  3144. // for (var i = 0; i < strArr.length; i++) {
  3145. // var flag = true
  3146. //
  3147. // for (var j = 0; j < i; j++) {
  3148. // if (strArr[i] === strArr[j]) {
  3149. // flag = false
  3150. // break
  3151. // }
  3152. // }
  3153. // if (flag) {
  3154. // res.push(strArr[i])
  3155. // }
  3156. // }
  3157. // console.log(res)
  3158. // var idstr = res.join(',')
  3159. this.teamList = []
  3160. let teamList = []
  3161. for (let i = 0; i < row.length; i++) {
  3162. let team_id = row[i].id
  3163. const params = {
  3164. project_id: row[i].item_id
  3165. }
  3166. getPojectListById(params).then(response => {
  3167. if (response.data.state == 1) {
  3168. var project = response.data.data.project
  3169. let num = 0
  3170. for (let i = 0; i < project.length; i++) {
  3171. if (project[i].type == 2 && project[i].status == 1) {
  3172. let obj = {
  3173. id: project[i].project_id,
  3174. project_name: project[i].project.project_name,
  3175. statistical_classification: '',
  3176. single_dose: project[i].project.single_dose,
  3177. delivery_way: project[i].project.delivery_way,
  3178. execution_frequency: project[i].project.execution_frequency,
  3179. number_days: project[i].project.number_days,
  3180. cus_total: project[i].number,
  3181. price: project[i].project.price,
  3182. remark: '',
  3183. medical_code: project[i].project.medical_code,
  3184. unit: project[i].project.unit,
  3185. type: project[i].type,
  3186. is_special_diseases: project[i].project.disease_directory,
  3187. team_id: team_id,
  3188. project:project[i].project,
  3189. }
  3190. if (obj.cus_total == 0 || obj.cus_total == undefined) {
  3191. obj.cus_total = 1
  3192. }
  3193. teamList.push(obj)
  3194. } else if (project[i].type == 3 && project[i].status == 1) {
  3195. if (project[i].good_info.sum_count <= 0) {
  3196. num++
  3197. this.$refs.tabProjectTeam.toggleRowSelection(row)
  3198. this.$message.error(project[i].good_info.good_name + '库存不足')
  3199. }
  3200. if (num > 0) {
  3201. this.$refs.tabProjectTeam.clearSelection()
  3202. }
  3203. let obj = {
  3204. id: project[i].project_id,
  3205. project_name: project[i].good_info.good_name,
  3206. statistical_classification: '',
  3207. single_dose: '',
  3208. delivery_way: '',
  3209. execution_frequency: '',
  3210. number_days: '',
  3211. cus_total: project[i].number,
  3212. price: project[i].good_info.retail_price,
  3213. remark: '',
  3214. medical_code: project[i].good_info.medical_insurance_number,
  3215. unit: project[i].good_info.unit,
  3216. type: project[i].type,
  3217. is_special_diseases: project[i].good_info.is_special_diseases,
  3218. team_id: team_id,
  3219. good_info: project[i].good_info,
  3220. }
  3221. if (obj.cus_total == 0 || obj.cus_total == undefined) {
  3222. obj.cus_total = 1
  3223. }
  3224. teamList.push(obj)
  3225. }
  3226. }
  3227. this.teamList = teamList
  3228. }
  3229. })
  3230. }
  3231. }, changeDoctor(val) {
  3232. for (let i = 0; i < this.doctors.length; i++) {
  3233. if (this.doctors[i].admin_user_id == this.doctorValue) {
  3234. this.departmentValue = this.doctors[i].department_id
  3235. }
  3236. }
  3237. if (this.departmentValue == 0) {
  3238. this.departmentValue = ''
  3239. }
  3240. },
  3241. changeDayOrMonth(tab) {
  3242. if (this.dayorMonth == 'day') {
  3243. this.$emit('day')
  3244. } else if (this.dayorMonth == 'month') {
  3245. console.log('~~~~~~')
  3246. let form = {
  3247. id: this.patientInfo.id,
  3248. his_patient_id: this.hisPatientInfo.id
  3249. }
  3250. console.log(form)
  3251. this.$emit('month', form)
  3252. }
  3253. },
  3254. getAllProjectList() {
  3255. getAllProjectList().then(response => {
  3256. if (response.data.state == 1) {
  3257. var hisprojectlist = response.data.data.hisprojectlist
  3258. this.hisList = hisprojectlist
  3259. }
  3260. })
  3261. },
  3262. clearSelection() {
  3263. this.$refs.tabProjectTeam.clearSelection()
  3264. }
  3265. }, mounted() {
  3266. this.request_record_date = this.record_date
  3267. // this.getInitData()
  3268. //获取所有项目
  3269. this.getlist()
  3270. //获取所以项目组套
  3271. this.getAllProjectTeam()
  3272. this.getAllProjectList()
  3273. this.$nextTick(() => {
  3274. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  3275. })
  3276. },
  3277. watch: {
  3278. fullHeight(val) {
  3279. if (!this.timer) {
  3280. this.fullHeight = val
  3281. let tableHeight = val - 263
  3282. this.tableHeight = tableHeight
  3283. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  3284. this.timer = true
  3285. let that = this
  3286. setTimeout(function() {
  3287. that.timer = false
  3288. }, 400)
  3289. }
  3290. }
  3291. }
  3292. }
  3293. </script>
  3294. <style lang="scss" scoped>
  3295. .new-main-contain {
  3296. height: 100%;
  3297. display: flex;
  3298. flex-direction: column;
  3299. }
  3300. .app-container {
  3301. height: 100%;
  3302. }
  3303. .mainCell {
  3304. height: 36px;
  3305. display: flex;
  3306. align-items: center;
  3307. }
  3308. .mainLeft {
  3309. width: 200px;
  3310. height: 100%;
  3311. display: flex;
  3312. flex-direction: column;
  3313. margin-top: 2px;
  3314. .el-radio {
  3315. margin-right: 5px;
  3316. }
  3317. }
  3318. .mainRight {
  3319. margin-left: 20px;
  3320. flex: 1;
  3321. height: 100%;
  3322. display: flex;
  3323. flex-direction: column;
  3324. .cellSpan {
  3325. min-width: 80px;
  3326. display: inline-block;
  3327. margin-right: 10px;
  3328. }
  3329. }
  3330. .mainCenter {
  3331. display: flex;
  3332. flex: 1;
  3333. height: 100%;
  3334. }
  3335. .centerLeft {
  3336. flex: 1;
  3337. display: flex;
  3338. flex-direction: column;
  3339. position: relative;
  3340. .el-form-item {
  3341. width: 33%;
  3342. margin-bottom: 14px;
  3343. }
  3344. .el-form-item__label {
  3345. text-align: left;
  3346. }
  3347. }
  3348. .backColor {
  3349. background: #f6f8f9;
  3350. height: 5px;
  3351. margin-bottom: 5px;
  3352. }
  3353. .RP {
  3354. color: #409EFF;
  3355. font-size: 14px;
  3356. margin-bottom: 5px;
  3357. }
  3358. .tabsBox {
  3359. position: relative;
  3360. flex: 1;
  3361. overflow-y: auto;
  3362. margin-bottom: 60px;
  3363. /*/ / margin-top: 4 px;*/
  3364. .el-tabs__item {
  3365. padding: 0 10px;
  3366. }
  3367. }
  3368. .preTabs {
  3369. height: 100%;
  3370. display: flex;
  3371. flex-direction: column;
  3372. .el-tabs__content {
  3373. flex: 1;
  3374. overflow-y: auto;
  3375. }
  3376. }
  3377. .costBox {
  3378. width: 100%;
  3379. height: 60px;
  3380. background: #fff;
  3381. position: absolute;
  3382. bottom: 0;
  3383. display: flex;
  3384. align-items: center;
  3385. justify-content: space-between;
  3386. }
  3387. .statusRed {
  3388. color: red;
  3389. }
  3390. .addTab {
  3391. position: absolute;
  3392. right: 8px;
  3393. top: 3px;
  3394. z-index: 20;
  3395. }
  3396. .centerRight {
  3397. width: 300px;
  3398. margin-left: 10px;
  3399. display: flex;
  3400. flex-direction: column;
  3401. position: relative;
  3402. }
  3403. .rightTab {
  3404. height: 40px;
  3405. width: 100%;
  3406. border: 1px solid #d2d2d2;
  3407. box-sizing: border-box;
  3408. p {
  3409. width: 50%;
  3410. height: 40px;
  3411. line-height: 40px;
  3412. text-align: center;
  3413. background: #eee;
  3414. float: left;
  3415. }
  3416. > p:last-child {
  3417. border-left: 1px solid #d2d2d2;
  3418. float: right;
  3419. }
  3420. .activeP {
  3421. background: #409EFF;
  3422. color: #fff;
  3423. }
  3424. }
  3425. .rightTabs {
  3426. display: flex;
  3427. flex-direction: column;
  3428. }
  3429. .comfirmBox {
  3430. width: 100%;
  3431. height: 60px;
  3432. background: #fff;
  3433. position: absolute;
  3434. bottom: 0;
  3435. display: flex;
  3436. align-items: center;
  3437. justify-content: space-between;
  3438. z-index: 99;
  3439. }
  3440. .borderCard {
  3441. height: 100%;
  3442. display: flex;
  3443. flex-direction: column;
  3444. margin-bottom: 60px;
  3445. .el-tabs--border-card > .el-tabs__content {
  3446. padding: 0;
  3447. }
  3448. }
  3449. </style>
  3450. <style lang="scss">
  3451. .borderCard {
  3452. .el-tabs__nav {
  3453. width: 100%;
  3454. }
  3455. .el-tabs__item {
  3456. width: 50%;
  3457. text-align: center;
  3458. }
  3459. .el-tabs__content {
  3460. padding: 5px;
  3461. flex: 1;
  3462. }
  3463. }
  3464. .centerLeft {
  3465. .el-form-item__label {
  3466. text-align: left;
  3467. }
  3468. }
  3469. .tabsBox {
  3470. .el-tabs__item {
  3471. padding: 0 10px;
  3472. }
  3473. .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) {
  3474. padding: 0 10px;
  3475. }
  3476. .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 {
  3477. padding: 0 10px;
  3478. }
  3479. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  3480. padding: 0 10px;
  3481. }
  3482. }
  3483. .centerRight {
  3484. .el-tabs__nav-scroll {
  3485. display: flex;
  3486. }
  3487. .el-tabs__nav {
  3488. margin: 0 auto;
  3489. }
  3490. .el-table th .cell, .el-table td .cell {
  3491. padding: 0 2px;
  3492. }
  3493. }
  3494. .preTabs {
  3495. .el-tabs__content {
  3496. flex: 1;
  3497. overflow-y: auto;
  3498. padding: 5px 0 5px 5px;
  3499. }
  3500. }
  3501. .rightTabs {
  3502. height: 100%;
  3503. .el-tabs__nav {
  3504. width: auto;
  3505. }
  3506. .el-tabs__header {
  3507. margin-bottom: 5px;
  3508. }
  3509. .el-tabs__item {
  3510. width: auto;
  3511. text-align: inherit;
  3512. }
  3513. .el-tabs__content {
  3514. flex: 1;
  3515. overflow-y: auto;
  3516. }
  3517. .el-tab-pane {
  3518. display: flex;
  3519. flex-direction: column;
  3520. height: 100%;
  3521. }
  3522. }
  3523. #tab-more {
  3524. .el-icon-close {
  3525. display: none;
  3526. }
  3527. }
  3528. ::-webkit-scrollbar {
  3529. height: 15px;
  3530. }
  3531. </style>