Skip to content

Commit

Permalink
UI Navigation -> UWL: Add new workitems #2768
Browse files Browse the repository at this point in the history
  • Loading branch information
shral committed Oct 28, 2020
1 parent efc8483 commit 285d14c
Show file tree
Hide file tree
Showing 7 changed files with 369 additions and 14 deletions.
5 changes: 5 additions & 0 deletions dcm4chee-arc-ui2/src/app/constants/globalvar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,11 @@ export class Globalvar {
filterKey:"00380014.00400031",
description:$localize `:@@issuer_of_admission_id_sequence:Issuer of Admission ID Sequence`,
placeholder:$localize `:@@issuer_of_admission_id_sequence:Issuer of Admission ID Sequence`
},{
tag:"checkbox",
filterKey:"template",
text:$localize `:@@template:Template`,
description:$localize `:@@template:Template`
},{
tag:"code-selector",
codes:[
Expand Down
45 changes: 33 additions & 12 deletions dcm4chee-arc-ui2/src/app/study/study/study.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {Observable} from "rxjs";
import {DiffDicom} from "../../models/diff-dicom";
import {UwlDicom} from "../../models/uwl-dicom";
import {filter, map, switchMap} from "rxjs/operators";
import {ModifyUpsComponent} from "../../widgets/dialogs/modify-ups/modify-ups.component";


@Component({
Expand Down Expand Up @@ -2622,34 +2623,54 @@ export class StudyComponent implements OnInit, OnDestroy, AfterContentChecked{
_.set(workitem.attrs, "00741000.Value[0]","SCHEDULED")
}
this.service.initEmptyValue(workitem.attrs);
this.dialogRef = this.dialog.open(EditPatientComponent, {
this.dialogRef = this.dialog.open(ModifyUpsComponent, {
height: 'auto',
width: '90%'
});

this.dialogRef.componentInstance.mode = "create";
this.dialogRef.componentInstance.patient = workitem;
this.dialogRef.componentInstance.mode = mode;
this.dialogRef.componentInstance.ups = workitem;
this.dialogRef.componentInstance.dropdown = this.service.getArrayFromIod(iod);
this.dialogRef.componentInstance.iod = this.service.replaceKeyInJson(iod, 'items', 'Value');
this.dialogRef.componentInstance.saveLabel = config.saveLabel;
this.dialogRef.componentInstance.titleLabel = config.titleLabel;
this.dialogRef.afterClosed().subscribe(ok => {
if (ok){
console.log("ok",ok);
j4care.removeKeyFromObject(workitem.attrs, ["required","enum", "multi"]);
if(mode === "create" || mode === "clone"){
this.service.modifyUPS(undefined,workitem.attrs,this.studyWebService).subscribe(res=>{
let createUPS = (template?:boolean)=>{
let object = _.cloneDeep(workitem);
if(template){
if(_.hasIn(object,"attrs.00404005")){
delete object.attrs["00404005"];
}
successfullMessage = $localize `:@@ups_template_created_successfully:UPS template created successfully!`;
}
this.service.modifyUPS(undefined,object.attrs,this.studyWebService, template).subscribe(res=>{
this.appService.showMsg(successfullMessage);
},err=>{
workitem = undefined;
if(!template){
workitem = undefined;
}
this.httpErrorHandler.handleError(err);
});
};
if(ok.templateParameter && (ok.templateParameter === "no_template" || ok.templateParameter === "template_too")){
if(mode === "create" || mode === "clone"){
createUPS();
}else{
this.service.modifyUPS(this.service.getUpsWorkitemUID(originalWorkitemObject.attrs), workitem.attrs, this.studyWebService).subscribe(res=>{
this.appService.showMsg(successfullMessage);
},err=>{
_.assign(workitem, originalWorkitemObject);
this.httpErrorHandler.handleError(err);
});
}
if(ok.templateParameter === "template_too"){
createUPS(true);
}
}else{
this.service.modifyUPS(this.service.getUpsWorkitemUID(originalWorkitemObject.attrs), workitem.attrs, this.studyWebService).subscribe(res=>{
this.appService.showMsg(successfullMessage);
},err=>{
_.assign(workitem, originalWorkitemObject);
this.httpErrorHandler.handleError(err);
});
createUPS(true);
}
}else{
_.assign(workitem, originalWorkitemObject);
Expand Down
4 changes: 2 additions & 2 deletions dcm4chee-arc-ui2/src/app/study/study/study.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3332,7 +3332,7 @@ export class StudyService {
return throwError({error: $localize `:@@error_on_getting_needed_webapp:Error on getting the needed WebApp (with one of the web service classes "DCM4CHEE_ARC_AET" or "PAM")`});
}))
}
modifyUPS(workitemUID: string, object, deviceWebservice: StudyWebService) {
modifyUPS(workitemUID: string, object, deviceWebservice: StudyWebService, template?:boolean) {
// const url = this.getModifyPatientUrl(deviceWebservice);
let header = new HttpHeaders({'Content-Type': 'application/dicom+json','Accept': 'application/dicom+json'});
return this.getModifyUPSUrl(deviceWebservice)
Expand All @@ -3343,7 +3343,7 @@ export class StudyService {
return this.$http.post(`${url}/${workitemUID}`, object, header);
} else {
//Create new patient
return this.$http.post(url, object, header);
return this.$http.post(url + j4care.objToUrlParams({template:template},true), object, header);
}
}
return throwError({error: $localize `:@@error_on_getting_needed_webapp:Error on getting the needed WebApp (with one of the web service classes "DCM4CHEE_ARC_AET" or "PAM")`});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<div class="vex vex-theme-os edit-ups" xmlns="http://www.w3.org/1999/html">
<div class="vex-dialog-form" (click)="checkClick($event)">
<h3 [innerHtml]="titleLabel"></h3>
<input autocomplete="off" id="addPatientAttribut" class="addPatientAttribut" [(ngModel)]="addPatientAttribut" i18n-placeholder="@@placeholder.add_new_attribute" placeholder="Add new attribute" (click)="opendropdown = !opendropdown" (keydown)="pressedKey($event)"/>
<div class="overlay" *ngIf="opendropdown" (click)="opendropdown = false"></div>
<div id="dropdown" class="dropdown study_edit" *ngIf="opendropdown">
<a class="dropdown_element" name="{{m.code}}" *ngFor="let m of dropdown | search:addPatientAttribut" (click)="$event.preventDefault();addAttribute(m.code, ups)">({{m.codeComma}}) {{m.name}}</a>
</div>
<div mat-dialog-content>
<iod-form-generator [externalInternalAetMode]="externalInternalAetMode" [object]="ups.attrs" [prefix]="" [mode]="mode" [iod]="iod" (keydown)="dialogKeyHandler($event,dialogRef)"></iod-form-generator>
</div>
<div class="template_checkboxes">
<label for="no_template">
<input id="no_template" type="radio" name="template_radio" [(ngModel)]="templateParameter" value="no_template"> Don't create template
</label>
<label for="template_too">
<input id="template_too" type="radio" name="template_radio" [(ngModel)]="templateParameter" value="template_too"> Create template too
</label>
<label for="only_template">
<input id="only_template" type="radio" name="template_radio" [(ngModel)]="templateParameter" value="only_template"> Create only template
</label>
</div>
<div class="dialogbuttons">
<button class="save" type="button" (click)="dialogRef.close({object:ups,templateParameter:templateParameter})">{{saveLabel}}</button>
<button class="cancle" type="button" (click)="dialogRef.close(null)" i18n="@@CANCEL">CANCEL</button>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.template_checkboxes{
margin:10px 0;
float: left;
width: 100%;
border: 1px solid #ccc;
padding: 10px;
label{
float: left;
width: 100%;
}
}
Loading

0 comments on commit 285d14c

Please sign in to comment.