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

CheckPersonal.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template>
  2. <div class="page_checkPersonal">
  3. <div class="cell clearfix">
  4. <el-form :inline="true" :model="listQuery">
  5. <el-form-item label>
  6. <el-input v-model.trim="listQuery.search" placeholder="姓名/透析号" style="width:150px"></el-input>
  7. <el-button type="primary" @click="onSearch" icon="el-icon-search">搜索</el-button>
  8. </el-form-item>
  9. </el-form>
  10. <label class="title">
  11. <span class="name">日期查询</span> :
  12. </label>
  13. <el-date-picker
  14. v-model="listQuery.start_time"
  15. prefix-icon="el-icon-date"
  16. @change="changeTime"
  17. :editable="false"
  18. style="width: 196px;"
  19. type="date"
  20. placeholder="选择日期时间"
  21. align="right"
  22. format="yyyy-MM-dd"
  23. value-format="yyyy-MM-dd"
  24. :picker-options="pickerOptions"
  25. ></el-date-picker>
  26. <span class>-</span>
  27. <el-date-picker
  28. v-model="listQuery.end_time"
  29. prefix-icon="el-icon-date"
  30. @change="changeEndTime"
  31. :editable="false"
  32. style="width: 196px;"
  33. type="date"
  34. placeholder="选择日期时间"
  35. align="right"
  36. format="yyyy-MM-dd"
  37. value-format="yyyy-MM-dd"
  38. :picker-options="pickerOptions"
  39. ></el-date-picker>
  40. </div>
  41. <el-container>
  42. <div style="width:150px">
  43. <div class="tableTitle">患者列表</div>
  44. <el-table :data="patientsData" border style="width: 100%;"
  45. height="500" :row-style="{ color: '#303133' }"
  46. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  47. highlight-current-row
  48. @current-change="handleChange"
  49. >
  50. <el-table-column prop="dialysis_no" label="透析号" width="80">
  51. <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
  52. </el-table-column>
  53. <el-table-column prop="name" label="姓名" width="80">
  54. <template slot-scope="scope">{{ scope.row.name }}</template>
  55. </el-table-column>
  56. </el-table>
  57. </div>
  58. <div style="padding-left:10px;flex:1">
  59. <div class="tableTitle">统计图</div>
  60. <div>
  61. <line-chart :options="chart"></line-chart>
  62. </div>
  63. </div>
  64. </el-container>
  65. </div>
  66. </template>
  67. <script>
  68. import echarts from "echarts";
  69. import LineChart from "../../components/LineChart";
  70. import { getCurrentOrgPatients,getInspectionTotalCount,getInspectionDetailById,getSearchPatientInfo } from "@/api/common/common";
  71. export default {
  72. components: {
  73. LineChart
  74. },
  75. data() {
  76. return {
  77. listQuery: {
  78. start_time: "",
  79. end_time: "",
  80. page: 1,
  81. limit: 10
  82. },
  83. value: "请选项",
  84. patientsData:[],
  85. tableData:[],
  86. chart: {
  87. tooltip: {},
  88. // legend: {
  89. // data: ["次数"],
  90. // left: 0
  91. // },
  92. xAxis: {
  93. data: []
  94. },
  95. yAxis: {
  96. axisLabel: {
  97. formatter: "{value} %"
  98. },
  99. show: false
  100. },
  101. series: [
  102. {
  103. name: "次数",
  104. type: "bar",
  105. data: [],
  106. barWidth: 30,
  107. label: {
  108. normal: {
  109. show: true,
  110. position: "top",
  111. formatter: (params) => {
  112. if(this.obj.length > 0){
  113. let str = ''
  114. str = params.data +'次' + '\n(参考值'+ this.obj[params.dataIndex] +'次)'
  115. return str
  116. }else{
  117. let str = ''
  118. str = params.data+'次'
  119. return str
  120. }
  121. }
  122. }
  123. },
  124. //配置样式
  125. itemStyle: {
  126. //通常情况下:
  127. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  128. normal: {
  129. color: function(params) {
  130. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  131. var colorList = [
  132. ["#A9E0F3", "#9FBDFC"],
  133. ["#A9E0F3", "#9FBDFC"],
  134. ["#A9E0F3", "#9FBDFC"],
  135. ["#FFD7C0", "#FF9994"],
  136. ["#FFD7C0", "#FF9994"],
  137. ["#FFD7C0", "#FF9994"],
  138. ["#D7C3FD", "#B3A8F7"],
  139. ["#D7C3FD", "#B3A8F7"],
  140. ["#D7C3FD", "#B3A8F7"]
  141. ];
  142. var index = params.dataIndex;
  143. if (params.dataIndex >= colorList.length) {
  144. index = params.dataIndex % colorList.length;
  145. }
  146. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  147. { offset: 0, color: colorList[index][0] },
  148. // { offset: 0.5, color: colorList[index][1] },
  149. { offset: 1, color: colorList[index][1] }
  150. ]);
  151. },
  152. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  153. },
  154. //鼠标悬停时:
  155. emphasis: {
  156. shadowBlur: 10,
  157. shadowOffsetX: 0,
  158. shadowColor: "rgba(0, 0, 0, 0.5)"
  159. }
  160. }
  161. }
  162. ]
  163. },
  164. pickerOptions: {
  165. disabledDate(time) {
  166. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
  167. return time.getTime() > Date.now() || time.getTime() < threeMonths;;
  168. }
  169. },
  170. modesData: {
  171. xAxis: [],
  172. series: []
  173. },
  174. obj:[]
  175. };
  176. },
  177. methods: {
  178. changeTime() {
  179. var time = this.getTimestamp(val) - this.getTimestamp(this.listQuery.end_time);
  180. if (time > 0) {
  181. this.$message.error("结束时间不能小于开始时间");
  182. this.listQuery.start_time = "";
  183. } else {
  184. }
  185. },
  186. changeEndTime(val) {
  187. var time =
  188. this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time);
  189. if (time < 0) {
  190. this.$message.error("结束时间不能小于开始时间");
  191. this.listQuery.end_time = "";
  192. } else {
  193. }
  194. },
  195. getTimestamp(time) {
  196. // 把时间日期转成时间戳
  197. return new Date(time).getTime() / 1000;
  198. },
  199. getCurrentOrgPatients(){
  200. getCurrentOrgPatients().then(response=>{
  201. var patients = response.data.data.patients
  202. this.patientsData = patients
  203. })
  204. },
  205. getInspectionTotalCount(){
  206. this.modesData.series = []
  207. this.modesData.xAxis = []
  208. getInspectionTotalCount(this.listQuery.start_time,this.listQuery.end_time).then(response=>{
  209. if(response.data.state === 1){
  210. var Inspection = response.data.data.Inspection
  211. this.tableData = Inspection
  212. var counts = response.data.data.counts
  213. var arr = []
  214. for(let i=0;i<Inspection.length;i++){
  215. for(let j=0;j<counts.length;j++){
  216. if(Inspection[i].inspection_major == counts[j].ProjectId){
  217. arr.push(counts[j])
  218. }
  219. }
  220. }
  221. var arrtwo = this.arrayDate(counts,this.normData)
  222. var hash = {};
  223. var i = 0;
  224. var res = [];
  225. arr.forEach(function(item) {
  226. var ProjectName = item.ProjectName;
  227. hash[ProjectName] ? res[hash[ProjectName] - 1].Count.push(item.Count) : hash[ProjectName] = ++i && res.push({
  228. Count: [item.Count],
  229. ProjectName: ProjectName,
  230. ProjectId: item.ProjectId,
  231. Sort:item.Sort,
  232. })
  233. });
  234. res.map(item => {
  235. item.Count = eval(item.Count.join('+'))
  236. })
  237. let arr1 = []
  238. this.tableData.map(it => {
  239. arr1.push(it.project_name)
  240. })
  241. arr1.forEach((item,index)=>{
  242. if(!(res[index] && item ==res[index].ProjectName)){
  243. res.splice(index,0,{Count:0, ProjectName: item, Sort: index+1})
  244. }
  245.             })
  246. res.map(item => {
  247. this.modesData.series.push(parseInt(item.Count));
  248. })
  249. for (const key in this.tableData) {
  250. this.modesData.xAxis.push(this.tableData[key].project_name);
  251. // if (key in res) {
  252. // this.modesData.series.push(parseInt(res[key].Count));
  253. // // batotal += parseInt(res[key].Count);
  254. // } else {
  255. // this.modesData.series.push(0);
  256. // }
  257. }
  258. this.chart.series[0].data = this.modesData.series
  259. this.chart.xAxis.data = this.modesData.xAxis
  260. }
  261. })
  262. },
  263. //获取单个病人数据
  264. handleChange(val){
  265. this.modesData.series = []
  266. this.modesData.xAxis = []
  267. getInspectionDetailById(val.id,this.listQuery.start_time,this.listQuery.end_time).then(response=>{
  268. if(response.data.state === 1){
  269. var patientdetail = response.data.data.patientdetail
  270. var arr=[]
  271. for(let i=0;i<this.tableData.length;i++){
  272. for(let j=0;j<patientdetail.length;j++){
  273. if(this.tableData[i].inspection_major == patientdetail[j].ProjectId){
  274. arr.push(patientdetail[j])
  275. }
  276. }
  277. }
  278. let time = new Date(this.listQuery.end_time) - new Date(this.listQuery.start_time)
  279. let day = parseInt(time / (1000 * 60 * 60 * 24))
  280. for (const key in this.tableData) {
  281. this.modesData.xAxis.push(this.tableData[key].project_name);
  282. if (key in arr) {
  283. this.modesData.series.push(parseInt(arr[key].Count));
  284. this.obj.push(Math.round(day / arr[key].InspectionFrequency))
  285. // batotal += parseInt(res[key].Count);
  286. } else {
  287. this.modesData.series.push(0);
  288. this.obj.push(0)
  289. }
  290. }
  291. this.chart.series[0].data = this.modesData.series
  292. this.chart.xAxis.data = this.modesData.xAxis
  293. }
  294. })
  295. },
  296. //搜索功能
  297. onSearch(){
  298. getSearchPatientInfo(this.listQuery.search,this.listQuery.start_time,this.listQuery.end_time).then(response=>{
  299. if(response.data.state === 1){
  300. var PatientsInfo = response.data.data.PatientsInfo
  301. var arr = []
  302. for(let i=0;i<this.tableData.length;i++){
  303. for(let j=0;j<PatientsInfo.length;j++){
  304. if(this.tableData[i].inspection_major == PatientsInfo[j].ProjectId){
  305. arr.push(PatientsInfo[j])
  306. }
  307. }
  308. }
  309. }
  310. })
  311. },
  312. arrayDate(array1,array2){
  313. var array1 = array1;
  314. var array2 = this.tableData;
  315. var result = [];
  316. for(var i = 0; i < array2.length; i++){
  317. var obj = array2[i];
  318. var num = obj.inspection_major; //staff_id 就是要对比的key
  319. var isExist = false;
  320. for(var j = 0; j < array1.length; j++){
  321. var aj = array1[j];
  322. var n = aj.ProjectId;
  323. if(n == num){
  324. isExist = true;
  325. break;
  326. }
  327. }
  328. if(!isExist){
  329. result.push(obj);
  330. }
  331. }
  332. return result;
  333. },
  334. },
  335. created(){
  336. var nowDate = new Date();
  337. var nowYear = nowDate.getFullYear();
  338. var nowMonth = nowDate.getMonth() + 1;
  339. var nowDay = nowDate.getDate();
  340. this.listQuery.end_time =
  341. nowYear +
  342. "-" +
  343. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  344. "-" +
  345. (nowDay < 10 ? "0" + nowDay : nowDay);
  346. nowDate.setMonth(nowDate.getMonth() - 3);
  347. nowYear = nowDate.getFullYear();
  348. nowMonth = nowDate.getMonth() + 1;
  349. nowDay = nowDate.getDate();
  350. this.listQuery.start_time =
  351. nowYear +
  352. "-" +
  353. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  354. "-" +
  355. (nowDay < 10 ? "0" + nowDay : nowDay);
  356. //获取该机构下的所有患者
  357. this.getCurrentOrgPatients()
  358. //获取检验检查项目
  359. this.getInspectionTotalCount()
  360. }
  361. };
  362. </script>
  363. <style lang="scss" scoped>
  364. .tableTitle {
  365. font-size: 16px;
  366. color: #000;
  367. font-weight: bold;
  368. margin-bottom: 10px;
  369. }
  370. </style>
  371. <style lang="scss">
  372. .page_checkPersonal {
  373. .cell {
  374. text-align: center;
  375. }
  376. }
  377. </style>