Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sửa lỗi xóa người tiêm chủng và dublicate giấy hẹn tiêm #154

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 18 additions & 5 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,9 @@
+ Thêm thời gian vào trang hiển thị danh sách lịch tiêm
+ fix cơ chế lấy danh sách lịch tiêm chủng trong ds gọi tiêm (size = -1, page = -1)
+ Thêm cột tên lịch
+ Sửa lại filter toàn bộ trong màn hình gọi tiêm
+ Sửa lại filter toàn bộ trong màn hình gọi tiêm


#update 21/10/2021
+ Sửa lỗi xóa không hết người tiêm chủng trong danh sách ban đầu
+ Fix lỗi dublicate phiếu hẹn
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ public long countNguoiTiemChung(String cmtcccd, Integer nhomdoituong, String nga

public NguoiTiemChung findBycongDanID(long id);

public List<NguoiTiemChung> findBycongDanIDReturnList(long id);

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ public List<PhieuHenTiem> searchPhieuHenTiem(long lichTiemChungId, long caTiemCh

public PhieuHenTiem update(PhieuHenTiem phieuHenTiem);

public List<PhieuHenTiem> findExist(long lichTiemChungId, long nguoiTiemChungId);
}

Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,14 @@ public void deleteNguoiTiemChung(String reqBody) {
long id = GetterUtil.getLong(strId, 0);
if (id > 0) {
NguoiTiemChung nguoiTiemChung = nguoiTiemChungService.findById(id);

if (nguoiTiemChung != null && nguoiTiemChung.getTinhTrangDangKi() == VaccomUtil.MOIDANGKY) {
try {
nguoiTiemChungService.deleteNguoiTiemChung(id);
List<NguoiTiemChung> listXoa = nguoiTiemChungService.findBycongDanIDReturnList(nguoiTiemChung.getCongDanID());
for(NguoiTiemChung nguoitiemChung1 :listXoa){
nguoiTiemChungService.deleteNguoiTiemChung(nguoitiemChung1.getId());
}

long congDanId = nguoiTiemChung.getCongDanID();
List<MuiTiemChung> muiTiemChungs = muiTiemChungService.findByCongDan_ID(congDanId);

Expand Down Expand Up @@ -1027,6 +1032,11 @@ public NguoiTiemChung findBycongDanID(long id) {
return nguoiTiemChungService.findBycongDanID(id);
}

@Override
public List<NguoiTiemChung> findBycongDanIDReturnList(long id) {
return nguoiTiemChungService.findBycongDanIDReturnList(id);
}

@Override
public NguoiTiemChung addNguoiTiemChung(String hoVaTen, String ngaySinh, int gioiTinh, String cmtcccd,
int nhomDoiTuong, String donViCongTac, String soDienThoai, String email, String soTheBHYT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ public PhieuHenTiem update(PhieuHenTiem phieuHenTiem) {
return phieuHenTiemService.update(phieuHenTiem);
}

@Override
public List<PhieuHenTiem> findExist(long lichTiemChungId, long nguoiTiemChungId) {
return phieuHenTiemService.findExist(lichTiemChungId, nguoiTiemChungId);
}


private final Log _log = LogFactory.getLog(PhieuHenTiemActionImpl.class);
}
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,19 @@ public ResponseEntity<?> deleteNguoiTiemChung(HttpServletRequest request, HttpSe
NguoiTiemChung nguoiTiemChung = nguoiTiemChungAction.findById(id);
long congDanId = nguoiTiemChung.getCongDanID();

boolean result = nguoiTiemChungAction.deleteNguoiTiemChung(id);

List<NguoiTiemChung> lst = nguoiTiemChungAction.findBycongDanIDReturnList(congDanId);

_log.info(lst.size());

boolean result = false;
for (NguoiTiemChung nguoiTiemChungEntity: lst) {
_log.info(nguoiTiemChungEntity.getId());
result = nguoiTiemChungAction.deleteNguoiTiemChung(nguoiTiemChungEntity.getId());
if(!result){
break;
}
}

if (result) {
List<MuiTiemChung> muiTiemChungs = muiTiemChungAction.findByCongDan_ID(congDanId);
Expand All @@ -836,11 +848,11 @@ public ResponseEntity<?> deleteNguoiTiemChung(HttpServletRequest request, HttpSe
}
}
;
// CongDan congDan = congDanAction.findByCongDanId(congDanId);
// _log.info("congDan :" + congDan);
// if(Validator.isNotNull(congDan)){
// congDanAction.deleteById(congDan.getId());
// }
CongDan congDan = congDanAction.findByCongDanId(congDanId);

if(Validator.isNotNull(congDan)){
congDanAction.deleteById(congDan.getId());
}

String msg = MessageUtil.getVNMessageText("nguoitiemchung.delete.success");

Expand Down Expand Up @@ -2062,39 +2074,49 @@ public ResponseEntity<?> addPhieuHenTiemList(HttpServletRequest request, HttpSer
for (Integer nguoiTiemChungID : NguoiTiemChungIdList) {
NguoiTiemChung nguoiTiemChung = nguoiTiemChungAction.findById(nguoiTiemChungID);

List<MuiTiemChung> muiTiemChungList = muiTiemChungAction.findByCongDan_ID(nguoiTiemChung.getCongDanID());
int lanTiem = 0;
if (Validator.isNull(muiTiemChungList)) {
lanTiem = 1;
} else {
lanTiem = muiTiemChungList.size() + 1;
}
// List<MuiTiemChung> muiTiemChungList = muiTiemChungAction.findByCongDan_ID(nguoiTiemChung.getCongDanID());
// int lanTiem = 0;
// if (Validator.isNull(muiTiemChungList)) {
// lanTiem = 1;
// } else {
// lanTiem = muiTiemChungList.size() + 1;
// }
// Fix cứng mũi tiêm = 3 (04/01/2022)
int lanTiem = 3;
List<PhieuHenTiem> findExist = phieuHenTiemAction.findExist(phieuHenTiemDto.LichTiemChungID, nguoiTiemChungID);

if (Validator.isNull(nguoiTiemChung)) {
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(MessageUtil.getVNMessageText("nguoiTiemChung.chitiet.not_found"));
}
PhieuHenTiem phieuHenTiem = new PhieuHenTiem();

phieuHenTiem.setGioHenTiem(lichTiemChung.getGioHenTiem());
phieuHenTiem.setLichTiemChungId(lichTiemChung.getId());
phieuHenTiem.setCaTiemChungId(0);
phieuHenTiem.setNgayHenTiem(lichTiemChung.getNgayBatDau());
phieuHenTiem.setNguoiTiemChungId(nguoiTiemChung.getId());
phieuHenTiem.setMaQR(VaccomUtil.generateQRCode("pht", 4));
phieuHenTiem.setLanTiem(lanTiem);
phieuHenTiem.setTinhTrangXacNhan(VaccomUtil.DUKIEN);
phieuHenTiem.setNgayCheckin(StringPool.BLANK);
phieuHenTiem.setThongTinCheckin(StringPool.BLANK);
phieuHenTiem.setGioDuocTiem(StringPool.BLANK);
phieuHenTiem.setTrieuChungSauTiem(StringPool.BLANK);
phieuHenTiem.setDieuTriTrieuChung(StringPool.BLANK);

phieuHenTiemAction.addPhieuHenTiem(phieuHenTiem);

if(findExist.size() == 0 || findExist.isEmpty()){
PhieuHenTiem phieuHenTiem = new PhieuHenTiem();

phieuHenTiem.setGioHenTiem(lichTiemChung.getGioHenTiem());
phieuHenTiem.setLichTiemChungId(lichTiemChung.getId());
phieuHenTiem.setCaTiemChungId(0);
phieuHenTiem.setNgayHenTiem(lichTiemChung.getNgayBatDau());
phieuHenTiem.setNguoiTiemChungId(nguoiTiemChung.getId());
phieuHenTiem.setMaQR(VaccomUtil.generateQRCode("pht", 4));
phieuHenTiem.setLanTiem(lanTiem);
phieuHenTiem.setTinhTrangXacNhan(VaccomUtil.DUKIEN);
phieuHenTiem.setNgayCheckin(StringPool.BLANK);
phieuHenTiem.setThongTinCheckin(StringPool.BLANK);
phieuHenTiem.setGioDuocTiem(StringPool.BLANK);
phieuHenTiem.setTrieuChungSauTiem(StringPool.BLANK);
phieuHenTiem.setDieuTriTrieuChung(StringPool.BLANK);

phieuHenTiemAction.addPhieuHenTiem(phieuHenTiem);


} else {
_log.error("Phieu hen tiem da ton tai : lichtiemchungId : " + phieuHenTiemDto.LichTiemChungID + " - nguoitiemchungid: " + nguoiTiemChungID + " - hovaten : " + nguoiTiemChung.getHoVaTen());
}
nguoiTiemChung.setTinhTrangDangKi(VaccomUtil.DACHUYENSANGPHIEUHEN);
nguoiTiemChungAction.update(nguoiTiemChung);


}

String msg = MessageUtil.getVNMessageText("phieuhentiem.list.add.success");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public interface NguoiTiemChungRepository extends JpaRepository<NguoiTiemChung,

public List<NguoiTiemChung> findByCmtcccd(String cmtcccd);

@Query(value="SELECT * FROM " + DBConstant._NGUOITIEMCHUNG_TABLE_NAME + " WHERE CongDan_ID = :id", nativeQuery = true)
public List<NguoiTiemChung> findBycongDanIDReturnList(@Param(value = "id")long id);

public NguoiTiemChung findBycongDanID(long id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public interface PhieuHenTiemRepository extends JpaRepository<PhieuHenTiem, Long

public List<PhieuHenTiem> findByNguoiTiemChungId(long id);

@Query(value="SELECT * FROM " + DBConstant._PHIEUTIEM_TABLE_NAME + " WHERE LichTiemChungID = :lichTiemChungID and NguoiTiemChungID = :nguoiTiemChungID", nativeQuery = true)
public List<PhieuHenTiem> findExist(@Param(value = "lichTiemChungID") long lichTiemChungID, @Param(value = "nguoiTiemChungID") long nguoiTiemChungID);

@Query(value="SELECT * FROM " + DBConstant._PHIEUTIEM_TABLE_NAME + " WHERE LichTiemChungID = :lichTiemChungID and TinhTrangXacNhan = :tinhTrangXacNhan", nativeQuery = true)
public List<PhieuHenTiem> findByLichTiemChungId_TinhTrangXacNhan(@Param(value = "lichTiemChungID") long lichTiemChungID, @Param(value = "tinhTrangXacNhan") int tinhTrangXacNhan);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ public List<NguoiTiemChung> searchNguoiTiemChung(String cmtcccd, Integer nhomdoi

public long countByTen_SDT(String hovaten, String sodienthoai);

public List<NguoiTiemChung> findBycongDanIDReturnList(long id);

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ public List<PhieuHenTiem> searchPhieuHenTiem(Long lichTiemChungId, Long caTiemCh
public List<PhieuHenTiem> findByLichTiemChungId_TinhTrangXacNhan(long LichTiemChungID, int TinhTrangXacNhan);
public PhieuHenTiem update(PhieuHenTiem phieuHenTiem);

public List<PhieuHenTiem> findExist (long lichTiemChungId, long nguoiTiemChungId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,11 @@ public long countByTen_SDT(String hovaten, String sodienthoai) {
return nguoiTiemChungRepository.countByTen_SDT(hovaten, sodienthoai);
}

@Override
public List<NguoiTiemChung> findBycongDanIDReturnList(long id) {
return nguoiTiemChungRepository.findBycongDanIDReturnList(id);
}

@Override
public List<NguoiTiemChung> searchListChuyenDangKyChinhThuc(NguoiTiemChungDto nguoiTiemChungDto) {
CriteriaBuilder builder = em.getCriteriaBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,9 @@ public PhieuHenTiem update(PhieuHenTiem phieuHenTiem) {
return phieuHenTiemRepository.save(phieuHenTiem);
}

@Override
public List<PhieuHenTiem> findExist(long lichTiemChungId, long nguoiTiemChungId) {
return phieuHenTiemRepository.findExist(lichTiemChungId, nguoiTiemChungId);
}

}