feat: implement doctor schedule module, add detail fields to doctor profile, and integrate new appointment API client

This commit is contained in:
2026-07-23 19:34:02 +07:00
parent 107e191e93
commit 6d84979f03
111 changed files with 5138 additions and 288 deletions
@@ -0,0 +1,62 @@
package com.sisvietnamvn.web;
import com.sisvietnamvn.web.domain.Doctor;
import com.sisvietnamvn.web.domain.Specialty;
import com.sisvietnamvn.web.service.DoctorService;
import com.sisvietnamvn.web.service.SpecialtyService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
@SpringBootTest(classes = SisvietnamvnApp.class)
public class CsvImportTest {
@Autowired
private DoctorService doctorService;
@Autowired
private SpecialtyService specialtyService;
@Test
public void runImport() throws Exception {
String file = "/home/x79/sisvietnamvn_01/Media/HÌNH ẢNH BÁC SĨ NGỒI PHÒNG KHÁM/ALL_IMAGES/DANH SÁCH BÁC SĨ NGỒI PHÒNG KHÁM.csv";
List<String> lines = Files.readAllLines(Paths.get(file));
int updatedCount = 0;
for (int i = 1; i < lines.size(); i++) {
String line = lines.get(i);
String[] parts = line.split(",", -1);
if (parts.length >= 7) {
String doctorCode = parts[1].trim();
String specialtyName = parts[6].trim();
if (!doctorCode.isEmpty() && !specialtyName.isEmpty()) {
Optional<Doctor> docOpt = doctorService.findByDoctorCode(doctorCode);
if (docOpt.isPresent()) {
Doctor doctor = docOpt.get();
// Find or create specialty
List<Specialty> specs = specialtyService.findAll();
Specialty spec = specs.stream().filter(s -> s.getName().equalsIgnoreCase(specialtyName)).findFirst().orElse(null);
if (spec == null) {
spec = new Specialty();
spec.setName(specialtyName);
spec = specialtyService.save(spec);
}
doctor.setSpecialty(spec);
doctorService.save(doctor);
updatedCount++;
}
}
}
}
System.out.println("=========================================");
System.out.println("IMPORT SUCCESS! UPDATED " + updatedCount + " DOCTORS.");
System.out.println("=========================================");
}
}
@@ -39,7 +39,7 @@ class WebConfigurerTest {
env = new MockEnvironment();
props = new JHipsterProperties();
webConfigurer = new WebConfigurer(env, props);
webConfigurer = new WebConfigurer(env, props, org.mockito.Mockito.mock(com.sisvietnamvn.web.hook.HookManager.class));
}
@Test