mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-18 07:55:10 +00:00
Funciona el post y el get de recetas a hyper ledger
This commit is contained in:
parent
3f29718c54
commit
de9e40a101
4 changed files with 24 additions and 48 deletions
|
|
@ -16,22 +16,22 @@ type SmartContract struct {
|
|||
// Insert struct field in alphabetic order => to achieve determinism across languages
|
||||
// golang keeps the order when marshal to json but doesn't order automatically
|
||||
type Asset struct {
|
||||
ID string `json:"ID"`
|
||||
Owner string `json:"Owner"`
|
||||
PrescripcionAnteriorId string `json:"PrescripcionAnteriorId"`
|
||||
Status string `json:"Status"`
|
||||
StatusChange string `json:"StatusChange"` // Changed to string
|
||||
Prioridad string `json:"Prioridad"`
|
||||
ID string `json:"id"`
|
||||
Owner string `json:"owner"`
|
||||
PrescripcionAnteriorId string `json:"prescripcionAnteriorId"`
|
||||
Status string `json:"status"`
|
||||
StatusChange string `json:"statusChange"`
|
||||
Prioridad string `json:"prioridad"`
|
||||
Medicacion string `json:"medicacion"`
|
||||
Razon string `json:"Razon"`
|
||||
Notas string `json:"Notas"`
|
||||
PeriodoDeTratamiento string `json:"PeriodoDeTratamiento"`
|
||||
InstruccionesTratamiento string `json:"InstruccionesTratamiento"`
|
||||
PeriodoDeValidez string `json:"PeriodoDeValidez"`
|
||||
DniPaciente string `json:"DniPaciente"`
|
||||
FechaDeAutorizacion string `json:"FechaDeAutorizacion"` // Changed to string
|
||||
Cantidad string `json:"Cantidad"`
|
||||
ExpectedSupplyDuration string `json:"ExpectedSupplyDuration"` // Changed to string
|
||||
Razon string `json:"razon"`
|
||||
Notas string `json:"notas"`
|
||||
PeriodoDeTratamiento string `json:"periodoDeTratamiento"`
|
||||
InstruccionesTratamiento string `json:"instruccionesTratamiento"`
|
||||
PeriodoDeValidez string `json:"periodoDeValidez"`
|
||||
DniPaciente string `json:"dniPaciente"`
|
||||
FechaDeAutorizacion string `json:"fechaDeAutorizacion"`
|
||||
Cantidad string `json:"cantidad"`
|
||||
ExpectedSupplyDuration string `json:"expectedSupplyDuration"`
|
||||
}
|
||||
|
||||
// InitLedger adds a base set of assets to the ledger
|
||||
|
|
|
|||
|
|
@ -76,12 +76,6 @@
|
|||
<version>1.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>2.15.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -4,45 +4,27 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Receta {
|
||||
@JsonProperty("ID")
|
||||
private String id;
|
||||
@JsonProperty("Owner")
|
||||
private String owner;
|
||||
@JsonProperty("PrescripcionAnteriorId")
|
||||
private String prescripcionAnteriorId;
|
||||
@JsonProperty("Status")
|
||||
private String status;
|
||||
@JsonProperty("StatusChange")
|
||||
private LocalDateTime statusChange;
|
||||
@JsonProperty("Prioridad")
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
private String statusChange;
|
||||
private String prioridad;
|
||||
@JsonProperty("Medicacion")
|
||||
private String medicacion;
|
||||
@JsonProperty("Razon")
|
||||
private String razon;
|
||||
@JsonProperty("Notas")
|
||||
private String notas;
|
||||
@JsonProperty("PeriodoDeTratamiento")
|
||||
private String periodoDeTratamiento;
|
||||
@JsonProperty("InstruccionesTratamiento")
|
||||
private String instruccionesTratamiento;
|
||||
@JsonProperty("PeriodoDeValidez")
|
||||
private String periodoDeValidez;
|
||||
@JsonProperty("DniPaciente")
|
||||
private String dniPaciente;
|
||||
@JsonProperty("FechaDeAutorizacion")
|
||||
private LocalDate fechaDeAutorizacion;
|
||||
@JsonProperty("Cantidad")
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private String fechaDeAutorizacion;
|
||||
private int cantidad;
|
||||
@JsonProperty("ExpectedSupplyDuration")
|
||||
private LocalDate expectedSupplyDuration;
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private String expectedSupplyDuration;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public class RecetaService {
|
|||
receta.getOwner(),
|
||||
receta.getPrescripcionAnteriorId(),
|
||||
receta.getStatus(),
|
||||
receta.getStatusChange().toString(),
|
||||
receta.getStatusChange(),
|
||||
receta.getPrioridad(),
|
||||
receta.getMedicacion(),
|
||||
receta.getRazon(),
|
||||
|
|
@ -139,9 +139,9 @@ public class RecetaService {
|
|||
receta.getInstruccionesTratamiento(),
|
||||
receta.getPeriodoDeValidez(),
|
||||
receta.getDniPaciente(),
|
||||
receta.getFechaDeAutorizacion().toString(),
|
||||
receta.getFechaDeAutorizacion(),
|
||||
Integer.toString(receta.getCantidad()),
|
||||
receta.getExpectedSupplyDuration().toString()
|
||||
receta.getExpectedSupplyDuration()
|
||||
);
|
||||
|
||||
System.out.println("*** Transaction committed successfully");
|
||||
|
|
|
|||
Loading…
Reference in a new issue