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

deskPrescription.vue 157KB

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