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