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

deskPrescription.vue 159KB

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