deskPrescription.vue 157KB

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