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

prescriptionTemplatedetail.vue 95KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522
  1. <template>
  2. <div class="main-contain new-main-contain">
  3. <div style="height: calc(100% - 0px);display: flex;flex-direction: column;">
  4. <div style="display:flex;justify-content: space-between;align-items:center;margin:10px 0;padding:0 10px;color:#606266;">
  5. <div style="font-size:14px;">姓名:{{ $route.query.patient_name }}</div>
  6. <el-button size="small" @click="save" type="primary">保存</el-button>
  7. </div>
  8. <div class="mainCenter" style="padding:0 10px;" v-loading="loading">
  9. <div class="centerLeft">
  10. <el-form :model="tempForm" ref="tempForm" label-width="80px"
  11. style="display: flex;flex-wrap: wrap;justify-content: space-between;">
  12. <el-form-item label="模版名称:" prop="name" label-position="right">
  13. <el-input v-model="tempForm.name" placeholder=""></el-input>
  14. </el-form-item>
  15. <!-- <el-button @click="lili">调试</el-button>-->
  16. <el-form-item label="透析模式: " prop="mode_id" label-position="right">
  17. <el-select v-model="tempForm.mode_id" style="width:100%;" placeholder="请选择"
  18. :disabled="this.$route.query.id > 0 ?true:false" v-if="this.$route.query.id == 0"
  19. @change = "changeMode">
  20. <el-option
  21. v-for="item in modeOptions"
  22. :key="item.id"
  23. :label="item.name"
  24. :value="item.id"
  25. ></el-option>
  26. </el-select>
  27. <el-select v-model="tempForm.mode_id" style="width:100%;" placeholder="请选择"
  28. :disabled="this.$route.query.id > 0 ?true:false" v-if="this.$route.query.id > 0"
  29. @change = "changeMode">>
  30. <el-option
  31. v-for="item in modeOptionsTwo"
  32. :key="item.id"
  33. :label="item.name"
  34. :value="item.id"
  35. ></el-option>
  36. </el-select>
  37. </el-form-item>
  38. </el-form>
  39. <div class="tabsBox">
  40. <el-tabs class="preTabs" v-model="editableTabsValue" type="border-card"
  41. closable
  42. @tab-remove="removeTab"
  43. :before-leave="moreState" @tab-click="tabclickEvent">
  44. <el-tab-pane
  45. v-for="(item, index) in prescriptions"
  46. :key="index"
  47. :label="item.name"
  48. :name="item.name"
  49. >
  50. <!--<el-select style="width:50%;" v-model="item.med_type" placeholder="医疗类型" v-if="($store.getters.xt_user.org_id == 10028 || $store.getters.xt_user.org_id == 9504 || $store.getters.xt_user.org_id == 10138)" @change="changevalue" >-->
  51. <!--<el-option-->
  52. <!--v-for="(item,index) in medical_care"-->
  53. <!--:key="index"-->
  54. <!--:label="item.label"-->
  55. <!--:value="item.value">-->
  56. <!--</el-option>-->
  57. <!--</el-select>-->
  58. <el-select v-if="org_id != 10206" style="width:50%;" v-model="item.med_type" placeholder="医疗类型"
  59. @change="changevalue">
  60. <el-option
  61. v-for="(item,index) in register"
  62. :key="index"
  63. :label="item.label"
  64. :value="item.value">
  65. </el-option>
  66. </el-select>
  67. <!-- //针对海拉尔普爱肾病医院-->
  68. <el-select v-if="org_id == 10206" style="width:50%;" v-model="item.med_type" placeholder="医疗类型"
  69. @change="changevalue">
  70. <el-option
  71. v-for="(item,index) in register10206"
  72. :key="index"
  73. :label="item.label"
  74. :value="item.value">
  75. </el-option>
  76. </el-select>
  77. </el-tab-pane>
  78. <el-tab-pane name="more" closable><span slot="label"><i
  79. class="el-icon-plus"
  80. @click="addTab"></i></span>
  81. </el-tab-pane>
  82. <!--<prescription-table ref="prescription_tables"-->
  83. <!--:prescription="curPrescriptions"-->
  84. <!--:preDrugs="preDrugs"-->
  85. <!--:activeType="customTabIndex"></prescription-table>-->
  86. <prescription-template-table ref="prescription_tables"
  87. :prescription="curPrescriptions"
  88. :preDrugs="preDrugs"
  89. :activeType="customTabIndex"></prescription-template-table>
  90. </el-tabs>
  91. </div>
  92. </div>
  93. <div class='centerRight'>
  94. <el-tabs class="borderCard" type="border-card" v-model="rightTab" @tab-click="clickTab"
  95. :before-leave='beforeLeave'>
  96. <el-tab-pane label="药品" :name="1">
  97. </el-tab-pane>
  98. <el-tab-pane label="项目" :name="2">
  99. </el-tab-pane>
  100. <div style="height:100%;" v-show="showOne">
  101. <el-tabs class="rightTabs" v-model="drug_activeName">
  102. <el-tab-pane label="药品列表" name="1">
  103. <div style="margin-bottom:5px;display:flex;">
  104. <el-input style="width:50%;" @input="searchAction"
  105. @keyup.enter.native='searchAction'
  106. v-model.trim="search_keyword"
  107. placeholder="请输入药品名字"></el-input>
  108. <el-select style="margin-left:5px;width:50%;" v-model="value" placeholder=""
  109. @change="changeKind">
  110. <el-option
  111. label="全部"
  112. value="0">
  113. </el-option>
  114. <el-option
  115. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  116. :key="index"
  117. :label="item.name"
  118. :value="item.id">
  119. </el-option>
  120. </el-select>
  121. </div>
  122. <div style="width: 100%;flex:1;overflow: hidden;" ref="rightTable">
  123. <el-table ref="multipleTable"
  124. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  125. :data="drugs" border @select='selectDrugs'
  126. :row-style="{ color: '#303133' }"
  127. @select-all="changeAllGoodInfoTableData"
  128. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  129. highlight-current-row>
  130. <el-table-column type="selection" width="40"
  131. align="center"></el-table-column>
  132. <el-table-column label="名称" v-if="org_id == 10206 || org_id == 0">
  133. <template slot-scope="scope">{{ scope.row.drug_name }}{{scope.row.number?"("+scope.row.number+")":""}}</template>
  134. </el-table-column>
  135. <el-table-column label="名称" v-if="org_id != 10206 && org_id != 0">
  136. <template slot-scope="scope">{{ scope.row.drug_name }}</template>
  137. </el-table-column>
  138. <el-table-column label="规格" width="60" v-if="org_id != 10206 && org_id != 0">
  139. <template slot-scope="scope">
  140. <span
  141. v-if="scope.row.min_unit != scope.row.dose_unit">{{ scope.row.dose }}{{ scope.row.dose_unit }}&nbsp;* &nbsp;</span>
  142. {{ scope.row.min_number }}{{ scope.row.min_unit }}/{{ scope.row.max_unit }}
  143. </template>
  144. </el-table-column>
  145. <el-table-column label="规格" width="60" v-if="org_id == 10206 || org_id == 0">
  146. <template slot-scope="scope">
  147. <span>{{scope.row.drug_spec}}</span>
  148. </template>
  149. </el-table-column>
  150. <el-table-column label="单价" width="40">
  151. <template slot-scope="scope">{{ scope.row.retail_price }}</template>
  152. </el-table-column>
  153. </el-table>
  154. </div>
  155. </el-tab-pane>
  156. </el-tabs>
  157. </div>
  158. <div style="height:100%;" v-show="showTwo">
  159. <div style="height:100%;" v-show="showTwo">
  160. <el-tabs class="rightTabs" v-model="activeName">
  161. <el-tab-pane label="项目列表" name="1">
  162. <div style="margin-bottom:5px;">
  163. <!--<el-input style="width:50%;" v-model="input" placeholder=""></el-input>-->
  164. <el-input style="width:50%;" @input="searchProjectAction"
  165. @keyup.enter.native='searchProjectAction'
  166. v-model.trim="search_project_keyword"
  167. placeholder="请输入项目名称"></el-input>
  168. <el-select style="float: right;width: 49%;" v-model="value" placeholder=""
  169. @change="changeClass">
  170. <el-option
  171. label="全部"
  172. value="0">
  173. </el-option>
  174. <el-option
  175. v-for="(item, index) in getDictionaryDataConfig('system','cost_classify')"
  176. :key="index"
  177. :label="item.name"
  178. :value="item.id">
  179. </el-option>
  180. </el-select>
  181. </div>
  182. <div style="width: 100%;flex:1;overflow-y: auto;">
  183. <el-table ref="tables"
  184. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  185. :data="tabProject" border @select='selectChange'
  186. :row-style="{ color: '#303133' }"
  187. @select-all="changeAllGoodInfoTableDataTwo"
  188. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  189. highlight-current-row>
  190. <el-table-column type="selection" width="40"
  191. align="center"></el-table-column>
  192. <el-table-column prop="name" label="名称" v-if="org_id != 10206 && org_id != 0">
  193. <template slot-scope="scope">{{ scope.row.project_name }}</template>
  194. </el-table-column>
  195. <el-table-column prop="name" label="名称" v-if="org_id == 10206 || org_id == 0">
  196. <template slot-scope="scope">{{ scope.row.project_name }}{{scope.row.number?"("+scope.row.number+")":""}}</template>
  197. </el-table-column>
  198. <el-table-column label="规格" width="60">
  199. <template slot-scope="scope">{{ scope.row.single_dose }}</template>
  200. </el-table-column>
  201. <el-table-column label="单价" width="40">
  202. <template slot-scope="scope">{{ scope.row.price }}</template>
  203. </el-table-column>
  204. </el-table>
  205. </div>
  206. </el-tab-pane>
  207. <el-tab-pane label="项目组套" name="2">
  208. <div style="width: 100%;flex:1;overflow-y: auto;">
  209. <el-table :data="tabPrjectTeam" border ref="tabProjectTeam"
  210. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  211. :row-style="{ color: '#303133' }"
  212. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  213. highlight-current-row
  214. @select='selectTeam'>
  215. <el-table-column type="selection" width="40"
  216. align="center"></el-table-column>
  217. <el-table-column prop="name" label="名称">
  218. <template slot-scope="scope">{{scope.row.project_team}}</template>
  219. </el-table-column>
  220. </el-table>
  221. </div>
  222. </el-tab-pane>
  223. </el-tabs>
  224. </div>
  225. </div>
  226. </el-tabs>
  227. <template>
  228. <div class="comfirmBox">
  229. <el-button type="primary" style="width:100%;" @click="comfirm">确定添加</el-button>
  230. </div>
  231. </template>
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. </template>
  237. <script>
  238. import { createdTemplate, delHisPrescriptionInfoTemplate, getPrescriptionTemplateInfo } from '@/api/his/his_config'
  239. import {
  240. createHisPrescription,
  241. delHisPrescription,
  242. editHisPrescription,
  243. getCallHisPrescription,
  244. getDayOrMonthHisPrescription,
  245. getInitData,
  246. getNextOrLastHisPrescription,
  247. getPatientInfo,
  248. getSchedulePatientList,
  249. getPresciptionTemplateDetail
  250. } from '@/api/his/his'
  251. import { getDictionaryDataConfig } from '@/utils/data'
  252. import prescriptionTable from './components/prescriptionTable'
  253. import {
  254. addProjectTeam,
  255. getAllProjectList,
  256. getAllProjectTeam,
  257. getHisProject,
  258. getPojectListById
  259. } from '@/api/project/project'
  260. import { uParseTime } from '@/utils/tools'
  261. import PrescriptionTemplateTable from './components/prescriptionTemplateTable'
  262. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  263. const moment = require('moment')
  264. export default {
  265. props: {
  266. patientInfo: Object,
  267. hisPatientInfo: Object,
  268. prescriptions: Array,
  269. record_date: String,
  270. search_keyword: '',
  271. month_prescriptions: Array,
  272. isloading: false,
  273. loading: false,
  274. other_sick: {
  275. type: Array,
  276. default: function() {
  277. return []
  278. }
  279. }
  280. },
  281. components: {
  282. PrescriptionTemplateTable,
  283. prescriptionTable,
  284. BreadCrumb
  285. },
  286. data() {
  287. return {
  288. org_id:this.$store.getters.xt_user.org_id,
  289. register10206: [
  290. { value: 1, label: '普通' },
  291. { value: 2, label: '急诊' },
  292. { value: 5, label: '第一类精神药品' },
  293. { value: 6, label: '第二类精神药品' },
  294. { value: 7, label: '放射药品' },
  295. { value: 8, label: '毒性药品' },
  296. { value: 9, label: '检查' },
  297. { value: 10, label: '检验' },
  298. { value: 12, label: '治疗' },
  299. { value: 99, label: '其他' },
  300. ],
  301. medical_care: [
  302. { value: 11, label: '普通门诊' },
  303. { value: 12, label: '家庭通道' },
  304. { value: 13, label: '门诊大病' },
  305. { value: 14, label: '重疾特药' },
  306. { value: 15, label: '门诊慢病' },
  307. { value: 16, label: '门诊特检' },
  308. { value: 17, label: '健康体检' },
  309. { value: 18, label: '预防接种' },
  310. { value: 19, label: '门诊输血' },
  311. { value: 91, label: '新冠肺炎门诊' }
  312. ],
  313. register: [
  314. { value: 11, label: '普通门诊' },
  315. // { value: 12, label: '门诊挂号' },
  316. // { value: 13, label: '急诊' },
  317. { value: 14, label: '门诊特殊病' }
  318. // { value: 15, label: '门诊统筹' },
  319. // { value: 16, label: '门诊慢性病' },
  320. // { value: 21, label: '普通住院' }
  321. ],
  322. crumbs: [
  323. { path: false, name: '门诊医生站' },
  324. { path: false, name: '处方模版' },
  325. { path: false, name: '模版详情' }
  326. ],
  327. tempForm: {
  328. name: '',
  329. mode_id: ''
  330. },
  331. modeOptions:{},
  332. modeOptionsTwo: {},
  333. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  334. end_time: moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  335. isLastOrNextVisible: false,
  336. multipleTableHeight: '',
  337. register_type: 1,
  338. value: '0',
  339. search_project_keyword: '',
  340. drugs: [],
  341. allDrugs: [],
  342. advices_template: [],
  343. additions: [],
  344. editableTabsValueTwo: '处方1',
  345. editableTabsValue: '处方1',
  346. editableTabs: [{
  347. title: '处方1',
  348. name: '1'
  349. }],
  350. curDayPrescriptions: null,
  351. dayPrescriptions: [],
  352. currenet_inedx: 0,
  353. rightTab: 1,
  354. activeName: '1',
  355. drug_activeName: '1',
  356. curPrescriptions: null,
  357. drugTableData: [],
  358. preDrugs: [],
  359. curDrugs: [],
  360. doctorOptions: [],
  361. doctorValue: '',
  362. departmentOptions: [],
  363. departmentValue: '',
  364. total: 0,
  365. request_record_date: '',
  366. state2: '',
  367. customTabIndex: 1,
  368. options: [],
  369. tabProject: [],
  370. allProject: [],
  371. strids: '',
  372. showOne: true,
  373. showTwo: false,
  374. tableData: [],
  375. tabPrjectTeam: [],
  376. teamList: [],
  377. doctors: [],
  378. departMent: [],
  379. curStatus: 0,
  380. isShowDayPrescription: false,
  381. monthCustomTabIndex: 1,
  382. order_status: '',
  383. register_types: [
  384. { id: 1, name: '医保' },
  385. { id: 2, name: '自费' }
  386. ],
  387. pickerOptions: {
  388. disabledDate(time) {
  389. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).getTime() - 24 * 3600 * 1000
  390. return time.getTime() > Date.now() || time.getTime() < threeMonths
  391. }
  392. },
  393. department: [],
  394. sick: [],
  395. diagnoses: [],
  396. diagnose: 1,
  397. state1: 1,
  398. curTotal: 0,
  399. prescription_id: 0,
  400. tempDrugs: [],
  401. dayorMonth: 'day',
  402. hisList: [],
  403. id:0,
  404. }
  405. },
  406. methods: {
  407. lili(){
  408. console.log("this.$store.getters.treatment_mode",this.$store.getters.treatment_mode)
  409. },
  410. save() {
  411. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length == 0) {
  412. this.$message.error('请先开处方')
  413. return
  414. }
  415. if (this.tempForm.name.length <= 0) {
  416. this.$message.error('模版名称不能为空')
  417. return
  418. }
  419. if (this.tempForm.mode_id <= 0) {
  420. this.$message.error('透析模式不能为空')
  421. return
  422. }
  423. for (let i = 0; i < this.prescriptions.length; i++) {
  424. console.log(this.prescriptions[i].med_type)
  425. if (this.prescriptions[i].med_type == 0 || this.prescriptions[i].med_type == '') {
  426. this.$message.error('处方医疗类型不能为空')
  427. return
  428. }
  429. }
  430. if(this.org_id != 10206){
  431. for (let i = 0; i < this.prescriptions.length; i++) {
  432. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  433. if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].advices[b].drug.is_special_diseases != 1) {
  434. this.$message.error('处方' + (i + 1).toString() + '属于特病类型处方,不能开非特病类型的药')
  435. return
  436. }
  437. }
  438. for (let c = 0; c < this.prescriptions[i].project.length; c++) {
  439. if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].project[c].type == 2 && this.prescriptions[i].project[c].project.disease_directory != 1) {
  440. this.$message.error('处方' + (i + 1).toString() + '属于特病类型处方,请开特病类型的项目')
  441. return
  442. }
  443. 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) {
  444. this.$message.error('处方' + (i + 1).toString() + '属于特病类型处方,请开特病类型的耗材')
  445. return
  446. }
  447. }
  448. }
  449. }
  450. let params = {
  451. name: this.tempForm.name,
  452. mode_id: this.tempForm.mode_id,
  453. patient_id: this.$route.query.patient_id,
  454. id:this.$route.query.id,
  455. }
  456. for (let i = 0; i < this.prescriptions.length; i++) {
  457. this.prescriptions[i].med_type = parseInt(this.prescriptions[i].med_type)
  458. if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
  459. this.prescriptions[i]['type'] = 1
  460. }
  461. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
  462. this.prescriptions[i]['type'] = 2
  463. }
  464. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  465. this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
  466. this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
  467. this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
  468. this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
  469. this.prescriptions[i].advices[b].groupno = parseInt(this.prescriptions[i].advices[b].groupno)
  470. this.prescriptions[i].advices[b].day_count = parseInt(this.prescriptions[i].advices[b].day_count)
  471. this.prescriptions[i].advices[b].frequency_type = parseInt(this.prescriptions[i].advices[b].frequency_type)
  472. this.prescriptions[i].advices[b].week_day = this.prescriptions[i].advices[b].week_day.toString()
  473. }
  474. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  475. this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString()
  476. this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString()
  477. this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
  478. this.prescriptions[i].project[b].day_count = parseInt(this.prescriptions[i].project[b].day_count)
  479. this.prescriptions[i].project[b].frequency_type = parseInt(this.prescriptions[i].project[b].frequency_type)
  480. this.prescriptions[i].project[b].week_day = this.prescriptions[i].project[b].week_day.toString()
  481. }
  482. }
  483. let data = {
  484. 'prescriptions': this.prescriptions
  485. }
  486. createdTemplate(params, data).then(response => {
  487. if (response.data.state == 1) {
  488. this.$message.success('保存成功')
  489. this.$emit('save',this.$route.query.patient_name)
  490. for (const mkey in this.modeOptions) {
  491. if (mkey == this.tempForm.mode_id) {
  492. delete this.modeOptions[mkey]
  493. }
  494. }
  495. this.$router.go(-1)
  496. } else {
  497. this.$message.error(response.data.msg)
  498. }
  499. })
  500. },
  501. changeClass(id) {
  502. this.tabProject = []
  503. if (id == 0) {
  504. this.tabProject = this.allProject
  505. } else {
  506. for (let i = 0; i < this.allProject.length; i++) {
  507. if (this.allProject[i].cost_classify == id) {
  508. this.tabProject.push(this.allProject[i])
  509. }
  510. }
  511. }
  512. },
  513. formatDecimal(num, decimal) {
  514. num = num.toString()
  515. let index = num.indexOf('.')
  516. if (index !== -1) {
  517. num = num.substring(0, decimal + index + 1)
  518. } else {
  519. num = num.substring(0)
  520. }
  521. return parseFloat(num).toFixed(decimal)
  522. },
  523. setValue(val) {
  524. this.prescriptions = []
  525. this.prescriptions = val
  526. this.$refs.next_or_last_prescription.close()
  527. var nowDate = new Date()
  528. var nowYear = nowDate.getFullYear()
  529. var nowMonth = nowDate.getMonth() + 1
  530. var nowDay = nowDate.getDate()
  531. var hours = nowDate.getHours()
  532. var min = nowDate.getMinutes()
  533. var nowTime =
  534. nowYear +
  535. '-' +
  536. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  537. '-' +
  538. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  539. ':' + (min < 10 ? '0' + min : min)
  540. for (let i = 0; i < this.prescriptions.length; i++) {
  541. this.prescriptions[i].name = '处方' + (i + 1)
  542. this.prescriptions[i]['pre_time'] = nowTime
  543. if (i == 0) {
  544. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  545. this.customTabIndex = 1
  546. this.curStatus = 1
  547. this.rightTab = 1
  548. this.showOne = true
  549. this.showTwo = false
  550. }
  551. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  552. this.customTabIndex = 2
  553. this.curStatus = 2
  554. this.rightTab = 2
  555. this.showTwo = true
  556. this.showOne = false
  557. }
  558. }
  559. }
  560. this.curPrescriptions = this.prescriptions[0]
  561. this.request_record_date = this.record_date
  562. this.$emit('setData', this.prescriptions)
  563. },
  564. GetNextOrLastHisPrescription(params) {
  565. getNextOrLastHisPrescription(params).then(response => {
  566. if (response.data.state == 1) {
  567. if (this.dayorMonth == 'day') {
  568. this.$refs.next_or_last_prescription.show(response.data.data.prescriptions, this.patientInfo.name, this.patientInfo.id, this.prescriptions)
  569. this.request_record_date = uParseTime(response.data.data.prescriptions[0].record_date, '{y}-{m}-{d}')
  570. } else {
  571. this.$message.error('当前处于月结,无法使用上一方或下一方功能')
  572. }
  573. } else {
  574. this.$message.error(response.data.msg)
  575. }
  576. })
  577. },
  578. selectTemplate(selection, row) {
  579. this.tempDrugs = selection
  580. }, changeTemplateData(selection) {
  581. this.tempDrugs = selection
  582. },
  583. searchProjectAction() {
  584. if (this.search_project_keyword.length == 0) {
  585. this.tabProject = this.allProject
  586. } else {
  587. let arr = []
  588. for (let i = 0; i < this.tabProject.length; i++) {
  589. if (this.tabProject[i].project_name.indexOf(this.search_project_keyword) != -1 ||
  590. this.tabProject[i].first_letter.indexOf(this.search_project_keyword) !=-1) {
  591. arr = arr.concat(this.tabProject[i])
  592. }
  593. }
  594. this.tabProject = arr
  595. }
  596. },
  597. searchAction() {
  598. if (this.search_keyword.length == 0) {
  599. this.drugs = this.allDrugs
  600. } else {
  601. let arr = []
  602. for (let i = 0; i < this.drugs.length; i++) {
  603. if (this.drugs[i].drug_name.indexOf(this.search_keyword) != -1 ||
  604. this.drugs[i].wubi.indexOf(this.search_keyword) != -1 ||
  605. this.drugs[i].pinyin.indexOf(this.search_keyword) != -1 ||
  606. this.drugs[i].first_letter.indexOf(this.search_keyword) != -1) {
  607. arr = arr.concat(this.drugs[i])
  608. }
  609. }
  610. this.drugs = arr
  611. }
  612. },
  613. createFilter(queryString) {
  614. return (restaurant) => {
  615. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  616. }
  617. },
  618. querySearch2(queryString, cb) {
  619. var restaurants = this.other_sick
  620. restaurants.map(item => {
  621. item.value = item.name
  622. })
  623. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  624. // 调用 callback 返回建议列表的数据
  625. cb(results)
  626. },
  627. changeKind(val) {
  628. this.drugs = []
  629. if (val == 0) {
  630. this.drugs = this.allDrugs
  631. } else {
  632. for (let i = 0; i < this.allDrugs.length; i++) {
  633. if (this.allDrugs[i].drug_type == val) {
  634. this.drugs.push(this.allDrugs[i])
  635. }
  636. }
  637. }
  638. },
  639. getDictionaryDataConfig(module, filed_name) {
  640. return getDictionaryDataConfig(module, filed_name)
  641. },
  642. getInitData() {
  643. getInitData().then(response => {
  644. if (response.data.state == 0) {
  645. this.$message.error(response.data.msg)
  646. return false
  647. } else {
  648. this.drugs = response.data.data.drugs
  649. this.allDrugs = response.data.data.drugs
  650. this.advices_template = response.data.data.advices_template
  651. this.doctors = response.data.data.doctors
  652. for (let i = 0; i < this.doctors.length; i++) {
  653. if (this.doctors[i].user_type == 1) {
  654. this.doctors.splice(i, 1)
  655. }
  656. }
  657. this.department = response.data.data.department
  658. this.sick = response.data.data.sick
  659. this.diagnoses = response.data.data.diagnose
  660. this.additions = response.data.data.additions
  661. }
  662. })
  663. },
  664. tabclickEvent(val) {
  665. for (let i = 0; i < this.prescriptions.length; i++) {
  666. if (this.prescriptions[i].name == val.name) {
  667. this.prescription_id = this.prescriptions[i].id
  668. this.$emit('event1', this.prescription_id)
  669. this.curPrescriptions = this.prescriptions[i]
  670. this.teamList = []
  671. this.curDrugs = []
  672. this.$refs.multipleTable.clearSelection()
  673. this.$refs.tables.clearSelection()
  674. //用来区分处方属于项目还是药品
  675. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  676. this.customTabIndex = 1
  677. this.curStatus = 1
  678. this.rightTab = 1
  679. this.showOne = true
  680. this.showTwo = false
  681. }
  682. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  683. this.customTabIndex = 2
  684. this.curStatus = 2
  685. this.rightTab = 2
  686. this.showTwo = true
  687. this.showOne = false
  688. }
  689. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  690. this.customTabIndex = this.rightTab
  691. this.curStatus = 0
  692. }
  693. }
  694. }
  695. if (this.curPrescriptions.order_status == 0) {
  696. this.order_status = ''
  697. }
  698. if (this.curPrescriptions.order_status == 1) {
  699. this.order_status = '未收费'
  700. }
  701. if (this.curPrescriptions.order_status == 2) {
  702. this.order_status = '已结算'
  703. }
  704. if (this.curPrescriptions.order_status == 3) {
  705. this.order_status = '已退费'
  706. }
  707. },
  708. clearData() {
  709. this.curPrescriptions = []
  710. this.curStatus = 0
  711. this.curDrugs = []
  712. this.preDrugs = []
  713. this.teamList = []
  714. },
  715. setData(data, info, admin_info, doctors, department, hisPatientInfo, month_data) {
  716. for (let i = 0; i < doctors.length; i++) {
  717. if (doctors[i].user_type == 1) {
  718. doctors.splice(i, 1)
  719. }
  720. }
  721. this.curMonthPrescriptions = {}
  722. this.curPrescriptions = {}
  723. this.prescription_id = data[0].id
  724. this.editableTabsValue = '处方1'
  725. this.dayorMonth = 'day'
  726. this.$emit('event1', this.prescription_id)
  727. this.curStatus = 0
  728. this.curPrescriptions = {}
  729. this.curMonthPrescriptions = {}
  730. if (month_data && month_data.length > 0) {
  731. this.curMonthPrescriptions = month_data[0]
  732. } else {
  733. this.curMonthPrescriptions = {}
  734. }
  735. if (data && data.length > 0) {
  736. this.curPrescriptions = data[0]
  737. } else {
  738. this.curPrescriptions = {}
  739. }
  740. this.diagnose = info.diagnosis
  741. if (this.diagnose == 0) {
  742. for (let i = 0; i < this.diagnoses.length; i++) {
  743. this.diagnose = this.diagnoses[0].id
  744. }
  745. }
  746. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  747. this.curStatus = 1
  748. this.customTabIndex = 1
  749. this.rightTab = 1
  750. this.showOne = true
  751. this.showTwo = false
  752. }
  753. if (this.curPrescriptions.project.length > 0 && this.curPrescriptions.advices.length == 0) {
  754. this.curStatus = 2
  755. this.customTabIndex = 2
  756. this.rightTab = 2
  757. this.showOne = false
  758. this.showTwo = true
  759. }
  760. this.state1 = info.sick_type
  761. if (this.state1 == 0) {
  762. this.state1 = ''
  763. for (let i = 0; i < this.sick.length; i++) {
  764. this.state1 = this.sick[0].id
  765. }
  766. }
  767. this.state2 = info.sick_history
  768. if (this.state2 == 0) {
  769. this.state2 = ''
  770. }
  771. if (info.prescription_status == 0) {
  772. this.order_status = ''
  773. }
  774. if (this.curPrescriptions.order_status == 1) {
  775. this.order_status = '未收费'
  776. }
  777. if (this.curPrescriptions.order_status == 2) {
  778. this.order_status = '已结算'
  779. }
  780. if (this.curPrescriptions.order_status == 3) {
  781. this.order_status = '已退费'
  782. }
  783. if (info.id > 0) {
  784. this.doctorValue = info.doctor_id
  785. this.departmentValue = info.departments
  786. } else {
  787. if (hisPatientInfo.doctor != 0 && hisPatientInfo.department != 0) {
  788. this.doctorValue = hisPatientInfo.doctor
  789. this.departmentValue = hisPatientInfo.department
  790. } else {
  791. if (admin_info.user_type == 2 || admin_info.user_type == 1) {
  792. this.doctorValue = admin_info.admin_user_id
  793. if (admin_info.department_id == 0) {
  794. if (this.department.length > 0) {
  795. if (department && department.length > 0) {
  796. this.departmentValue = department[0].id
  797. } else {
  798. this.departmentValue = ''
  799. }
  800. } else {
  801. this.departmentValue = ''
  802. }
  803. } else {
  804. this.departmentValue = admin_info.department_id
  805. }
  806. } else {
  807. this.doctorValue = doctors[0].admin_user_id
  808. }
  809. if (this.doctorValue == 0) {
  810. this.doctorValue = ''
  811. }
  812. }
  813. }
  814. if (info.register_type == 0) {
  815. for (let i = 0; i < this.register.length; i++) {
  816. this.register_type = this.register[0].value
  817. }
  818. } else {
  819. this.register_type = info.register_type
  820. }
  821. },
  822. moreState(tab, event) {
  823. if (tab == 'more') {
  824. return false
  825. }
  826. }, open_three() {
  827. this.$refs.saveTemplate.show(this.prescriptions)
  828. }, open_two() {
  829. if (this.dayorMonth == 'day') {
  830. if (this.patientInfo == null || this.patientInfo.id == 0) {
  831. this.$message.error('请选择患者')
  832. return
  833. }
  834. let params = {
  835. end_time: this.record_date,
  836. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  837. patient_id: this.patientInfo.id,
  838. p_type: 2
  839. }
  840. getCallHisPrescription(params).then(response => {
  841. if (response.data.state == 1) {
  842. this.$refs.call_prescription.show(this.patientInfo.name, this.patientInfo.id, params.end_time, params.start_time, this.prescriptions, response.data.data.prescriptions)
  843. } else {
  844. this.$message.error(response.data.msg)
  845. }
  846. })
  847. } else {
  848. this.$message.error('当前属于月结状态,无法试用处方调用')
  849. }
  850. },
  851. open(index, isLoading) {
  852. if (this.dayorMonth == 'day') {
  853. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length == 0) {
  854. this.$message.error('请先开处方')
  855. return
  856. }
  857. }
  858. if (this.dayorMonth == 'day') {
  859. if (this.doctorValue.length <= 0) {
  860. this.$message.error('医生不能为空')
  861. return
  862. }
  863. if (this.departmentValue.length <= 0) {
  864. this.$message.error('科室不能为空')
  865. return
  866. }
  867. if (this.state1 <= 0) {
  868. this.$message.error('疾病类型不能为空')
  869. return
  870. }
  871. if (index == 1) {
  872. let params = {
  873. p_type: 2,
  874. patient_id: this.patientInfo.id,
  875. diagnose: this.diagnose,
  876. sick_type: this.state1,
  877. sick_history: this.state2,
  878. doctor: this.doctorValue,
  879. department: this.departmentValue,
  880. record_date: this.record_date,
  881. his_patient_id: this.hisPatientInfo.id,
  882. reg_type: this.register_type,
  883. }
  884. for (let i = 0; i < this.prescriptions.length; i++) {
  885. if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
  886. this.prescriptions[i]['type'] = 1
  887. }
  888. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
  889. this.prescriptions[i]['type'] = 2
  890. }
  891. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  892. this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
  893. this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
  894. this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
  895. this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
  896. this.prescriptions[i].advices[b].day_count = parseInt(this.prescriptions[i].advices[b].day_count)
  897. this.prescriptions[i].advices[b].frequency_type = parseInt(this.prescriptions[i].advices[b].frequency_type)
  898. this.prescriptions[i].advices[b].week_day = this.prescriptions[i].advices[b].week_day.toString()
  899. }
  900. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  901. this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString()
  902. this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString()
  903. this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
  904. this.prescriptions[i].project[b].day_count = parseInt(this.prescriptions[i].project[b].day_count)
  905. this.prescriptions[i].project[b].frequency_type = parseInt(this.prescriptions[i].project[b].frequency_type)
  906. this.prescriptions[i].project[b].week_day = this.prescriptions[i].project[b].week_day.toString()
  907. }
  908. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  909. this.prescriptions[i].addition[b].id = parseInt(this.prescriptions[i].addition[b].id)
  910. this.prescriptions[i].addition[b].item_id = parseInt(this.prescriptions[i].addition[b].item_id)
  911. this.prescriptions[i].addition[b].price = this.prescriptions[i].addition[b].price.toString()
  912. this.prescriptions[i].addition[b].count = this.prescriptions[i].addition[b].count.toString()
  913. }
  914. }
  915. let data = {
  916. 'prescriptions': this.prescriptions
  917. }
  918. isLoading = true
  919. createHisPrescription(data, params).then(response => {
  920. if (response.data.state == 1) {
  921. this.$emit('change', this.patientInfo.id)
  922. this.$message.success('保存成功')
  923. }
  924. })
  925. } else if (index == 2) {
  926. this.$router.push('/outpatientDoctorStation/print')
  927. } else if (index == 4) {
  928. } else if (index == 5) {
  929. this.$refs.saveTemplate.show()
  930. }
  931. } else if (this.dayorMonth == 'month') {
  932. if (this.isShowDayPrescription) {
  933. // if (this.curDayPrescriptions.order_status == 2) {
  934. // this.$message.error('当前处方已经结算,无法保存')
  935. // return
  936. // }
  937. if (this.doctorValue.length <= 0) {
  938. this.$message.error('医生不能为空')
  939. return
  940. }
  941. if (this.departmentValue.length <= 0) {
  942. this.$message.error('科室不能为空')
  943. return
  944. }
  945. if (index == 1) {
  946. let params = {
  947. patient_id: this.patientInfo.id,
  948. diagnose: this.diagnose,
  949. sick_type: this.state1,
  950. sick_history: this.state2,
  951. doctor: this.doctorValue,
  952. department: this.departmentValue,
  953. record_date: this.end_time,
  954. his_patient_id: this.hisPatientInfo.id,
  955. reg_type: this.register_type,
  956. p_type: 2
  957. }
  958. var month_prescriptions = this.deepClone(this.month_prescriptions)
  959. for (let i = 0; i < month_prescriptions.length; i++) {
  960. if (month_prescriptions[i].advices.length > 0 && month_prescriptions[i].project.length == 0) {
  961. month_prescriptions[i]['type'] = 1
  962. }
  963. if (month_prescriptions[i].advices.length == 0 && month_prescriptions[i].project.length > 0) {
  964. month_prescriptions[i]['type'] = 2
  965. }
  966. for (let b = 0; b < month_prescriptions[i].advices.length; b++) {
  967. month_prescriptions[i].advices[b].single_dose = month_prescriptions[i].advices[b].single_dose.toString()
  968. month_prescriptions[i].advices[b].prescribing_number = month_prescriptions[i].advices[b].prescribing_number.toString()
  969. month_prescriptions[i].advices[b].retail_price = month_prescriptions[i].advices[b].retail_price.toString()
  970. month_prescriptions[i].advices[b].day = parseInt(month_prescriptions[i].advices[b].day)
  971. }
  972. for (let b = 0; b < month_prescriptions[i].project.length; b++) {
  973. console.log('~~~~~~~')
  974. month_prescriptions[i].project[b].price = month_prescriptions[i].project[b].price.toString()
  975. month_prescriptions[i].project[b].total = month_prescriptions[i].project[b].total.toString()
  976. month_prescriptions[i].project[b].delivery_way = month_prescriptions[i].project[b].delivery_way.toString()
  977. }
  978. for (let b = 0; b < month_prescriptions[i].addition.length; b++) {
  979. month_prescriptions[i].addition[b].id = parseInt(month_prescriptions[i].addition[b].id)
  980. month_prescriptions[i].addition[b].item_id = parseInt(month_prescriptions[i].addition[b].item_id)
  981. month_prescriptions[i].addition[b].price = month_prescriptions[i].addition[b].price.toString()
  982. month_prescriptions[i].addition[b].count = month_prescriptions[i].addition[b].count.toString()
  983. }
  984. }
  985. let data = {
  986. 'prescriptions': month_prescriptions
  987. }
  988. editHisPrescription(data, params).then(response => {
  989. if (response.data.state == 1) {
  990. this.month_prescriptions = month_prescriptions
  991. this.$message.success('编辑成功')
  992. }
  993. })
  994. }
  995. }
  996. }
  997. },
  998. addTab(targetName) {
  999. // if (this.curPrescriptions.order_status == 2) {
  1000. // this.$message.error('该处方已经结算或者退费,无法继续添加处方')
  1001. // return
  1002. // }
  1003. // if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1004. // this.$message.error('当前处方无数据,新增数据后才能新增处方')
  1005. // return
  1006. // }
  1007. if (this.prescriptions.length == 0){
  1008. this.tabIndex = 1
  1009. }else{
  1010. var str = this.prescriptions[this.prescriptions.length - 1].name
  1011. var reg =/[\u4e00-\u9fa5]/g;
  1012. this.tabIndex = parseInt(str.replace(reg, ""))
  1013. ++this.tabIndex
  1014. }
  1015. let newTabName = '处方' + this.tabIndex
  1016. var nowDate = new Date()
  1017. var nowYear = nowDate.getFullYear()
  1018. var nowMonth = nowDate.getMonth() + 1
  1019. var nowDay = nowDate.getDate()
  1020. var hours = nowDate.getHours()
  1021. var min = nowDate.getMinutes()
  1022. var nowTime =
  1023. nowYear +
  1024. '-' +
  1025. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1026. '-' +
  1027. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1028. ':' + (min < 10 ? '0' + min : min)
  1029. let obj = {
  1030. id: 0,
  1031. name: newTabName,
  1032. order_status: 0,
  1033. advices: [],
  1034. project: [],
  1035. addition: [],
  1036. pre_time: nowTime,
  1037. // pre_time: nowTime
  1038. }
  1039. if(this.org_id == 10206) {
  1040. obj.med_type = 12
  1041. }else{
  1042. obj.med_type = 14
  1043. }
  1044. this.prescriptions.push(obj)
  1045. this.editableTabsValue = newTabName
  1046. this.curPrescriptions = this.prescriptions[this.prescriptions.length - 1]
  1047. this.curStatus = 0
  1048. if (this.curPrescriptions.order_status == 0) {
  1049. this.order_status = '未收费'
  1050. }
  1051. if (this.curPrescriptions.order_status == 1) {
  1052. this.order_status = '未收费'
  1053. }
  1054. if (this.curPrescriptions.order_status == 2) {
  1055. this.order_status = '已结算'
  1056. }
  1057. if (this.curPrescriptions.order_status == 3) {
  1058. this.order_status = '已退费'
  1059. }
  1060. },
  1061. removeTab(targetName) {
  1062. this.$confirm('处方删除后不可恢复,是否确认删除', '删除', {
  1063. confirmButtonText: '确 定',
  1064. cancelButtonText: '取 消',
  1065. type: 'warning'
  1066. }).then(() => {
  1067. let id = 0
  1068. for (let i = 0; i < this.prescriptions.length; i++) {
  1069. if (this.prescriptions[i].name == targetName) {
  1070. id = this.prescriptions[i].id
  1071. }
  1072. }
  1073. if (id == 0) {
  1074. let tabs = this.prescriptions
  1075. let activeName = this.editableTabsValue
  1076. if (activeName === targetName) {
  1077. tabs.forEach((tab, index) => {
  1078. if (tab.name === targetName) {
  1079. let nextTab = tabs[index + 1] || tabs[index - 1]
  1080. if (nextTab) {
  1081. activeName = nextTab.name
  1082. }
  1083. }
  1084. })
  1085. }
  1086. this.editableTabsValue = activeName
  1087. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  1088. for (let i = 0; i < this.prescriptions.length; i++) {
  1089. if (activeName == this.prescriptions[i].name) {
  1090. this.curPrescriptions = this.prescriptions[i]
  1091. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1092. this.curStatus = 1
  1093. }
  1094. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1095. this.curStatus = 2
  1096. }
  1097. }
  1098. }
  1099. if (this.prescriptions.length == 0) {
  1100. this.curPrescriptions = []
  1101. this.curStatus = 0
  1102. }
  1103. } else {
  1104. let params = {
  1105. 'id': id
  1106. }
  1107. delHisPrescriptionInfoTemplate(params).then(response => {
  1108. if (response.data.state == 1) {
  1109. this.$message.success('删除成功')
  1110. let tabs = this.prescriptions
  1111. let activeName = this.editableTabsValue
  1112. if (activeName === targetName) {
  1113. tabs.forEach((tab, index) => {
  1114. if (tab.name === targetName) {
  1115. let nextTab = tabs[index + 1] || tabs[index - 1]
  1116. if (nextTab) {
  1117. activeName = nextTab.name
  1118. }
  1119. }
  1120. })
  1121. }
  1122. this.editableTabsValue = activeName
  1123. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  1124. for (let i = 0; i < this.prescriptions.length; i++) {
  1125. if (activeName == this.prescriptions[i].name) {
  1126. this.curPrescriptions = this.prescriptions[i]
  1127. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1128. this.curStatus = 1
  1129. }
  1130. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1131. this.curStatus = 2
  1132. }
  1133. }
  1134. }
  1135. if (this.prescriptions.length == 0) {
  1136. this.curPrescriptions = []
  1137. this.curStatus = 0
  1138. }
  1139. } else {
  1140. this.$message.success(response.data.msg)
  1141. }
  1142. })
  1143. }
  1144. }).catch(() => {
  1145. })
  1146. },
  1147. beforeLeave(activeName, oldActiveName) {
  1148. let index = activeName
  1149. if (index == 1) {
  1150. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1151. return false
  1152. }
  1153. } else {
  1154. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1155. return false
  1156. }
  1157. }
  1158. },
  1159. clickTab(tab) {
  1160. let index = parseInt(tab.name)
  1161. if (index == 1) {
  1162. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1163. this.$message.error('当前处方为项目,无法切换为药品,需要新开处方')
  1164. return
  1165. }
  1166. } else {
  1167. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1168. this.$message.error('当前处方为药品,无法切换为项目,需要新开处方')
  1169. return
  1170. }
  1171. }
  1172. if (index == 1) {
  1173. this.teamList = []
  1174. this.$refs.tables.clearSelection()
  1175. this.showOne = true
  1176. this.showTwo = false
  1177. this.$nextTick(() => {
  1178. console.log("lilili1111111111111111111111111111111111111111111",this.prescriptions[this.prescriptions.length - 1])
  1179. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  1180. })
  1181. this.customTabIndex = 1
  1182. }
  1183. if (index == 2) {
  1184. this.curDrugs = []
  1185. this.$refs.multipleTable.clearSelection()
  1186. this.showTwo = true
  1187. this.showOne = false
  1188. this.$nextTick(() => {
  1189. console.log("lilili1111111111111111111111111111111111111111111",this.prescriptions[this.prescriptions.length - 1])
  1190. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  1191. })
  1192. this.customTabIndex = 2
  1193. }
  1194. this.rightTab = index
  1195. //用来区分处方属于项目还是药品
  1196. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1197. this.customTabIndex = 1
  1198. this.curStatus = 1
  1199. }
  1200. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1201. this.customTabIndex = 2
  1202. this.curStatus = 2
  1203. }
  1204. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1205. // this.customTabIndex = this.rightTab
  1206. this.customTabIndex = index
  1207. this.curStatus = 0
  1208. }
  1209. }, changeAllGoodInfoTableData: function(selection) {
  1210. this.curDrugs = selection
  1211. }, addCharges() {
  1212. this.$refs.additionalCharges.show()
  1213. },
  1214. selectDrugs(selection, row) {
  1215. this.curDrugs = selection
  1216. },
  1217. comfirm() {
  1218. console.log('222222222222', this.teamList)
  1219. // if (this.curPrescriptions.order_status == 2) {
  1220. // this.$message.error('该处方已经结算,无法继续添加药品或者项目')
  1221. // this.teamList = []
  1222. // this.curDrugs = []
  1223. // this.tempDrugs = []
  1224. // this.$refs.tables.clearSelection()
  1225. // this.$refs.multipleTableTwo.clearSelection()
  1226. // this.$refs.multipleTable.clearSelection()
  1227. // return
  1228. // }
  1229. // if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1230. // if (this.$store.getters.xt_user.org_id == 10138) {
  1231. // for (let i = 0; i < this.curDrugs.length; i++) {
  1232. // if (this.curPrescriptions.med_type == 14 && this.curDrugs[i].is_special_diseases != 1) {
  1233. // this.$message.error('该处方属于特病类型处方,开非特病类型的药')
  1234. // return
  1235. // }
  1236. // }
  1237. // }
  1238. // }
  1239. // if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1240. // if (this.$store.getters.xt_user.org_id == 10138) {
  1241. // for (let i = 0; i < this.curDrugs.length; i++) {
  1242. // if (this.curPrescriptions.med_type == 14 && this.curDrugs[i].is_special_diseases != 1) {
  1243. // this.$message.error('该处方属于特病类型处方,开非特病类型的药')
  1244. // return
  1245. // }
  1246. // }
  1247. // }
  1248. // }
  1249. if (this.curDrugs.length > 0) {
  1250. for (let i = 0; i < this.curDrugs.length; i++) {
  1251. if(this.$store.getters.xt_user.org.id != 10206) {
  1252. if (this.curPrescriptions.med_type == 14 && this.curDrugs[i].is_special_diseases != 1) {
  1253. this.$message.error('该处方属于特病类型处方,开非特病类型的药')
  1254. return
  1255. }
  1256. }
  1257. }
  1258. }
  1259. if (this.teamList.length > 0) {
  1260. for (let i = 0; i < this.teamList.length; i++) {
  1261. if(this.$store.getters.xt_user.org.id != 10206) {
  1262. if (this.curPrescriptions.med_type == 14 && this.teamList[i].is_special_diseases != 1) {
  1263. setTimeout(() => {
  1264. this.$message.error('该处方属于特病类型处方,请开特病类型的项目')
  1265. }, 100)
  1266. // return
  1267. }
  1268. }
  1269. }
  1270. let arr = this.teamList
  1271. let newArr = []
  1272. arr.map(item => {
  1273. if (this.curPrescriptions.med_type != 14) {
  1274. newArr.push(item)
  1275. }
  1276. if (this.curPrescriptions.med_type == 14 && item.is_special_diseases == 1) {
  1277. newArr.push(item)
  1278. }
  1279. })
  1280. this.teamList = newArr
  1281. }
  1282. if (this.curDrugs.length == 0) {
  1283. for (let i = 0; i < this.curDrugs.length; i++) {
  1284. if(this.$store.getters.xt_user.org.id != 10206) {
  1285. if (this.curPrescriptions.med_type == 14 && this.curDrugs[i].is_special_diseases != 1) {
  1286. this.$message.error('该处方属于特病类型处方,开非特病类型的药')
  1287. return
  1288. }
  1289. }
  1290. }
  1291. }
  1292. if (this.curStatus == 1 && this.rightTab == 2) {
  1293. this.$message.error('该处方是药品,无法添加项目')
  1294. this.teamList = []
  1295. this.$refs.tables.clearSelection()
  1296. return
  1297. }
  1298. if (this.curStatus == 2 && this.rightTab == 1) {
  1299. this.$message.error('该处方是项目,无法添加药品')
  1300. this.curDrugs = []
  1301. this.tempDrugs = []
  1302. this.$refs.multipleTable.clearSelection()
  1303. this.$refs.multipleTableTwo.clearSelection()
  1304. return
  1305. }
  1306. for (let i = 0; i < this.teamList.length; i++) {
  1307. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  1308. if (this.teamList[i].id == this.curPrescriptions.project[a].project_id) {
  1309. this.$message.error('当前处方存在相同的药品,无法添加相同的项目')
  1310. return
  1311. }
  1312. }
  1313. }
  1314. for (let i = 0; i < this.curDrugs.length; i++) {
  1315. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  1316. if (this.curDrugs[i].id == this.curPrescriptions.advices[a].id) {
  1317. this.$message.error('当前处方存在相同的药品,无法添加相同的药品')
  1318. return
  1319. }
  1320. }
  1321. }
  1322. let templateDrugs = []
  1323. for (let i = 0; i < this.tempDrugs.length; i++) {
  1324. for (let a = 0; a < this.tempDrugs[i].advices.length; a++) {
  1325. templateDrugs.push(this.tempDrugs[i].advices[a])
  1326. }
  1327. }
  1328. // for (let i = 0; i < templateDrugs.length; i++) {
  1329. // for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  1330. // if (this.templateDrugs[i].drug_id == this.curPrescriptions.advices[i].id) {
  1331. // this.$message.error('改处方存在相同的药品,无法添加相同的药品')
  1332. // return
  1333. //
  1334. // }
  1335. // }
  1336. // }
  1337. for (let i = 0; i < this.prescriptions.length; i++) {
  1338. if (this.prescriptions[i].name == this.editableTabsValue) {
  1339. var temp = this.deepClone(this.curDrugs)
  1340. var temp2 = this.deepClone(this.teamList)
  1341. var temp3 = this.deepClone(templateDrugs)
  1342. if (temp3.length > 0) {
  1343. for (let b = 0; b < temp3.length; b++) {
  1344. let obj = {
  1345. advice_id: 0,
  1346. id: temp3[b].id,
  1347. drug_name: temp3[b].advice_name,
  1348. single_dose: temp3[b].single_dose,
  1349. delivery_way: temp3[b].delivery_way,
  1350. execution_frequency: temp3[b].execution_frequency,
  1351. retail_price: temp3[b].drug.retail_price.toString(),
  1352. remark: '',
  1353. day: 1,
  1354. prescribing_number: temp3[b].prescribing_number,
  1355. single_dose_unit: temp3[b].drug.drug_dose_unit,
  1356. prescribing_number_unit: temp3[b].drug.max_unit,
  1357. medical_insurance_number: temp3[b].drug.medical_insurance_number
  1358. }
  1359. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  1360. obj.prescribing_number = 1
  1361. }
  1362. this.prescriptions[i].advices.push(obj)
  1363. }
  1364. this.curStatus = 1
  1365. }
  1366. let index = 0
  1367. if (this.prescriptions[i].advices.length > 0) {
  1368. index = this.prescriptions[i].advices.length
  1369. }
  1370. if (temp.length > 0) {
  1371. for (let b = 0; b < temp.length; b++) {
  1372. let temp_index = b + 1
  1373. let obj = {
  1374. advice_id: 0,
  1375. id: temp[b].id,
  1376. drug_name: temp[b].drug_name,
  1377. single_dose: temp[b].single_dose,
  1378. delivery_way: temp[b].delivery_way,
  1379. execution_frequency: temp[b].execution_frequency,
  1380. retail_price: temp[b].prescribing_number_unit == temp[b].max_unit ? temp[b].retail_price.toString() : temp[b].min_price.toString(),
  1381. remark: '',
  1382. day: 1,
  1383. prescribing_number: temp[b].prescribing_number,
  1384. single_dose_unit: temp[b].dose_unit,
  1385. prescribing_number_unit: temp[b].prescribing_number_unit,
  1386. medical_insurance_number: temp[b].medical_insurance_number,
  1387. drug: temp[b],
  1388. groupno: index + temp_index,
  1389. frequency_type: 1,
  1390. day_count: 0,
  1391. week_day: ''
  1392. }
  1393. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  1394. obj.prescribing_number = 1
  1395. }
  1396. this.prescriptions[i].advices.push(obj)
  1397. }
  1398. this.curStatus = 1
  1399. }
  1400. if (temp2.length > 0) {
  1401. for (let b = 0; b < temp2.length; b++) {
  1402. let obj = {
  1403. id: 0,
  1404. project_id: temp2[b].id,
  1405. project_name: temp2[b].project_name,
  1406. statistical_classification: temp2[b].statistical_classification,
  1407. single_dose: temp2[b].single_dose,
  1408. delivery_way: temp2[b].delivery_way,
  1409. execution_frequency: temp2[b].execution_frequency,
  1410. number_days: temp2[b].number_days,
  1411. total: temp2[b].total,
  1412. price: temp2[b].price,
  1413. remark: '',
  1414. medical_code: temp2[b].medical_code,
  1415. type: temp2[b].type,
  1416. frequency_type: 1,
  1417. day_count: 0,
  1418. week_day: ''
  1419. }
  1420. if (temp2[b].type == 2) {
  1421. obj['project'] = temp2[b].project
  1422. obj['unit'] = temp2[b].project.unit
  1423. } else if (temp2[b].type == 3) {
  1424. obj['good_info'] = temp2[b].good_info
  1425. obj['unit'] = temp2[b].good_info.packing_unit
  1426. }
  1427. if (obj.total == 0 || obj.total == undefined) {
  1428. obj.total = 1
  1429. }
  1430. if (obj.type == 3) {
  1431. obj.single_dose = 1
  1432. }
  1433. this.prescriptions[i].project.push(obj)
  1434. }
  1435. this.curStatus = 2
  1436. }
  1437. this.curPrescriptions = this.prescriptions[i]
  1438. this.$refs.multipleTable.clearSelection()
  1439. this.$refs.tables.clearSelection()
  1440. }
  1441. }
  1442. this.curDrugs = []
  1443. this.preDrugs = []
  1444. this.teamList = []
  1445. }, changeAllGoodInfoTableDataTwo(row) {
  1446. this.teamList = row
  1447. },
  1448. selectChange(row) {
  1449. this.teamList = row
  1450. }, getPrescriptionTemplateInfo() {
  1451. let params = {
  1452. id: this.$route.query.id
  1453. }
  1454. getPrescriptionTemplateInfo(params).then(response => {
  1455. if (response.data.state == 0) {
  1456. this.$message.error(response.data.msg)
  1457. return false
  1458. } else {
  1459. this.prescriptions = []
  1460. if (response.data.data.template.id > 0) {
  1461. this.tempForm.name = response.data.data.template.name
  1462. this.tempForm.mode_id = response.data.data.template.mode
  1463. for (let i = 0; i < response.data.data.prescriptions.length; i++) {
  1464. var prescription = response.data.data.prescriptions[i]
  1465. let tempAdvice = []
  1466. let tempProject = []
  1467. let tempAddition = []
  1468. //药品
  1469. for (let b = 0; b < prescription.advices.length; b++) {
  1470. console.log("prescription.advices[b].drug.drug_status.startsWith('停用')",prescription.advices[b].drug.drug_status.startsWith('停用'))
  1471. if(prescription.advices[b].drug!=null && prescription.advices[b].drug.drug_status.startsWith('停用') == false){
  1472. let obj = {
  1473. advice_id: prescription.advices[b].id,
  1474. drug_name: prescription.advices[b].advice_name,
  1475. single_dose: prescription.advices[b].single_dose,
  1476. delivery_way: prescription.advices[b].delivery_way,
  1477. execution_frequency: prescription.advices[b].execution_frequency,
  1478. retail_price: prescription.advices[b].price.toString(),
  1479. remark: prescription.advices[b].remark,
  1480. day: prescription.advices[b].day,
  1481. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1482. single_dose_unit: prescription.advices[b].single_dose_unit,
  1483. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1484. medical_insurance_number: prescription.advices[b].med_list_codg,
  1485. id: prescription.advices[b].drug_id,
  1486. drug: prescription.advices[b].drug,
  1487. groupno: prescription.advices[b].groupno,
  1488. frequency_type: prescription.advices[b].frequency_type,
  1489. day_count: prescription.advices[b].day_count,
  1490. week_day: prescription.advices[b].week_day
  1491. }
  1492. tempAdvice.push(obj)
  1493. }
  1494. }
  1495. //项目
  1496. for (let b = 0; b < prescription.project.length; b++) {
  1497. if(prescription.project!=null && (prescription.project[b].good_info.good_status.startsWith('停用') == false )) {
  1498. if (this.org_id == 10206 || this.org_id == 0) {
  1499. let obj = {
  1500. id: prescription.project[b].id,
  1501. project_id: prescription.project[b].project_id,
  1502. project_name: prescription.project[b].project.project_name,
  1503. statistical_classification: prescription.project[b].project.statistical_classification,
  1504. single_dose: prescription.project[b].single_dose,
  1505. delivery_way: prescription.project[b].delivery_way,
  1506. execution_frequency: prescription.project[b].execution_frequency,
  1507. number_days: prescription.project[b].day,
  1508. total: prescription.project[b].count.toString(),
  1509. price: prescription.project[b].price,
  1510. remark: prescription.project[b].remark,
  1511. medical_code: prescription.project[b].project.medical_code,
  1512. type: prescription.project[b].type,
  1513. frequency_type: prescription.project[b].frequency_type,
  1514. day_count: prescription.project[b].day_count,
  1515. week_day: prescription.project[b].week_day
  1516. }
  1517. if (prescription.project[b].type == 2) {
  1518. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  1519. obj['medical_code'] = prescription.project[b].project.medical_code
  1520. obj['project_name'] = prescription.project[b].project.project_name
  1521. obj['project'] = prescription.project[b].project
  1522. obj['unit'] = prescription.project[b].unit
  1523. } else if (prescription.project[b].type == 3) {
  1524. obj['statistical_classification'] = ''
  1525. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1526. obj['project_name'] = prescription.project[b].good_info.good_name
  1527. obj['good_info'] = prescription.project[b].good_info
  1528. obj['unit'] = prescription.project[b].good_info.packing_unit
  1529. }
  1530. tempProject.push(obj)
  1531. }
  1532. }else{
  1533. if( prescription.project[b].project.medical_status!=1){
  1534. let obj = {
  1535. id: prescription.project[b].id,
  1536. project_id: prescription.project[b].project_id,
  1537. project_name: prescription.project[b].project.project_name,
  1538. statistical_classification: prescription.project[b].project.statistical_classification,
  1539. single_dose: prescription.project[b].single_dose,
  1540. delivery_way: prescription.project[b].delivery_way,
  1541. execution_frequency: prescription.project[b].execution_frequency,
  1542. number_days: prescription.project[b].day,
  1543. total: prescription.project[b].count.toString(),
  1544. price: prescription.project[b].price,
  1545. remark: prescription.project[b].remark,
  1546. medical_code: prescription.project[b].project.medical_code,
  1547. type: prescription.project[b].type,
  1548. frequency_type: prescription.project[b].frequency_type,
  1549. day_count: prescription.project[b].day_count,
  1550. week_day: prescription.project[b].week_day
  1551. }
  1552. if (prescription.project[b].type == 2) {
  1553. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  1554. obj['medical_code'] = prescription.project[b].project.medical_code
  1555. obj['project_name'] = prescription.project[b].project.project_name
  1556. obj['project'] = prescription.project[b].project
  1557. obj['unit'] = prescription.project[b].unit
  1558. } else if (prescription.project[b].type == 3) {
  1559. obj['statistical_classification'] = ''
  1560. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1561. obj['project_name'] = prescription.project[b].good_info.good_name
  1562. obj['good_info'] = prescription.project[b].good_info
  1563. obj['unit'] = prescription.project[b].good_info.packing_unit
  1564. }
  1565. tempProject.push(obj)
  1566. }
  1567. }
  1568. }
  1569. // var preTime = nowTime
  1570. let index = i + 1
  1571. let obj = {
  1572. id: prescription.id,
  1573. name: '处方' + index,
  1574. advices: tempAdvice,
  1575. project: tempProject,
  1576. addition: tempAddition,
  1577. order_status: 1
  1578. // pre_time: preTime
  1579. }
  1580. if (prescription.med_type == '' || prescription.med_type == 0) {
  1581. obj['med_type'] = ''
  1582. } else {
  1583. obj['med_type'] = parseInt(prescription.med_type)
  1584. }
  1585. this.prescriptions.push(obj)
  1586. console.log("!!!!!")
  1587. console.log(this.prescriptions)
  1588. console.log("!!!!!")
  1589. }
  1590. this.curPrescriptions = this.prescriptions[0]
  1591. } else {
  1592. let obj = {
  1593. id: 0,
  1594. name: '处方1',
  1595. advices: [],
  1596. project: [],
  1597. addition: [],
  1598. order_status: 0,
  1599. med_type: ''
  1600. }
  1601. if(this.org_id == 10206) {
  1602. obj.med_type = 12
  1603. }else{
  1604. obj.med_type = 14
  1605. }
  1606. this.prescriptions.push(obj)
  1607. console.log("this.prescriptions")
  1608. console.log(this.prescriptions)
  1609. console.log("this.prescriptions")
  1610. this.curPrescriptions = this.prescriptions[0]
  1611. }
  1612. }
  1613. })
  1614. },
  1615. getlist() {
  1616. this.tabProject = []
  1617. getHisProject().then(response => {
  1618. if (response.data.state == 1) {
  1619. var project = response.data.data.project
  1620. for (let i = 0; i < project.length; i++) {
  1621. let obj = {
  1622. id: project[i].id,
  1623. project_name: project[i].project_name,
  1624. statistical_classification: project[i].statistical_classification,
  1625. single_dose: project[i].single_dose,
  1626. delivery_way: project[i].delivery_way,
  1627. execution_frequency: project[i].execution_frequency,
  1628. number_days: project[i].number_days,
  1629. price: project[i].price,
  1630. medical_code: project[i].medical_code,
  1631. unit: project[i].unit,
  1632. type: 2,
  1633. is_special_diseases: project[i].disease_directory,
  1634. project: project[i],
  1635. first_letter:project[i].first_letter,
  1636. number: "",
  1637. }
  1638. this.tabProject.push(obj)
  1639. }
  1640. var good_info = response.data.data.good_info
  1641. for (let i = 0; i < good_info.length; i++) {
  1642. let obj = {
  1643. id: good_info[i].id,
  1644. project_name: good_info[i].good_name,
  1645. statistical_classification: 0,
  1646. single_dose: good_info[i].specification_name,
  1647. delivery_way: '',
  1648. execution_frequency: '',
  1649. number_days: 1,
  1650. price: good_info[i].retail_price,
  1651. medical_code: good_info[i].medical_insurance_number,
  1652. unit: this.getGoodUnit(good_info[i].good_unit),
  1653. type: 3,
  1654. is_special_diseases: good_info[i].is_special_diseases,
  1655. good_info: good_info[i],
  1656. first_letter:good_info[i].first_letter,
  1657. number: good_info[i].good_number,
  1658. }
  1659. this.tabProject.push(obj)
  1660. }
  1661. this.allProject = this.tabProject
  1662. }
  1663. })
  1664. }, deepClone(source) {
  1665. if (!source && typeof source !== 'object') {
  1666. throw new Error('error arguments', 'shallowClone')
  1667. }
  1668. const targetObj = source.constructor === Array ? [] : {}
  1669. Object.keys(source).forEach((keys) => {
  1670. if (source[keys] && typeof source[keys] === 'object') {
  1671. targetObj[keys] = this.deepClone(source[keys])
  1672. } else {
  1673. targetObj[keys] = source[keys]
  1674. }
  1675. })
  1676. return targetObj
  1677. }, getGoodUnit(id) {
  1678. var goodUnit = this.$store.getters.good_unit
  1679. for (let i = 0; i < goodUnit.length; i++) {
  1680. if (goodUnit[i].id == id) {
  1681. return goodUnit[i].name
  1682. }
  1683. }
  1684. },
  1685. getAllProjectTeam() {
  1686. getAllProjectTeam().then(response => {
  1687. if (response.data.state == 1) {
  1688. var team = response.data.data.team
  1689. console.log('team2222', team)
  1690. this.tabPrjectTeam = team.sort(this.compare("sort"))
  1691. this.projectList = team
  1692. }
  1693. })
  1694. },
  1695. compare (property) {
  1696. return function (a, b) {
  1697. var value1 = a[property]
  1698. var value2 = b[property]
  1699. return value1 - value2
  1700. }
  1701. },
  1702. changevalue(val) {
  1703. this.$forceUpdate()
  1704. },
  1705. selectTeam(row) {
  1706. console.log('row', row)
  1707. var arr = []
  1708. for (let i = 0; i < row.length; i++) {
  1709. arr.push(row[i].item_id)
  1710. }
  1711. var ids = arr.join(',')
  1712. var strArr = ids.split(',')
  1713. var res = []//接收不重复的数据
  1714. for (var i = 0; i < strArr.length; i++) {
  1715. var flag = true
  1716. for (var j = 0; j < i; j++) {
  1717. if (strArr[i] === strArr[j]) {
  1718. flag = false
  1719. break
  1720. }
  1721. }
  1722. if (flag) {
  1723. res.push(strArr[i])
  1724. }
  1725. }
  1726. var idstr = res.join(',')
  1727. const params = {
  1728. project_id: idstr
  1729. }
  1730. getPojectListById(params).then(response => {
  1731. if (response.data.state == 1) {
  1732. this.teamList = []
  1733. var project = response.data.data.project
  1734. for (let i = 0; i < project.length; i++) {
  1735. if (project[i].type == 2) {
  1736. let obj = {
  1737. id: project[i].project_id,
  1738. project_name: project[i].project.project_name,
  1739. statistical_classification: project[i].project.statistical_classification,
  1740. single_dose: project[i].project.single_dose,
  1741. delivery_way: project[i].project.delivery_way,
  1742. execution_frequency: project[i].project.execution_frequency,
  1743. number_days: project[i].project.number_days,
  1744. total: project[i].number,
  1745. price: project[i].project.price,
  1746. remark: '',
  1747. medical_code: project[i].project.medical_code,
  1748. unit: project[i].project.unit,
  1749. type: project[i].type,
  1750. is_special_diseases: project[i].project.disease_directory,
  1751. project: project[i].project
  1752. }
  1753. if (obj.total == 0 || obj.total == undefined) {
  1754. obj.total = 1
  1755. }
  1756. this.teamList.push(obj)
  1757. } else if (project[i].type == 3) {
  1758. let obj = {
  1759. id: project[i].project_id,
  1760. project_name: project[i].good_info.good_name,
  1761. statistical_classification: '',
  1762. single_dose: '',
  1763. delivery_way: '',
  1764. execution_frequency: '',
  1765. number_days: '',
  1766. total: project[i].number,
  1767. price: project[i].good_info.retail_price,
  1768. remark: '',
  1769. medical_code: project[i].good_info.medical_insurance_number,
  1770. unit: project[i].good_info.unit,
  1771. type: project[i].type,
  1772. is_special_diseases: project[i].good_info.is_special_diseases,
  1773. good_info: project[i].good_info
  1774. }
  1775. if (obj.total == 0 || obj.total == undefined) {
  1776. obj.total = 1
  1777. }
  1778. this.teamList.push(obj)
  1779. console.log(this.teamList)
  1780. }
  1781. }
  1782. }
  1783. })
  1784. }, changeDoctor(val) {
  1785. for (let i = 0; i < this.doctors.length; i++) {
  1786. if (this.doctors[i].admin_user_id == this.doctorValue) {
  1787. this.departmentValue = this.doctors[i].department_id
  1788. }
  1789. }
  1790. if (this.departmentValue == 0) {
  1791. this.departmentValue = ''
  1792. }
  1793. },
  1794. changeDayOrMonth(tab) {
  1795. if (this.dayorMonth == 'day') {
  1796. } else if (this.dayorMonth == 'month') {
  1797. }
  1798. },
  1799. getAllProjectList() {
  1800. getAllProjectList().then(response => {
  1801. if (response.data.state == 1) {
  1802. var hisprojectlist = response.data.data.hisprojectlist
  1803. console.log('hisprojectlist', hisprojectlist)
  1804. this.hisList = hisprojectlist
  1805. }
  1806. })
  1807. },
  1808. clearSelection() {
  1809. this.$refs.tabProjectTeam.clearSelection()
  1810. },
  1811. changeMode(id){
  1812. var params = {
  1813. mode_id:id,
  1814. }
  1815. getPresciptionTemplateDetail(params).then(response=>{
  1816. if (response.data.state == 0) {
  1817. this.$message.error(response.data.msg)
  1818. return false
  1819. } else {
  1820. this.prescriptions = []
  1821. // console.log(this.tempForm)
  1822. if (response.data.data.template.id > 0) {
  1823. this.tempForm.name = response.data.data.template.name
  1824. this.tempForm.mode_id = response.data.data.template.mode
  1825. this.id = response.data.data.template.id
  1826. for (let i = 0; i < response.data.data.prescriptions.length; i++) {
  1827. var prescription = response.data.data.prescriptions[i]
  1828. let tempAdvice = []
  1829. let tempProject = []
  1830. let tempAddition = []
  1831. //药品
  1832. for (let b = 0; b < prescription.advices.length; b++) {
  1833. let obj = {
  1834. advice_id: 0,
  1835. drug_name: prescription.advices[b].advice_name,
  1836. single_dose: prescription.advices[b].single_dose,
  1837. delivery_way: prescription.advices[b].delivery_way,
  1838. execution_frequency: prescription.advices[b].execution_frequency,
  1839. retail_price: prescription.advices[b].price.toString(),
  1840. remark: prescription.advices[b].remark,
  1841. day: prescription.advices[b].day,
  1842. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1843. single_dose_unit: prescription.advices[b].single_dose_unit,
  1844. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1845. medical_insurance_number: prescription.advices[b].med_list_codg,
  1846. id: prescription.advices[b].drug_id,
  1847. drug: prescription.advices[b].drug,
  1848. groupno: prescription.advices[b].groupno,
  1849. frequency_type: prescription.advices[b].frequency_type,
  1850. day_count: prescription.advices[b].day_count,
  1851. week_day: prescription.advices[b].week_day,
  1852. }
  1853. tempAdvice.push(obj)
  1854. }
  1855. //项目
  1856. for (let b = 0; b < prescription.project.length; b++) {
  1857. let obj = {
  1858. id: 0,
  1859. project_id: prescription.project[b].project_id,
  1860. project_name: prescription.project[b].project.project_name,
  1861. statistical_classification: prescription.project[b].project.statistical_classification,
  1862. single_dose: prescription.project[b].single_dose,
  1863. delivery_way: prescription.project[b].delivery_way,
  1864. execution_frequency: prescription.project[b].execution_frequency,
  1865. number_days: prescription.project[b].day,
  1866. total: prescription.project[b].count.toString(),
  1867. price: prescription.project[b].price,
  1868. remark: prescription.project[b].remark,
  1869. medical_code: prescription.project[b].project.medical_code,
  1870. unit: prescription.project[b].project.unit,
  1871. type: prescription.project[b].type,
  1872. frequency_type: prescription.project[b].frequency_type,
  1873. day_count: prescription.project[b].day_count,
  1874. week_day: prescription.project[b].week_day
  1875. }
  1876. if (prescription.project[b].type == 2) {
  1877. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  1878. obj['medical_code'] = prescription.project[b].project.medical_code
  1879. obj['project_name'] = prescription.project[b].project.project_name
  1880. obj['project'] = prescription.project[b].project
  1881. } else if (prescription.project[b].type == 3) {
  1882. obj['statistical_classification'] = ''
  1883. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1884. obj['project_name'] = prescription.project[b].good_info.good_name
  1885. obj['good_info'] = prescription.project[b].good_info
  1886. }
  1887. tempProject.push(obj)
  1888. }
  1889. // var preTime = nowTime
  1890. let index = i + 1
  1891. let obj = {
  1892. id: 0,
  1893. name: '处方' + index,
  1894. advices: tempAdvice,
  1895. project: tempProject,
  1896. addition: tempAddition,
  1897. order_status: 1
  1898. // pre_time: preTime
  1899. }
  1900. if (prescription.med_type == '' || prescription.med_type == 0) {
  1901. obj['med_type'] = ''
  1902. } else {
  1903. obj['med_type'] = parseInt(prescription.med_type)
  1904. }
  1905. this.prescriptions.push(obj)
  1906. }
  1907. this.curPrescriptions = this.prescriptions[0]
  1908. } else {
  1909. let obj = {
  1910. id: 0,
  1911. name: '处方1',
  1912. advices: [],
  1913. project: [],
  1914. addition: [],
  1915. order_status: 0,
  1916. med_type: ''
  1917. }
  1918. if(this.org_id == 10206) {
  1919. obj.med_type = 12
  1920. }else{
  1921. obj.med_type = 14
  1922. }
  1923. this.prescriptions.push(obj)
  1924. this.curPrescriptions = this.prescriptions[0]
  1925. }
  1926. }
  1927. })
  1928. }
  1929. }, created() {
  1930. for(let key in this.$store.getters.treatment_mode){
  1931. this.modeOptions[key] = this.$store.getters.treatment_mode[key]
  1932. this.modeOptionsTwo[key]= this.$store.getters.treatment_mode[key]
  1933. }
  1934. var modes = this.$route.query.modes.split(',')
  1935. console.log('~~~~~~~~~~')
  1936. console.log(modes)
  1937. for (const mkey in this.modeOptions) {
  1938. console.log(mkey)
  1939. for (let b = 0; b < modes.length; b++) {
  1940. if (mkey == parseInt(modes[b])) {
  1941. delete this.modeOptions[mkey]
  1942. }
  1943. }
  1944. }
  1945. this.getPrescriptionTemplateInfo()
  1946. this.getInitData()
  1947. //获取所有项目
  1948. this.getlist()
  1949. //获取所以项目组套
  1950. this.getAllProjectTeam()
  1951. this.getAllProjectList()
  1952. this.$nextTick(() => {
  1953. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  1954. })
  1955. }
  1956. }
  1957. </script>
  1958. <style lang="scss" scoped>
  1959. .new-main-contain {
  1960. height: 100%;
  1961. display: flex;
  1962. flex-direction: column;
  1963. }
  1964. .app-container {
  1965. height: 100%;
  1966. }
  1967. .mainCell {
  1968. height: 36px;
  1969. display: flex;
  1970. align-items: center;
  1971. }
  1972. .mainLeft {
  1973. width: 200px;
  1974. height: 100%;
  1975. display: flex;
  1976. flex-direction: column;
  1977. margin-top: 2px;
  1978. .el-radio {
  1979. margin-right: 5px;
  1980. }
  1981. }
  1982. .mainRight {
  1983. margin-left: 20px;
  1984. flex: 1;
  1985. height: 100%;
  1986. display: flex;
  1987. flex-direction: column;
  1988. .cellSpan {
  1989. min-width: 80px;
  1990. display: inline-block;
  1991. margin-right: 10px;
  1992. }
  1993. }
  1994. .mainCenter {
  1995. display: flex;
  1996. flex: 1;
  1997. height: 100%;
  1998. }
  1999. .centerLeft {
  2000. flex: 1;
  2001. display: flex;
  2002. flex-direction: column;
  2003. position: relative;
  2004. overflow-x: auto;
  2005. .el-form-item {
  2006. width: 33%;
  2007. margin-bottom: 14px;
  2008. }
  2009. .el-form-item__label {
  2010. text-align: left;
  2011. }
  2012. }
  2013. .backColor {
  2014. background: #f6f8f9;
  2015. height: 5px;
  2016. margin-bottom: 5px;
  2017. }
  2018. .RP {
  2019. color: #409EFF;
  2020. font-size: 14px;
  2021. margin-bottom: 5px;
  2022. }
  2023. .tabsBox {
  2024. position: relative;
  2025. flex: 1;
  2026. overflow-y: auto;
  2027. margin-bottom: 60px;
  2028. /*/ / margin-top: 4 px;*/
  2029. .el-tabs__item {
  2030. padding: 0 10px;
  2031. }
  2032. }
  2033. .preTabs {
  2034. height: 100%;
  2035. display: flex;
  2036. flex-direction: column;
  2037. .el-tabs__content {
  2038. flex: 1;
  2039. overflow-y: auto;
  2040. }
  2041. }
  2042. .costBox {
  2043. width: 100%;
  2044. height: 60px;
  2045. background: #fff;
  2046. position: absolute;
  2047. bottom: 0;
  2048. display: flex;
  2049. align-items: center;
  2050. justify-content: space-between;
  2051. }
  2052. .statusRed {
  2053. color: red;
  2054. }
  2055. .addTab {
  2056. position: absolute;
  2057. right: 8px;
  2058. top: 3px;
  2059. z-index: 20;
  2060. }
  2061. .centerRight {
  2062. width: 300px;
  2063. margin-left: 10px;
  2064. display: flex;
  2065. flex-direction: column;
  2066. position: relative;
  2067. }
  2068. .rightTab {
  2069. height: 40px;
  2070. width: 100%;
  2071. border: 1px solid #d2d2d2;
  2072. box-sizing: border-box;
  2073. p {
  2074. width: 50%;
  2075. height: 40px;
  2076. line-height: 40px;
  2077. text-align: center;
  2078. background: #eee;
  2079. float: left;
  2080. }
  2081. > p:last-child {
  2082. border-left: 1px solid #d2d2d2;
  2083. float: right;
  2084. }
  2085. .activeP {
  2086. background: #409EFF;
  2087. color: #fff;
  2088. }
  2089. }
  2090. .rightTabs {
  2091. display: flex;
  2092. flex-direction: column;
  2093. }
  2094. .comfirmBox {
  2095. width: 100%;
  2096. height: 60px;
  2097. background: #fff;
  2098. position: absolute;
  2099. bottom: 0;
  2100. display: flex;
  2101. align-items: center;
  2102. justify-content: space-between;
  2103. z-index: 99;
  2104. }
  2105. .borderCard {
  2106. height: 100%;
  2107. display: flex;
  2108. flex-direction: column;
  2109. margin-bottom: 60px;
  2110. .el-tabs--border-card > .el-tabs__content {
  2111. padding: 0;
  2112. }
  2113. }
  2114. </style>
  2115. <style lang="scss">
  2116. .borderCard {
  2117. .el-tabs__nav {
  2118. width: 100%;
  2119. }
  2120. .el-tabs__item {
  2121. width: 50%;
  2122. text-align: center;
  2123. }
  2124. .el-tabs__content {
  2125. padding: 5px;
  2126. flex: 1;
  2127. }
  2128. }
  2129. .centerLeft {
  2130. .el-form-item__label {
  2131. text-align: left;
  2132. }
  2133. }
  2134. .tabsBox {
  2135. .el-tabs__item {
  2136. padding: 0 10px;
  2137. }
  2138. .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) {
  2139. padding: 0 10px;
  2140. }
  2141. .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 {
  2142. padding: 0 10px;
  2143. }
  2144. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  2145. padding: 0 10px;
  2146. }
  2147. }
  2148. .centerRight {
  2149. .el-tabs__nav-scroll {
  2150. display: flex;
  2151. }
  2152. .el-tabs__nav {
  2153. margin: 0 auto;
  2154. }
  2155. .el-table th .cell, .el-table td .cell {
  2156. padding: 0 2px;
  2157. }
  2158. }
  2159. .preTabs {
  2160. .el-tabs__content {
  2161. flex: 1;
  2162. overflow-y: auto;
  2163. padding: 5px 0 5px 5px;
  2164. }
  2165. }
  2166. .rightTabs {
  2167. height: 100%;
  2168. .el-tabs__nav {
  2169. width: auto;
  2170. }
  2171. .el-tabs__header {
  2172. margin-bottom: 5px;
  2173. }
  2174. .el-tabs__item {
  2175. width: auto;
  2176. text-align: inherit;
  2177. }
  2178. .el-tabs__content {
  2179. flex: 1;
  2180. overflow-y: auto;
  2181. }
  2182. .el-tab-pane {
  2183. display: flex;
  2184. flex-direction: column;
  2185. height: 100%;
  2186. }
  2187. }
  2188. #tab-more {
  2189. .el-icon-close {
  2190. display: none;
  2191. }
  2192. }
  2193. ::-webkit-scrollbar {
  2194. height: 15px;
  2195. }
  2196. </style>