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

deskPrescription.vue 137KB

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