|
|
|
|
@ -74,6 +74,7 @@ public class PatientDao { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据openid查询患者 部分信息 用作外部对接 不回传openId |
|
|
|
|
* |
|
|
|
|
* @param openid |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@ -136,13 +137,14 @@ public class PatientDao { |
|
|
|
|
*/ |
|
|
|
|
public Patient selectByOpenidAndPatientId(String openid, String patientId) { |
|
|
|
|
String sql = "select * from patientBase where openid= ? and patientId= ? and deletedState = 0"; |
|
|
|
|
List<Patient> resultList = DataBase.select(sql, Patient.class, ps -> { |
|
|
|
|
List<Patient> dataList = DataBase.select(sql, Patient.class, ps -> { |
|
|
|
|
ps.setString(1, openid); |
|
|
|
|
ps.setString(2, patientId); |
|
|
|
|
}); |
|
|
|
|
return !resultList.isEmpty() ? resultList.get(0) : null; |
|
|
|
|
return !dataList.isEmpty() ? dataList.get(0) : null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询患者本人 |
|
|
|
|
* |
|
|
|
|
@ -184,8 +186,8 @@ public class PatientDao { |
|
|
|
|
* @param address 地址 |
|
|
|
|
* @return 是否成功 |
|
|
|
|
*/ |
|
|
|
|
public boolean updateInfo(String openid, String idCardNo, String patientId, String healthCardId, String name, String nation, String tel, String address, String uuid, String county) { |
|
|
|
|
String sql = "update patientBase set deletedState=0, healthCardId=?, name=?, nation=?, tel=?, address=?, uuid=?, county=?, patientId=? where openid=? and idCardNo=?"; |
|
|
|
|
public boolean updateInfo(String openid, String idCardNo, String patientId, String healthCardId, String name, String nation, String tel, String uuid, String address, String areaCode, String areaAddress) { |
|
|
|
|
String sql = "update patientBase set deletedState=0, healthCardId=?, name=?, nation=?, tel=?, address=?, uuid=?, areaCode=?, areaAddress=?, patientId=? where openid=? and idCardNo=?"; |
|
|
|
|
|
|
|
|
|
return DataBase.update(sql, ps -> { |
|
|
|
|
ps.setString(1, healthCardId); |
|
|
|
|
@ -194,11 +196,12 @@ public class PatientDao { |
|
|
|
|
ps.setString(4, tel); |
|
|
|
|
ps.setString(5, address); |
|
|
|
|
ps.setString(6, uuid); |
|
|
|
|
ps.setString(7, county); |
|
|
|
|
ps.setString(8, patientId); |
|
|
|
|
ps.setString(7, areaCode); |
|
|
|
|
ps.setString(8, areaAddress); |
|
|
|
|
ps.setString(9, patientId); |
|
|
|
|
// 条件
|
|
|
|
|
ps.setString(9, openid); |
|
|
|
|
ps.setString(10, idCardNo); |
|
|
|
|
ps.setString(10, openid); |
|
|
|
|
ps.setString(11, idCardNo); |
|
|
|
|
}) > 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -219,14 +222,15 @@ public class PatientDao { |
|
|
|
|
*/ |
|
|
|
|
public boolean insertCard(boolean isMyself, String healthCardId, String openid, String patientId, String hisTransNo, |
|
|
|
|
String name, String sex, String idCardNo, HCardTypeEnum cardTypeEnum, String birthday, String age, |
|
|
|
|
String address, String nation, String tel, String uuid, String county) { |
|
|
|
|
return insert(isMyself, healthCardId, openid, patientId, hisTransNo, name, sex, idCardNo, cardTypeEnum, birthday, age, address, nation, tel, uuid, county, null, null, null, null, null, null); |
|
|
|
|
String nation, String tel, String uuid, String address, String areaCode, String areaAddress) { |
|
|
|
|
return insert(isMyself, healthCardId, openid, patientId, hisTransNo, name, sex, idCardNo, cardTypeEnum, birthday, age, nation, tel, uuid, address, areaCode, areaAddress, null, null, null, null, null, null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [患者]绑定身份证 |
|
|
|
|
* |
|
|
|
|
* @param isMyself 是否为自己 |
|
|
|
|
* @param healthCardId 健康卡ID |
|
|
|
|
* @param openid openid |
|
|
|
|
* @param patientId 患者ID |
|
|
|
|
@ -234,25 +238,31 @@ public class PatientDao { |
|
|
|
|
* @param name 姓名 |
|
|
|
|
* @param sex 性别 |
|
|
|
|
* @param idCardNo 身份证 |
|
|
|
|
* @param tel 电话 |
|
|
|
|
* @param address 地址 |
|
|
|
|
* @param cardTypeEnum 证件类型 |
|
|
|
|
* @param birthday 生日 |
|
|
|
|
* @param age 年龄 |
|
|
|
|
* @param address 详细地址 |
|
|
|
|
* @param nation 民族 |
|
|
|
|
* @param tel 电话 |
|
|
|
|
* @param uuid uuid |
|
|
|
|
* @param areaCode 地区编码 |
|
|
|
|
* @param areaAddress 地区地址 |
|
|
|
|
* @param fName 父亲姓名 |
|
|
|
|
* @param fTel 父亲电话 |
|
|
|
|
* @param fIDCardNo 父亲身份证 |
|
|
|
|
* @param mName 母亲姓名 |
|
|
|
|
* @param mTel 母亲电话 |
|
|
|
|
* @param mIDCardNo 母亲身份证号 |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public boolean insert(boolean isMyself, String healthCardId, String openid, String patientId, String hisTransNo, |
|
|
|
|
String name, String sex, String idCardNo, HCardTypeEnum cardTypeEnum, String birthday, String age, |
|
|
|
|
String address, String nation, String tel, String uuid, String county, |
|
|
|
|
String nation, String tel, String uuid, String address, String areaCode, String areaAddress, |
|
|
|
|
String fName, String fTel, String fIDCardNo, |
|
|
|
|
String mName, String mTel, String mIDCardNo) { |
|
|
|
|
|
|
|
|
|
String sql = "insert into patientBase(bindDate, openid, patientId, hisTransNo, name, sex, idCardNo, tel, address, birthday, nation, healthCardId, age, uuid, fatherName, fatherTel, fatherIDCardNo, motherName, motherTel, motherIDCardNo, county, isMyself, cardType) " + |
|
|
|
|
" values(now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)"; |
|
|
|
|
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) " + |
|
|
|
|
" values(now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|
|
|
|
return DataBase.insert(sql, ps -> { |
|
|
|
|
ps.setString(1, openid); |
|
|
|
|
ps.setString(2, patientId); |
|
|
|
|
@ -261,22 +271,23 @@ public class PatientDao { |
|
|
|
|
ps.setString(5, sex); |
|
|
|
|
ps.setString(6, idCardNo); |
|
|
|
|
ps.setString(7, tel); |
|
|
|
|
ps.setString(8, address); |
|
|
|
|
ps.setString(9, birthday); |
|
|
|
|
ps.setString(10, nation); |
|
|
|
|
ps.setString(11, healthCardId); |
|
|
|
|
ps.setString(12, age); |
|
|
|
|
ps.setString(13, uuid); |
|
|
|
|
ps.setString(8, birthday); |
|
|
|
|
ps.setString(9, nation); |
|
|
|
|
ps.setString(10, healthCardId); |
|
|
|
|
ps.setString(11, age); |
|
|
|
|
ps.setString(12, uuid); |
|
|
|
|
//
|
|
|
|
|
ps.setString(14, fName); |
|
|
|
|
ps.setString(15, fTel); |
|
|
|
|
ps.setString(16, fIDCardNo); |
|
|
|
|
ps.setString(17, mName); |
|
|
|
|
ps.setString(18, mTel); |
|
|
|
|
ps.setString(19, mIDCardNo); |
|
|
|
|
ps.setString(20, county); |
|
|
|
|
ps.setBoolean(21, isMyself); |
|
|
|
|
ps.setString(22, cardTypeEnum.WX_CODE); |
|
|
|
|
ps.setString(13, fName); |
|
|
|
|
ps.setString(14, fTel); |
|
|
|
|
ps.setString(15, fIDCardNo); |
|
|
|
|
ps.setString(16, mName); |
|
|
|
|
ps.setString(17, mTel); |
|
|
|
|
ps.setString(18, mIDCardNo); |
|
|
|
|
ps.setString(19, address); |
|
|
|
|
ps.setString(20, areaCode); |
|
|
|
|
ps.setString(21, areaAddress); |
|
|
|
|
ps.setBoolean(22, isMyself); |
|
|
|
|
ps.setString(23, cardTypeEnum.WX_CODE); |
|
|
|
|
}) > 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -285,8 +296,8 @@ public class PatientDao { |
|
|
|
|
* 查询所有未领取健康卡的用户信息,民族、电话不能为空,一次读取15条信息 |
|
|
|
|
*/ |
|
|
|
|
public List<Patient> selectPatient4BatchUpdateHealthCard() { |
|
|
|
|
String sql = "select * from patientBase where HealthCardID is null and ifnull(idcardno,'') <> '' " + |
|
|
|
|
"and ifnull(nation,'') <> '' and ifnull(tel, '') <> '' and callFlag=0 LIMIT 15"; |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -352,14 +363,14 @@ public class PatientDao { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public boolean updateMyself(String openid, String idCardNo, String patientId, String name, String address, String county, String nation, String tel) { |
|
|
|
|
public boolean updateMyself(String openid, String idCardNo, String patientId, String name, String address, String areaCode, String nation, String tel) { |
|
|
|
|
if (idCardNo == null) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
idCardNo = "'" + idCardNo + "'"; |
|
|
|
|
String sql = "update patientBase set isMyself = (CASE idCardNo WHEN " + idCardNo + " THEN 1 else 0 end)," + |
|
|
|
|
" deletedState = (CASE idCardNo WHEN " + idCardNo + " THEN 0 else deletedState end)," + |
|
|
|
|
" county = (CASE idCardNo WHEN " + idCardNo + " THEN ? else county end)," + |
|
|
|
|
" areaCode = (CASE idCardNo WHEN " + idCardNo + " THEN ? else areaCode end)," + |
|
|
|
|
" address = (CASE idCardNo WHEN " + idCardNo + " THEN ? else address end)," + |
|
|
|
|
" patientId = (CASE idCardNo WHEN " + idCardNo + " THEN ? else patientId end)," + |
|
|
|
|
" name = (CASE idCardNo WHEN " + idCardNo + " THEN ? else name end)," + |
|
|
|
|
@ -367,7 +378,7 @@ public class PatientDao { |
|
|
|
|
" nation = (CASE idCardNo WHEN " + idCardNo + " THEN ? else nation end)" + |
|
|
|
|
" where openid = ?"; |
|
|
|
|
return DataBase.update(sql, ps -> { |
|
|
|
|
ps.setString(1, county); |
|
|
|
|
ps.setString(1, areaCode); |
|
|
|
|
ps.setString(2, address); |
|
|
|
|
ps.setString(3, patientId); |
|
|
|
|
ps.setString(4, name); |
|
|
|
|
|