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

deskPrescription.vue 126KB

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