fail chemo ongoing

This commit is contained in:
vanilia
2025-12-09 12:11:05 +07:00
parent cef816ecb6
commit 45d883e0b7
10 changed files with 62 additions and 205 deletions
@@ -56,11 +56,12 @@ func Create(input e.CreateDto) (*d.Data, error) {
// update chemoPlan
if chemoPlan != nil {
chemoPlan.Encounter_Id = input.Encounter_Id
if err = ucp.UpdateData(chemoPlan, &event, tx); err != nil {
return err
}
}
// get detail for sync
soapiData, err := ReadDetailData(e.ReadDetailDto{
Id: data.Id,
@@ -134,7 +134,7 @@ func getChemo(patientId uint, event *pl.Event) (*ecp.ChemoProtocol, error) {
tx = tx.Model(&ecp.ChemoProtocol{}).
Joins(`"ChemoPlan" cp ON cp."Protocol_Id" = "ChemoProtocol"."Id"`).
Where(`"Patient.Id" = ? AND (cp.Status = ? OR cp.Status IS NULL)`, patientId, ere.SPCPlanned).
Where(`"Patient.Id" = ? AND cp."Status" = ?`, patientId, ere.SPCPlanned).
Preload("ChemoPlans", func(db *gorm.DB) *gorm.DB {
return tx.Order(`"Id" ASC`).Limit(1)
}).