123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963 |
- 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 { DomSanitizer } from '@angular/platform-browser';
- import {
- FormBuilder,
- Validators,
- FormGroup,
- FormControl,
- } from "@angular/forms";
- import { format, startOfDay, endOfDay, subDays} from "date-fns";
- import { ToolService } from "../../services/tool.service";
- @Component({
- selector: 'app-pathology-add',
- templateUrl: './pathology-add.component.html',
- styleUrls: ['./pathology-add.component.less']
- })
- export class PathologyAddComponent implements OnInit {
-
- @Output() pathologyCancel = new EventEmitter();
- @Input() surgeryId: string;
- @Input() patientId: string;
- @Input() detailId: string;
-
- constructor(
- private http: HttpClient,
- private message: NzMessageService,
- private mainService: MainService,
- private fb: FormBuilder,
- private tool: ToolService,
- private sanitizer: DomSanitizer
- ) { }
-
- btnLoading:boolean = false;
- validateForm: FormGroup; //新增/编辑表单
- validateSpecimenForm: FormGroup; //选择标本表单
- validatePrintForm: FormGroup;
- specimenData:any=[]; //标本类型
- projectData: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;
- startDate: string; //离体开始
-
- ngOnInit() {
- this.hosId = this.tool.getCurrentHospital().id;
- this.initForm()
- this.fetchDataList()
- }
-
- // 初始化新增form表单
- initForm() {
- this.validateForm = this.fb.group({
- pathologyFormType: [null, [Validators.required]],
- specimenGenre: [null, [Validators.required]],
- intraoperativeFindings: [null, []],
- project: [null, [Validators.required]],
- // surgicalPlan: [null, [Validators.required]],
- specimenNum: [null,[Validators.required]],
- takePart: [null, [Validators.required]]
- });
- }
-
- statusValue:any = 1;
- 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)
- this.mainService.getFetchData("data", "pathologyForm", this.detailId)
- .subscribe((data) => {
- this.isSpinning = false;
- this.detailsData = data.data;
- if(this.detailsData.status){
- this.statusValue = this.detailsData.status.value
- }
- if(this.detailsData.pathologyFormType!=null){
- this.validateForm.controls.pathologyFormType.setValue(this.detailsData.pathologyFormType);
- }
- if(this.detailsData.intraoperativeFindings){
- this.validateForm.controls.intraoperativeFindings.setValue(this.detailsData.intraoperativeFindings);
- }
- this.getProDicData()
- this.getDicData()
- this.getSampleData('load')
- this.getSourceData()
- this.getSysData()
- });
- }
-
- // 获取标本类型
- getDicData(){
- this.mainService.getDictionary("list", "specimen_type").subscribe((res) => {
- this.specimenData = res.filter(i=>i.extra1 == 'pathologySpecimen')
- if(this.detailsData.specimenType){
- this.validateForm.controls.specimenGenre.setValue(this.detailsData.specimenType.id);
- }
- if(this.detailsData.specimenNum){
- this.validateForm.controls.specimenNum.setValue(this.detailsData.specimenNum);
- }
- if(this.detailsData.takePart){
- this.validateForm.controls.takePart.setValue(this.detailsData.takePart);
- }
- });
- }
-
- // 获取检验项目
- getProDicData(){
- this.mainService.getDictionary("list", "pathology_inspect_type").subscribe((res) => {
- this.projectData = res
- let arr = []
- if(this.detailsData.pathologyInspectDTOS){
- for(let i of this.detailsData.pathologyInspectDTOS){
- arr.push(i.inspectProject.id)
- }
- this.validateForm.controls.project.setValue(arr);
- }
- });
- }
-
- // 获取标本-位置来源
- 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, []],
- specimenName: [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);
- this.validateSpecimenForm.controls.specimenName.setValue(item.specimenName);
- },100)
- }else{
- // this.validateSpecimenForm = this.fb.group({
- // remark: [null, []],
- // 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, []],
- specimenName:[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.specimenNameName = null;
- 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.specimenNameList = [];
- this.specimenNameId = null;
- this.specimenNameIndex = null;
- this.specimenNameName = null;
- if(this.validateSpecimenForm.value.specimenName){
- this.validateSpecimenForm.controls.specimenName.setValue('')
- }
- 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.specimenNameName = null;
- if(this.validateSpecimenForm.value.specimenName){
- this.validateSpecimenForm.controls.specimenName.setValue('')
- }
- 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, []],
- // specimenName: [null, [Validators.required]]
- // });
- // this.specimenNameId = 'null'
- // this.specimenNameName = 'qita'
- // }else{
- // this.validateSpecimenForm = this.fb.group({
- // remark: [remark?remark:null, []],
- // });
- this.specimenNameId = item.id
- this.specimenNameName = item.name
- if(this.validateSpecimenForm.value.specimenName && this.validateSpecimenForm.value.specimenName.length){
- if(item.name.length+this.validateSpecimenForm.value.specimenName.length>14){
- this.message.error('字符长度不能超过15个')
- return
- }
- }
-
- // if(this.validateSpecimenForm.value.specimenName && this.validateSpecimenForm.value.specimenName.length>15){
- // this.message.error('字符长度不能超过15个')
- // return
- // }
- let namn = null
- if(this.validateSpecimenForm.value.specimenName){
- namn = this.validateSpecimenForm.value.specimenName + '、'+ item.name
- }else{
- namn = item.name
- }
- this.validateSpecimenForm.controls.specimenName.setValue(namn);
- // }
- }
-
- // 保存标本
- btnSpLoading:boolean = false;
- addSpLoading:boolean = false;
- addMadal:boolean = false;
- submitSpecimen(type){
- 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;
- if(this.validateSpecimenForm.value.specimenName.length>15){
- this.message.error('字符长度不能超过15个')
- return
- }
- if(type==2){
- this.addMadal = true
- 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:this.validateSpecimenForm.value.specimenName,
- 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.message.success('操作成功')
- setTimeout(_=>{
- this.closeSpecimenModel()
- },200)
- // this.showSpecimenModal("操作", true, "");
- } else {
- this.message.error(res.msg)
- // this.showSpecimenModal("操作", false, res.msg);
- }
- });
- }
-
- // 新增下一个标本
- confirmAdd(){
- this.addSpLoading = true
- 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:this.validateSpecimenForm.value.specimenName,
- 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.message.success('操作成功')
- this.validateSpecimenForm = this.fb.group({
- remark: [null, []],
- specimenName:[null, [Validators.required]],
- });
- this.specimenDetailId = null;
- this.specimenNameIndex = null;
- this.specimenNameId = null;
-
- this.placeIndex = null;
- this.placeId = null;
-
- // this.specimenNameList=[]; //标本名称数据
- // this.specimenNameName = null;
-
- this.addSpLoading = false;
- this.addMadal = false;
-
- } else {
- this.message.error(res.msg)
- }
- });
- }
-
- // 新增下一个标本
- hideAddModal() {
- this.addMadal = false;
- }
-
- //清空标本名称
- emptData(e){
- e.stopPropagation()
- this.validateSpecimenForm.controls.specimenName.setValue('')
- }
-
- // 监听输入字数
- specimenNameLength:any=0;
- specimenInput(e){
- if(e.length>15){
- return
- }
- this.specimenNameLength = e.length
- }
-
- // 获取标本列表
- getSampleData(type){
- let data={
- idx: 0,
- sum: 9999,
- pathologySpecimen:{
- pathologyFormId:this.detailsData.id
- }
- }
- this.mainService
- .getFetchDataList("data", "pathologySpecimen", data)
- .subscribe((res) => {
- this.specimenList = res.list
- if(type!='load'){
- let str = []
- if(res.list.length>0){
- for(let i of res.list){
- str.push(i.system.name + '-' + i.organ.name)
- }
- const newStr = new Set(str);
- const newData = Array.from(newStr);
- this.validateForm.controls.takePart.setValue(newData.join('、'));
- }
- }
- this.validateForm.controls.specimenNum.setValue(this.specimenList.length);
- });
- }
-
- hideSpecimenModal(){
- this.getSampleData('')
- this.specimenModal = false
- }
-
- hideNotModal(){
- this.notModal = false
- }
-
- // 日期选择
- formChangeDate(result?): void {
- this.startDate = format(result, 'yyyy-MM-dd HH:mm:ss');
- }
-
- //未打印提交
- printLoading:boolean = false;
- submitPrintForm(): void{
- let that = this
- for (const i in this.validatePrintForm.controls) {
- this.validatePrintForm.controls[i].markAsDirty();
- this.validatePrintForm.controls[i].updateValueAndValidity();
- }
- if (this.validatePrintForm.invalid) return;
- let ids = this.validateForm.value.project.join(',')
- let data: any = {
- pathologyForm:{
- ...this.detailsData,
- ...this.validateForm.value,
- inVitroTime:this.startDate,
- surgeryId: this.surgeryId || "",
- patientId: this.patientId || "",
- hosId: this.hosId || "" ,
- handoverUserId:this.handoverUserId,
- pathologyInspectIds:ids,
- specimenType:{
- id:this.validateForm.value.specimenGenre
- }
- },
- operation:'',
- pathologySpecimenIds:'',
- };
- delete data.pathologyForm.patientDTO
- delete data.pathologyForm.surgeryDeptDTO
- delete data.pathologyForm.surgeryDoctorDTO
- delete data.pathologyForm.specimenGenre
- data.pathologyForm.specimenNum = this.specimenList.length
- if(this.operation=='addPrint' || this.operation=='wholePrint'){
- data.operation = this.operation
- data.pathologySpecimenIds = this.pathologySpecimenIds
- }else{
- delete data.operation
- delete data.pathologySpecimenIds
- }
- this.printLoading = true;
- this.mainService
- .pathologyPrint(data)
- .subscribe((res:any) => {
- if(res.status==200){
- let arr = res.data;
- // if(arr.specimenList.length==1){
- // for(let i of arr.specimenList){
- // i.applyCode = data.pathologyForm.applyCode
- // }
- // }
- if(arr.applyBarCode){
- arr.applyBarCode = this.sanitizer.bypassSecurityTrustResourceUrl(arr.applyBarCode)
- }
- for(let i of arr.specimenList){
- i.applyCode = arr.applyCode?arr.applyCode:data.pathologyForm.applyCode
- 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)
- }
- });
- }
-
- // 监听工号数据
- handoverUserId:any = null;
- numberChange(e){
- if(e.length < 3) {
- this.validatePrintForm.controls.name.setValue('');
- return
- }
- let query = {
- account: e
- };
- this.mainService
- .jobSearch(query)
- .subscribe((data:any) => {
- if(data.status==200){
- this.validatePrintForm.controls.name.setValue(data.userName);
- this.handoverUserId = data.userId
- }else{
- this.validatePrintForm.controls.name.setValue('');
- this.handoverUserId = null
- // this.message.error(data.data)
- }
- });
- }
-
- // 暂存/保存
- zcLoading:any = false;
- temporary(type): 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.specimenList.length==0){
- this.message.error('标本不能为空')
- return
- }
- let data = {
- pathologyForm:{
- ...this.detailsData,
- ...this.validateForm.value,
- surgeryId: this.surgeryId || "",
- patientId: this.patientId || "",
- hosId: this.hosId || "" ,
- pathologyInspectIds: this.validateForm.value.project.join(','),
- specimenType:{
- id:this.validateForm.value.specimenGenre
- }
- }
- };
- data.pathologyForm.specimenNum = this.specimenList.length
- delete data.pathologyForm.patientDTO
- delete data.pathologyForm.surgeryDeptDTO
- delete data.pathologyForm.surgeryDoctorDTO
- delete data.pathologyForm.specimenGenre
- that.zcLoading = true;
- this.mainService.pathologyOperation(data,'storage').subscribe((res:any) => {
- that.zcLoading = false;
- if(res.status==200){
- this.message.success('操作成功')
- this.hideModal()
- }else{
- this.message.error(res.msg)
- }
- });
- }
-
- // 追加打印
- zjLoading:any = false;
- operation:any;
- pathologySpecimenIds:any;
- superaddition(): void{
- var that = this;
- this.operation = 'addPrint'
- for (const i in that.validateForm.controls) {
- that.validateForm.controls[i].markAsDirty();
- that.validateForm.controls[i].updateValueAndValidity();
- }
- if (that.validateForm.invalid) return;
- if(this.specimenList.length==0){
- this.message.error('标本不能为空')
- return
- }
- that.mainService.pathologyCheckPrint('pathologyForm',this.detailsData.id).subscribe((res:any)=>{
- if(res.ids){
- this.notModal = true
- this.pathologySpecimenIds = res.ids
- 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);
- }else{
- this.message.info('无新标本需要打印')
- }
- })
- }
-
- // 打印标本/全量
- printData:any;
- submitForm(type): void{
- var that = this;
- this.operation = 'wholePrint'
- for (const i in that.validateForm.controls) {
- that.validateForm.controls[i].markAsDirty();
- that.validateForm.controls[i].updateValueAndValidity();
- }
- if (that.validateForm.invalid) return;
- if(this.specimenList.length==0){
- this.message.error('标本不能为空')
- return
- }
- if(type=='all'){
- that.mainService.pathologyCheckPrint('pathologyForm',this.detailsData.id).subscribe((res:any)=>{
- if(res.ids){
- this.notModal = true
- this.pathologySpecimenIds = res.ids
- 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);
- }else{
- let data: any = {
- pathologyForm:{
- ...this.detailsData,
- ...this.validateForm.value,
- surgeryId: this.surgeryId || "",
- patientId: this.patientId || "",
- hosId: this.hosId || "" ,
- pathologyInspectIds: this.validateForm.value.project.join(','),
- specimenType:{
- id:this.validateForm.value.specimenGenre
- }
- },
- operation:'',
- pathologySpecimenIds:'',
- };
- data.pathologyForm.specimenNum = this.specimenList.length
- if(this.operation=='addPrint' || this.operation=='wholePrint'){
- data.operation = this.operation
- data.pathologySpecimenIds = this.pathologySpecimenIds
- }else{
- delete data.operation
- delete data.pathologySpecimenIds
- }
- delete data.pathologyForm.patientDTO
- delete data.pathologyForm.surgeryDeptDTO
- delete data.pathologyForm.surgeryDoctorDTO
- delete data.pathologyForm.specimenGenre
- that.btnLoading = true;
- this.printFun(data)
- }
- })
- }else{
- this.operation = 'null'
- if(this.statusValue==1){
- 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.detailsData,
- ...this.validateForm.value,
- surgeryId: this.surgeryId || "",
- patientId: this.patientId || "",
- hosId: this.hosId || "" ,
- specimenType:{
- id:this.validateForm.value.specimenGenre
- }
- }
- };
- data.pathologyForm.specimenNum = this.specimenList.length
- delete data.pathologyForm.patientDTO
- delete data.pathologyForm.surgeryDeptDTO
- delete data.pathologyForm.surgeryDoctorDTO
- delete data.pathologyForm.specimenGenre
- this.btnLoading = true;
- this.printFun(data)
- }
- }
-
- // 打印
- printFun(data){
- 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.applyCode = arr.applyCode?arr.applyCode:data.pathologyForm.applyCode
- i.barCode = this.sanitizer.bypassSecurityTrustResourceUrl(i.barCode)
- }
- this.btnLoading = false;
- this.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();
- this.hideModal();
- },500)
- }, 500);
- }else{
- this.message.error(res.msg)
- }
- });
- }
-
- // 关闭标本
- 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);
- }
- }
|