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

deskPrescription.vue 129KB

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