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

deskPrescription.vue 135KB

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