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