diff --git a/src/main/java/com/ynxbd/common/dao/PatientDao.java b/src/main/java/com/ynxbd/common/dao/PatientDao.java index ebf59ec..1a48255 100644 --- a/src/main/java/com/ynxbd/common/dao/PatientDao.java +++ b/src/main/java/com/ynxbd/common/dao/PatientDao.java @@ -208,6 +208,15 @@ public class PatientDao { }); } + /** + * 查询所有未领取健康卡的用户信息,民族、电话不能为空,一次读取15条信息 + */ + public List selectPatient4BatchUpdateHealthCard() { + String sql = "select * from patientBase where HealthCardID is null and ifNull(idCardNo,'') <> '' " + + "and ifNull(nation,'') <> '' and ifNull(tel, '') <> '' and callFlag=0 LIMIT 15"; + return DataBase.select(sql, Patient.class); + } + /** * 根据身份证查询患者 @@ -244,7 +253,7 @@ public class PatientDao { return false; } - String sql = "update patientBase set deletedState=0, updateTime=now(), healthCardId=?, name=?, nation=?, tel=?, address=?, uuid=?, areaCode=?, areaAddress=?, patientId=?, empiId=?, gmcBindState=?, gmcCheckTime=?, " + + String sql = "update patientBase set deletedState=0, bindDate=now(), healthCardId=?, name=?, nation=?, tel=?, address=?, uuid=?, areaCode=?, areaAddress=?, patientId=?, empiId=?, gmcBindState=?, gmcCheckTime=?, " + " uniqueId=if(uniqueId is null or uniqueId = '', ?, uniqueId), " + " gmcUniqueId=if(gmcUniqueId is null or gmcUniqueId = '', ?, gmcUniqueId) " + " where id=? and openid=? and idCardNo=?"; @@ -294,8 +303,8 @@ public class PatientDao { */ public boolean insert(boolean isMyself, Patient bindData) { bindData.setIsMyself(isMyself); - String sql = "insert into patientBase(bindDate, openid, patientId, hisTransNo, name, sex, idCardNo, tel, birthday, nation, healthCardId, age, uuid, fatherName, fatherTel, fatherIDCardNo, motherName, motherTel, motherIDCardNo, address, areaCode, areaAddress, isMyself, cardType, unionId, uniqueId, empiId, gmcUniqueId, gmcBindState, gmcCheckTime) " + - " values(now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + String sql = "insert into patientBase(createTime, bindDate, openid, patientId, hisTransNo, name, sex, idCardNo, tel, birthday, nation, healthCardId, age, uuid, fatherName, fatherTel, fatherIDCardNo, motherName, motherTel, motherIDCardNo, address, areaCode, areaAddress, isMyself, cardType, unionId, uniqueId, empiId, gmcUniqueId, gmcBindState, gmcCheckTime) " + + " values(now(), now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; return DataBase.insert(sql, ps -> { setInsertPs(ps, bindData); @@ -310,8 +319,8 @@ public class PatientDao { * @return bool */ public int insertBatch(List dataList) { - String sql = "insert into patientBase(bindDate, openid, patientId, hisTransNo, name, sex, idCardNo, tel, birthday, nation, healthCardId, age, uuid, fatherName, fatherTel, fatherIDCardNo, motherName, motherTel, motherIDCardNo, address, areaCode, areaAddress, isMyself, cardType, unionId, uniqueId, empiId, gmcUniqueId, gmcBindState, gmcCheckTime %s) " + - " values(now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? %s)"; + String sql = "insert into patientBase(createTime, bindDate, openid, patientId, hisTransNo, name, sex, idCardNo, tel, birthday, nation, healthCardId, age, uuid, fatherName, fatherTel, fatherIDCardNo, motherName, motherTel, motherIDCardNo, address, areaCode, areaAddress, isMyself, cardType, unionId, uniqueId, empiId, gmcUniqueId, gmcBindState, gmcCheckTime %s) " + + " values(now(), now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? %s)"; List hasIdList = new ArrayList<>(); List noneIdList = new ArrayList<>(); @@ -382,14 +391,6 @@ public class PatientDao { } - /** - * 查询所有未领取健康卡的用户信息,民族、电话不能为空,一次读取15条信息 - */ - public List selectPatient4BatchUpdateHealthCard() { - String sql = "select * from patientBase where HealthCardID is null and ifNull(idCardNo,'') <> '' " + - "and ifNull(nation,'') <> '' and ifNull(tel, '') <> '' and callFlag=0 LIMIT 15"; - return DataBase.select(sql, Patient.class); - } /** @@ -399,7 +400,7 @@ public class PatientDao { * @param idCardNo 身份证 */ public boolean updateHealthCard(String healthCardId, String idCardNo) { - String sql = "update patientBase set healthCardId = ? where idCardNo = ?"; + String sql = "update patientBase set healthCardId= ? where idCardNo = ?"; return DataBase.update(sql, ps -> { ps.setString(1, healthCardId); ps.setString(2, idCardNo); diff --git a/src/main/java/com/ynxbd/common/service/GMCService.java b/src/main/java/com/ynxbd/common/service/GMCService.java index 71e53c1..745cd1b 100644 --- a/src/main/java/com/ynxbd/common/service/GMCService.java +++ b/src/main/java/com/ynxbd/common/service/GMCService.java @@ -134,7 +134,7 @@ public class GMCService { delRows = new PatientDao().delByIds(wxOpenId, removeIds); } - int addRows = addItems(addList); // 添加后会补充数据 + int addRows = addDBPatients(addList); // 添加后会补充数据 long endTime = System.currentTimeMillis(); String takeTime = (endTime - begTime) + "ms"; // 耗时 @@ -143,12 +143,12 @@ public class GMCService { } /** - * 添加 + * 本院数据补充 * - * @param patients - * @return + * @param patients 患者信息 + * @return int */ - public int addItems(List patients) { + public int addDBPatients(List patients) { if (patients.isEmpty()) { return 0; }