mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
fix endpoints
This commit is contained in:
parent
d7c6a7a77c
commit
6d422441ff
9 changed files with 16 additions and 16 deletions
|
|
@ -25,7 +25,7 @@ type Receta struct {
|
|||
PeriodoDeTratamiento string `json:"periodoDeTratamiento"`
|
||||
InstruccionesTratamiento string `json:"instruccionesTratamiento"`
|
||||
PeriodoDeValidez string `json:"periodoDeValidez"`
|
||||
DniPaciente string `json:"dniPaciente"`
|
||||
PatientDocumentNumber string `json:"patientDocumentNumber"`
|
||||
FechaDeAutorizacion string `json:"fechaDeAutorizacion"`
|
||||
Cantidad string `json:"cantidad"`
|
||||
ExpectedSupplyDuration string `json:"expectedSupplyDuration"`
|
||||
|
|
@ -42,7 +42,7 @@ type Vacuna struct {
|
|||
Manufacturer string `json:"manufacturer"`
|
||||
LotNumber string `json:"lotNumber"`
|
||||
ExpirationDate string `json:"expirationDate"` // como string ISO8601
|
||||
DniPaciente string `json:"dniPaciente"`
|
||||
PatientDocumentNumber string `json:"patientDocumentNumber"`
|
||||
Reactions string `json:"reactions"` // puede ser un string o una estructura si querés después
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ func (s *SmartContract) InitLedger(ctx contractapi.TransactionContextInterface)
|
|||
PeriodoDeTratamiento: "30 dias",
|
||||
InstruccionesTratamiento: "una por dia",
|
||||
PeriodoDeValidez: "1 anio",
|
||||
DniPaciente: "12345678",
|
||||
PatientDocumentNumber: "12345678",
|
||||
FechaDeAutorizacion: "2024-01-01T09:00:00Z",
|
||||
Cantidad: "5",
|
||||
ExpectedSupplyDuration: "2024-02-01T09:00:00Z",
|
||||
|
|
@ -82,7 +82,7 @@ func (s *SmartContract) InitLedger(ctx contractapi.TransactionContextInterface)
|
|||
PeriodoDeTratamiento: "60 dias",
|
||||
InstruccionesTratamiento: "dos por dia",
|
||||
PeriodoDeValidez: "2 anios",
|
||||
DniPaciente: "87654321",
|
||||
PatientDocumentNumber: "87654321",
|
||||
FechaDeAutorizacion: "2024-01-10T10:00:00Z",
|
||||
Cantidad: "10",
|
||||
ExpectedSupplyDuration: "2024-04-10T10:00:00Z",
|
||||
|
|
@ -291,7 +291,7 @@ func (s *SmartContract) GetRecetasPorDniYEstado(ctx contractapi.TransactionConte
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if receta.DniPaciente == dni && receta.Status == estado {
|
||||
if receta.PatientDocumentNumber == dni && receta.Status == estado {
|
||||
recetasFiltradas = append(recetasFiltradas, &receta)
|
||||
}
|
||||
}
|
||||
|
|
@ -367,7 +367,7 @@ func (s *SmartContract) GetVacunasPorDniYEstado(ctx contractapi.TransactionConte
|
|||
}
|
||||
|
||||
// Validamos que tenga un DNI y coincida
|
||||
if vacuna.DniPaciente != dni {
|
||||
if vacuna.PatientDocumentNumber != dni {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class RecetaController {
|
|||
System.out.println("\n--> Submit Transaction: CrearReceta");
|
||||
|
||||
String now = LocalDateTime.now().toString();
|
||||
String dni = receta.getDniPaciente();
|
||||
String dni = receta.getPatientDocumentNumber();
|
||||
String id = dni + now;
|
||||
String assetId = Hashing.sha256(id);
|
||||
receta.setId(assetId);
|
||||
|
|
@ -66,7 +66,7 @@ public class RecetaController {
|
|||
try {
|
||||
List<String> ids = requestBody.get("ids");
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
return new ResponseEntity<>(new ArrayList<>(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
List<Receta> recetas = recetaService.obtenerRecetasPorIds(ids);
|
||||
|
|
@ -119,7 +119,7 @@ public class RecetaController {
|
|||
dto.setPeriodoDeTratamiento(receta.getPeriodoDeTratamiento());
|
||||
dto.setInstruccionesTratamiento(receta.getInstruccionesTratamiento());
|
||||
dto.setPeriodoDeValidez(receta.getPeriodoDeValidez());
|
||||
dto.setDniPaciente(receta.getDniPaciente());
|
||||
dto.setPatientDocumentNumber(receta.getPatientDocumentNumber());
|
||||
dto.setFechaDeAutorizacion(receta.getFechaDeAutorizacion());
|
||||
dto.setCantidad(receta.getCantidad());
|
||||
dto.setExpectedSupplyDuration(receta.getExpectedSupplyDuration());
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class VacunaController {
|
|||
System.out.println("\n--> Submit Transaction: CrearVacuna");
|
||||
|
||||
String now = LocalDateTime.now().toString();
|
||||
String dni = vacuna.getDniPaciente();
|
||||
String dni = vacuna.getPatientDocumentNumber();
|
||||
String id = dni + now;
|
||||
String assetId = Hashing.sha256(id);
|
||||
vacuna.setId(assetId);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class Receta {
|
|||
private String periodoDeTratamiento;
|
||||
private String instruccionesTratamiento;
|
||||
private String periodoDeValidez;
|
||||
private String dniPaciente;
|
||||
private String patientDocumentNumber;
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private String fechaDeAutorizacion;
|
||||
private int cantidad;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class RecetaDto {
|
|||
private String periodoDeTratamiento;
|
||||
private String instruccionesTratamiento;
|
||||
private String periodoDeValidez;
|
||||
private String dniPaciente;
|
||||
private String patientDocumentNumber;
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private String fechaDeAutorizacion;
|
||||
private int cantidad;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class Vacuna {
|
|||
private String manufacturer;
|
||||
private String lotNumber;
|
||||
private String expirationDate;
|
||||
private String dniPaciente;
|
||||
private String patientDocumentNumber;
|
||||
private String reactions;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@ public class VacunaDto {
|
|||
private String manufacturer;
|
||||
private String lotNumber;
|
||||
private String expirationDate;
|
||||
private String dniPaciente;
|
||||
private String patientDocumentNumber;
|
||||
private String reactions;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public class RecetaService {
|
|||
receta.getPeriodoDeTratamiento(),
|
||||
receta.getInstruccionesTratamiento(),
|
||||
receta.getPeriodoDeValidez(),
|
||||
receta.getDniPaciente(),
|
||||
receta.getPatientDocumentNumber(),
|
||||
receta.getFechaDeAutorizacion(),
|
||||
Integer.toString(receta.getCantidad()),
|
||||
receta.getExpectedSupplyDuration());
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ public class VacunaService {
|
|||
vacuna.getManufacturer(),
|
||||
vacuna.getLotNumber(),
|
||||
vacuna.getExpirationDate(),
|
||||
vacuna.getDniPaciente(),
|
||||
vacuna.getPatientDocumentNumber(),
|
||||
vacuna.getReactions()
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue