businessData-detail-modal.component.ts 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
  2. import { MainService } from '../../services/main.service';
  3. import { ToolService } from 'src/app/services/tool.service';
  4. import { format, startOfDay, endOfDay } from 'date-fns';
  5. @Component({
  6. selector: 'app-businessData-detail-modal',
  7. templateUrl: './businessData-detail-modal.component.html',
  8. styleUrls: ['./businessData-detail-modal.component.less']
  9. })
  10. export class BusinessDataDetailModalComponent implements OnInit {
  11. // 切换科室,切换弹窗
  12. hosId;
  13. hsLoading = false;
  14. bloodList: any = [];// 血制品列表
  15. specimenList: any = [];// 标本列表
  16. inspectionRateStatisticsList: any = [];// 科室检查率统计列表
  17. pageIndex: number = 1;//表格当前页码
  18. pageSize: number = 5;//表格每页展示条数
  19. total: number = 0;//表格总数据量
  20. searchCriteria:any = {
  21. stype: 0,
  22. specimenDesc: 0,
  23. }
  24. @Input() show: Boolean;
  25. @Input() orderId: String;
  26. @Input() type: String = '';
  27. @Input() dataInfo: any;
  28. @Output() closeModelHs = new EventEmitter<any>();//1.组件暴露一个 EventEmitter 属性,当事件发生时,子组件利用该属性 emits(向上弹射)事件
  29. constructor(private mainService: MainService, private tool: ToolService) { }
  30. ngOnInit() {
  31. this.hosId = this.tool.getCurrentHospital().id;
  32. this.tabType = 1;
  33. switch(this.type){
  34. case 'blood':
  35. this.getBlood(1);
  36. break;
  37. case 'specimen':
  38. this.getSpecimen(1);
  39. this.getSpecimenType();
  40. this.getSpecimenDesc();
  41. break;
  42. case 'deptInspectionRateStatistics':
  43. this.getDeptInspectionRateStatistics(1);
  44. break;
  45. }
  46. }
  47. // 关闭弹窗
  48. hideModal() {
  49. this.closeModelHs.emit(JSON.stringify({ show: false }));//emits(向上弹射)事件
  50. }
  51. // 切换tab栏
  52. tabType: number = 1; //tab栏
  53. checkTab(type) {
  54. this.tabType = type;
  55. }
  56. // 切换标本类型下拉框
  57. selectStype(e){
  58. console.log(e);
  59. this.searchCriteria.specimenDesc = 0;
  60. this.getSpecimenDesc();
  61. this.getSpecimen(1);
  62. }
  63. // 切换标本类型下拉框
  64. selectDesc(e){
  65. console.log(e);
  66. this.getSpecimen(1);
  67. }
  68. // 分页获取数据
  69. getList(){
  70. switch(this.type){
  71. case 'blood':
  72. this.getBlood();
  73. break;
  74. case 'specimen':
  75. this.getSpecimen();
  76. break;
  77. case 'deptInspectionRateStatistics':
  78. this.getDeptInspectionRateStatistics();
  79. break;
  80. }
  81. }
  82. // 获取列表数据
  83. getBlood(idx?) {
  84. if (idx) {
  85. this.pageIndex = 1;
  86. }
  87. let postData = {
  88. "type": "blood",
  89. "orderId": this.orderId
  90. }
  91. this.hsLoading = true;
  92. this.mainService.checkData(postData).subscribe((data:any) => {
  93. this.hsLoading = false;
  94. this.bloodList = data.data ? data.data.all : [];
  95. this.pageSize = this.total = data.data ? data.data.all.length : 0;
  96. })
  97. }
  98. // 获取标本类型
  99. specimentTypeList: any[] = [{ id: 0, name: '全部' }];
  100. getSpecimenType() {
  101. this.mainService.getDictionary("list", "specimen_type").subscribe((data:any) => {
  102. let specimentTypeList = [{ id: 0, name: '全部' }];
  103. this.specimentTypeList = specimentTypeList.concat(data);
  104. })
  105. }
  106. // 获取检验项目
  107. specimenDescList: any[] = [{ id: 0, name: '', nameNum: '全部' }];
  108. id:number = 0;
  109. getSpecimenDesc() {
  110. let postData = {
  111. "hosId": this.hosId,
  112. "gdId": this.orderId,
  113. "stype": this.searchCriteria.stype || undefined,
  114. };
  115. this.mainService.specimenCount(postData).subscribe((data:any) => {
  116. data.data = data.data || [];
  117. let specimenDescList:any = [{ id: 0, name: '全部', nameNum: '全部' }];
  118. specimenDescList[0].nameNum = `全部(${data.total})`;
  119. this.specimenDescList = specimenDescList.concat( data.data.map(v => ({id: --this.id, name: v[0] || '', nameNum: (v[0] ? v[0].slice(0, 15) + (v[0].length >= 15 ? '...' : '') : '') + `(${v[1]})`})));
  120. })
  121. }
  122. // 获取标本列表
  123. getSpecimen(idx?) {
  124. if (idx) {
  125. this.pageIndex = 1;
  126. }
  127. let postData = {
  128. idx: this.pageIndex - 1,
  129. sum: this.pageSize,
  130. specimen: {
  131. orderBy: 'arrive_time desc',
  132. hosId: this.hosId,
  133. gdid: this.orderId,
  134. stype: this.searchCriteria.stype ? { id: this.searchCriteria.stype } : undefined,
  135. specimenDesc: this.searchCriteria.specimenDesc ? this.specimenDescList.find(v => v.id == this.searchCriteria.specimenDesc).name: undefined,
  136. }
  137. }
  138. this.hsLoading = true;
  139. this.mainService.getFetchDataList('simple/data','specimen',postData).subscribe(data => {
  140. this.hsLoading = false;
  141. this.specimenList = data.list || [];
  142. this.total = data.totalNum || 0;
  143. })
  144. }
  145. // 获取科室检查率统计-详情列表
  146. getDeptInspectionRateStatistics(idx?) {
  147. if (idx) {
  148. this.pageIndex = 1;
  149. }
  150. let postData:any = {
  151. idx: this.pageIndex - 1,
  152. sum: this.pageSize,
  153. }
  154. switch(this.dataInfo.type){
  155. case 'total':
  156. postData.deptId = this.dataInfo.data.deptId;
  157. postData.hosId = this.hosId;
  158. postData.startTime = this.dataInfo.searchDto.dateRange[0] ? format(startOfDay(this.dataInfo.searchDto.dateRange[0]), 'yyyy-MM-dd HH:mm:ss') : undefined;
  159. postData.endTime = this.dataInfo.searchDto.dateRange[1] ? format(endOfDay(this.dataInfo.searchDto.dateRange[1]), 'yyyy-MM-dd HH:mm:ss') : undefined;
  160. break;
  161. case 'noCheckCount':
  162. postData.deptId = this.dataInfo.data.deptId;
  163. postData.hosId = this.hosId;
  164. postData.startTime = this.dataInfo.searchDto.dateRange[0] ? format(startOfDay(this.dataInfo.searchDto.dateRange[0]), 'yyyy-MM-dd HH:mm:ss') : undefined;
  165. postData.endTime = this.dataInfo.searchDto.dateRange[1] ? format(endOfDay(this.dataInfo.searchDto.dateRange[1]), 'yyyy-MM-dd HH:mm:ss') : undefined;
  166. postData.reportInsState = 'noCheck';
  167. break;
  168. case 'checkCount':
  169. postData.deptId = this.dataInfo.data.deptId;
  170. postData.hosId = this.hosId;
  171. postData.startTime = this.dataInfo.searchDto.dateRange[0] ? format(startOfDay(this.dataInfo.searchDto.dateRange[0]), 'yyyy-MM-dd HH:mm:ss') : undefined;
  172. postData.endTime = this.dataInfo.searchDto.dateRange[1] ? format(endOfDay(this.dataInfo.searchDto.dateRange[1]), 'yyyy-MM-dd HH:mm:ss') : undefined;
  173. postData.reportInsState = 'check';
  174. break;
  175. case 'insCount':
  176. postData.deptId = this.dataInfo.data.deptId;
  177. postData.hosId = this.hosId;
  178. postData.startTime = this.dataInfo.searchDto.dateRange[0] ? format(startOfDay(this.dataInfo.searchDto.dateRange[0]), 'yyyy-MM-dd HH:mm:ss') : undefined;
  179. postData.endTime = this.dataInfo.searchDto.dateRange[1] ? format(endOfDay(this.dataInfo.searchDto.dateRange[1]), 'yyyy-MM-dd HH:mm:ss') : undefined;
  180. postData.reportInsState = 'inspect';
  181. break;
  182. }
  183. this.hsLoading = true;
  184. this.mainService.listMsgByMain("listInspect", postData).subscribe((data: any) => {
  185. this.hsLoading = false;
  186. this.inspectionRateStatisticsList = data.list || [];
  187. this.total = data.totalNum || 0;
  188. })
  189. }
  190. }