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

deskPrescription.vue 153KB

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