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

deskPrescription.vue 154KB

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