Skip to content

Commit

Permalink
Merge pull request #196 from NiV-Labs/develop
Browse files Browse the repository at this point in the history
Develop into master
  • Loading branch information
viniciosarodrigues committed Jan 12, 2021
2 parents 25b42f2 + 5d39a75 commit d3c8a30
Show file tree
Hide file tree
Showing 7 changed files with 324 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import br.com.nivlabs.gp.models.dto.CustomerInfoDTO;
import br.com.nivlabs.gp.models.dto.FileDTO;
import br.com.nivlabs.gp.models.dto.InstituteDTO;
import br.com.nivlabs.gp.service.InstituteService;
Expand Down Expand Up @@ -53,4 +54,12 @@ public ResponseEntity<Void> uploadCustomInfoCrypto(@RequestBody(required = true)
instituteService.checkAndActiveLicense(file);
return ResponseEntity.ok().build();
}

@ApiOperation(nickname = "institute-customerinfo-create-update", value = "Cria ou altera informações da instituição")
@PostMapping
@PreAuthorize("hasAnyRole('INSTITUTO_ESCRITA', 'ADMIN')")
public ResponseEntity<Void> create(@RequestBody(required = true) CustomerInfoDTO request) {
instituteService.createOrUpdate(request);
return ResponseEntity.ok().build();
}
}
68 changes: 51 additions & 17 deletions src/main/java/br/com/nivlabs/gp/models/domain/Institute.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ public class Institute implements Serializable {
@Column(name = "TIPO_DE_INSTITUICAO")
private String instituteType;

@Column(name = "GESTAO")
private String management;
@Column(name = "GESTOR")
private String managerName;

@Column(name = "TELEFONE_GESTOR")
private String managerPhone;

@Column(name = "EMAIL_GESTOR")
private String managerMail;

@Column(name = "DATA_DE_REGISTRO")
private Date licenseDate;
Expand Down Expand Up @@ -224,14 +230,6 @@ public void setInstituteType(String instituteType) {
this.instituteType = instituteType;
}

public String getManagement() {
return management;
}

public void setManagement(String management) {
this.management = management;
}

public Date getLicenseDate() {
return licenseDate;
}
Expand Down Expand Up @@ -272,6 +270,30 @@ public void setEndDate(LocalDateTime endDate) {
this.endDate = endDate;
}

public String getManagerName() {
return managerName;
}

public void setManagerName(String managerName) {
this.managerName = managerName;
}

public String getManagerPhone() {
return managerPhone;
}

public void setManagerPhone(String managerPhone) {
this.managerPhone = managerPhone;
}

public String getManagerMail() {
return managerMail;
}

public void setManagerMail(String managerMail) {
this.managerMail = managerMail;
}

@Override
public int hashCode() {
final int prime = 31;
Expand All @@ -289,7 +311,9 @@ public int hashCode() {
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + ((legalNature == null) ? 0 : legalNature.hashCode());
result = prime * result + ((licenseDate == null) ? 0 : licenseDate.hashCode());
result = prime * result + ((management == null) ? 0 : management.hashCode());
result = prime * result + ((managerMail == null) ? 0 : managerMail.hashCode());
result = prime * result + ((managerName == null) ? 0 : managerName.hashCode());
result = prime * result + ((managerPhone == null) ? 0 : managerPhone.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((neighborhood == null) ? 0 : neighborhood.hashCode());
result = prime * result + ((phone == null) ? 0 : phone.hashCode());
Expand Down Expand Up @@ -375,10 +399,20 @@ public boolean equals(Object obj) {
return false;
} else if (!licenseDate.equals(other.licenseDate))
return false;
if (management == null) {
if (other.management != null)
if (managerMail == null) {
if (other.managerMail != null)
return false;
} else if (!management.equals(other.management))
} else if (!managerMail.equals(other.managerMail))
return false;
if (managerName == null) {
if (other.managerName != null)
return false;
} else if (!managerName.equals(other.managerName))
return false;
if (managerPhone == null) {
if (other.managerPhone != null)
return false;
} else if (!managerPhone.equals(other.managerPhone))
return false;
if (name == null) {
if (other.name != null)
Expand Down Expand Up @@ -429,8 +463,8 @@ public String toString() {
+ corporativeName + ", legalNature=" + legalNature + ", street=" + street + ", addressNumber=" + addressNumber
+ ", complement=" + complement + ", postalCode=" + postalCode + ", state=" + state + ", neighborhood=" + neighborhood
+ ", city=" + city + ", phone=" + phone + ", dependency=" + dependency + ", instituteType=" + instituteType
+ ", management=" + management + ", licenseDate=" + licenseDate + ", userOfRegister=" + userOfRegister + ", key=" + key
+ ", startDate=" + startDate + ", endDate=" + endDate + "]";
+ ", managerName=" + managerName + ", managerPhone=" + managerPhone + ", managerMail=" + managerMail + ", licenseDate="
+ licenseDate + ", userOfRegister=" + userOfRegister + ", key=" + key + ", startDate=" + startDate + ", endDate=" + endDate
+ "]";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
package br.com.nivlabs.gp.models.domain;

import java.io.Serializable;
import java.time.LocalDateTime;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonFormat;

import br.com.nivlabs.gp.enums.ScheduleStatus;

@Table(name = "AGENDA_CONFIRMACAO")
public class WebScheduleConfirmation implements Serializable {

private static final long serialVersionUID = 3844020943998908507L;

@Id
@Column(name = "ID", length = 100)
private String id;

@Column(name = "DATA_HORA_RESP")
private LocalDateTime dateTimeResponse;

@Column(name = "IP_RESPOSTA", length = 45)
private String originIp;

@Column(name = "SITUACAO", length = 45)
@Enumerated(EnumType.STRING)
private ScheduleStatus status;

@Column(name = "DATA_CRIACAO")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private LocalDateTime createdAt;

@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.DETACH)
@JoinColumn(name = "ID_PACIENTE")
private Patient patient;

@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.DETACH)
@JoinColumn(name = "ID_RESPONSVEL")
private Responsible responsible;

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public LocalDateTime getDateTimeResponse() {
return dateTimeResponse;
}

public void setDateTimeResponse(LocalDateTime dateTimeResponse) {
this.dateTimeResponse = dateTimeResponse;
}

public String getOriginIp() {
return originIp;
}

public void setOriginIp(String originIp) {
this.originIp = originIp;
}

public ScheduleStatus getStatus() {
return status;
}

public void setStatus(ScheduleStatus status) {
this.status = status;
}

public LocalDateTime getCreatedAt() {
return createdAt;
}

public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}

public Patient getPatient() {
return patient;
}

public void setPatient(Patient patient) {
this.patient = patient;
}

public Responsible getResponsible() {
return responsible;
}

public void setResponsible(Responsible responsible) {
this.responsible = responsible;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((createdAt == null) ? 0 : createdAt.hashCode());
result = prime * result + ((dateTimeResponse == null) ? 0 : dateTimeResponse.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((originIp == null) ? 0 : originIp.hashCode());
result = prime * result + ((patient == null) ? 0 : patient.hashCode());
result = prime * result + ((responsible == null) ? 0 : responsible.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
WebScheduleConfirmation other = (WebScheduleConfirmation) obj;
if (createdAt == null) {
if (other.createdAt != null)
return false;
} else if (!createdAt.equals(other.createdAt))
return false;
if (dateTimeResponse == null) {
if (other.dateTimeResponse != null)
return false;
} else if (!dateTimeResponse.equals(other.dateTimeResponse))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (originIp == null) {
if (other.originIp != null)
return false;
} else if (!originIp.equals(other.originIp))
return false;
if (patient == null) {
if (other.patient != null)
return false;
} else if (!patient.equals(other.patient))
return false;
if (responsible == null) {
if (other.responsible != null)
return false;
} else if (!responsible.equals(other.responsible))
return false;
if (status != other.status)
return false;
return true;
}

@Override
public String toString() {
return "WebScheduleConfirmation [id=" + id + ", dateTimeResponse=" + dateTimeResponse + ", originIp=" + originIp + ", status="
+ status + ", createdAt=" + createdAt + ", patient=" + patient + ", responsible=" + responsible + "]";
}

}
Loading

0 comments on commit d3c8a30

Please sign in to comment.