doctorDesk.vue 94KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396
  1. <template>
  2. <div class="main-contain new-main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. </div>
  6. <div class="app-container" style="display:flex;flex: 1;padding: 10px 20px 0px 20px;">
  7. <div class="mainLeft">
  8. <div class="mainCell" style="justify-content: space-between;">
  9. <p style="font-size:14px;">未就诊:<span>{{cal_one}}</span>人</p>
  10. <p style="font-size:14px;">已就诊:<span>{{cal_two}}</span>人</p>
  11. </div>
  12. <div class="mainCell">
  13. <el-radio-group v-model="radio" @change="change">
  14. <el-radio :label="1">未就诊</el-radio>
  15. <el-radio :label="2">已就诊</el-radio>
  16. <el-radio :label="0">全部</el-radio>
  17. </el-radio-group>
  18. </div>
  19. <div class="mainCell" style="margin-bottom:10px;">
  20. <el-input size="small" placeholder="请输入姓名或就诊号" @input="searchAction" @keyup.enter.native='searchAction'
  21. v-model="search_input" class="filter-item"/>
  22. <el-button size="small" style="margin-left:10px;" class="filter-item" type="primary" @click="searchAction">
  23. 搜索
  24. </el-button>
  25. </div>
  26. <div>
  27. <el-table :data="patientTableData" :height="tableHeight" @row-click='choosePatient'
  28. @current-change='currentChange' border style="width: 100%;"
  29. :row-style="{ color: '#303133' }"
  30. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  31. highlight-current-row
  32. ref="tab"
  33. >
  34. <el-table-column prop="name" label="姓名" width='89'>
  35. <template slot-scope="scope">{{scope.row.name}}</template>
  36. </el-table-column>
  37. <el-table-column prop="name" label="就诊号" width="110">
  38. <template slot-scope="scope">{{ scope.row.his_patient ?scope.row.his_patient.number:''}}</template>
  39. </el-table-column>
  40. </el-table>
  41. </div>
  42. </div>
  43. <div class="mainRight">
  44. <div class="mainHeader">
  45. <el-tabs v-model="titleType" @tab-click="handleClick"
  46. style="position: fixed;width: calc(100% - 490px);background:#fff;">
  47. <el-tab-pane label="电子处方" name="电子处方"></el-tab-pane>
  48. <el-tab-pane label="电子病历" name="电子病历"></el-tab-pane>
  49. </el-tabs>
  50. <div class="mainCell fixedCell" style="float:right" v-if="titleType == '电子处方'">
  51. <el-button size="small" ref="button_one" @click="open(1)" type="primary" v-loading="saveLoading">保存
  52. </el-button>
  53. <el-button size="small" ref="button_three" @click="open_two()" type="primary">处方调用</el-button>
  54. <el-popover
  55. placement="bottom"
  56. width="200"
  57. trigger="click">
  58. <el-button size="small" ref="button_two" @click="open(2)">处方单</el-button>
  59. <el-button size="small" ref="button_six" @click="open(6)">治疗单</el-button>
  60. <el-button slot="reference" style="margin:0 10px;" type="primary" size="small">打印</el-button>
  61. </el-popover>
  62. <!--<el-button size="small" ref="button_four" @click="open(5)" type="primary" :disabled='prescriptions && prescriptions[0].advices && prescriptions[0].project ? prescriptions[0].advices.length == 0 && prescriptions[0].project.length == 0 : false'>存模板</el-button> -->
  63. </div>
  64. <div class="mainCell fixedCell" style="float:right" v-if="titleType == '电子病历'">
  65. <el-button size="small" @click="opentwo(1)" type="primary">保存</el-button>
  66. <el-button size="small" @click="opentwo(2)" type="primary">打印</el-button>
  67. <el-button size="small" @click="opentwo(3)" type="primary">病历调用</el-button>
  68. <el-button size="small" @click="opentwo(4)" type="primary">存模板</el-button>
  69. </div>
  70. </div>
  71. <!--<desk-prescription ref="prescriptions" :prescriptions="prescriptions" :patientInfo="patientInfo" :hisPatientInfo="hisPatientInfo"-->
  72. <!--v-if="titleType == '处方'" style="flex:1;"></desk-prescription>-->
  73. <desk-prescription v-on:setData="setData" :diagnoses="diagnoses" :loading="isloading"
  74. :other_sick="other_sick" :record_date="record_date"
  75. v-on:change="changeOther"
  76. :month_prescriptions="month_prescriptions"
  77. ref="prescriptions" :prescriptions="prescriptions" :patientInfo="patientInfo"
  78. :hisPatientInfo="hisPatientInfo" @event1="changetwo($event)"
  79. v-if="titleType == '电子处方'" style="flex:1;" ></desk-prescription>
  80. <desk-record :record_date="record_date" :case_history="case_history" :patientInfo="patientInfo"
  81. :hisPatientInfo="hisPatientInfo" v-if="titleType == '电子病历'" :detalid="detalid"
  82. ref="child"></desk-record>
  83. <medicalRecord ref='medicalRecord' @func="getMsgFormSon"></medicalRecord>
  84. <saveRecordTemplate ref='saveRecordTemplate'></saveRecordTemplate>
  85. </div>
  86. </div>
  87. <el-dialog
  88. title="处方打印"
  89. :visible.sync="centerDialogVisible"
  90. width="600px"
  91. center>
  92. <el-table
  93. ref="multipleTable"
  94. :data="tableData"
  95. tooltip-effect="dark"
  96. style="width: 600px"
  97. @selection-change="handleSelectionChange">
  98. <el-table-column
  99. align='center'
  100. type="selection"
  101. width="50">
  102. </el-table-column>
  103. <el-table-column
  104. align='center'
  105. label="处方编号"
  106. width="120">
  107. <template slot-scope="scope">
  108. <span>处方 {{scope.$index + 1}}</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="处方号">
  112. <template slot-scope="scope">
  113. <span>
  114. <el-input v-model="scope.row.prescription_number" :disabled="true"></el-input>
  115. </span>
  116. </template>
  117. </el-table-column>
  118. </el-table>
  119. <el-dialog
  120. class="centerDialog"
  121. width="600px"
  122. title="打印"
  123. :visible.sync="innerVisible"
  124. append-to-body>
  125. <print v-if="index == 2" :paramsObj='paramsObj'></print>
  126. <treatPrint v-if="index == 6" :paramsObj='paramsObj'></treatPrint>
  127. </el-dialog>
  128. <span slot="footer" class="dialog-footer">
  129. <el-button @click="centerDialogVisible = false">取 消</el-button>
  130. <el-button type="primary" @click="savePrint">确 定</el-button>
  131. </span>
  132. </el-dialog>
  133. <el-dialog
  134. class="centerDialog"
  135. width="600px"
  136. title="打印"
  137. :visible.sync="recordVisible">
  138. <recordPrint :patientid="patientid"></recordPrint>
  139. </el-dialog>
  140. </div>
  141. </template>
  142. <script>
  143. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  144. import deskPrescription from './components/deskPrescription'
  145. import deskRecord from './components/deskRecord'
  146. import {createCaseHistory, getPatientInfo, getHospitalPatientList} from '@/api/his/his'
  147. import {getDictionaryDataConfig} from '@/utils/data'
  148. import medicalRecord from './components/medicalRecord'
  149. import saveRecordTemplate from './components/saveRecordTemplate'
  150. import {uParseTime} from '@/utils/tools'
  151. import {getPrescriptionList} from "@/api/project/project"
  152. import print from './print'
  153. import treatPrint from './treatPrint'
  154. import recordPrint from './recordPrint'
  155. const moment = require('moment');
  156. export default {
  157. components: {
  158. BreadCrumb,
  159. deskPrescription,
  160. deskRecord,
  161. medicalRecord,
  162. saveRecordTemplate,
  163. print,
  164. treatPrint,
  165. recordPrint
  166. },
  167. data() {
  168. return {
  169. tableHeight: '',
  170. saveloading: false,
  171. fullHeight: document.documentElement.clientHeight,
  172. month_prescriptions: [],
  173. isloading:false,
  174. prescriptions: [
  175. {
  176. name: '处方1',
  177. advices: [],
  178. project: [],
  179. addition: [],
  180. }
  181. ],
  182. search_input: '',
  183. cal_one: 0,
  184. cal_two: 0,
  185. radio: 1,
  186. record_date: '',
  187. crumbs: [
  188. {path: false, name: '住院工作站'},
  189. {path: false, name: '医生工作台'}
  190. ],
  191. titleType: '电子处方',
  192. patientTableData: [{}],
  193. patientTableDataTwo: [{}],
  194. patientInfo: {},
  195. hisPatientInfo: {},
  196. case_history: {},
  197. patient_id: 0,
  198. diagnoses: [],
  199. other_sick: [],
  200. info: {},
  201. templatedetail: {},
  202. detalid: 0,
  203. prescription_id: 0,
  204. doctors: [],
  205. department: [],
  206. patientid: 0,
  207. prescriptionList: [],
  208. centerDialogVisible: false,
  209. tableData: [],
  210. selecting_schs: [],
  211. index: 0,
  212. admin_info: {},
  213. saveLoading: false,
  214. innerVisible: false,
  215. paramsObj: {},
  216. recordVisible: false,
  217. recordObj: {},
  218. additions: [],
  219. }
  220. },
  221. methods: {
  222. changeOther(patient_id){
  223. this.radio = 2;
  224. let params = {
  225. 'record_date': this.record_date,
  226. 'type': this.radio
  227. };
  228. this.patientTableData = [];
  229. getHospitalPatientList(params).then(response => {
  230. if (response.data.state == 0) {
  231. this.$message.error(response.data.msg);
  232. return false
  233. } else {
  234. this.patientTableData = response.data.data.list;
  235. this.patientTableDataTwo = response.data.data.list;
  236. this.cal_one = response.data.data.total_one;
  237. this.cal_two = response.data.data.total_two;
  238. this.admin_info = response.data.data.info;
  239. if (this.patientTableData.length > 0) {
  240. for(let i = 0; i < this.patientTableData.length; i++){
  241. if (this.patientTableData[i].id == patient_id){
  242. this.$refs.tab.setCurrentRow(this.patientTableData[i]);
  243. this.oldCurrentRow = this.patientTableData[i];
  244. this.getPatientInfo(this.patientTableData[i])
  245. }
  246. }
  247. }
  248. this.prescriptionList = response.data.data.list.prescription
  249. // this.patientid = this.patientTableData[0].patient_id
  250. }
  251. })
  252. },
  253. setData(val) {
  254. this.prescriptions = val
  255. },
  256. getDictionaryDataConfig(module, filed_name) {
  257. return getDictionaryDataConfig(module, filed_name)
  258. },
  259. searchAction() {
  260. if (this.search_input.length == 0) {
  261. this.patientTableData = this.patientTableDataTwo
  262. } else {
  263. let arr = [];
  264. for (let i = 0; i < this.patientTableData.length; i++) {
  265. if (this.patientTableData[i].name.indexOf(this.search_input) != -1 || this.patientTableData[i].his_patient.number.indexOf(this.search_input) != -1) {
  266. arr = arr.concat(this.patientTableData[i])
  267. }
  268. }
  269. this.patientTableData = arr
  270. }
  271. },
  272. // changeTab() {
  273. // this.saveLoading = false
  274. //
  275. // this.radio = 2
  276. // let params = {
  277. // 'record_date': this.record_date,
  278. // 'type': this.radio
  279. // }
  280. // this.patientTableData = []
  281. // getSchedulePatientList(params).then(response => {
  282. // if (response.data.state == 0) {
  283. // this.$message.error(response.data.msg)
  284. // return false
  285. // } else {
  286. // this.patientTableData = response.data.data.list
  287. // this.patientTableDataTwo = response.data.data.list
  288. // this.cal_one = response.data.data.total_one
  289. // this.cal_two = response.data.data.total_two
  290. // this.admin_info = response.data.data.info
  291. // for (let i = 0; i < this.patientTableData.length; i++) {
  292. // if (this.patientTableData[i].id == this.patientid) {
  293. // this.$refs.tab.setCurrentRow(this.patientTableData[i])
  294. // this.getPatientInfo(this.patientTableData[i])
  295. //
  296. // }
  297. // }
  298. //
  299. //
  300. // }
  301. // })
  302. //
  303. // },
  304. change() {
  305. let params = {
  306. 'record_date': this.record_date,
  307. 'type': this.radio
  308. };
  309. this.patientTableData = [];
  310. getHospitalPatientList(params).then(response => {
  311. if (response.data.state == 0) {
  312. this.$message.error(response.data.msg);
  313. return false
  314. } else {
  315. this.patientTableData = response.data.data.list;
  316. this.patientTableDataTwo = response.data.data.list;
  317. this.cal_one = response.data.data.total_one;
  318. this.cal_two = response.data.data.total_two;
  319. this.admin_info = response.data.data.info;
  320. if (this.patientTableData.length > 0) {
  321. this.$refs.tab.setCurrentRow(this.patientTableData[0]);
  322. this.oldCurrentRow = this.patientTableData[0];
  323. this.getPatientInfo(this.patientTableData[0])
  324. }
  325. this.prescriptionList = response.data.data.list.prescription
  326. // this.patientid = this.patientTableData[0].patient_id
  327. }
  328. })
  329. },
  330. setMonthPrescription(month_prescriptions) {
  331. console.log("11111111");
  332. console.log(month_prescriptions);
  333. this.month_prescriptions = [];
  334. let drug_month_prescriptions = {
  335. advices: []
  336. };
  337. let drug_ids = [];
  338. let project_month_prescriptions = {
  339. project: []
  340. };
  341. let project_ids = [];
  342. let addition_month_prescriptions = {
  343. addition: []
  344. };
  345. let additions_ids = [];
  346. for (let i = 0; i < month_prescriptions.length; i++) {
  347. if (month_prescriptions[i].type == 1) { //药品
  348. for (let a = 0; a < month_prescriptions[i].advices.length; a++) {
  349. let obj = {
  350. id: month_prescriptions[i].advices[a].drug_id,
  351. price:month_prescriptions[i].advices[a].price,
  352. };
  353. drug_ids.push(obj);
  354. drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
  355. }
  356. } else if (month_prescriptions[i].type == 2) { //项目
  357. for (let a = 0; a < month_prescriptions[i].project.length; a++) {
  358. let obj = {
  359. id: month_prescriptions[i].project[a].project_id,
  360. price:month_prescriptions[i].project[a].price,
  361. };
  362. project_ids.push(obj);
  363. project_month_prescriptions.project.push(month_prescriptions[i].project[a])
  364. }
  365. }
  366. //附加收费
  367. for (let a = 0; a < month_prescriptions[i].addition.length; a++) {
  368. let obj = {
  369. id: month_prescriptions[i].addition[a].item_id,
  370. price:month_prescriptions[i].addition[a].price,
  371. };
  372. additions_ids.push(obj);
  373. addition_month_prescriptions.addition.push(month_prescriptions[i].addition[a])
  374. }
  375. }
  376. console.log("00000000000000");
  377. console.log(drug_ids);
  378. console.log(project_ids);
  379. console.log(additions_ids);
  380. console.log("00000000000000");
  381. const obj = {};
  382. const obj1 = {};
  383. const obj2 = {};
  384. drug_ids = drug_ids.reduce((cur, next) => {
  385. obj[next.price] ? '' : obj[next.price] = true && cur.push(next);
  386. return cur
  387. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  388. project_ids = project_ids.reduce((cur, next) => {
  389. obj[next.price] ? '' : obj[next.price] = true && cur.push(next);
  390. return cur
  391. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  392. additions_ids = additions_ids.reduce((cur, next) => {
  393. obj[next.price] ? '' : obj[next.price] = true && cur.push(next);
  394. return cur
  395. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  396. let drugs = [];
  397. let projects = [];
  398. let additions = [];
  399. for (let i = 0; i < drug_ids.length; i++) {
  400. let obj = {};
  401. let count = 0;
  402. for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
  403. if (drug_ids[i].price == drug_month_prescriptions.advices[a].price) {
  404. obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name;
  405. obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose;
  406. obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way;
  407. obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency;
  408. obj['day'] = drug_month_prescriptions.advices[a].day;
  409. // obj['prescribing_number'] = obj['prescribing_number'] + drug_month_prescriptions.advices[a].prescribing_number
  410. obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit;
  411. obj['medical_insurance_number'] = drug_month_prescriptions.advices[a].drug.medical_insurance_number;
  412. obj['id'] = drug_month_prescriptions.advices[a].drug_id;
  413. // obj['retail_price'] = obj['retail_price'] + drug_month_prescriptions.advices[a].drug.retail_price
  414. obj['retail_price'] = parseFloat(drug_month_prescriptions.advices[a].price);
  415. obj['drug'] = drug_month_prescriptions.advices[a].drug
  416. count = count + drug_month_prescriptions.advices[a].prescribing_number
  417. }
  418. }
  419. obj['prescribing_number'] = count;
  420. drugs.push(obj)
  421. }
  422. for (let i = 0; i < project_ids.length; i++) {
  423. let obj = {};
  424. let count = 0;
  425. for (let a = 0; a < project_month_prescriptions.project.length; a++) {
  426. if (project_ids[i].price == project_month_prescriptions.project[a].price) {
  427. if(project_month_prescriptions.project[a].type == 2){
  428. obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification
  429. obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code
  430. obj['project_name'] = project_month_prescriptions.project[a].project.project_name
  431. }else if(project_month_prescriptions.project[a].type == 3){
  432. obj['statistical_classification'] = ""
  433. obj['medical_code'] = project_month_prescriptions.project[a].good_info.medical_insurance_number
  434. obj['project_name'] = project_month_prescriptions.project[a].good_info.good_name
  435. }
  436. obj['type'] = project_month_prescriptions.project[a].type
  437. obj['project_name'] = project_month_prescriptions.project[a].project.project_name;
  438. obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification;
  439. obj['single_dose'] = project_month_prescriptions.project[a].single_dose;
  440. obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way;
  441. obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency;
  442. obj['number_days'] = project_month_prescriptions.project[a].day;
  443. obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code;
  444. obj['unit'] = project_month_prescriptions.project[a].unit;
  445. obj['project_id'] = project_month_prescriptions.project[a].project_id;
  446. count = count + project_month_prescriptions.project[a].count;
  447. // price = price + project_month_prescriptions.project[a].price
  448. obj['price'] = parseFloat(project_month_prescriptions.project[a].price)
  449. }
  450. }
  451. obj['total'] = count;
  452. projects.push(obj)
  453. }
  454. for (let i = 0; i < additions_ids.length; i++) {
  455. let obj = {};
  456. let count = 0;
  457. console.log(addition_month_prescriptions.addition);
  458. if (addition_month_prescriptions.addition) {
  459. for (let a = 0; a < addition_month_prescriptions.addition.length; a++) {
  460. if (project_ids[i].price == addition_month_prescriptions.addition[a].price) {
  461. obj['item_name'] = addition_month_prescriptions.addition[a].item_name;
  462. obj['id'] = addition_month_prescriptions.addition[a].id;
  463. obj['item_id'] = addition_month_prescriptions.addition[a].item_id;
  464. count = count + addition_month_prescriptions.addition[a].count;
  465. obj['price'] = parseFloat(addition_month_prescriptions.addition[a].price)
  466. }
  467. }
  468. obj['count'] = count;
  469. additions.push(obj)
  470. }
  471. }
  472. console.log(drugs);
  473. console.log(projects);
  474. console.log(additions);
  475. let p1 = {
  476. name: '处方' + 1,
  477. advices: drugs,
  478. project: [],
  479. type: 1,
  480. addition: additions
  481. };
  482. let p2 = {
  483. name: '处方' + 2,
  484. type: 2,
  485. project: projects,
  486. advices: [],
  487. addition: []
  488. };
  489. this.month_prescriptions.push(p1);
  490. this.month_prescriptions.push(p2);
  491. this.curMonthPrescriptions = this.month_prescriptions[0]
  492. },
  493. // setMonthPrescription(month_prescriptions){
  494. // let drug_month_prescriptions = {
  495. // advices:[],
  496. // }
  497. // let drug_ids=[]
  498. // let project_month_prescriptions ={
  499. // project:[],
  500. //
  501. // }
  502. // let project_ids=[]
  503. //
  504. // let addition_month_prescriptions ={
  505. // addtions:[],
  506. //
  507. // }
  508. // let additions_ids=[]
  509. //
  510. //
  511. // for (let i = 0; i < month_prescriptions.length; i++){
  512. // if(month_prescriptions[i].type == 1){ //药品
  513. // for (let a = 0; a < month_prescriptions[i].advices.length; a++){
  514. // drug_ids.push(month_prescriptions[i].advices[a].drug_id)
  515. // drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
  516. // }
  517. //
  518. // }else if(month_prescriptions[i].type == 2){ //项目
  519. // for (let a = 0; a < month_prescriptions[i].project.length; a++){
  520. // project_ids.push(month_prescriptions[i].project[a].project_id)
  521. // project_month_prescriptions.project.push(month_prescriptions[i].project[a])
  522. // }
  523. // }
  524. // //附加收费
  525. // for (let a = 0; a < month_prescriptions[i].addition.length; a++) {
  526. // additions_ids.push(month_prescriptions[i].addition[a].item_id)
  527. // addition_month_prescriptions.addtions.push(month_prescriptions[i].addition[a])
  528. // }
  529. //
  530. // }
  531. //
  532. //
  533. //
  534. //
  535. // const obj = {}
  536. // const obj1 = {}
  537. // const obj2 = {}
  538. //
  539. // drug_ids = drug_ids.reduce((cur, next) => {
  540. // obj[next] ? '' : obj[next] = true && cur.push(next)
  541. // return cur
  542. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  543. // project_ids = project_ids.reduce((cur, next) => {
  544. // obj1[next] ? '' : obj1[next] = true && cur.push(next)
  545. // return cur
  546. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  547. // additions_ids = additions_ids.reduce((cur, next) => {
  548. // obj2[next] ? '' : obj2[next] = true && cur.push(next)
  549. // return cur
  550. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  551. //
  552. //
  553. //
  554. //
  555. //
  556. // let drugs =[]
  557. // let projects =[]
  558. // let additions =[]
  559. //
  560. //
  561. // for (let i = 0; i < drug_ids.length; i++){
  562. // let obj = {}
  563. // let price = 0
  564. // let count = 0
  565. // for (let a = 0; a < drug_month_prescriptions.advices.length; a++){
  566. // if(drug_ids[i] == drug_month_prescriptions.advices[a].drug_id){
  567. // obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name
  568. // obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
  569. // obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
  570. // obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency
  571. // obj['day'] = drug_month_prescriptions.advices[a].day
  572. // // obj['prescribing_number'] = obj['prescribing_number'] + drug_month_prescriptions.advices[a].prescribing_number
  573. // obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
  574. // obj['medical_insurance_number'] = drug_month_prescriptions.advices[a].drug.medical_insurance_number
  575. // obj['id'] = drug_month_prescriptions.advices[a].drug_id
  576. // // obj['retail_price'] = obj['retail_price'] + drug_month_prescriptions.advices[a].drug.retail_price
  577. //
  578. //
  579. // count = count + drug_month_prescriptions.advices[a].prescribing_number
  580. // price = price + drug_month_prescriptions.advices[a].price
  581. //
  582. // }
  583. // }
  584. // obj['retail_price'] = price
  585. // obj['prescribing_number'] = count
  586. // drugs.push(obj)
  587. // }
  588. //
  589. //
  590. //
  591. //
  592. // for (let i = 0; i < project_ids.length; i++){
  593. // let obj = {}
  594. // let price = 0
  595. // let count = 0
  596. // for (let a = 0; a < project_month_prescriptions.project.length; a++){
  597. // if(project_ids[i] == project_month_prescriptions.project[a].project_id){
  598. // obj['project_name'] = project_month_prescriptions.project[a].project.project_name
  599. // obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification
  600. // obj['single_dose'] = project_month_prescriptions.project[a].single_dose
  601. // obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way
  602. // obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency
  603. // obj['number_days'] = project_month_prescriptions.project[a].day
  604. // obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code
  605. // obj['unit'] = project_month_prescriptions.project[a].unit
  606. // obj['project_id'] = project_month_prescriptions.project[a].project_id
  607. // count = count + project_month_prescriptions.project[a].count
  608. // price = price + project_month_prescriptions.project[a].price
  609. // }
  610. // }
  611. // obj['price'] = price
  612. // obj['total'] = count
  613. // projects.push(obj)
  614. // }
  615. //
  616. //
  617. // for (let i = 0; i < additions_ids.length; i++){
  618. // let obj = {}
  619. // let price = 0
  620. // let count = 0
  621. // for (let a = 0; a < addition_month_prescriptions.addition.length; a++){
  622. // if(project_ids[i] == addition_month_prescriptions.addition[a].item_id){
  623. // obj['item_name'] = addition_month_prescriptions.addition[a].item_name
  624. // obj['id'] = addition_month_prescriptions.addition[a].id
  625. // obj['item_id'] = addition_month_prescriptions.addition[a].item_id
  626. // count = count + addition_month_prescriptions.addition[a].count
  627. // price = price + addition_month_prescriptions.addition[a].price
  628. // }
  629. // }
  630. // obj['price'] = price
  631. // obj['count'] = count
  632. // additions.push(obj)
  633. // }
  634. //
  635. //
  636. // let p1 = {
  637. // name: '处方' + 1,
  638. // advices: drugs,
  639. // project: [],
  640. // type:1,
  641. // addition: additions,
  642. // }
  643. // let p2 = {
  644. // name: '处方' + 2,
  645. // type:2,
  646. // project: projects,
  647. // advices: [],
  648. // }
  649. // this.month_prescriptions.push(p1)
  650. // this.month_prescriptions.push(p2)
  651. //
  652. // },
  653. getList() {
  654. let params = {
  655. 'record_date': this.record_date,
  656. 'type': this.radio
  657. };
  658. this.patientTableData = [];
  659. getHospitalPatientList(params).then(response => {
  660. if (response.data.state == 0) {
  661. this.$message.error(response.data.msg);
  662. return false
  663. } else {
  664. this.patientTableData = response.data.data.list;
  665. this.patientTableDataTwo = response.data.data.list;
  666. this.cal_one = response.data.data.total_one;
  667. this.cal_two = response.data.data.total_two;
  668. this.admin_info = response.data.data.info;
  669. if (this.patientTableData.length > 0) {
  670. this.$refs.tab.setCurrentRow(this.patientTableData[0]);
  671. this.oldCurrentRow = this.patientTableData[0];
  672. this.getPatientInfo(this.patientTableData[0])
  673. }
  674. // this.patientid = this.patientTableData[0].patient_id
  675. }
  676. })
  677. },
  678. getPatientInfo(val) {
  679. var nowDate = new Date();
  680. var nowYear = nowDate.getFullYear();
  681. var nowMonth = nowDate.getMonth() + 1;
  682. var nowDay = nowDate.getDate();
  683. var hours = nowDate.getHours();
  684. var min = nowDate.getMinutes();
  685. var nowTime =
  686. nowYear +
  687. '-' +
  688. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  689. '-' +
  690. (nowDay < 10 ? '0' + nowDay : nowDay) + " " + (hours < 10 ? '0' + hours : hours) +
  691. ':' + (min < 10 ? '0' + min : min);
  692. this.patientid = val.id;
  693. let params = {
  694. 'record_date': this.record_date,
  695. 'patient_id': val.id,
  696. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  697. 'end_time': moment(new Date()).add('year', 0).format("YYYY-MM-DD"),
  698. 'p_type':1,
  699. };
  700. this.isloading = true;
  701. getPatientInfo(params).then(response => {
  702. if (response.data.state == 0) {
  703. this.$message.error(response.data.msg);
  704. this.isloading = false;
  705. return false
  706. } else {
  707. this.isloading = false;
  708. this.prescriptions = [];
  709. this.month_prescriptions = [];
  710. this.patientInfo = response.data.data.xt_info;
  711. this.hisPatientInfo = response.data.data.his_info;
  712. this.case_history = response.data.data.case_history;
  713. this.info = response.data.data.info;
  714. this.doctors = response.data.data.doctors;
  715. this.department = response.data.data.department;
  716. for (let i = 0; i < this.doctors.length; i++){
  717. if(this.doctors[i].user_type == 1){
  718. this.doctors.splice(i,1)
  719. }
  720. }
  721. var month_prescriptions = response.data.data.month_prescriptions;
  722. this.setMonthPrescription(month_prescriptions);
  723. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}');
  724. if (this.case_history.temperature <= 0) {
  725. this.case_history.temperature = ''
  726. }
  727. if (this.case_history.blood_sugar <= 0) {
  728. this.case_history.blood_sugar = ''
  729. }
  730. if (this.case_history.pulse <= 0) {
  731. this.case_history.pulse = ''
  732. }
  733. if (this.case_history.sbp <= 0) {
  734. this.case_history.sbp = ''
  735. }
  736. if (this.case_history.dbp <= 0) {
  737. this.case_history.dbp = ''
  738. }
  739. if (this.case_history.height <= 0) {
  740. this.case_history.height = ''
  741. }
  742. if (this.case_history.blood_fat <= 0) {
  743. this.case_history.blood_fat = ''
  744. }
  745. if (this.case_history.sick_type <= 0) {
  746. this.case_history.sick_type = ''
  747. }
  748. if (this.case_history.sick <= 0) {
  749. this.case_history.sick = ''
  750. }
  751. if (this.case_history.diagnose <= 0) {
  752. this.case_history.diagnose = ''
  753. }
  754. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}');
  755. if (this.case_history.is_infect == 1) {
  756. this.case_history.is_infect = true
  757. } else {
  758. this.case_history.is_infect = false
  759. }
  760. //处方相关
  761. this.prescriptionList = response.data.data.prescription;
  762. if (response.data.data.prescription.length > 0) {
  763. for (let i = 0; i < response.data.data.prescription.length; i++) {
  764. var prescription = response.data.data.prescription[i];
  765. let tempAdvice = [];
  766. let tempProject = [];
  767. let tempAddition = [];
  768. //药品
  769. for (let b = 0; b < prescription.advices.length; b++) {
  770. let obj = {
  771. advice_id: prescription.advices[b].id,
  772. drug_name: prescription.advices[b].advice_name,
  773. single_dose: prescription.advices[b].single_dose,
  774. delivery_way: prescription.advices[b].delivery_way,
  775. execution_frequency: prescription.advices[b].execution_frequency,
  776. retail_price: prescription.advices[b].price.toString(),
  777. remark: prescription.advices[b].remark,
  778. day: prescription.advices[b].day,
  779. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  780. single_dose_unit: prescription.advices[b].single_dose_unit,
  781. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  782. medical_insurance_number: prescription.advices[b].med_list_codg,
  783. id: prescription.advices[b].drug_id,
  784. drug:prescription.advices[b].drug,
  785. };
  786. tempAdvice.push(obj)
  787. }
  788. //项目
  789. for (let b = 0; b < prescription.project.length; b++) {
  790. let obj = {
  791. id: prescription.project[b].id,
  792. project_id: prescription.project[b].project_id,
  793. project_name: prescription.project[b].project.project_name,
  794. statistical_classification: prescription.project[b].project.statistical_classification,
  795. single_dose: prescription.project[b].single_dose,
  796. delivery_way: prescription.project[b].delivery_way,
  797. execution_frequency: prescription.project[b].execution_frequency,
  798. number_days: prescription.project[b].day,
  799. total: prescription.project[b].count.toString(),
  800. price: prescription.project[b].price,
  801. remark: prescription.project[b].remark,
  802. medical_code: prescription.project[b].project.medical_code,
  803. unit: prescription.project[b].project.unit,
  804. type: prescription.project[b].type
  805. };
  806. if(prescription.project[b].type == 2){
  807. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  808. obj['medical_code'] = prescription.project[b].project.medical_code
  809. obj['project_name'] = prescription.project[b].project.project_name
  810. }else if(prescription.project[b].type == 3){
  811. obj['statistical_classification'] = ""
  812. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  813. obj['project_name'] = prescription.project[b].good_info.good_name
  814. }
  815. tempProject.push(obj)
  816. }
  817. //附加收费
  818. for (let b = 0; b < prescription.addition.length; b++) {
  819. let obj = {
  820. id: prescription.addition[b].id,
  821. item_name: prescription.addition[b].item_name,
  822. price: prescription.addition[b].price,
  823. count: prescription.addition[b].count,
  824. item_id: prescription.addition[b].item_id,
  825. };
  826. tempAddition.push(obj)
  827. }
  828. var preTime = "";
  829. if (prescription.pre_time == 0) {
  830. preTime = nowTime
  831. } else {
  832. preTime = this.getTime(prescription.pre_time, "{y}-{m}-{d} {h}:{i}")
  833. }
  834. let index = i + 1;
  835. let obj = {
  836. id: prescription.id,
  837. name: '处方' + index,
  838. advices: tempAdvice,
  839. project: tempProject,
  840. addition: tempAddition,
  841. order_status: prescription.order_status,
  842. pre_time: preTime
  843. };
  844. this.prescriptions.push(obj)
  845. }
  846. } else {
  847. let obj = {
  848. id: 0,
  849. name: '处方' + 1,
  850. advices: [],
  851. project: [],
  852. addition: [],
  853. order_status: 0,
  854. pre_time: nowTime,
  855. };
  856. this.prescriptions.push(obj)
  857. }
  858. this.$refs.prescriptions.setData(this.prescriptions, this.info, this.admin_info, this.doctors, this.department, this.hisPatientInfo, this.month_prescriptions)
  859. }
  860. })
  861. },
  862. choosePatient(val) {
  863. console.log(val);
  864. if(this.titleType == '电子病历'){
  865. console.log('this.$refs.child.watchSign',this.$refs.child.watchSign);
  866. if(this.$refs.child.watchSign > 2){
  867. this.$confirm('是否保存当前病例', '保存', {
  868. confirmButtonText: '确 定',
  869. cancelButtonText: '取 消',
  870. type: 'warning'
  871. }).then(() => {
  872. this.$refs.child.createCaseHistory(this.newPatientId);
  873. this.patientid = val.id;
  874. let params = {
  875. 'record_date': this.record_date,
  876. 'patient_id': val.id,
  877. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  878. 'end_time': moment(new Date()).add('year', 0).format("YYYY-MM-DD"),
  879. 'p_type':1,
  880. };
  881. getPatientInfo(params).then(response => {
  882. if (response.data.state == 0) {
  883. this.$message.error(response.data.msg);
  884. return false
  885. } else {
  886. this.prescriptions = [];
  887. this.month_prescriptions = [];
  888. var month_prescriptions = response.data.data.month_prescriptions;
  889. this.setMonthPrescription(month_prescriptions);
  890. this.patientInfo = response.data.data.xt_info;
  891. this.hisPatientInfo = response.data.data.his_info;
  892. this.case_history = response.data.data.case_history;
  893. console.log("数据是22222多少",this.case_history);
  894. this.info = response.data.data.info;
  895. this.doctors = response.data.data.doctors;
  896. this.department = response.data.data.department;
  897. for (let i = 0; i < this.doctors.length; i++){
  898. if(this.doctors[i].user_type == 1){
  899. this.doctors.splice(i,1)
  900. }
  901. }
  902. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}');
  903. if (this.case_history.breathing <= 0) {
  904. this.case_history.breathing = ""
  905. }
  906. if (this.case_history.sick <= 0) {
  907. this.case_history.sick = ""
  908. }
  909. if (this.case_history.diagnose <= 0) {
  910. this.case_history.diagnose = ""
  911. }
  912. if (this.case_history.temperature <= 0) {
  913. this.case_history.temperature = ''
  914. }
  915. if (this.case_history.blood_sugar <= 0) {
  916. this.case_history.blood_sugar = ''
  917. }
  918. if (this.case_history.pulse <= 0) {
  919. this.case_history.pulse = ''
  920. }
  921. if (this.case_history.sbp <= 0) {
  922. this.case_history.sbp = ''
  923. }
  924. if (this.case_history.dbp <= 0) {
  925. this.case_history.dbp = ''
  926. }
  927. if (this.case_history.height <= 0) {
  928. this.case_history.height = ''
  929. }
  930. if (this.case_history.blood_fat <= 0) {
  931. this.case_history.blood_fat = ''
  932. }
  933. if (this.case_history.sick_type <= 0) {
  934. this.case_history.sick_type = ''
  935. }
  936. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}');
  937. if (this.case_history.is_infect == 1) {
  938. this.case_history.is_infect = true
  939. } else {
  940. this.case_history.is_infect = false
  941. }
  942. this.prescriptionList = response.data.data.prescription;
  943. if (response.data.data.prescription.length > 0) {
  944. for (let i = 0; i < response.data.data.prescription.length; i++) {
  945. var prescription = response.data.data.prescription[i];
  946. let tempAdvice = [];
  947. let tempProject = [];
  948. let tempAddition = [];
  949. for (let b = 0; b < prescription.advices.length; b++) {
  950. let obj = {
  951. advice_id: prescription.advices[b].id,
  952. drug_name: prescription.advices[b].advice_name,
  953. single_dose: prescription.advices[b].single_dose,
  954. delivery_way: prescription.advices[b].delivery_way,
  955. execution_frequency: prescription.advices[b].execution_frequency,
  956. retail_price: prescription.advices[b].price.toString(),
  957. remark: prescription.advices[b].remark,
  958. day: prescription.advices[b].day,
  959. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  960. single_dose_unit: prescription.advices[b].single_dose_unit,
  961. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  962. medical_insurance_number: prescription.advices[b].med_list_codg,
  963. id: prescription.advices[b].drug_id,
  964. drug:prescription.advices[b].drug,
  965. };
  966. tempAdvice.push(obj)
  967. }
  968. for (let b = 0; b < prescription.project.length; b++) {
  969. let obj = {
  970. id: prescription.project[b].id,
  971. project_id: prescription.project[b].project_id,
  972. project_name: prescription.project[b].project.project_name,
  973. statistical_classification: prescription.project[b].project.statistical_classification,
  974. single_dose: prescription.project[b].single_dose,
  975. delivery_way: prescription.project[b].delivery_way,
  976. execution_frequency: prescription.project[b].execution_frequency,
  977. number_days: prescription.project[b].day,
  978. total: prescription.project[b].count.toString(),
  979. price: prescription.project[b].price,
  980. remark: prescription.project[b].remark,
  981. medical_code: prescription.project[b].project.medical_code,
  982. unit: prescription.project[b].unit,
  983. type: prescription.project[b].type,
  984. };
  985. if(prescription.project[b].type == 2){
  986. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  987. obj['medical_code'] = prescription.project[b].project.medical_code
  988. obj['project_name'] = prescription.project[b].project.project_name
  989. }else if(prescription.project[b].type == 3){
  990. obj['statistical_classification'] = ""
  991. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  992. obj['project_name'] = prescription.project[b].good_info.good_name
  993. }
  994. tempProject.push(obj)
  995. }
  996. for (let b = 0; b < prescription.addition.length; b++) {
  997. let obj = {
  998. id: prescription.addition[b].id,
  999. item_name: prescription.addition[b].item_name,
  1000. price: prescription.addition[b].price,
  1001. count: prescription.addition[b].count,
  1002. item_id: prescription.addition[b].item_id,
  1003. };
  1004. tempAddition.push(obj)
  1005. }
  1006. var preTime = "";
  1007. if (prescription.pre_time == 0) {
  1008. preTime = nowTime
  1009. } else {
  1010. preTime = this.getTime(prescription.pre_time, "{y}-{m}-{d} {h}:{i}")
  1011. }
  1012. let index = i + 1;
  1013. let obj = {
  1014. id: prescription.id,
  1015. name: '处方' + index,
  1016. advices: tempAdvice,
  1017. project: tempProject,
  1018. addition: tempAddition,
  1019. order_status: prescription.order_status,
  1020. pre_time: preTime
  1021. };
  1022. this.prescriptions.push(obj)
  1023. }
  1024. } else {
  1025. let obj = {
  1026. id: 0,
  1027. name: '处方' + 1,
  1028. advices: [],
  1029. project: [],
  1030. addition: [],
  1031. order_status: 0,
  1032. pre_time: nowTime,
  1033. };
  1034. this.prescriptions.push(obj)
  1035. }
  1036. this.$refs.prescriptions.setData(this.prescriptions, this.info, this.admin_info, this.doctors, this.department,this.hisPatientInfo, this.month_prescriptions);
  1037. this.$refs.child.watchSign = 0
  1038. }
  1039. });
  1040. this.$refs.child.watchSign = 0
  1041. }).catch(() => {
  1042. this.patientid = val.id;
  1043. let params = {
  1044. 'record_date': this.record_date,
  1045. 'patient_id': val.id,
  1046. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  1047. 'end_time': moment(new Date()).add('year', 0).format("YYYY-MM-DD"),
  1048. 'p_type':1,
  1049. };
  1050. getPatientInfo(params).then(response => {
  1051. if (response.data.state == 0) {
  1052. this.$message.error(response.data.msg);
  1053. return false
  1054. } else {
  1055. this.prescriptions = [];
  1056. this.month_prescriptions = [];
  1057. var month_prescriptions = response.data.data.month_prescriptions;
  1058. this.setMonthPrescription(month_prescriptions);
  1059. this.patientInfo = response.data.data.xt_info;
  1060. this.hisPatientInfo = response.data.data.his_info;
  1061. this.case_history = response.data.data.case_history;
  1062. console.log("数据是22222多少",this.case_history);
  1063. this.info = response.data.data.info;
  1064. this.doctors = response.data.data.doctors;
  1065. this.department = response.data.data.department;
  1066. for (let i = 0; i < this.doctors.length; i++){
  1067. if(this.doctors[i].user_type == 1){
  1068. this.doctors.splice(i,1)
  1069. }
  1070. }
  1071. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}');
  1072. if (this.case_history.breathing <= 0) {
  1073. this.case_history.breathing = ""
  1074. }
  1075. if (this.case_history.sick <= 0) {
  1076. this.case_history.sick = ""
  1077. }
  1078. if (this.case_history.diagnose <= 0) {
  1079. this.case_history.diagnose = ""
  1080. }
  1081. if (this.case_history.temperature <= 0) {
  1082. this.case_history.temperature = ''
  1083. }
  1084. if (this.case_history.blood_sugar <= 0) {
  1085. this.case_history.blood_sugar = ''
  1086. }
  1087. if (this.case_history.pulse <= 0) {
  1088. this.case_history.pulse = ''
  1089. }
  1090. if (this.case_history.sbp <= 0) {
  1091. this.case_history.sbp = ''
  1092. }
  1093. if (this.case_history.dbp <= 0) {
  1094. this.case_history.dbp = ''
  1095. }
  1096. if (this.case_history.height <= 0) {
  1097. this.case_history.height = ''
  1098. }
  1099. if (this.case_history.blood_fat <= 0) {
  1100. this.case_history.blood_fat = ''
  1101. }
  1102. if (this.case_history.sick_type <= 0) {
  1103. this.case_history.sick_type = ''
  1104. }
  1105. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}');
  1106. if (this.case_history.is_infect == 1) {
  1107. this.case_history.is_infect = true
  1108. } else {
  1109. this.case_history.is_infect = false
  1110. }
  1111. this.prescriptionList = response.data.data.prescription;
  1112. if (response.data.data.prescription.length > 0) {
  1113. for (let i = 0; i < response.data.data.prescription.length; i++) {
  1114. var prescription = response.data.data.prescription[i];
  1115. let tempAdvice = [];
  1116. let tempProject = [];
  1117. let tempAddition = [];
  1118. for (let b = 0; b < prescription.advices.length; b++) {
  1119. let obj = {
  1120. advice_id: prescription.advices[b].id,
  1121. drug_name: prescription.advices[b].advice_name,
  1122. single_dose: prescription.advices[b].single_dose,
  1123. delivery_way: prescription.advices[b].delivery_way,
  1124. execution_frequency: prescription.advices[b].execution_frequency,
  1125. retail_price: prescription.advices[b].price.toString(),
  1126. remark: prescription.advices[b].remark,
  1127. day: prescription.advices[b].day,
  1128. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1129. single_dose_unit: prescription.advices[b].single_dose_unit,
  1130. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1131. medical_insurance_number: prescription.advices[b].med_list_codg,
  1132. id: prescription.advices[b].drug_id,
  1133. drug:prescription.advices[b].drug,
  1134. };
  1135. tempAdvice.push(obj)
  1136. }
  1137. for (let b = 0; b < prescription.project.length; b++) {
  1138. let obj = {
  1139. id: prescription.project[b].id,
  1140. project_id: prescription.project[b].project_id,
  1141. project_name: prescription.project[b].project.project_name,
  1142. statistical_classification: prescription.project[b].project.statistical_classification,
  1143. single_dose: prescription.project[b].single_dose,
  1144. delivery_way: prescription.project[b].delivery_way,
  1145. execution_frequency: prescription.project[b].execution_frequency,
  1146. number_days: prescription.project[b].day,
  1147. total: prescription.project[b].count.toString(),
  1148. price: prescription.project[b].price,
  1149. remark: prescription.project[b].remark,
  1150. medical_code: prescription.project[b].project.medical_code,
  1151. unit: prescription.project[b].unit,
  1152. type:prescription.project[b].type,
  1153. };
  1154. if(prescription.project[b].type == 2){
  1155. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  1156. obj['medical_code'] = prescription.project[b].project.medical_code
  1157. obj['project_name'] = prescription.project[b].project.project_name
  1158. }else if(prescription.project[b].type == 3){
  1159. obj['statistical_classification'] = ""
  1160. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1161. obj['project_name'] = prescription.project[b].good_info.good_name
  1162. }
  1163. tempProject.push(obj)
  1164. }
  1165. for (let b = 0; b < prescription.addition.length; b++) {
  1166. let obj = {
  1167. id: prescription.addition[b].id,
  1168. item_name: prescription.addition[b].item_name,
  1169. price: prescription.addition[b].price,
  1170. count: prescription.addition[b].count,
  1171. item_id: prescription.addition[b].item_id,
  1172. };
  1173. tempAddition.push(obj)
  1174. }
  1175. var preTime = "";
  1176. if (prescription.pre_time == 0) {
  1177. preTime = nowTime
  1178. } else {
  1179. preTime = this.getTime(prescription.pre_time, "{y}-{m}-{d} {h}:{i}")
  1180. }
  1181. let index = i + 1;
  1182. let obj = {
  1183. id: prescription.id,
  1184. name: '处方' + index,
  1185. advices: tempAdvice,
  1186. project: tempProject,
  1187. addition: tempAddition,
  1188. order_status: prescription.order_status,
  1189. pre_time: preTime
  1190. };
  1191. this.prescriptions.push(obj)
  1192. }
  1193. } else {
  1194. let obj = {
  1195. id: 0,
  1196. name: '处方' + 1,
  1197. advices: [],
  1198. project: [],
  1199. addition: [],
  1200. order_status: 0,
  1201. pre_time: nowTime,
  1202. };
  1203. this.prescriptions.push(obj)
  1204. }
  1205. this.$refs.prescriptions.setData(this.prescriptions, this.info, this.admin_info, this.doctors, this.department,this.hisPatientInfo, this.month_prescriptions);
  1206. this.$refs.child.watchSign = 0
  1207. }
  1208. })
  1209. });
  1210. this.$refs.child.watchSign = 0
  1211. }else{
  1212. this.patientid = val.id;
  1213. let params = {
  1214. 'record_date': this.record_date,
  1215. 'patient_id': val.id,
  1216. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  1217. 'end_time': moment(new Date()).add('year', 0).format("YYYY-MM-DD"),
  1218. 'p_type':1,
  1219. };
  1220. getPatientInfo(params).then(response => {
  1221. if (response.data.state == 0) {
  1222. this.$message.error(response.data.msg);
  1223. return false
  1224. } else {
  1225. this.prescriptions = [];
  1226. this.month_prescriptions = [];
  1227. var month_prescriptions = response.data.data.month_prescriptions;
  1228. this.setMonthPrescription(month_prescriptions);
  1229. this.patientInfo = response.data.data.xt_info;
  1230. this.hisPatientInfo = response.data.data.his_info;
  1231. this.case_history = response.data.data.case_history;
  1232. console.log("数据是22222多少",this.case_history);
  1233. this.info = response.data.data.info;
  1234. this.doctors = response.data.data.doctors;
  1235. this.department = response.data.data.department;
  1236. for (let i = 0; i < this.doctors.length; i++){
  1237. if(this.doctors[i].user_type == 1){
  1238. this.doctors.splice(i,1)
  1239. }
  1240. }
  1241. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}');
  1242. if (this.case_history.breathing <= 0) {
  1243. this.case_history.breathing = ""
  1244. }
  1245. if (this.case_history.sick <= 0) {
  1246. this.case_history.sick = ""
  1247. }
  1248. if (this.case_history.diagnose <= 0) {
  1249. this.case_history.diagnose = ""
  1250. }
  1251. if (this.case_history.temperature <= 0) {
  1252. this.case_history.temperature = ''
  1253. }
  1254. if (this.case_history.blood_sugar <= 0) {
  1255. this.case_history.blood_sugar = ''
  1256. }
  1257. if (this.case_history.pulse <= 0) {
  1258. this.case_history.pulse = ''
  1259. }
  1260. if (this.case_history.sbp <= 0) {
  1261. this.case_history.sbp = ''
  1262. }
  1263. if (this.case_history.dbp <= 0) {
  1264. this.case_history.dbp = ''
  1265. }
  1266. if (this.case_history.height <= 0) {
  1267. this.case_history.height = ''
  1268. }
  1269. if (this.case_history.blood_fat <= 0) {
  1270. this.case_history.blood_fat = ''
  1271. }
  1272. if (this.case_history.sick_type <= 0) {
  1273. this.case_history.sick_type = ''
  1274. }
  1275. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}');
  1276. if (this.case_history.is_infect == 1) {
  1277. this.case_history.is_infect = true
  1278. } else {
  1279. this.case_history.is_infect = false
  1280. }
  1281. this.prescriptionList = response.data.data.prescription;
  1282. if (response.data.data.prescription.length > 0) {
  1283. for (let i = 0; i < response.data.data.prescription.length; i++) {
  1284. var prescription = response.data.data.prescription[i];
  1285. let tempAdvice = [];
  1286. let tempProject = [];
  1287. let tempAddition = [];
  1288. for (let b = 0; b < prescription.advices.length; b++) {
  1289. let obj = {
  1290. advice_id: prescription.advices[b].id,
  1291. drug_name: prescription.advices[b].advice_name,
  1292. single_dose: prescription.advices[b].single_dose,
  1293. delivery_way: prescription.advices[b].delivery_way,
  1294. execution_frequency: prescription.advices[b].execution_frequency,
  1295. retail_price: prescription.advices[b].price.toString(),
  1296. remark: prescription.advices[b].remark,
  1297. day: prescription.advices[b].day,
  1298. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1299. single_dose_unit: prescription.advices[b].single_dose_unit,
  1300. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1301. medical_insurance_number: prescription.advices[b].med_list_codg,
  1302. id: prescription.advices[b].drug_id,
  1303. drug:prescription.advices[b].drug,
  1304. };
  1305. tempAdvice.push(obj)
  1306. }
  1307. for (let b = 0; b < prescription.project.length; b++) {
  1308. let obj = {
  1309. id: prescription.project[b].id,
  1310. project_id: prescription.project[b].project_id,
  1311. project_name: prescription.project[b].project.project_name,
  1312. statistical_classification: prescription.project[b].project.statistical_classification,
  1313. single_dose: prescription.project[b].single_dose,
  1314. delivery_way: prescription.project[b].delivery_way,
  1315. execution_frequency: prescription.project[b].execution_frequency,
  1316. number_days: prescription.project[b].day,
  1317. total: prescription.project[b].count.toString(),
  1318. price: prescription.project[b].price,
  1319. remark: prescription.project[b].remark,
  1320. medical_code: prescription.project[b].project.medical_code,
  1321. unit: prescription.project[b].unit,
  1322. type:prescription.project[b].type,
  1323. };
  1324. if(prescription.project[b].type == 2){
  1325. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  1326. obj['medical_code'] = prescription.project[b].project.medical_code
  1327. obj['project_name'] = prescription.project[b].project.project_name
  1328. }else if(prescription.project[b].type == 3){
  1329. obj['statistical_classification'] = ""
  1330. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1331. obj['project_name'] = prescription.project[b].good_info.good_name
  1332. }
  1333. tempProject.push(obj)
  1334. }
  1335. for (let b = 0; b < prescription.addition.length; b++) {
  1336. let obj = {
  1337. id: prescription.addition[b].id,
  1338. item_name: prescription.addition[b].item_name,
  1339. price: prescription.addition[b].price,
  1340. count: prescription.addition[b].count,
  1341. item_id: prescription.addition[b].item_id,
  1342. };
  1343. tempAddition.push(obj)
  1344. }
  1345. var preTime = "";
  1346. if (prescription.pre_time == 0) {
  1347. preTime = nowTime
  1348. } else {
  1349. preTime = this.getTime(prescription.pre_time, "{y}-{m}-{d} {h}:{i}")
  1350. }
  1351. let index = i + 1;
  1352. let obj = {
  1353. id: prescription.id,
  1354. name: '处方' + index,
  1355. advices: tempAdvice,
  1356. project: tempProject,
  1357. addition: tempAddition,
  1358. order_status: prescription.order_status,
  1359. pre_time: preTime
  1360. };
  1361. this.prescriptions.push(obj)
  1362. }
  1363. } else {
  1364. let obj = {
  1365. id: 0,
  1366. name: '处方' + 1,
  1367. advices: [],
  1368. project: [],
  1369. addition: [],
  1370. order_status: 0,
  1371. pre_time: nowTime,
  1372. };
  1373. this.prescriptions.push(obj)
  1374. }
  1375. this.$refs.prescriptions.setData(this.prescriptions, this.info, this.admin_info, this.doctors, this.department,this.hisPatientInfo, this.month_prescriptions);
  1376. this.$refs.child.watchSign = 0
  1377. }
  1378. });
  1379. this.$refs.child.watchSign = 0
  1380. }
  1381. }else{
  1382. var nowDate = new Date();
  1383. var nowYear = nowDate.getFullYear();
  1384. var nowMonth = nowDate.getMonth() + 1;
  1385. var nowDay = nowDate.getDate();
  1386. var hours = nowDate.getHours();
  1387. var min = nowDate.getMinutes();
  1388. var nowTime =
  1389. nowYear +
  1390. '-' +
  1391. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1392. '-' +
  1393. (nowDay < 10 ? '0' + nowDay : nowDay) + " " + (hours < 10 ? '0' + hours : hours) +
  1394. ':' + (min < 10 ? '0' + min : min);
  1395. var last_month = nowDate.getMonth() < 10 ? '0' + nowDate.getMonth().toString() : nowDate.getMonth(); //获取当前月份(0-11,0代表1月)
  1396. var endTime =
  1397. nowYear +
  1398. '-' +
  1399. last_month +
  1400. '-' +
  1401. (nowDay < 10 ? '0' + nowDay : nowDay) + " " + (hours < 10 ? '0' + hours : hours) +
  1402. ':' + (min < 10 ? '0' + min : min);
  1403. let isShowDailog = false;
  1404. for (let i = 0; i < this.prescriptions.length; i++) {
  1405. if ((this.prescriptions[i].id == 0 && this.prescriptions[i].advices.length > 0) || (this.prescriptions[i].id == 0 && this.prescriptions[i].project.length > 0)) {
  1406. isShowDailog = true
  1407. }
  1408. }
  1409. if (isShowDailog) {
  1410. this.patientTableData.map((item, index) => {
  1411. if (item.patient_id == this.oldCurrentRow.patient_id) {
  1412. this.$refs.tab.setCurrentRow(this.patientTableData[index]);
  1413. }
  1414. });
  1415. this.$confirm('是否保存当前处方', '保存', {
  1416. confirmButtonText: '确 定',
  1417. cancelButtonText: '取 消',
  1418. type: 'warning'
  1419. }).then(() => {
  1420. this.open(1)
  1421. }).catch(() => {
  1422. this.patientTableData.map((item, index) => {
  1423. if (item.patient_id == val.patient_id) {
  1424. this.$refs.tab.setCurrentRow(this.patientTableData[index])
  1425. }
  1426. });
  1427. this.patientid = val.id;
  1428. let params = {
  1429. 'record_date': this.record_date,
  1430. 'patient_id': val.id,
  1431. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  1432. 'end_time': moment(new Date()).add('year', 0).format("YYYY-MM-DD"),
  1433. 'p_type':1,
  1434. };
  1435. getPatientInfo(params).then(response => {
  1436. if (response.data.state == 0) {
  1437. this.$message.error(response.data.msg);
  1438. return false
  1439. } else {
  1440. this.prescriptions = [];
  1441. this.patientInfo = response.data.data.xt_info;
  1442. this.hisPatientInfo = response.data.data.his_info;
  1443. this.case_history = response.data.data.case_history;
  1444. console.log("数据列表是多少",this.case_history);
  1445. var month_prescriptions = response.data.data.month_prescriptions;
  1446. this.setMonthPrescription(month_prescriptions);
  1447. this.doctors = response.data.data.doctors;
  1448. this.department = response.data.data.department;
  1449. for (let i = 0; i < this.doctors.length; i++){
  1450. if(this.doctors[i].user_type == 1){
  1451. this.doctors.splice(i,1)
  1452. }
  1453. }
  1454. this.case_history = case_history;
  1455. this.info = response.data.data.info;
  1456. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}');
  1457. if (this.case_history.breathing <= 0) {
  1458. this.case_history.breathing = ""
  1459. }
  1460. if (this.case_history.sick <= 0) {
  1461. this.case_history.sick = ""
  1462. }
  1463. if (this.case_history.diagnose <= 0) {
  1464. this.case_history.diagnose = ""
  1465. }
  1466. if (this.case_history.temperature <= 0) {
  1467. this.case_history.temperature = ''
  1468. }
  1469. if (this.case_history.blood_sugar <= 0) {
  1470. this.case_history.blood_sugar = ''
  1471. }
  1472. if (this.case_history.pulse <= 0) {
  1473. this.case_history.pulse = ''
  1474. }
  1475. if (this.case_history.sbp <= 0) {
  1476. this.case_history.sbp = ''
  1477. }
  1478. if (this.case_history.dbp <= 0) {
  1479. this.case_history.dbp = ''
  1480. }
  1481. if (this.case_history.height <= 0) {
  1482. this.case_history.height = ''
  1483. }
  1484. if (this.case_history.blood_fat <= 0) {
  1485. this.case_history.blood_fat = ''
  1486. }
  1487. if (this.case_history.sick_type <= 0) {
  1488. this.case_history.sick_type = ''
  1489. }
  1490. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}');
  1491. if (this.case_history.is_infect == 1) {
  1492. this.case_history.is_infect = true
  1493. } else {
  1494. this.case_history.is_infect = false
  1495. }
  1496. this.prescriptionList = response.data.data.prescription;
  1497. if (response.data.data.prescription.length > 0) {
  1498. for (let i = 0; i < response.data.data.prescription.length; i++) {
  1499. var prescription = response.data.data.prescription[i];
  1500. let tempAdvice = [];
  1501. let tempProject = [];
  1502. let tempAddition = [];
  1503. for (let b = 0; b < prescription.advices.length; b++) {
  1504. let obj = {
  1505. advice_id: prescription.advices[b].id,
  1506. drug_name: prescription.advices[b].advice_name,
  1507. single_dose: prescription.advices[b].single_dose,
  1508. delivery_way: prescription.advices[b].delivery_way,
  1509. execution_frequency: prescription.advices[b].execution_frequency,
  1510. retail_price: prescription.advices[b].price.toString(),
  1511. remark: prescription.advices[b].remark,
  1512. day: prescription.advices[b].day,
  1513. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1514. single_dose_unit: prescription.advices[b].single_dose_unit,
  1515. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1516. medical_insurance_number: prescription.advices[b].med_list_codg,
  1517. id: prescription.advices[b].drug_id,
  1518. drug:prescription.advices[b].drug,
  1519. };
  1520. tempAdvice.push(obj)
  1521. }
  1522. for (let b = 0; b < prescription.project.length; b++) {
  1523. let obj = {
  1524. id: prescription.project[b].id,
  1525. project_id: prescription.project[b].project_id,
  1526. project_name: prescription.project[b].project.project_name,
  1527. statistical_classification: prescription.project[b].project.statistical_classification,
  1528. single_dose: prescription.project[b].single_dose,
  1529. delivery_way: prescription.project[b].delivery_way,
  1530. execution_frequency: prescription.project[b].execution_frequency,
  1531. number_days: prescription.project[b].day,
  1532. total: prescription.project[b].count.toString(),
  1533. price: prescription.project[b].price,
  1534. remark: prescription.project[b].remark,
  1535. medical_code: prescription.project[b].project.medical_code,
  1536. unit: prescription.project[b].unit,
  1537. type:prescription.project[b].type,
  1538. };
  1539. if(prescription.project[b].type == 2){
  1540. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  1541. obj['medical_code'] = prescription.project[b].project.medical_code
  1542. obj['project_name'] = prescription.project[b].project.project_name
  1543. }else if(prescription.project[b].type == 3){
  1544. obj['statistical_classification'] = ""
  1545. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1546. obj['project_name'] = prescription.project[b].good_info.good_name
  1547. }
  1548. tempProject.push(obj)
  1549. }
  1550. for (let b = 0; b < prescription.addition.length; b++) {
  1551. let obj = {
  1552. id: prescription.addition[b].id,
  1553. item_name: prescription.addition[b].item_name,
  1554. price: prescription.addition[b].price,
  1555. count: prescription.addition[b].count,
  1556. item_id: prescription.addition[b].item_id,
  1557. };
  1558. tempAddition.push(obj)
  1559. }
  1560. var preTime = "";
  1561. if (prescription.pre_time == 0) {
  1562. preTime = nowTime
  1563. } else {
  1564. preTime = this.getTime(prescription.pre_time, "{y}-{m}-{d} {h}:{i}")
  1565. }
  1566. let index = i + 1;
  1567. let obj = {
  1568. id: prescription.id,
  1569. name: '处方' + index,
  1570. advices: tempAdvice,
  1571. project: tempProject,
  1572. addition: tempAddition,
  1573. order_status: prescription.order_status,
  1574. pre_time: preTime
  1575. };
  1576. this.prescriptions.push(obj)
  1577. }
  1578. } else {
  1579. let obj = {
  1580. id: 0,
  1581. name: '处方' + 1,
  1582. advices: [],
  1583. project: [],
  1584. addition: [],
  1585. order_status: 0,
  1586. pre_time: nowTime
  1587. };
  1588. this.prescriptions.push(obj)
  1589. }
  1590. this.$refs.prescriptions.setData(this.prescriptions, this.info, this.admin_info, this.doctors, this.department,this.hisPatientInfo, this.month_prescriptions)
  1591. }
  1592. })
  1593. })
  1594. // this.$message.error('需要保存保存处方才能切换')
  1595. } else {
  1596. this.patientid = val.id;
  1597. let params = {
  1598. 'record_date': this.record_date,
  1599. 'patient_id': val.id,
  1600. 'start_time': moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  1601. 'end_time': moment(new Date()).add('year', 0).format("YYYY-MM-DD"),
  1602. 'p_type':1,
  1603. };
  1604. getPatientInfo(params).then(response => {
  1605. if (response.data.state == 0) {
  1606. this.$message.error(response.data.msg);
  1607. return false
  1608. } else {
  1609. this.prescriptions = [];
  1610. this.month_prescriptions = [];
  1611. var month_prescriptions = response.data.data.month_prescriptions;
  1612. this.setMonthPrescription(month_prescriptions);
  1613. this.patientInfo = response.data.data.xt_info;
  1614. this.hisPatientInfo = response.data.data.his_info;
  1615. this.case_history = response.data.data.case_history;
  1616. console.log("数据是22222多少",this.case_history);
  1617. this.info = response.data.data.info;
  1618. this.doctors = response.data.data.doctors;
  1619. this.department = response.data.data.department;
  1620. for (let i = 0; i < this.doctors.length; i++){
  1621. if(this.doctors[i].user_type == 1){
  1622. this.doctors.splice(i,1)
  1623. }
  1624. }
  1625. this.patientInfo.birth = uParseTime(this.patientInfo.birthday, '{y}-{m}-{d}');
  1626. if (this.case_history.breathing <= 0) {
  1627. this.case_history.breathing = ""
  1628. }
  1629. if (this.case_history.sick <= 0) {
  1630. this.case_history.sick = ""
  1631. }
  1632. if (this.case_history.diagnose <= 0) {
  1633. this.case_history.diagnose = ""
  1634. }
  1635. if (this.case_history.temperature <= 0) {
  1636. this.case_history.temperature = ''
  1637. }
  1638. if (this.case_history.blood_sugar <= 0) {
  1639. this.case_history.blood_sugar = ''
  1640. }
  1641. if (this.case_history.pulse <= 0) {
  1642. this.case_history.pulse = ''
  1643. }
  1644. if (this.case_history.sbp <= 0) {
  1645. this.case_history.sbp = ''
  1646. }
  1647. if (this.case_history.dbp <= 0) {
  1648. this.case_history.dbp = ''
  1649. }
  1650. if (this.case_history.height <= 0) {
  1651. this.case_history.height = ''
  1652. }
  1653. if (this.case_history.blood_fat <= 0) {
  1654. this.case_history.blood_fat = ''
  1655. }
  1656. if (this.case_history.sick_type <= 0) {
  1657. this.case_history.sick_type = ''
  1658. }
  1659. this.case_history.sick_date = uParseTime(this.case_history.sick_date, '{y}-{m}-{d}');
  1660. if (this.case_history.is_infect == 1) {
  1661. this.case_history.is_infect = true
  1662. } else {
  1663. this.case_history.is_infect = false
  1664. }
  1665. this.prescriptionList = response.data.data.prescription;
  1666. if (response.data.data.prescription.length > 0) {
  1667. for (let i = 0; i < response.data.data.prescription.length; i++) {
  1668. var prescription = response.data.data.prescription[i];
  1669. let tempAdvice = [];
  1670. let tempProject = [];
  1671. let tempAddition = [];
  1672. for (let b = 0; b < prescription.advices.length; b++) {
  1673. let obj = {
  1674. advice_id: prescription.advices[b].id,
  1675. drug_name: prescription.advices[b].advice_name,
  1676. single_dose: prescription.advices[b].single_dose,
  1677. delivery_way: prescription.advices[b].delivery_way,
  1678. execution_frequency: prescription.advices[b].execution_frequency,
  1679. retail_price: prescription.advices[b].price.toString(),
  1680. remark: prescription.advices[b].remark,
  1681. day: prescription.advices[b].day,
  1682. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1683. single_dose_unit: prescription.advices[b].single_dose_unit,
  1684. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1685. medical_insurance_number: prescription.advices[b].med_list_codg,
  1686. id: prescription.advices[b].drug_id,
  1687. drug:prescription.advices[b].drug,
  1688. };
  1689. tempAdvice.push(obj)
  1690. }
  1691. for (let b = 0; b < prescription.project.length; b++) {
  1692. let obj = {
  1693. id: prescription.project[b].id,
  1694. project_id: prescription.project[b].project_id,
  1695. project_name: prescription.project[b].project.project_name,
  1696. statistical_classification: prescription.project[b].project.statistical_classification,
  1697. single_dose: prescription.project[b].single_dose,
  1698. delivery_way: prescription.project[b].delivery_way,
  1699. execution_frequency: prescription.project[b].execution_frequency,
  1700. number_days: prescription.project[b].day,
  1701. total: prescription.project[b].count.toString(),
  1702. price: prescription.project[b].price,
  1703. remark: prescription.project[b].remark,
  1704. medical_code: prescription.project[b].project.medical_code,
  1705. type:prescription.project[b].type,
  1706. unit: prescription.project[b].unit
  1707. };
  1708. if(prescription.project[b].type == 2){
  1709. obj['statistical_classification'] = prescription.project[b].project.statistical_classification
  1710. obj['medical_code'] = prescription.project[b].project.medical_code
  1711. obj['project_name'] = prescription.project[b].project.project_name
  1712. }else if(prescription.project[b].type == 3){
  1713. obj['statistical_classification'] = ""
  1714. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1715. obj['project_name'] = prescription.project[b].good_info.good_name
  1716. }
  1717. tempProject.push(obj)
  1718. }
  1719. for (let b = 0; b < prescription.addition.length; b++) {
  1720. let obj = {
  1721. id: prescription.addition[b].id,
  1722. item_name: prescription.addition[b].item_name,
  1723. price: prescription.addition[b].price,
  1724. count: prescription.addition[b].count,
  1725. item_id: prescription.addition[b].item_id,
  1726. };
  1727. tempAddition.push(obj)
  1728. }
  1729. var preTime = "";
  1730. if (prescription.pre_time == 0) {
  1731. preTime = nowTime
  1732. } else {
  1733. preTime = this.getTime(prescription.pre_time, "{y}-{m}-{d} {h}:{i}")
  1734. }
  1735. let index = i + 1;
  1736. let obj = {
  1737. id: prescription.id,
  1738. name: '处方' + index,
  1739. advices: tempAdvice,
  1740. project: tempProject,
  1741. addition: tempAddition,
  1742. order_status: prescription.order_status,
  1743. pre_time: preTime
  1744. };
  1745. this.prescriptions.push(obj)
  1746. }
  1747. } else {
  1748. let obj = {
  1749. id: 0,
  1750. name: '处方' + 1,
  1751. advices: [],
  1752. project: [],
  1753. addition: [],
  1754. order_status: 0,
  1755. pre_time: nowTime,
  1756. };
  1757. this.prescriptions.push(obj)
  1758. }
  1759. this.$refs.prescriptions.setData(this.prescriptions, this.info, this.admin_info, this.doctors, this.department,this.hisPatientInfo, this.month_prescriptions)
  1760. }
  1761. })
  1762. }
  1763. }
  1764. },
  1765. currentChange(currentRow, oldCurrentRow) {
  1766. this.newPatientId = oldCurrentRow.id;
  1767. console.log('执行',this.newPatientId);
  1768. let isShowDailog = false;
  1769. for (let i = 0; i < this.prescriptions.length; i++) {
  1770. if ((this.prescriptions[i].id == 0 && this.prescriptions[i].advices.length > 0) || (this.prescriptions[i].id == 0 && this.prescriptions[i].project.length > 0)) {
  1771. isShowDailog = true
  1772. }
  1773. }
  1774. if (!isShowDailog) {
  1775. this.oldCurrentRow = currentRow;
  1776. }
  1777. }, open_two() {
  1778. this.$refs.prescriptions.open_two()
  1779. },
  1780. open(index) {
  1781. this.index = index;
  1782. if (index == 1) {
  1783. this.$refs.prescriptions.open(1, this.saveLoading)
  1784. } else if (index == 2) {
  1785. this.getPrescriptionList(this.patientInfo.id)
  1786. // this.$router.push("/outpatientDoctorStation/print?record="+this.record_date+"&prescription_id="+this.prescription_id)
  1787. } else if (index == 3) {
  1788. this.$refs.prescriptions.open(3)
  1789. } else if (index == 4) {
  1790. this.$refs.prescriptions.open(4)
  1791. } else if (index == 6) {
  1792. // this.$router.push("/outpatientDoctorStation/treatPrint?record="+this.record_date+"&prescription_id="+this.prescription_id)
  1793. this.getPrescriptionList(this.patientInfo.id)
  1794. // this.$router.push("/outpatientDoctorStation/treatPrint?record="+this.record_date+"&prescription_id="+this.prescription_id)
  1795. }
  1796. },
  1797. opentwo(index) {
  1798. if (index == 1) {
  1799. if (this.patientInfo.id == undefined) {
  1800. this.$message.error("请先选择病人");
  1801. return
  1802. }
  1803. this.$refs.child.createCaseHistory()
  1804. } else if (index == 2) {
  1805. this.recordVisible = true
  1806. // this.$router.push('/outpatientDoctorStation/recordPrint?record='+this.record_date+"&patient_id="+this.patientid)
  1807. } else if (index == 3) {
  1808. var mode_status = this.$refs.saveRecordTemplate.mode_status;
  1809. this.$refs.medicalRecord.show(mode_status)
  1810. } else if (index == 4) {
  1811. this.$refs.saveRecordTemplate.show(this.case_history)
  1812. }
  1813. },
  1814. // changePatient(val){
  1815. // console.log("患者val",val)
  1816. // this.hisPatientInfo = val.hisPatientInfo
  1817. // console.log("333333",this.hisPatientInfo)
  1818. // }
  1819. getMsgFormSon(id) {
  1820. this.detalid = id
  1821. },
  1822. changetwo(data) {
  1823. this.prescription_id = data
  1824. },
  1825. getPrescriptionList(id) {
  1826. getPrescriptionList(id,1).then(response => {
  1827. if (response.data.state == 1) {
  1828. this.centerDialogVisible = true;
  1829. var list = response.data.data.list;
  1830. console.log("list2222222",list);
  1831. for(let i=0;i<list.length;i++){
  1832. list[i].prescription_number = list[i].prescription_number + i
  1833. }
  1834. this.tableData = list
  1835. }
  1836. })
  1837. },
  1838. handleSelectionChange(val) {
  1839. this.selecting_schs = val
  1840. // console.log("99999",this.selecting_schs)
  1841. },
  1842. handleClick() {
  1843. },
  1844. savePrint() {
  1845. var arr = [];
  1846. for (let i = 0; i < this.selecting_schs.length; i++) {
  1847. arr.push(this.selecting_schs[i].id)
  1848. }
  1849. var ids = arr.join(",");
  1850. if (this.index == 2) {
  1851. let obj = {
  1852. record: this.record_date,
  1853. prescription_id: this.prescription_id,
  1854. ids: ids,
  1855. patient_id: this.patientid
  1856. };
  1857. this.paramsObj = obj;
  1858. this.innerVisible = true
  1859. // this.$router.push("/outpatientDoctorStation/print?record="+this.record_date+"&prescription_id="+this.prescription_id+"&ids="+ids+"&patient_id="+this.patientid)
  1860. }
  1861. if (this.index == 6) {
  1862. let obj = {
  1863. record: this.record_date,
  1864. prescription_id: this.prescription_id,
  1865. ids: ids,
  1866. patient_id: this.patientid
  1867. };
  1868. this.paramsObj = obj;
  1869. this.innerVisible = true
  1870. // this.$router.push("/outpatientDoctorStation/treatPrint?record="+this.record_date+"&prescription_id="+this.prescription_id+"&ids="+ids+"&patient_id="+this.patientid)
  1871. }
  1872. }, getTime(val, temp) {
  1873. if (val != 0) {
  1874. return uParseTime(val, temp)
  1875. } else {
  1876. return ''
  1877. }
  1878. }
  1879. },
  1880. created() {
  1881. var nowDate = new Date();
  1882. var nowYear = nowDate.getFullYear();
  1883. var nowMonth = nowDate.getMonth() + 1;
  1884. var nowDay = nowDate.getDate();
  1885. this.record_date =
  1886. nowYear +
  1887. '-' +
  1888. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1889. '-' +
  1890. (nowDay < 10 ? '0' + nowDay : nowDay);
  1891. this.getList();
  1892. this.diagnoses = this.getDictionaryDataConfig('system', 'diagnose');
  1893. this.other_sick = this.getDictionaryDataConfig('system', 'other_sick_history');
  1894. let tableHeight = document.body.clientHeight - 263;
  1895. this.tableHeight = tableHeight
  1896. },
  1897. mounted() {
  1898. const that = this;
  1899. window.onresize = () => {
  1900. return (() => {
  1901. window.fullHeight = document.documentElement.clientHeight;
  1902. that.fullHeight = window.fullHeight
  1903. })()
  1904. }
  1905. },
  1906. watch: {
  1907. fullHeight(val) {
  1908. if (!this.timer) {
  1909. this.fullHeight = val;
  1910. let tableHeight = val - 263;
  1911. this.tableHeight = tableHeight;
  1912. this.timer = true;
  1913. let that = this;
  1914. setTimeout(function () {
  1915. that.timer = false
  1916. }, 400)
  1917. }
  1918. },
  1919. }
  1920. }
  1921. </script>
  1922. <style lang="scss" scoped>
  1923. .new-main-contain {
  1924. height: 100%;
  1925. display: flex;
  1926. flex-direction: column;
  1927. }
  1928. .app-container {
  1929. height: 100%;
  1930. }
  1931. .mainCell {
  1932. height: 36px;
  1933. display: flex;
  1934. align-items: center;
  1935. }
  1936. .mainLeft {
  1937. width: 200px;
  1938. height: 100%;
  1939. display: flex;
  1940. flex-direction: column;
  1941. .el-radio {
  1942. margin-right: 5px;
  1943. }
  1944. }
  1945. .mainRight {
  1946. margin-left: 10px;
  1947. flex: 1;
  1948. height: 100%;
  1949. display: flex;
  1950. flex-direction: column;
  1951. overflow-y: auto;
  1952. .cellSpan {
  1953. min-width: 80px;
  1954. display: inline-block;
  1955. margin-right: 10px;
  1956. }
  1957. }
  1958. .mainCenter {
  1959. display: flex;
  1960. flex: 1;
  1961. }
  1962. .centerLeft {
  1963. flex: 1;
  1964. display: flex;
  1965. flex-direction: column;
  1966. position: relative;
  1967. .el-form-item {
  1968. width: 32%;
  1969. margin-right: 1%;
  1970. float: left;
  1971. }
  1972. .el-form-item__label {
  1973. text-align: left;
  1974. }
  1975. }
  1976. .backColor {
  1977. background: #f6f8f9;
  1978. height: 5px;
  1979. margin-bottom: 5px;
  1980. }
  1981. .tabsBox {
  1982. position: relative;
  1983. height: 76%;
  1984. overflow-y: auto;
  1985. margin-bottom: 60px;
  1986. .el-tabs__item {
  1987. padding: 0 10px;
  1988. }
  1989. }
  1990. .preTabs {
  1991. height: 100%;
  1992. display: flex;
  1993. flex-direction: column;
  1994. .el-tabs__content {
  1995. flex: 1;
  1996. overflow-y: auto;
  1997. }
  1998. }
  1999. .costBox {
  2000. width: 100%;
  2001. height: 60px;
  2002. background: #fff;
  2003. position: absolute;
  2004. bottom: 0;
  2005. display: flex;
  2006. align-items: center;
  2007. }
  2008. .addTab {
  2009. position: absolute;
  2010. right: 0;
  2011. top: 14px;
  2012. z-index: 20;
  2013. }
  2014. .centerRight {
  2015. width: 300px;
  2016. margin-left: 10px;
  2017. display: flex;
  2018. flex-direction: column;
  2019. position: relative;
  2020. }
  2021. .rightTab {
  2022. height: 40px;
  2023. width: 100%;
  2024. border: 1px solid #d2d2d2;
  2025. box-sizing: border-box;
  2026. p {
  2027. width: 50%;
  2028. height: 40px;
  2029. line-height: 40px;
  2030. text-align: center;
  2031. background: #eee;
  2032. float: left;
  2033. }
  2034. > p:last-child {
  2035. border-left: 1px solid #d2d2d2;
  2036. float: right;
  2037. }
  2038. .activeP {
  2039. background: #409EFF;
  2040. color: #fff;
  2041. }
  2042. }
  2043. .comfirmBox {
  2044. width: 100%;
  2045. height: 60px;
  2046. background: #fff;
  2047. position: absolute;
  2048. bottom: 0;
  2049. display: flex;
  2050. align-items: center;
  2051. justify-content: space-between;
  2052. }
  2053. .mainHeader {
  2054. width: 100%;
  2055. background: #fff;
  2056. position: fixed;
  2057. z-index: 100;
  2058. height: 36px;
  2059. }
  2060. .titleBox {
  2061. position: fixed;
  2062. z-index: 99;
  2063. background: #fff;
  2064. }
  2065. .fixedCell {
  2066. position: fixed;
  2067. z-index: 99;
  2068. right: 30px;
  2069. background: #fff;
  2070. width: 300px;
  2071. display: flex;
  2072. justify-content: space-between;
  2073. }
  2074. </style>
  2075. <style lang="scss">
  2076. .centerLeft {
  2077. .el-form-item__label {
  2078. text-align: left;
  2079. }
  2080. }
  2081. .tabsBox {
  2082. .el-tabs__item {
  2083. padding: 0 10px;
  2084. }
  2085. .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) {
  2086. padding: 0 10px;
  2087. }
  2088. .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 {
  2089. padding: 0 10px;
  2090. }
  2091. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  2092. padding: 0 10px;
  2093. }
  2094. }
  2095. .centerRight {
  2096. .el-tabs__nav-scroll {
  2097. display: flex;
  2098. }
  2099. .el-tabs__nav {
  2100. margin: 0 auto;
  2101. }
  2102. .el-table th .cell, .el-table td .cell {
  2103. padding: 0 2px;
  2104. }
  2105. }
  2106. .preTabs {
  2107. .el-tabs__content {
  2108. }
  2109. }
  2110. .rightTabs {
  2111. height: 100%;
  2112. .el-tabs__content {
  2113. }
  2114. }
  2115. .centerDialog {
  2116. .el-dialog__body {
  2117. max-height: calc(100vh - 100px) !important;
  2118. padding: 0 20px;
  2119. }
  2120. }
  2121. </style>