specimen-search.component.ts 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. import { Component, OnInit } from "@angular/core";
  2. import { MainService } from "../../services/main.service";
  3. import { ToolService } from "../../services/tool.service";
  4. import { Subject } from "rxjs";
  5. import { debounceTime } from "rxjs/operators";
  6. @Component({
  7. selector: "app-specimen-search",
  8. templateUrl: "./specimen-search.component.html",
  9. styleUrls: ["./specimen-search.component.less"],
  10. })
  11. export class SpecimenSearchComponent implements OnInit {
  12. constructor(private mainService: MainService, private tool: ToolService) {}
  13. searchCriteria = {
  14. //搜索条件
  15. scode: "",
  16. parent: "",
  17. hospital: null,
  18. department: null,
  19. speState: null,
  20. };
  21. types = []; // 类型列表(搜索框)
  22. departmentSearch = []; // 院区下的科室列表(搜索框)
  23. allHospital: any = []; //院区下拉框
  24. listOfData: any[] = []; //表格数据
  25. pageIndex: number = 1; //表格当前页码
  26. pageSize: number = 10; //表格每页展示条数
  27. listLength: number = 10; //表格总数据量
  28. checkOptionsOne: Array<any> = [
  29. { label: "服务中心收取", value: "0", checked: false },
  30. ];
  31. changeInpSubject = new Subject();
  32. ngOnInit() {
  33. this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  34. this.searchDepartment(v[0], v[1]);
  35. });
  36. this.getAllHospital();
  37. }
  38. // 表格筛选
  39. log(value: object[]): void {
  40. console.log(value);
  41. this.getList(0);
  42. }
  43. // 搜索类型
  44. isLoading1 = false;
  45. searchTypes() {
  46. this.isLoading1 = true;
  47. this.mainService.getDictionary("list", "speState").subscribe((res) => {
  48. this.isLoading1 = false;
  49. this.types = res;
  50. });
  51. }
  52. // 清空标本
  53. delModal: boolean = false; //删除模态框
  54. tipsMsg1: string; //提示框信息
  55. showDelModal(tipsMsg1: string) {
  56. this.delModal = true;
  57. this.tipsMsg1 = tipsMsg1;
  58. }
  59. // 隐藏删除框
  60. hideDelModal() {
  61. this.delModal = false;
  62. }
  63. // 确认
  64. btnLoading: boolean = false; //提交按钮loading状态
  65. confirmDel() {
  66. this.btnLoading = true;
  67. this.mainService
  68. .coopDataM("api/emptySpecimenData", { hosId: 1, isEmpty: "ok" })
  69. .subscribe((data) => {
  70. this.btnLoading = false;
  71. this.delModal = false;
  72. if (data.status == 200) {
  73. this.showPromptModal("标本清空", true, "");
  74. } else {
  75. this.showPromptModal("标本清空", false, "");
  76. }
  77. });
  78. }
  79. // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
  80. promptContent: string; //操作提示框提示信息
  81. ifSuccess: boolean; //操作成功/失败
  82. promptInfo: string; //操作结果提示信息
  83. promptModalShow: boolean; //操作提示框是否展示
  84. showPromptModal(con, success, promptInfo?) {
  85. this.promptModalShow = false;
  86. this.promptContent = con;
  87. this.ifSuccess = success;
  88. this.promptInfo = promptInfo;
  89. setTimeout(() => {
  90. this.promptModalShow = true;
  91. }, 100);
  92. this.getList(0);
  93. }
  94. // 查看标本历史记录
  95. historyPromptModalShow = false; //标本历史记录弹窗开关
  96. scode = ""; //查看历史记录携带
  97. viewSpecimenHistory(data) {
  98. this.scode = data.scode;
  99. this.historyPromptModalShow = true;
  100. }
  101. // 关闭标本历史记录弹窗
  102. closeModelHistory(e) {
  103. this.historyPromptModalShow = JSON.parse(e).show;
  104. }
  105. // 重置
  106. reset() {
  107. this.searchCriteria = {
  108. //搜索条件
  109. scode: "",
  110. parent: "",
  111. hospital: this.allHospital[0] ? this.allHospital[0]["id"] + "" : null,
  112. department: null,
  113. speState: null,
  114. };
  115. this.getList(1);
  116. }
  117. // 选择院区
  118. changeHospital(id, type) {
  119. if (type === "search") {
  120. this.searchCriteria.department = null;
  121. }
  122. }
  123. // 打开搜索框
  124. changeSearch1(flag) {
  125. if (flag) {
  126. this.searchTypes();
  127. }
  128. }
  129. // 打开搜索框
  130. changeSearch(flag) {
  131. if (flag) {
  132. this.changeInp("no", "search");
  133. }
  134. }
  135. // 边输边搜节流阀
  136. isLoading = false;
  137. changeInp(dept, type) {
  138. if (!dept) {
  139. return;
  140. }
  141. if (dept === "no") {
  142. dept = "";
  143. }
  144. this.isLoading = true;
  145. this.changeInpSubject.next([dept, type]);
  146. }
  147. // 搜索科室
  148. snum = 0;
  149. searchDepartment(dept, type) {
  150. let data = {
  151. department: {
  152. dept,
  153. hospital: {
  154. id: this.searchCriteria.hospital,
  155. },
  156. },
  157. idx: 0,
  158. sum: 20,
  159. };
  160. this.snum++;
  161. this.mainService
  162. .getFetchDataList("data", "department", data)
  163. .subscribe((data) => {
  164. this.snum--;
  165. if (data.status == 200) {
  166. if (type === "search") {
  167. if (this.snum === 0) {
  168. this.isLoading = false;
  169. }
  170. this.departmentSearch = data.list;
  171. }
  172. }
  173. });
  174. }
  175. // 获取所有院区
  176. /**
  177. *
  178. *
  179. * @memberof RoundRobinComponent
  180. */
  181. getAllHospital() {
  182. this.allHospital = [this.tool.getCurrentHospital()];
  183. this.searchCriteria.hospital = this.tool.getCurrentHospital().id + "";
  184. this.getList(1);
  185. this.changeHospital(this.searchCriteria.hospital, "search");
  186. }
  187. // 表格数据
  188. loading1 = false;
  189. getList(type) {
  190. if (type == 1) {
  191. this.pageIndex = 1;
  192. }
  193. let postData = {
  194. idx: this.pageIndex - 1,
  195. sum: this.pageSize,
  196. specimen: {
  197. receivedMark: this.checkOptionsOne[0].checked ? 1 : undefined,
  198. hosId: this.searchCriteria.hospital,
  199. sickRoom: this.searchCriteria.department
  200. ? {
  201. id: this.searchCriteria.department,
  202. }
  203. : undefined,
  204. scode: !this.searchCriteria.scode
  205. ? undefined
  206. : this.searchCriteria.scode,
  207. keyWord: !this.searchCriteria.parent
  208. ? undefined
  209. : this.searchCriteria.parent,
  210. speState: this.searchCriteria.speState
  211. ? { id: this.searchCriteria.speState }
  212. : undefined,
  213. },
  214. };
  215. this.loading1 = true;
  216. this.mainService
  217. .getFetchDataList("simple/data", "specimen", postData)
  218. .subscribe((data) => {
  219. this.loading1 = false;
  220. if (data.status == 200) {
  221. this.listOfData = data.list;
  222. this.listLength = data.totalNum;
  223. }
  224. });
  225. }
  226. }