deskPrescription.vue 151KB

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