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

deskPrescription.vue 141KB

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