123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686 |
- import { Component, ElementRef, Output, Input, OnInit, EventEmitter } from '@angular/core';
- import { HttpHeaders, HttpRequest, HttpClient } from "@angular/common/http";
- import host from "../../../assets/js/http";
- import { NzMessageService } from "ng-zorro-antd";
- import { MainService } from '../../services/main.service';
- import {
- FormBuilder,
- Validators,
- FormGroup,
- FormControl,
- } from "@angular/forms";
- import { format, startOfDay, endOfDay, subDays} from "date-fns";
- import { ToolService } from "../../services/tool.service";
- import { DomSanitizer } from '@angular/platform-browser';
- @Component({
- selector: 'app-pathology-detail',
- templateUrl: './pathology-detail.component.html',
- styleUrls: ['./pathology-detail.component.less']
- })
- export class PathologyDetailComponent implements OnInit {
-
- @Output() pathologyCancel = new EventEmitter();
- @Input() surgeryId: string;
- @Input() patientId: string;
-
- constructor(
- private http: HttpClient,
- private message: NzMessageService,
- private mainService: MainService,
- private fb: FormBuilder,
- private tool: ToolService,
- private sanitizer: DomSanitizer
- ) { }
-
- specimenLookData:any=[
- {
- name:'通用-头颈部-口腔-黏膜活检',
- },
- {
- name:'通用-头颈部-口腔-黏膜活检',
- },
- {
- name:'通用-头颈部-口腔-黏膜活检',
- },
- {
- name:'通用-头颈部-口腔-黏膜活检',
- }
- ]
- stepLength:any = 0;
- btnLoading:boolean = false;
- validateForm: FormGroup; //新增/编辑表单
- validateSpecimenForm: FormGroup; //选择标本表单
- validatePrintForm: FormGroup;
- specimenData:any=[]; //标本类型
- isDeptLoading:boolean = false;
- specimenModal:boolean = false; //选择标本状态
- isSpinning:boolean = false; //页面加载状态
- detailsData:any;
- specimenList:any=[]; //已选标本
- placeIndex:any = null;
- systemIndex:any = null;
- apparatusIndex:any = null;
- specimenNameIndex:any = null;
- placeList:any=[]; //位置来源数据
- systemList:any=[]; //系统数据
- apparatusList:any=[]; //器官数据
- specimenNameList:any=[]; //标本名称数据
- promptContent: string; //操作提示框提示信息
- ifSuccess: boolean; //操作成功/失败
- promptInfo: string; //操作结果提示信息
- promptModalShow: boolean; //操作提示框是否展示
- specimenModalShow: boolean; //操作提示框是否展示
- type:any = '未打印';
- notModal:boolean = false;
- hosId:any;
- pathologyLogs:any //日志
- printLoading:boolean = false;
- printData:any = [];
- project:any = [];
-
- ngOnInit() {
- this.hosId = this.tool.getCurrentHospital().id;
- // this.initForm()
- this.fetchDataList()
- }
-
- // 补打
- submitPrint(){
- let that = this
- let data: any = {
- pathologyForm:{
- ...this.detailsData,
- surgeryId: this.surgeryId || "",
- patientId: this.patientId || "",
- hosId: this.hosId || ""
- }
- };
- delete data.pathologyForm.patientDTO
- delete data.pathologyForm.surgeryDeptDTO
- delete data.pathologyForm.surgeryDoctorDTO
- delete data.pathologyForm.specimenGenre
- this.printLoading = true;
- this.mainService
- .pathologyPrint(data)
- .subscribe((res:any) => {
- if(res.status==200){
- let arr = res.data;
- if(arr.applyBarCode){
- arr.applyBarCode = this.sanitizer.bypassSecurityTrustResourceUrl(arr.applyBarCode)
- }
- for(let i of arr.specimenList){
- i.barCode = this.sanitizer.bypassSecurityTrustResourceUrl(i.barCode)
- }
- that.printLoading = false;
- that.printData = arr;
- setTimeout(() => {
- const printContent = document.getElementById("report");
- const WindowPrt = window.open("", "", "width=100,height=1000");
- WindowPrt.document.body.innerHTML = printContent.innerHTML;
- setTimeout(_=>{
- WindowPrt.document.close();
- WindowPrt.focus();
- WindowPrt.print();
- WindowPrt.close();
- that.hideModal();
- },500)
- }, 500);
- }else{
- this.message.error(res.msg)
- }
- });
- }
-
- // 返回
- closeDetailMoadl(){
- this.pathologyCancel.emit()
- }
-
- // 初始化新增form表单
- // initForm() {
- // this.validateForm = this.fb.group({
- // intraoperativeRapidity: [1, [Validators.required]],
- // specimenGenre: [null, [Validators.required]],
- // intraoperativeFindings: [null, [Validators.required]],
- // surgicalPlan: [null, [Validators.required]],
- // specimenNum: [null,[Validators.required]],
- // takePart: [null, [Validators.required]]
- // });
- // }
-
- // 获取详情
- fetchDataList(){
- let data = {
- idx: 0,
- sum: 9999,
- pathologyForm: {
- surgeryId: this.surgeryId || "",
- patientId: this.patientId || "",
- hosId: this.hosId || "" ,
- },
- };
- this.isSpinning = true;
- this.mainService
- .getFetchDataList("data", "pathologyForm", data)
- .subscribe((data) => {
- this.isSpinning = false;
- this.detailsData = data.list[0];
- this.pathologyLogs = data.list[0].formLogDTOS
- this.stepLength = this.pathologyLogs.length
- if(this.detailsData.pathologyInspectDTOS){
- for(let i of this.detailsData.pathologyInspectDTOS){
- this.project.push(i.inspectProject.name)
- }
- this.project = this.project.join('、')
- }
- // if(this.detailsData.surgicalPlan){
- // this.validateForm.controls.surgicalPlan.setValue(this.detailsData.surgicalPlan);
- // }
- // if(this.detailsData.intraoperativeFindings){
- // this.validateForm.controls.intraoperativeFindings.setValue(this.detailsData.intraoperativeFindings);
- // }
- this.getSampleData()
- });
- }
-
- // // 获取标本类型
- // getDicData(){
- // this.mainService.getDictionary("list", "pathology_specimen_type").subscribe((res) => {
- // this.specimenData = res
- // });
- // }
-
- // // 获取标本-位置来源
- // getSourceData(){
- // this.mainService.getDictionary("list", "pathology_position").subscribe((res) => {
- // this.placeList = res
- // });
- // }
-
- // // 获取标本-系统
- // getSysData(){
- // let postData: any = {
- // idx: 0,
- // sum: 9999,
- // dictionaryTree: {
- // level: 1,
- // key: 'pathology_specimen',
- // deleted: 0,
- // },
- // };
- // this.mainService
- // .getFetchDataList("simple/data", "dictionaryTree", postData)
- // .subscribe((data) => {
- // this.systemList = data.list;
- // });
- // }
-
- // // 获取标本-器官
- // getApparatusData(id,item,type){
- // let postData: any = {
- // idx: 0,
- // sum: 9999,
- // dictionaryTree: {
- // level: 2,
- // parent:id,
- // key: 'pathology_specimen',
- // deleted: 0,
- // },
- // };
- // this.mainService
- // .getFetchDataList("simple/data", "dictionaryTree", postData)
- // .subscribe((data) => {
- // if(data.list.length>0){
- // this.apparatusList = data.list;
- // if(type=='edit'){
- // setTimeout(_=>{
- // let index3 = this.apparatusList.findIndex(i=>i.id==item.organ.id)
- // this.apparatusIndex = index3
- // this.apparatusId = Number(item.organ.id);
- // },100)
- // }
- // }else{
- // this.message.info('暂无数据')
- // }
- // });
- // }
-
- // // 获取标本-标本名称
- // getSpNameData(id,item,type){
- // let postData: any = {
- // idx: 0,
- // sum: 9999,
- // dictionaryTree: {
- // level: 3,
- // parent:id,
- // key: 'pathology_specimen',
- // deleted: 0,
- // },
- // };
- // this.mainService
- // .getFetchDataList("simple/data", "dictionaryTree", postData)
- // .subscribe((data) => {
- // this.specimenNameList = data.list;
- // this.specimenNameList.push({
- // name:'其他',
- // id:'qita'
- // })
- // if(type=='edit'){
- // if(item.sample){
- // this.validateSpecimenForm = this.fb.group({
- // remark: [null, [Validators.required]]
- // });
- // setTimeout(_=>{
- // let index4 = this.specimenNameList.findIndex(i=>i.id==item.sample.id)
- // this.specimenNameIndex = index4
- // this.specimenNameName = item.sample.name
- // this.specimenNameId = Number(item.sample.id);
- // },100)
- // }else{
- // this.validateSpecimenForm = this.fb.group({
- // remark: [null, [Validators.required]],
- // specimenName: [null, [Validators.required]]
- // });
- // this.specimenNameIndex = this.specimenNameList.length-1
- // this.specimenNameName = 'qita'
- // this.validateSpecimenForm.controls.specimenName.setValue(item.specimenName);
- // }
- // setTimeout(_=>{
- // this.validateSpecimenForm.controls.remark.setValue(item.remark);
- // this.specimenModal = true
- // },50)
- // }
- // });
- // }
-
- // // 删除标本
- // delModal:boolean = false
- // coopId:any;
- // specimenDel(e,item,index){
- // this.delModal = true
- // this.coopId = item.id
- // }
-
- // // 确定删除
- // confirmDel(){
- // this.mainService
- // .coopTypeConfig(
- // "rmvData",
- // "pathologySpecimen",
- // [this.coopId]
- // )
- // .subscribe((data) => {
- // this.btnLoading = false;
- // this.delModal = false;
- // this.getSampleData()
- // if (data.status==200) {
- // this.showSpecimenModal("删除", true, "");
- // } else {
- // this.showSpecimenModal("删除", false, data.data[0].msg);
- // }
- // });
- // }
- // // 确定删除
- // hideDelModal() {
- // this.delModal = false;
- // }
-
- // // 编辑标本
- // specimenDetailId:any = null;
- // specimenEdit(e,item,index){
- // this.specimenDetailId = item.id
- // let index1 = this.placeList.findIndex(i=>i.id==item.partSource.id)
- // this.placeIndex = index1
- // this.placeId = Number(item.partSource.id)
- // let index2 = this.systemList.findIndex(i=>i.id==item.system.id)
- // this.systemIndex = index2
- // this.systemId = Number(item.system.id)
- // this.getApparatusData(item.system.id,item,'edit')
- // this.getSpNameData(item.organ.id,item,'edit')
- // }
-
- // // 选择标本
- // openSpecimen(){
- // this.validateSpecimenForm = this.fb.group({
- // remark: [null, [Validators.required]]
- // });
- // this.specimenDetailId = null;
- // this.placeIndex = null;
- // this.systemIndex = null;
- // this.apparatusIndex = null;
- // this.specimenNameIndex = null;
- // this.placeId = null;
- // this.systemId = null;
- // this.apparatusId = null;
- // this.specimenNameId = null;
- // this.placeList=[]; //位置来源数据
- // this.systemList=[]; //系统数据
- // this.apparatusList=[]; //器官数据
- // this.specimenNameList=[]; //标本名称数据
- // this.getSourceData()
- // this.getSysData()
- // this.specimenModal = true
- // }
-
- // // 选择位置来源
- // placeId:any = null;
- // placeClick(e,item,index){
- // this.placeId = item.id
- // this.placeIndex = index
- // }
-
- // // 选择系统
- // systemId:any = null;
- // systemClick(e,item,index){
- // this.systemId = Number(item.id)
- // this.systemIndex = index
- // this.apparatusList = [];
- // this.apparatusId = null;
- // this.apparatusIndex = null;
- // this.getApparatusData(item.id,{},'select')
- // }
-
- // // 选择器官
- // apparatusId:any = null;
- // apparatusClick(e,item,index){
- // this.apparatusId = Number(item.id)
- // this.apparatusIndex = index
- // this.specimenNameList = [];
- // this.specimenNameId = null;
- // this.specimenNameIndex = null;
- // this.getSpNameData(item.id,{},'select')
- // }
-
- // // 选择标本名称
- // specimenNameId:any = null;
- // specimenNameName:any = null;
- // specimenNameClick(e,item,index){
- // this.specimenNameIndex = index
- // let remark = this.validateSpecimenForm.value.remark
- // if(item.id == 'qita'){
- // this.validateSpecimenForm = this.fb.group({
- // remark: [remark?remark:null, [Validators.required]],
- // specimenName: [null, [Validators.required]]
- // });
- // this.specimenNameId = 'null'
- // this.specimenNameName = 'qita'
- // }else{
- // this.validateSpecimenForm = this.fb.group({
- // remark: [remark?remark:null, [Validators.required]],
- // });
- // this.specimenNameId = item.id
- // this.specimenNameName = item.name
- // }
- // }
-
- // // 保存标本
- // btnSpLoading:boolean = false;
- // submitSpecimen(){
- // if(this.placeIndex==null){
- // this.message.error('请选择位置来源')
- // return
- // }
- // if(this.systemIndex==null){
- // this.message.error('请选择系统')
- // return
- // }
- // if(this.apparatusIndex==null){
- // this.message.error('请选择器官')
- // return
- // }
- // if(this.specimenNameIndex==null){
- // this.message.error('请选择标本名称')
- // return
- // }
- // for (const i in this.validateSpecimenForm.controls) {
- // this.validateSpecimenForm.controls[i].markAsDirty();
- // this.validateSpecimenForm.controls[i].updateValueAndValidity();
- // }
- // if (this.validateSpecimenForm.invalid) return;
- // let data = {
- // pathologyFormId:this.detailsData.id,
- // partSource:{
- // id:this.placeId
- // },
- // system:{
- // id:this.systemId
- // },
- // organ:{
- // id:this.apparatusId
- // },
- // sample:{
- // id:this.specimenNameId
- // },
- // hosId:this.hosId,
- // specimenName:null,
- // id:'',
- // remark:this.validateSpecimenForm.value.remark
- // };
- // if(this.specimenNameName == 'qita'){
- // delete data.sample
- // data.specimenName = this.validateSpecimenForm.value.specimenName
- // }else{
- // data.specimenName = this.specimenNameName
- // }
- // let queryType = null
- // if(this.specimenDetailId){
- // queryType = 'updData'
- // data.id = this.specimenDetailId
- // }else{
- // queryType = 'addData'
- // delete data.id
- // }
- // this.btnSpLoading = true;
- // this.mainService
- // .simplePost(queryType, "pathologySpecimen", data)
- // .subscribe((res) => {
- // this.btnSpLoading = false;
- // if (res.status == 200) {
- // this.showSpecimenModal("操作", true, "");
- // } else {
- // this.showSpecimenModal("操作", false, res.msg);
- // }
- // });
- // }
-
- // 获取标本列表
- getSampleData(){
- let data={
- idx: 0,
- sum: 9999,
- pathologySpecimen:{
- pathologyFormId:this.detailsData.id
- }
- }
- this.mainService
- .getFetchDataList("data", "pathologySpecimen", data)
- .subscribe((res) => {
- this.specimenList = res.list
- });
- }
-
- hideSpecimenModal(){
- this.specimenModal = false
- }
-
- hideNotModal(){
- this.notModal = false
- }
-
- // 日期选择
- // startDate: string; //时间开始
- // formChangeDate(result?): void {
- // this.startDate = format(result[0], 'yyyy-MM-dd HH:mm:ss');
-
- // }
-
- //未打印提交
- // submitPrintForm(): void{
- // for (const i in this.validatePrintForm.controls) {
- // this.validatePrintForm.controls[i].markAsDirty();
- // this.validatePrintForm.controls[i].updateValueAndValidity();
- // }
- // if (this.validatePrintForm.invalid) return;
-
- // let data: any = {
- // pathologyForm:{
- // ...this.validateForm.value,
- // ...this.detailsData,
- // inVitroTime:this.validatePrintForm.value.inVitroTime,
- // surgeryId: this.surgeryId || "",
- // patientId: this.patientId || "",
- // hosId: this.hosId || "" ,
- // handoverUserId:this.handoverUserId,
- // specimenType:{
- // id:this.validateForm.value.specimenGenre
- // }
- // }
- // };
- // delete data.pathologyForm.patientDTO
- // delete data.pathologyForm.surgeryDeptDTO
- // delete data.pathologyForm.surgeryDoctorDTO
- // delete data.pathologyForm.specimenGenre
- // this.printLoading = true;
- // this.mainService
- // .pathologyPrint(data)
- // .subscribe((res:any) => {
- // console.log(5555,res)
- // this.hideModal()
- // this.printData = res.data;
- // this.printLoading = false;
- // setTimeout(() => {
- // const printContent = document.getElementById("report");
- // const WindowPrt = window.open("", "", "width=100,height=1000");
- // WindowPrt.document.write(printContent.innerHTML);
- // WindowPrt.document.close();
- // WindowPrt.focus();
- // WindowPrt.print();
- // WindowPrt.close();
- // }, 500);
- // });
- // }
-
- // // 监听工号数据
- // handoverUserId:any = null;
- // numberChange(e){
- // if(e.length < 3) {
- // this.validatePrintForm.controls.name.setValue('');
- // return
- // }
- // let data = {
- // idx: 0,
- // sum: 9999,
- // user: {
- // account: e || "",
- // hospital: { id: this.hosId || "" }
- // },
- // };
- // this.mainService
- // .getFetchDataList("data", "user", data)
- // .subscribe((data) => {
- // if(data.list.length>0){
- // this.validatePrintForm.controls.name.setValue(data.list[0].name);
- // this.handoverUserId = data.list[0].id
- // }else{
- // this.validatePrintForm.controls.name.setValue('');
- // this.handoverUserId =null
- // }
- // });
- // }
-
- // printData:any;
- // submitForm(): void{
- // var that = this;
- // for (const i in that.validateForm.controls) {
- // that.validateForm.controls[i].markAsDirty();
- // that.validateForm.controls[i].updateValueAndValidity();
- // }
- // if (that.validateForm.invalid) return;
- // if(this.detailsData.status.name=='未打印'){
- // this.notModal = true
- // this.validatePrintForm = this.fb.group({
- // inVitroTime: [null, [Validators.required]],
- // jobNumber: [null, [Validators.required]],
- // name:[null, [Validators.required]],
- // });
- // let date = new Date();
- // this.startDate = format(date, "yyyy-MM-dd HH:mm:ss")
- // this.validatePrintForm.controls.inVitroTime.setValue(this.startDate);
- // return
- // }
- // let data: any = {
- // pathologyForm:{
- // ...this.validateForm.value,
- // ...this.detailsData,
- // surgeryId: this.surgeryId || "",
- // patientId: this.patientId || "",
- // hosId: this.hosId || "" ,
- // specimenType:{
- // id:this.validateForm.value.specimenGenre
- // }
- // }
- // };
- // delete data.pathologyForm.patientDTO
- // delete data.pathologyForm.surgeryDeptDTO
- // delete data.pathologyForm.surgeryDoctorDTO
- // delete data.pathologyForm.specimenGenre
- // that.btnLoading = true;
- // that.mainService
- // .pathologyPrint(data)
- // .subscribe((res:any) => {
- // this.hideModal()
- // let arr = res.data;
- // that.printData = arr;
- // that.btnLoading = false;
- // setTimeout(() => {
- // const printContent = document.getElementById("report");
- // const WindowPrt = window.open("", "", "width=100,height=1000");
- // WindowPrt.document.write(printContent.innerHTML);
- // WindowPrt.document.close();
- // WindowPrt.focus();
- // WindowPrt.print();
- // WindowPrt.close();
-
- // }, 500);
- // });
- // }
-
- // 关闭标本
- closeSpecimenModel(){
- this.getSampleData()
- this.hideSpecimenModal()
- }
-
- closeModel(){
- this.hideModal()
- }
- hideModal(){
- this.pathologyCancel.emit()
- }
-
- // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
- showPromptModal(con, success, promptInfo?) {
- this.promptModalShow = false;
- this.promptContent = con;
- this.ifSuccess = success;
- this.promptInfo = promptInfo;
- setTimeout(() => {
- this.promptModalShow = true;
- }, 100);
- }
-
- showSpecimenModal(con, success, promptInfo?) {
- this.specimenModalShow = false;
- this.promptContent = con;
- this.ifSuccess = success;
- this.promptInfo = promptInfo;
- setTimeout(() => {
- this.specimenModalShow = true;
- }, 100);
- }
- }
|