|
@ -124,9 +124,13 @@ public class FamilyContractService extends BaseService {
|
|
|
private ConsultDao consultDao;
|
|
|
@Autowired
|
|
|
private SignFamilyRenewDao signFamilyRenewDao;
|
|
|
|
|
|
@Autowired
|
|
|
private SignFamilyMappingDao signFamilyMappingDao;
|
|
|
@Autowired
|
|
|
private ImUtill ImUtill;
|
|
|
@Autowired
|
|
|
private HttpUtil httpUtil;
|
|
|
|
|
|
|
|
|
public SignFamily findSignFamilyByCode(String code) {
|
|
|
return signFamilyDao.findByCodeAndType(code, 2);
|
|
@ -163,6 +167,7 @@ public class FamilyContractService extends BaseService {
|
|
|
public SignFamily findSigningRenewByPatient(String patient) {
|
|
|
return signFamilyDao.findSigningByPatient(patient);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询医院列表
|
|
|
*
|
|
@ -549,7 +554,7 @@ public class FamilyContractService extends BaseService {
|
|
|
* @param patient 居民code
|
|
|
* @return
|
|
|
*/
|
|
|
public int sign(String doctor, String patient,String countryCode) throws Exception {
|
|
|
public int sign(String doctor, String patient, String countryCode) throws Exception {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
if (p == null) {
|
|
|
return -1;
|
|
@ -597,12 +602,12 @@ public class FamilyContractService extends BaseService {
|
|
|
sf.setSignSource("2");//签约来源【1 社区签约 2 移动签约】
|
|
|
//******************扣费接口**********************/
|
|
|
sf.setExpensesStatus("0"); //扣费状态 【0未扣费 1已扣费 2已退费】
|
|
|
sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear()+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear()+1+"-06-30 23:59:59","yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setSignYear(DateUtil.getSignYear()+"");
|
|
|
sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setSignYear(DateUtil.getSignYear() + "");
|
|
|
|
|
|
//1.3.5新增居委会字段
|
|
|
signWebService.setPatientCountryFamily(countryCode,sf);
|
|
|
signWebService.setPatientCountryFamily(countryCode, sf);
|
|
|
|
|
|
SignFamily temp = signFamilyDao.save(sf);
|
|
|
|
|
@ -668,8 +673,8 @@ public class FamilyContractService extends BaseService {
|
|
|
}
|
|
|
//结束与医生所有消息
|
|
|
List<Message> messages = messageDao.findByPatient(patient, doctor);
|
|
|
if(messages!=null&&messages.size()>0){
|
|
|
for(Message message:messages){
|
|
|
if (messages != null && messages.size() > 0) {
|
|
|
for (Message message : messages) {
|
|
|
//修改信息为无效
|
|
|
if (message != null) {
|
|
|
message.setRead(0);
|
|
@ -682,6 +687,7 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
/**
|
|
|
* 取消续签
|
|
|
*
|
|
|
* @param patient
|
|
|
* @param doctor
|
|
|
* @return
|
|
@ -689,15 +695,15 @@ public class FamilyContractService extends BaseService {
|
|
|
*/
|
|
|
public int unsignRenew(String patient, String doctor) throws Exception {
|
|
|
|
|
|
if(DateUtil.getNowMonth()<7){
|
|
|
SignFamilyRenew sf = signFamilyRenewDao.findByDoctorPatient(doctor, patient);
|
|
|
if (sf!=null&&sf.getStatus() != 0 && sf.getStatus() != 2) {
|
|
|
if (DateUtil.getNowMonth() < 7) {
|
|
|
SignFamilyRenew sf = signFamilyRenewDao.findByDoctorPatient(doctor, patient);
|
|
|
if (sf != null && sf.getStatus() != 0 && sf.getStatus() != 2) {
|
|
|
return -2;
|
|
|
}
|
|
|
sf.setStatus(-1);
|
|
|
}else{
|
|
|
SignFamily sf = signFamilyDao.findByDoctorPatient(doctor, patient);
|
|
|
if (sf!=null&&sf.getStatus() != 0 && sf.getStatus() != 2) {
|
|
|
} else {
|
|
|
SignFamily sf = signFamilyDao.findByDoctorPatient(doctor, patient);
|
|
|
if (sf != null && sf.getStatus() != 0 && sf.getStatus() != 2) {
|
|
|
return -2;
|
|
|
}
|
|
|
sf.setStatus(-1);
|
|
@ -706,8 +712,8 @@ public class FamilyContractService extends BaseService {
|
|
|
//结束与医生所有消息
|
|
|
List<Message> messages = messageDao.findByPatientRenew(patient, doctor);
|
|
|
|
|
|
if(messages!=null&messages.size()>0){
|
|
|
for(Message message:messages){
|
|
|
if (messages != null & messages.size() > 0) {
|
|
|
for (Message message : messages) {
|
|
|
//修改信息为无效
|
|
|
if (message != null) {
|
|
|
message.setRead(0);
|
|
@ -871,7 +877,7 @@ public class FamilyContractService extends BaseService {
|
|
|
String emerMobile, String images,
|
|
|
String healthLabel, String customLabel, String disease,
|
|
|
String expenses, String signDoctorCode,
|
|
|
String signDoctorName, String signDoctorLevel, long adminTeamCode,String sevId,String countryCode) throws Exception {
|
|
|
String signDoctorName, String signDoctorLevel, long adminTeamCode, String sevId, String countryCode) throws Exception {
|
|
|
// 查询是否有家庭签约
|
|
|
SignFamily sc = signFamilyDao.findByIdcard(idcard);
|
|
|
if (sc != null) {
|
|
@ -886,19 +892,19 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
// List<SystemDict> systemDicts = systemDictDao.findByDictName("SIGN_YEAR");
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
int m = cal.get(Calendar.MONTH)+1;
|
|
|
String signYear = "" ;
|
|
|
if(m>=4){
|
|
|
int m = cal.get(Calendar.MONTH) + 1;
|
|
|
String signYear = "";
|
|
|
if (m >= 4) {
|
|
|
//签约当前年度
|
|
|
signYear = cal.get(Calendar.YEAR)+"";
|
|
|
}else{
|
|
|
signYear = cal.get(Calendar.YEAR) + "";
|
|
|
} else {
|
|
|
//签约过去年度
|
|
|
signYear = (cal.get(Calendar.YEAR)-1)+"";
|
|
|
signYear = (cal.get(Calendar.YEAR) - 1) + "";
|
|
|
}
|
|
|
|
|
|
SignFamily sf = new SignFamily();
|
|
|
String signCode = getCode();
|
|
|
sf.setSignYear(DateUtil.getSignYear()+"");//设置签约年度
|
|
|
sf.setSignYear(DateUtil.getSignYear() + "");//设置签约年度
|
|
|
sf.setBegin(DateUtil.getNowDateShort());
|
|
|
sf.setCode(signCode);
|
|
|
sf.setCzrq(new Date());
|
|
@ -947,8 +953,8 @@ public class FamilyContractService extends BaseService {
|
|
|
//******************扣费接口**********************/
|
|
|
sf.setExpensesStatus("0"); //扣费状态 【0未扣费 1已扣费 2已退费】
|
|
|
//设置1.3.3.2服务信息
|
|
|
if(StringUtils.isNotBlank(sevId)){
|
|
|
signWebService.setSevId(sf,sevId);
|
|
|
if (StringUtils.isNotBlank(sevId)) {
|
|
|
signWebService.setSevId(sf, sevId);
|
|
|
}
|
|
|
// 查询该患者是否已注册
|
|
|
Patient patient = patientDao.findByIdcard(idcard);
|
|
@ -1004,8 +1010,8 @@ public class FamilyContractService extends BaseService {
|
|
|
// }
|
|
|
|
|
|
// 更新签约日期
|
|
|
sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear()+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear()+1+"-06-30 23:59:59","yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
|
|
|
|
|
|
sf.setOpenid(patient.getOpenid());
|
|
|
sf.setPatient(patient.getCode());
|
|
@ -1023,21 +1029,21 @@ public class FamilyContractService extends BaseService {
|
|
|
sf.setTeamCode(doctorTeamCode);
|
|
|
|
|
|
///1.3.5判断是否续签
|
|
|
Map<String,Object> oldSign = checkLastYearIsSign(sf.getPatient(),sf.getDoctor());
|
|
|
if(oldSign!=null){
|
|
|
Map<String, Object> oldSign = checkLastYearIsSign(sf.getPatient(), sf.getDoctor());
|
|
|
if (oldSign != null) {
|
|
|
//如果为续签
|
|
|
signWebService.setRenewLog(sf);
|
|
|
Integer adminTCode = (Integer) oldSign.get("admin_team_code");
|
|
|
Long aTCode = adminTCode.longValue();
|
|
|
if(aTCode!=null&&aTCode==adminTeamCode){
|
|
|
if (aTCode != null && aTCode == adminTeamCode) {
|
|
|
sf.setRenewFlag("1");
|
|
|
}else{
|
|
|
} else {
|
|
|
sf.setRenewFlag("2");
|
|
|
}
|
|
|
}else{
|
|
|
} else {
|
|
|
sf.setRenewFlag("0");
|
|
|
}
|
|
|
sf.setSignYear(DateUtil.getSignYear()+"");
|
|
|
sf.setSignYear(DateUtil.getSignYear() + "");
|
|
|
signFamilyDao.save(sf);
|
|
|
//添加团队成员
|
|
|
//添加健康管理师
|
|
@ -1081,12 +1087,12 @@ public class FamilyContractService extends BaseService {
|
|
|
throw new Exception("patient sign label settting error:" + patient.getIdcard());
|
|
|
}
|
|
|
//1.3.5新增居委会字段
|
|
|
signWebService.setPatientCountryFamily(countryCode,sf);
|
|
|
signWebService.setPatientCountryFamily(countryCode, sf);
|
|
|
//保存签约信息
|
|
|
SignFamily temp = signFamilyDao.save(sf);
|
|
|
|
|
|
//设置基卫标识1.3.3.2版本更新
|
|
|
setSignFamilyMapping(temp.getCode(),temp.getIdcard(),temp.getSignYear());
|
|
|
setSignFamilyMapping(temp.getCode(), temp.getIdcard(), temp.getSignYear());
|
|
|
|
|
|
if (temp != null && patient != null) {
|
|
|
Doctor doc = doctorDao.findByCode(sf.getDoctor());
|
|
@ -1098,7 +1104,7 @@ public class FamilyContractService extends BaseService {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", "签约成功通知");
|
|
|
json.put("toUser", sf.getPatient());
|
|
|
json.put("represented",sf.getPatient());//被代理人
|
|
|
json.put("represented", sf.getPatient());//被代理人
|
|
|
json.put("doctor", sf.getDoctor());
|
|
|
json.put("doctorName", sf.getDoctorName());
|
|
|
json.put("date", DateUtil.dateToStrShort(sf.getBegin()));
|
|
@ -1124,24 +1130,24 @@ public class FamilyContractService extends BaseService {
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(),sf.getOpenid());
|
|
|
if(jsonArray!=null&&jsonArray.length()>0){
|
|
|
for (int i = 0;i<jsonArray.length();i++){
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = json;
|
|
|
data.remove("toUser");
|
|
|
data.remove("agent");
|
|
|
data.put("toUser",member.getCode());
|
|
|
data.put("agent","1");
|
|
|
data.put("toUser", member.getCode());
|
|
|
data.put("agent", "1");
|
|
|
//String first = (String) json.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first",weiXinOpenIdUtils.getTitleMes(patient,j.getInt("relation"),patient.getName()));
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(patient, j.getInt("relation"), patient.getName()));
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, member.getOpenid(), patient.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
new Thread(new SignUploadTask(sf.getCode())).start();
|
|
|
new Thread(new SignUploadTask(sf.getCode(), httpUtil)).start();
|
|
|
JSONObject participants = new JSONObject();
|
|
|
participants.put(sf.getPatient(), 0);
|
|
|
if (StringUtils.equals(sf.getDoctor(), sf.getDoctorHealth())) {//全科和建管同一个人
|
|
@ -1244,14 +1250,14 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
//List<SystemDict> systemDicts = systemDictDao.findByDictName("SIGN_YEAR");
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
int m = cal.get(Calendar.MONTH)+1;
|
|
|
String year = "" ;
|
|
|
if(m>=4){
|
|
|
int m = cal.get(Calendar.MONTH) + 1;
|
|
|
String year = "";
|
|
|
if (m >= 4) {
|
|
|
//签约当前年度
|
|
|
year = cal.get(Calendar.YEAR)+"";
|
|
|
}else{
|
|
|
year = cal.get(Calendar.YEAR) + "";
|
|
|
} else {
|
|
|
//签约过去年度
|
|
|
year = (cal.get(Calendar.YEAR)-1)+"";
|
|
|
year = (cal.get(Calendar.YEAR) - 1) + "";
|
|
|
}
|
|
|
|
|
|
Calendar now = Calendar.getInstance();
|
|
@ -1283,8 +1289,8 @@ public class FamilyContractService extends BaseService {
|
|
|
}
|
|
|
|
|
|
// 更新签约日期
|
|
|
sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear()+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear()+1+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
|
|
|
|
|
|
|
|
|
// 改为签约生效
|
|
@ -1293,8 +1299,8 @@ public class FamilyContractService extends BaseService {
|
|
|
sf.setExpensesType(StringUtils.isEmpty(expenses) ? "01" : expenses);//收费类别
|
|
|
sf.setAdminTeamId(adminTeamCode);
|
|
|
//设置服务类型1.3.3.2版本更新
|
|
|
if(StringUtils.isNotBlank(sevId)){
|
|
|
signWebService.setSevId(sf,sevId);
|
|
|
if (StringUtils.isNotBlank(sevId)) {
|
|
|
signWebService.setSevId(sf, sevId);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(doctor)) {
|
|
|
//设置全科医生
|
|
@ -1317,7 +1323,7 @@ public class FamilyContractService extends BaseService {
|
|
|
sf.setSignDoctorLevel(String.valueOf(docLeader.getLevel()));
|
|
|
|
|
|
sf.setCzrq(new Date());
|
|
|
sf.setSignYear(DateUtil.getSignYear()+"");//设置签约年度
|
|
|
sf.setSignYear(DateUtil.getSignYear() + "");//设置签约年度
|
|
|
sf.setApplyDate(new Date());
|
|
|
Doctor doc = doctorDao.findByCode(sf.getDoctor());
|
|
|
//sf.setFamilyCode(createSignCode(sf.getDoctor(), doc.getHospital()));
|
|
@ -1368,7 +1374,7 @@ public class FamilyContractService extends BaseService {
|
|
|
doctorTeamDoctor.save(wlyyDoctorTeamPatient);
|
|
|
|
|
|
//设置基卫标识1.3.3.2版本更新
|
|
|
setSignFamilyMapping(sf.getCode(),sf.getIdcard(),sf.getSignYear());
|
|
|
setSignFamilyMapping(sf.getCode(), sf.getIdcard(), sf.getSignYear());
|
|
|
|
|
|
} else {
|
|
|
// 医生拒绝
|
|
@ -1378,7 +1384,7 @@ public class FamilyContractService extends BaseService {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", "签约失败通知");
|
|
|
json.put("toUser", sf.getPatient());
|
|
|
json.put("represented",sf.getPatient());//被代理人
|
|
|
json.put("represented", sf.getPatient());//被代理人
|
|
|
json.put("doctor", StringUtils.isEmpty(sf.getDoctor()) ? sf.getDoctorHealth() : sf.getDoctor());
|
|
|
// 增加signcode
|
|
|
json.put("signCode", sf.getCode());
|
|
@ -1402,17 +1408,17 @@ public class FamilyContractService extends BaseService {
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(),sf.getOpenid());
|
|
|
if(jsonArray!=null&&jsonArray.length()>0){
|
|
|
for (int i = 0;i<jsonArray.length();i++){
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = json;
|
|
|
data.remove("toUser");
|
|
|
data.put("toUser",member.getCode());
|
|
|
data.put("toUser", member.getCode());
|
|
|
//String first = (String) json.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),p.getName()));
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 2, member.getOpenid(), p.getName(), data);
|
|
|
}
|
|
|
}
|
|
@ -1440,15 +1446,15 @@ public class FamilyContractService extends BaseService {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", "签约成功通知");
|
|
|
json.put("toUser", sf.getPatient());
|
|
|
json.put("represented",sf.getPatient());//被代理人
|
|
|
json.put("represented", sf.getPatient());//被代理人
|
|
|
json.put("doctor", doc.getCode());
|
|
|
json.put("doctorName", doc.getName());
|
|
|
json.put("date", DateUtil.dateToStrShort(new Date()));
|
|
|
json.put("content", content);
|
|
|
json.put("remark", ""); //您好,您成功签约家庭医生
|
|
|
// 添加签约code by wjj 2017.7.18
|
|
|
json.put("signCode",sf.getCode()); //签约code
|
|
|
json.put("agent","0"); //是否是代理 否
|
|
|
json.put("signCode", sf.getCode()); //签约code
|
|
|
json.put("agent", "0"); //是否是代理 否
|
|
|
// 添加到发送队列
|
|
|
if (StringUtils.isNotBlank(sf.getOpenid())) {
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
|
|
@ -1464,24 +1470,24 @@ public class FamilyContractService extends BaseService {
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(),sf.getOpenid());
|
|
|
if(jsonArray!=null&&jsonArray.length()>0){
|
|
|
for (int i = 0;i<jsonArray.length();i++){
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = json;
|
|
|
data.remove("toUser");
|
|
|
data.remove("agent");
|
|
|
data.put("toUser",member.getCode());
|
|
|
data.put("agent","1");
|
|
|
data.put("toUser", member.getCode());
|
|
|
data.put("agent", "1");
|
|
|
//String first = (String) json.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),p.getName()));
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, member.getOpenid(), p.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
new Thread(new SignUploadTask(sf.getCode())).start();
|
|
|
new Thread(new SignUploadTask(sf.getCode(),httpUtil)).start();
|
|
|
JSONObject participants = new JSONObject();
|
|
|
participants.put(sf.getPatient(), 0);
|
|
|
if (StringUtils.equals(sf.getDoctor(), sf.getDoctorHealth())) {//全科和建管同一个人
|
|
@ -1548,7 +1554,7 @@ public class FamilyContractService extends BaseService {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", "解约申请通知");
|
|
|
json.put("toUser", sf.getPatient());
|
|
|
json.put("represented",sf.getPatient());//被代理人
|
|
|
json.put("represented", sf.getPatient());//被代理人
|
|
|
json.put("date", DateUtil.getStringDateShort());
|
|
|
json.put("doctor", sf.getDoctor());
|
|
|
json.put("doctorName", sf.getDoctorName());
|
|
@ -1571,18 +1577,18 @@ public class FamilyContractService extends BaseService {
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(),sf.getOpenid());
|
|
|
if(jsonArray!=null&&jsonArray.length()>0){
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
for (int i = 0;i<jsonArray.length();i++){
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = json;
|
|
|
data.remove("toUser");
|
|
|
data.put("toUser",member.getCode());
|
|
|
data.put("toUser", member.getCode());
|
|
|
//String first = (String) json.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),p.getName()));
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, member.getOpenid(), p.getName(), data);
|
|
|
}
|
|
|
}
|
|
@ -1593,7 +1599,7 @@ public class FamilyContractService extends BaseService {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", "解约申请通知");
|
|
|
json.put("toUser", sf.getPatient());
|
|
|
json.put("represented",sf.getPatient());//被代理人
|
|
|
json.put("represented", sf.getPatient());//被代理人
|
|
|
json.put("date", DateUtil.getStringDateShort());
|
|
|
json.put("doctor", sf.getDoctor());
|
|
|
json.put("doctorName", sf.getDoctorName());
|
|
@ -1616,18 +1622,18 @@ public class FamilyContractService extends BaseService {
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(),sf.getOpenid());
|
|
|
if(jsonArray!=null&&jsonArray.length()>0){
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
for (int i = 0;i<jsonArray.length();i++){
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = json;
|
|
|
data.remove("toUser");
|
|
|
data.put("toUser",member.getCode());
|
|
|
data.put("toUser", member.getCode());
|
|
|
//String first = (String) json.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),p.getName()));
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, member.getOpenid(), p.getName(), data);
|
|
|
}
|
|
|
}
|
|
@ -2036,7 +2042,7 @@ public class FamilyContractService extends BaseService {
|
|
|
* @param healthDoctor 健康管理师code
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject updateSignInfo(String patient, String healthDoctor, String doctor, String expensesType, String loginUser) throws Exception{
|
|
|
public JSONObject updateSignInfo(String patient, String healthDoctor, String doctor, String expensesType, String loginUser) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
|
|
@ -2094,7 +2100,7 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("toUser", patient);
|
|
|
data.put("represented",patient);//被代理人
|
|
|
data.put("represented", patient);//被代理人
|
|
|
data.put("doctor", docHealth.getCode());
|
|
|
data.put("doctorName", docHealth.getName());
|
|
|
data.put("first", p.getName() + ",您好!您签约团队的健康管理师已变更,您的新健管师信息如下:");
|
|
@ -2110,7 +2116,7 @@ public class FamilyContractService extends BaseService {
|
|
|
} else {
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("toUser", patient);
|
|
|
data.put("represented",patient);//被代理人
|
|
|
data.put("represented", patient);//被代理人
|
|
|
data.put("doctor", docHealth.getCode());
|
|
|
data.put("doctorName", docHealth.getName());
|
|
|
data.put("first", p.getName() + ",您好!您的签约团队已为您新增一位健康管理师,医生信息如下:");
|
|
@ -2204,7 +2210,7 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("toUser", patient);
|
|
|
data.put("represented",patient);//被代理人
|
|
|
data.put("represented", patient);//被代理人
|
|
|
data.put("doctor", docQk.getCode());
|
|
|
data.put("doctorName", docQk.getName());
|
|
|
data.put("first", p.getName() + ",您好!您签约团队的全科医生已变更,您的新全科医生信息如下:");
|
|
@ -2254,17 +2260,17 @@ public class FamilyContractService extends BaseService {
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(),p.getOpenid());
|
|
|
if(jsonArray!=null&&jsonArray.length()>0){
|
|
|
for (int i = 0;i<jsonArray.length();i++){
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = msg;
|
|
|
data.remove("toUser");
|
|
|
data.put("toUser",member.getCode());
|
|
|
data.put("toUser", member.getCode());
|
|
|
String first = (String) data.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),p.getName()));
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), p.getName(), data);
|
|
|
}
|
|
|
}
|
|
@ -2706,7 +2712,7 @@ public class FamilyContractService extends BaseService {
|
|
|
Map<String, JSONObject> docMap = new HashMap<>();
|
|
|
SignFamily ssSign = signFamilyDao.findSignByPatient(patient, 1);
|
|
|
// SignFamily jtSign = signFamilyDao.findByTeamCode(infos[1]);
|
|
|
SignFamily jtSign = getSignFamilyBySessionId(sessionId,infos[0]);
|
|
|
SignFamily jtSign = getSignFamilyBySessionId(sessionId, infos[0]);
|
|
|
if (ssSign != null) {
|
|
|
DoctorTeamMember member = doctorTeamDoctor.findSanshiByTeamAndType(ssSign.getTeamCode(), 1);
|
|
|
if (member != null) {
|
|
@ -2774,7 +2780,7 @@ public class FamilyContractService extends BaseService {
|
|
|
Map<String, JSONObject> docMap = new HashMap<>();
|
|
|
SignFamily ssSign = signFamilyDao.findSignByPatient(infos[0], 1);
|
|
|
// SignFamily jtSign = signFamilyDao.findByTeamCode(infos[1]);
|
|
|
SignFamily jtSign = getSignFamilyBySessionId(sessionId,infos[0]);
|
|
|
SignFamily jtSign = getSignFamilyBySessionId(sessionId, infos[0]);
|
|
|
JSONObject ssArray = new JSONObject();
|
|
|
JSONObject jtArray = new JSONObject();
|
|
|
if (ssSign != null) {
|
|
@ -2804,19 +2810,20 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
/**
|
|
|
* 根据会话id查询 家庭签约信息
|
|
|
*
|
|
|
* @param sessionId
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
public SignFamily getSignFamilyBySessionId(String sessionId,String patient){
|
|
|
public SignFamily getSignFamilyBySessionId(String sessionId, String patient) {
|
|
|
SignFamily signFamily = null;
|
|
|
String sql = "select id from " + SystemConf.getInstance().getImDataBaseName() + ".topics where session_id = '"+sessionId+"' order by create_time desc limit 0, 1";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
String sql = "select id from " + SystemConf.getInstance().getImDataBaseName() + ".topics where session_id = '" + sessionId + "' order by create_time desc limit 0, 1";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if (list != null && list.size() > 0) {
|
|
|
String consultCode = list.get(0).get("id").toString();
|
|
|
signFamily = signFamilyDao.findByPatient(patient);
|
|
|
Consult consult = consultDao.findByCode(consultCode);
|
|
|
if(signFamily==null||signFamily.getApplyDate().getTime()-consult.getCzrq().getTime()>0){
|
|
|
if (signFamily == null || signFamily.getApplyDate().getTime() - consult.getCzrq().getTime() > 0) {
|
|
|
signFamily = signFamilyDao.findOutTimeSigningByPatient(patient);
|
|
|
}
|
|
|
}
|
|
@ -2891,7 +2898,7 @@ public class FamilyContractService extends BaseService {
|
|
|
}
|
|
|
|
|
|
//根据姓名、地址、身份证搜索已分配健管师的居民
|
|
|
public List getPatientByLable(String doctorCode, String filter, String level, Long team,int page,int pagesize) throws Exception {
|
|
|
public List getPatientByLable(String doctorCode, String filter, String level, Long team, int page, int pagesize) throws Exception {
|
|
|
List list = new ArrayList();
|
|
|
//判断当前用户是健康管理师还是全科
|
|
|
List<Map<String, Object>> datas = null;
|
|
@ -2915,10 +2922,10 @@ public class FamilyContractService extends BaseService {
|
|
|
" and sf.admin_team_code = ? " +
|
|
|
" AND (p.name like ? or p.address like ? or p.idcard like ? ) " +
|
|
|
" ORDER BY p.name DESC,p.address DESC, p.idcard DESC " +
|
|
|
" limit "+(page-1)*pagesize+","+pagesize;
|
|
|
" limit " + (page - 1) * pagesize + "," + pagesize;
|
|
|
|
|
|
//查找居民
|
|
|
datas = jdbcTemplate.queryForList(sql, doctorCode, team,"%"+filter+"%","%"+filter+"%","%"+filter+"%");
|
|
|
datas = jdbcTemplate.queryForList(sql, doctorCode, team, "%" + filter + "%", "%" + filter + "%", "%" + filter + "%");
|
|
|
} else if (level.equals("2")) {
|
|
|
//全科
|
|
|
String sql = "SELECT DISTINCT " +
|
|
@ -2939,10 +2946,10 @@ public class FamilyContractService extends BaseService {
|
|
|
" and sf.admin_team_code = ? " +
|
|
|
" AND (p.name like ? or p.address like ? or p.idcard like ? ) " +
|
|
|
" ORDER BY p.name DESC,p.address DESC, p.idcard DESC " +
|
|
|
" limit "+(page-1)*pagesize+","+pagesize;
|
|
|
" limit " + (page - 1) * pagesize + "," + pagesize;
|
|
|
|
|
|
//查找居民
|
|
|
datas = jdbcTemplate.queryForList(sql, doctorCode, team,"%"+filter+"%","%"+filter+"%","%"+filter+"%");
|
|
|
datas = jdbcTemplate.queryForList(sql, doctorCode, team, "%" + filter + "%", "%" + filter + "%", "%" + filter + "%");
|
|
|
|
|
|
} else {
|
|
|
throw new Exception("参数错误!");
|
|
@ -2950,13 +2957,13 @@ public class FamilyContractService extends BaseService {
|
|
|
if (datas != null && datas.size() > 0) {
|
|
|
for (Map<String, Object> map : datas) {
|
|
|
Map ma = new HashMap();
|
|
|
ma.put("age", IdCardUtil.getAgeForIdcard(map.get("idcard")==null?"":map.get("idcard").toString()));
|
|
|
ma.put("photo",map.get("photo")==null?"":map.get("photo").toString());
|
|
|
ma.put("name",map.get("name")==null?"":map.get("name").toString());
|
|
|
ma.put("code",map.get("code")==null?"":map.get("code").toString());
|
|
|
ma.put("sex",map.get("sex")==null?"":map.get("sex").toString());
|
|
|
ma.put("address",map.get("address")==null?"":map.get("address").toString());
|
|
|
ma.put("idcard",map.get("idcard")==null?"":map.get("idcard").toString());
|
|
|
ma.put("age", IdCardUtil.getAgeForIdcard(map.get("idcard") == null ? "" : map.get("idcard").toString()));
|
|
|
ma.put("photo", map.get("photo") == null ? "" : map.get("photo").toString());
|
|
|
ma.put("name", map.get("name") == null ? "" : map.get("name").toString());
|
|
|
ma.put("code", map.get("code") == null ? "" : map.get("code").toString());
|
|
|
ma.put("sex", map.get("sex") == null ? "" : map.get("sex").toString());
|
|
|
ma.put("address", map.get("address") == null ? "" : map.get("address").toString());
|
|
|
ma.put("idcard", map.get("idcard") == null ? "" : map.get("idcard").toString());
|
|
|
list.add(ma);
|
|
|
}
|
|
|
}
|
|
@ -3143,7 +3150,7 @@ public class FamilyContractService extends BaseService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional
|
|
|
public int signRenew(String doctor,String healthDoctor, String patient, String reason) throws Exception {
|
|
|
public int signRenew(String doctor, String healthDoctor, String patient, String reason) throws Exception {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
if (p == null) {
|
|
|
return -1;
|
|
@ -3157,7 +3164,7 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
Doctor d = doctorDao.findByCode(doctor);
|
|
|
Doctor hd = null;
|
|
|
if(StringUtils.isNotBlank(healthDoctor)){
|
|
|
if (StringUtils.isNotBlank(healthDoctor)) {
|
|
|
hd = doctorDao.findByCode(healthDoctor);
|
|
|
}
|
|
|
|
|
@ -3165,11 +3172,11 @@ public class FamilyContractService extends BaseService {
|
|
|
return -3;
|
|
|
}
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
int year =cal.get(Calendar.YEAR);
|
|
|
int month = cal.get(Calendar.MONTH)+1;
|
|
|
int year = cal.get(Calendar.YEAR);
|
|
|
int month = cal.get(Calendar.MONTH) + 1;
|
|
|
|
|
|
List<SignFamilyRenew> res = signFamilyRenewDao.findByDoctorAndPatientHossPost(patient,DateUtil.getSignYear()+"");
|
|
|
if(res!=null&&res.size()>0){
|
|
|
List<SignFamilyRenew> res = signFamilyRenewDao.findByDoctorAndPatientHossPost(patient, DateUtil.getSignYear() + "");
|
|
|
if (res != null && res.size() > 0) {
|
|
|
return -2;
|
|
|
}
|
|
|
|
|
@ -3178,21 +3185,21 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
String sql = "";
|
|
|
//判断是否有生效记录SQL
|
|
|
sql ="SELECT t.doctor,t.team_code teamCode,t.admin_team_code adminTeamCode,t.mobile FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status>=0 AND t.expenses_status='1' AND t.sign_year ='"+(DateUtil.getSignYear()-1)+"'";
|
|
|
sql = "SELECT t.doctor,t.team_code teamCode,t.admin_team_code adminTeamCode,t.mobile FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status>=0 AND t.expenses_status='1' AND t.sign_year ='" + (DateUtil.getSignYear() - 1) + "'";
|
|
|
|
|
|
List<Map<String,Object>> signs = jdbcTemplate.queryForList(sql);
|
|
|
if(signs==null||signs.size()==0){
|
|
|
List<Map<String, Object>> signs = jdbcTemplate.queryForList(sql);
|
|
|
if (signs == null || signs.size() == 0) {
|
|
|
return -4;
|
|
|
}
|
|
|
Map<String,Object> sign = signs.get(0);
|
|
|
Map<String, Object> sign = signs.get(0);
|
|
|
//判断续签医生是否一致
|
|
|
if(doctor.equals(sign.get("doctor"))){
|
|
|
if (doctor.equals(sign.get("doctor"))) {
|
|
|
//如果一致保存团队信息
|
|
|
sf.setTeamCode((String)sign.get("teamCode"));
|
|
|
Integer c=(Integer)sign.get("adminTeamCode");
|
|
|
sf.setTeamCode((String) sign.get("teamCode"));
|
|
|
Integer c = (Integer) sign.get("adminTeamCode");
|
|
|
sf.setRenewFlag("1");
|
|
|
sf.setAdminTeamId(c.longValue());
|
|
|
}else {
|
|
|
} else {
|
|
|
//如果不一致 查看医生团队
|
|
|
sf.setRenewFlag("2");
|
|
|
// String tcSql = "SELECT t.id FROM wlyy_admin_team t WHERE t.leader_code ='"+doctor+"'";
|
|
@ -3213,8 +3220,8 @@ public class FamilyContractService extends BaseService {
|
|
|
team.setDel("1");
|
|
|
team.setSignType("2");
|
|
|
//判断是否有健康管理师
|
|
|
if(hd!=null&&StringUtils.isNotBlank(hd.getName())){
|
|
|
team.setName(d.getName()+","+hd.getName()+","+p.getName());
|
|
|
if (hd != null && StringUtils.isNotBlank(hd.getName())) {
|
|
|
team.setName(d.getName() + "," + hd.getName() + "," + p.getName());
|
|
|
//新建健康管理师
|
|
|
DoctorTeamMember hdmb = new DoctorTeamMember();
|
|
|
hdmb.setName(hd.getName());
|
|
@ -3226,8 +3233,8 @@ public class FamilyContractService extends BaseService {
|
|
|
hdmb.setType(3);
|
|
|
hdmb.setSignType("2");
|
|
|
doctorTeamDoctor.save(hdmb);
|
|
|
}else{
|
|
|
team.setName(d.getName()+","+p.getName());
|
|
|
} else {
|
|
|
team.setName(d.getName() + "," + p.getName());
|
|
|
}
|
|
|
//新建医生成员
|
|
|
DoctorTeamMember dmb = new DoctorTeamMember();
|
|
@ -3261,18 +3268,18 @@ public class FamilyContractService extends BaseService {
|
|
|
sf.setCzrq(new Date());
|
|
|
sf.setPatientApplyDate(new Date());
|
|
|
|
|
|
if(d!=null){
|
|
|
if (d != null) {
|
|
|
sf.setDoctor(doctor);
|
|
|
sf.setDoctorName(d.getName());
|
|
|
sf.setSignDoctorCode(doctor);
|
|
|
sf.setSignDoctorName(d.getName());
|
|
|
}
|
|
|
|
|
|
if(hd!=null){
|
|
|
if (hd != null) {
|
|
|
sf.setDoctorHealth(healthDoctor);
|
|
|
sf.setDoctorHealthName(hd.getName());
|
|
|
}
|
|
|
sf.setMobile((String)sign.get("mobile"));
|
|
|
sf.setMobile((String) sign.get("mobile"));
|
|
|
sf.setName(p.getName());
|
|
|
sf.setIdcard(p.getIdcard());
|
|
|
sf.setOpenid(p.getOpenid());
|
|
@ -3287,12 +3294,12 @@ public class FamilyContractService extends BaseService {
|
|
|
//******************扣费接口**********************/
|
|
|
sf.setExpensesStatus("0"); //扣费状态 【0未扣费 1已扣费 2已退费】
|
|
|
|
|
|
sf.setSignYear(DateUtil.getSignYear()+"");
|
|
|
sf.setSignYear(DateUtil.getSignYear() + "");
|
|
|
sf.setIsValid(0);
|
|
|
sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear()+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear()+1+"-06-30 23:59:59","yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
|
|
|
//设置转签原因
|
|
|
if(StringUtils.isNotBlank(reason)){
|
|
|
if (StringUtils.isNotBlank(reason)) {
|
|
|
sf.setRenewChangeReason(reason);
|
|
|
}
|
|
|
|
|
@ -3313,9 +3320,9 @@ public class FamilyContractService extends BaseService {
|
|
|
message.setTitle("家庭续签申请");
|
|
|
message.setType(1);//家庭签约信息
|
|
|
message.setReadonly(1);//是否只读消息
|
|
|
if("1".equals(sf.getRenewFlag())){
|
|
|
if ("1".equals(sf.getRenewFlag())) {
|
|
|
message.setSignStatus("8");//续签
|
|
|
}else{
|
|
|
} else {
|
|
|
message.setSignStatus("9");//改签
|
|
|
}
|
|
|
|
|
@ -3327,7 +3334,7 @@ public class FamilyContractService extends BaseService {
|
|
|
JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(doctor);
|
|
|
if (jsonObject.getString("status").equals("1")) {
|
|
|
//如果在工作时间内就推送
|
|
|
PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), p.getName()+"申请与您续签家庭医生", patient);
|
|
|
PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), p.getName() + "申请与您续签家庭医生", patient);
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -3342,7 +3349,7 @@ public class FamilyContractService extends BaseService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional
|
|
|
public int signRenewOverdue(String doctor,String healthDoctor, String patient, String reason,String countryCode) throws Exception {
|
|
|
public int signRenewOverdue(String doctor, String healthDoctor, String patient, String reason, String countryCode) throws Exception {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
if (p == null) {
|
|
|
return -1;
|
|
@ -3350,7 +3357,7 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
Doctor d = doctorDao.findByCode(doctor);
|
|
|
Doctor hd = null;
|
|
|
if(StringUtils.isNotBlank(healthDoctor)){
|
|
|
if (StringUtils.isNotBlank(healthDoctor)) {
|
|
|
hd = doctorDao.findByCode(healthDoctor);
|
|
|
}
|
|
|
|
|
@ -3359,32 +3366,32 @@ public class FamilyContractService extends BaseService {
|
|
|
}
|
|
|
|
|
|
|
|
|
List<SignFamily> res = signFamilyDao.findByDoctorAndPatientHossPost(patient,DateUtil.getSignYear()+"");
|
|
|
if(res!=null&&res.size()>0){
|
|
|
List<SignFamily> res = signFamilyDao.findByDoctorAndPatientHossPost(patient, DateUtil.getSignYear() + "");
|
|
|
if (res != null && res.size() > 0) {
|
|
|
return -2;
|
|
|
}
|
|
|
|
|
|
SignFamily sf = new SignFamily();
|
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
int year =cal.get(Calendar.YEAR);
|
|
|
int month = cal.get(Calendar.MONTH)+1;
|
|
|
String sql ="SELECT t.doctor,t.team_code teamCode,t.admin_team_code adminTeamCode,t.mobile FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status=-4 AND t.expenses_status='1' AND t.sign_year ='"+(year-1)+"'";
|
|
|
int year = cal.get(Calendar.YEAR);
|
|
|
int month = cal.get(Calendar.MONTH) + 1;
|
|
|
String sql = "SELECT t.doctor,t.team_code teamCode,t.admin_team_code adminTeamCode,t.mobile FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status=-4 AND t.expenses_status='1' AND t.sign_year ='" + (year - 1) + "'";
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> signs = jdbcTemplate.queryForList(sql);
|
|
|
if(signs==null||signs.size()==0){
|
|
|
List<Map<String, Object>> signs = jdbcTemplate.queryForList(sql);
|
|
|
if (signs == null || signs.size() == 0) {
|
|
|
return -4;
|
|
|
}
|
|
|
Map<String,Object> sign = signs.get(0);
|
|
|
Map<String, Object> sign = signs.get(0);
|
|
|
//判断续签医生是否一致
|
|
|
if(doctor.equals(sign.get("doctor"))){
|
|
|
if (doctor.equals(sign.get("doctor"))) {
|
|
|
//如果一致保存团队信息
|
|
|
sf.setRenewFlag("1");
|
|
|
sf.setTeamCode((String)sign.get("teamCode"));
|
|
|
Integer c=(Integer)sign.get("adminTeamCode");
|
|
|
sf.setTeamCode((String) sign.get("teamCode"));
|
|
|
Integer c = (Integer) sign.get("adminTeamCode");
|
|
|
sf.setAdminTeamId(c.longValue());
|
|
|
}else {
|
|
|
} else {
|
|
|
//如果不一致 查看医生团队
|
|
|
sf.setRenewFlag("2");
|
|
|
// String tcSql = "SELECT t.id FROM wlyy_admin_team t WHERE t.leader_code ='"+doctor+"'";
|
|
@ -3405,8 +3412,8 @@ public class FamilyContractService extends BaseService {
|
|
|
team.setDel("1");
|
|
|
team.setSignType("2");
|
|
|
//判断是否有健康管理师
|
|
|
if(hd!=null&&StringUtils.isNotBlank(hd.getName())){
|
|
|
team.setName(d.getName()+","+hd.getName()+","+p.getName());
|
|
|
if (hd != null && StringUtils.isNotBlank(hd.getName())) {
|
|
|
team.setName(d.getName() + "," + hd.getName() + "," + p.getName());
|
|
|
//新建健康管理师
|
|
|
DoctorTeamMember hdmb = new DoctorTeamMember();
|
|
|
hdmb.setName(hd.getName());
|
|
@ -3418,8 +3425,8 @@ public class FamilyContractService extends BaseService {
|
|
|
hdmb.setType(3);
|
|
|
hdmb.setSignType("2");
|
|
|
doctorTeamDoctor.save(hdmb);
|
|
|
}else{
|
|
|
team.setName(d.getName()+","+p.getName());
|
|
|
} else {
|
|
|
team.setName(d.getName() + "," + p.getName());
|
|
|
}
|
|
|
//新建医生成员
|
|
|
DoctorTeamMember dmb = new DoctorTeamMember();
|
|
@ -3453,18 +3460,18 @@ public class FamilyContractService extends BaseService {
|
|
|
sf.setCzrq(new Date());
|
|
|
sf.setPatientApplyDate(new Date());
|
|
|
|
|
|
if(d!=null){
|
|
|
if (d != null) {
|
|
|
sf.setDoctor(doctor);
|
|
|
sf.setDoctorName(d.getName());
|
|
|
sf.setSignDoctorCode(doctor);
|
|
|
sf.setSignDoctorName(d.getName());
|
|
|
}
|
|
|
|
|
|
if(hd!=null){
|
|
|
if (hd != null) {
|
|
|
sf.setDoctorHealth(healthDoctor);
|
|
|
sf.setDoctorHealthName(hd.getName());
|
|
|
}
|
|
|
sf.setMobile((String)sign.get("mobile"));
|
|
|
sf.setMobile((String) sign.get("mobile"));
|
|
|
sf.setName(p.getName());
|
|
|
sf.setIdcard(p.getIdcard());
|
|
|
sf.setOpenid(p.getOpenid());
|
|
@ -3479,16 +3486,16 @@ public class FamilyContractService extends BaseService {
|
|
|
//******************扣费接口**********************/
|
|
|
sf.setExpensesStatus("0"); //扣费状态 【0未扣费 1已扣费 2已退费】
|
|
|
|
|
|
sf.setSignYear(year+"");
|
|
|
sf.setSignYear(year + "");
|
|
|
|
|
|
sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear()+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear()+1+"-06-30 23:59:59","yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
|
|
|
|
|
|
if(StringUtils.isNotBlank(reason)){
|
|
|
if (StringUtils.isNotBlank(reason)) {
|
|
|
sf.setRenewChangeReason(reason);
|
|
|
}
|
|
|
//1.3.5新增居委会字段
|
|
|
signWebService.setPatientCountryFamily(countryCode,sf);
|
|
|
//1.3.5新增居委会字段
|
|
|
signWebService.setPatientCountryFamily(countryCode, sf);
|
|
|
|
|
|
SignFamily temp = signFamilyDao.save(sf);
|
|
|
|
|
@ -3508,9 +3515,9 @@ public class FamilyContractService extends BaseService {
|
|
|
message.setType(1);//家庭签约信息
|
|
|
message.setReadonly(1);//是否只读消息
|
|
|
|
|
|
if("1".equals(sf.getRenewFlag())){
|
|
|
if ("1".equals(sf.getRenewFlag())) {
|
|
|
message.setSignStatus("8");//续签
|
|
|
}else{
|
|
|
} else {
|
|
|
message.setSignStatus("9");//改签
|
|
|
}
|
|
|
//message.setSignStatus("1");//过期以后,变为1为签约
|
|
@ -3522,7 +3529,7 @@ public class FamilyContractService extends BaseService {
|
|
|
JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(doctor);
|
|
|
if (jsonObject.getString("status").equals("1")) {
|
|
|
//如果在工作时间内就推送
|
|
|
PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), p.getName()+"申请与您续签家庭医生", patient);
|
|
|
PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), p.getName() + "申请与您续签家庭医生", patient);
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -3530,20 +3537,19 @@ public class FamilyContractService extends BaseService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param code
|
|
|
* @return
|
|
|
*/
|
|
|
public String getTeamName(String code){
|
|
|
try{
|
|
|
String sql = "SELECT t.name FROM wlyy_doctor_team t WHERE t.code ='"+code+"'";
|
|
|
public String getTeamName(String code) {
|
|
|
try {
|
|
|
String sql = "SELECT t.name FROM wlyy_doctor_team t WHERE t.code ='" + code + "'";
|
|
|
|
|
|
List<Map<String,Object>> map = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String, Object>> map = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
if(map!=null&&map.size()>0){
|
|
|
return (String)map.get(0).get("name");
|
|
|
if (map != null && map.size() > 0) {
|
|
|
return (String) map.get(0).get("name");
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return "";
|
|
@ -3559,7 +3565,7 @@ public class FamilyContractService extends BaseService {
|
|
|
int year = cal.get(Calendar.YEAR);
|
|
|
|
|
|
//得到家庭签约
|
|
|
SignFamily jtSignFamily = signFamilyDao.findFamilySignByPatientOverDue(patientCode,(year-1)+"");
|
|
|
SignFamily jtSignFamily = signFamilyDao.findFamilySignByPatientOverDue(patientCode, (year - 1) + "");
|
|
|
|
|
|
if (jtSignFamily != null) {
|
|
|
//家庭签约只找全科医生
|
|
@ -3611,10 +3617,11 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
/**
|
|
|
* 存储同步纪委标识
|
|
|
*
|
|
|
* @param idCard
|
|
|
* @param signYear
|
|
|
*/
|
|
|
public void setSignFamilyMapping(String signCode,String idCard,String signYear){
|
|
|
public void setSignFamilyMapping(String signCode, String idCard, String signYear) {
|
|
|
SignFamilyMapping maping = new SignFamilyMapping();
|
|
|
maping.setCode(signCode);
|
|
|
maping.setCreateTime(new Date());
|
|
@ -3624,11 +3631,11 @@ public class FamilyContractService extends BaseService {
|
|
|
//判断是否是预签约
|
|
|
//判断规则:如果在4月份到7月份为预签约
|
|
|
int month = DateUtil.getNowMonth();
|
|
|
if(month>=4&&month<7){
|
|
|
if (month >= 4 && month < 7) {
|
|
|
//预签约逻辑
|
|
|
maping.setNeedUpload("0");
|
|
|
maping.setNeedRenewUpload("1");
|
|
|
}else{
|
|
|
} else {
|
|
|
maping.setNeedUpload("1");
|
|
|
maping.setNeedRenewUpload("0");
|
|
|
}
|
|
@ -3639,16 +3646,16 @@ public class FamilyContractService extends BaseService {
|
|
|
return signFamilyDao.findOutTimeSigningByPatient(patient);
|
|
|
}
|
|
|
|
|
|
public JSONObject getServerPatientList(Long teamCode){
|
|
|
String serverSql="SELECT " +
|
|
|
public JSONObject getServerPatientList(Long teamCode) {
|
|
|
String serverSql = "SELECT " +
|
|
|
" d.`code` As labelCode, " +
|
|
|
" d.`name` AS label " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_dict d " +
|
|
|
" WHERE " +
|
|
|
" d.type IN ('1', '2') " +
|
|
|
" AND d. YEAR = '"+DateUtil.getSignYear()+"' " ;
|
|
|
String patientSql ="SELECT " +
|
|
|
" AND d. YEAR = '" + DateUtil.getSignYear() + "' ";
|
|
|
String patientSql = "SELECT " +
|
|
|
" f.patient, " +
|
|
|
" f.sign_year, " +
|
|
|
" t.server_type AS serverType, " +
|
|
@ -3664,65 +3671,65 @@ public class FamilyContractService extends BaseService {
|
|
|
" wlyy_sign_family s " +
|
|
|
" WHERE " +
|
|
|
" s.`status` >= 0 " +
|
|
|
" AND s.admin_team_code = " +teamCode+
|
|
|
" AND s.admin_team_code = " + teamCode +
|
|
|
" AND s.doctor_health IS NULL " +
|
|
|
" ) f " +
|
|
|
"WHERE " +
|
|
|
" t.sign_code = f. CODE ";
|
|
|
List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);
|
|
|
List<Map<String, Object>> patientList = jdbcTemplate.queryForList(patientSql);
|
|
|
String totalSql = " SELECT " +
|
|
|
" s.patient" +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family s " +
|
|
|
" WHERE " +
|
|
|
" s.`status` >= 0 " +
|
|
|
" AND s.admin_team_code =" +teamCode+
|
|
|
" AND s.admin_team_code =" + teamCode +
|
|
|
" AND s.doctor_health IS NULL";
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
|
|
|
List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql);
|
|
|
|
|
|
JSONObject rs = new JSONObject();
|
|
|
rs.put("count",(totalList!=null&&totalList.size()>0)?totalList.size():0);
|
|
|
|
|
|
List<Map<String,Object>> serlist = jdbcTemplate.queryForList(serverSql);
|
|
|
if(serlist!=null&&serlist.size()>0){
|
|
|
if(patientList!=null){
|
|
|
for(Map<String,Object> map :serlist){
|
|
|
String labelCode = (String)map.get("labelCode");
|
|
|
List<Map<String,String>> codes = new ArrayList<>();
|
|
|
rs.put("count", (totalList != null && totalList.size() > 0) ? totalList.size() : 0);
|
|
|
|
|
|
List<Map<String, Object>> serlist = jdbcTemplate.queryForList(serverSql);
|
|
|
if (serlist != null && serlist.size() > 0) {
|
|
|
if (patientList != null) {
|
|
|
for (Map<String, Object> map : serlist) {
|
|
|
String labelCode = (String) map.get("labelCode");
|
|
|
List<Map<String, String>> codes = new ArrayList<>();
|
|
|
Iterator iterator = patientList.iterator();
|
|
|
while(iterator.hasNext()){
|
|
|
Map<String,Object> p = ( Map<String,Object>)iterator.next();
|
|
|
String serverType = p.get("serverType") ==null?"":((String)p.get("serverType"));
|
|
|
if(labelCode.equals(serverType)){
|
|
|
Map<String,String> code = new HashMap<>();
|
|
|
code.put("code",(String)p.get("patient"));
|
|
|
while (iterator.hasNext()) {
|
|
|
Map<String, Object> p = (Map<String, Object>) iterator.next();
|
|
|
String serverType = p.get("serverType") == null ? "" : ((String) p.get("serverType"));
|
|
|
if (labelCode.equals(serverType)) {
|
|
|
Map<String, String> code = new HashMap<>();
|
|
|
code.put("code", (String) p.get("patient"));
|
|
|
codes.add(code);
|
|
|
iterator.remove();
|
|
|
}
|
|
|
}
|
|
|
map.put("codes",codes);
|
|
|
map.put("number",(codes!=null&&codes.size()>0)?codes.size():0);
|
|
|
map.put("codes", codes);
|
|
|
map.put("number", (codes != null && codes.size() > 0) ? codes.size() : 0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
rs.put("patients",serlist);
|
|
|
rs.put("patients", serlist);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public JSONObject getCountryPatientList(Long teamCode){
|
|
|
public JSONObject getCountryPatientList(Long teamCode) {
|
|
|
String totalSql = " SELECT " +
|
|
|
" s.patient,ifnull(s.sick_village,0) as labelCode" +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family s " +
|
|
|
" WHERE " +
|
|
|
" s.`status` >= 0 " +
|
|
|
" AND s.admin_team_code = ? "+
|
|
|
" AND s.admin_team_code = ? " +
|
|
|
" AND s.doctor_health IS NULL";
|
|
|
JSONObject rs = new JSONObject();
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql,new Object[]{teamCode});
|
|
|
rs.put("count",(totalList!=null&&totalList.size()>0)?totalList.size():0);
|
|
|
String patientSql ="SELECT " +
|
|
|
List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql, new Object[]{teamCode});
|
|
|
rs.put("count", (totalList != null && totalList.size() > 0) ? totalList.size() : 0);
|
|
|
String patientSql = "SELECT " +
|
|
|
" f.sick_village AS labelCode, " +
|
|
|
" f.sick_village_name AS label, " +
|
|
|
" COUNT(1) AS number " +
|
|
@ -3732,37 +3739,37 @@ public class FamilyContractService extends BaseService {
|
|
|
" f.`status` >= 0 " +
|
|
|
" AND f.admin_team_code = ? " +
|
|
|
" AND f.doctor_health IS NULL " +
|
|
|
" AND f.sick_village IS NOT NULL "+
|
|
|
" AND f.sick_village IS NOT NULL " +
|
|
|
" GROUP BY " +
|
|
|
" f.sick_village " +
|
|
|
" ORDER BY " +
|
|
|
" number DESC ";
|
|
|
List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql,new Object[]{teamCode});
|
|
|
if(patientList!=null&&patientList.size()>0){
|
|
|
for(Map<String,Object> map : patientList){
|
|
|
String labelCode = (String)map.get("labelCode");
|
|
|
if(StringUtils.isNotBlank(labelCode)){
|
|
|
List<Map<String,String>> codes = new ArrayList<>();
|
|
|
List<Map<String, Object>> patientList = jdbcTemplate.queryForList(patientSql, new Object[]{teamCode});
|
|
|
if (patientList != null && patientList.size() > 0) {
|
|
|
for (Map<String, Object> map : patientList) {
|
|
|
String labelCode = (String) map.get("labelCode");
|
|
|
if (StringUtils.isNotBlank(labelCode)) {
|
|
|
List<Map<String, String>> codes = new ArrayList<>();
|
|
|
Iterator iterator = totalList.iterator();
|
|
|
while(iterator.hasNext()){
|
|
|
Map<String,Object> p = ( Map<String,Object>)iterator.next();
|
|
|
String lbCode = p.get("labelCode") ==null?"":((String)p.get("labelCode"));
|
|
|
if(labelCode.equals(lbCode)){
|
|
|
Map<String,String> code = new HashMap<>();
|
|
|
code.put("code",(String)p.get("patient"));
|
|
|
while (iterator.hasNext()) {
|
|
|
Map<String, Object> p = (Map<String, Object>) iterator.next();
|
|
|
String lbCode = p.get("labelCode") == null ? "" : ((String) p.get("labelCode"));
|
|
|
if (labelCode.equals(lbCode)) {
|
|
|
Map<String, String> code = new HashMap<>();
|
|
|
code.put("code", (String) p.get("patient"));
|
|
|
codes.add(code);
|
|
|
iterator.remove();
|
|
|
}
|
|
|
}
|
|
|
map.put("codes",codes);
|
|
|
map.put("codes", codes);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
rs.put("patients",patientList);
|
|
|
rs.put("patients", patientList);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public JSONObject getTeamCountryPatientChangeDoctorList(Long teamCode,String level,String oldDoctorCode){
|
|
|
public JSONObject getTeamCountryPatientChangeDoctorList(Long teamCode, String level, String oldDoctorCode) {
|
|
|
String totalSql = " SELECT " +
|
|
|
" s.patient,ifnull(s.sick_village,0) as labelCode" +
|
|
|
" FROM " +
|
|
@ -3770,15 +3777,15 @@ public class FamilyContractService extends BaseService {
|
|
|
" WHERE " +
|
|
|
" s.`status` >= 0 " +
|
|
|
" AND s.admin_team_code = ? ";
|
|
|
if("2".equals(level)){
|
|
|
totalSql = totalSql+" AND s.doctor ='"+oldDoctorCode+"'";
|
|
|
}else{
|
|
|
totalSql = totalSql+" AND s.doctor_health ='"+oldDoctorCode+"'";
|
|
|
if ("2".equals(level)) {
|
|
|
totalSql = totalSql + " AND s.doctor ='" + oldDoctorCode + "'";
|
|
|
} else {
|
|
|
totalSql = totalSql + " AND s.doctor_health ='" + oldDoctorCode + "'";
|
|
|
}
|
|
|
JSONObject rs = new JSONObject();
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql,new Object[]{teamCode});
|
|
|
rs.put("count",(totalList!=null&&totalList.size()>0)?totalList.size():0);
|
|
|
String patientSql ="SELECT " +
|
|
|
List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql, new Object[]{teamCode});
|
|
|
rs.put("count", (totalList != null && totalList.size() > 0) ? totalList.size() : 0);
|
|
|
String patientSql = "SELECT " +
|
|
|
" f.sick_village AS labelCode, " +
|
|
|
" f.sick_village_name AS label, " +
|
|
|
" COUNT(1) AS number " +
|
|
@ -3786,54 +3793,54 @@ public class FamilyContractService extends BaseService {
|
|
|
" wlyy_sign_family f " +
|
|
|
" WHERE " +
|
|
|
" f.`status` >= 0 " +
|
|
|
" AND f.sick_village IS NOT NULL "+
|
|
|
" AND f.admin_team_code = ? " ;
|
|
|
if("2".equals(level)){
|
|
|
patientSql = patientSql+" AND f.doctor ='"+oldDoctorCode+"'";
|
|
|
}else{
|
|
|
patientSql = patientSql+" AND f.doctor_health ='"+oldDoctorCode+"'";
|
|
|
}
|
|
|
patientSql = patientSql+" GROUP BY " +
|
|
|
" AND f.sick_village IS NOT NULL " +
|
|
|
" AND f.admin_team_code = ? ";
|
|
|
if ("2".equals(level)) {
|
|
|
patientSql = patientSql + " AND f.doctor ='" + oldDoctorCode + "'";
|
|
|
} else {
|
|
|
patientSql = patientSql + " AND f.doctor_health ='" + oldDoctorCode + "'";
|
|
|
}
|
|
|
patientSql = patientSql + " GROUP BY " +
|
|
|
" f.sick_village " +
|
|
|
" ORDER BY " +
|
|
|
" number DESC ";
|
|
|
List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql,new Object[]{teamCode});
|
|
|
if(patientList!=null&&patientList.size()>0){
|
|
|
for(Map<String,Object> map : patientList){
|
|
|
String labelCode = (String)map.get("labelCode");
|
|
|
if(StringUtils.isNotBlank(labelCode)){
|
|
|
List<Map<String,String>> codes = new ArrayList<>();
|
|
|
List<Map<String, Object>> patientList = jdbcTemplate.queryForList(patientSql, new Object[]{teamCode});
|
|
|
if (patientList != null && patientList.size() > 0) {
|
|
|
for (Map<String, Object> map : patientList) {
|
|
|
String labelCode = (String) map.get("labelCode");
|
|
|
if (StringUtils.isNotBlank(labelCode)) {
|
|
|
List<Map<String, String>> codes = new ArrayList<>();
|
|
|
Iterator iterator = totalList.iterator();
|
|
|
while(iterator.hasNext()){
|
|
|
Map<String,Object> p = ( Map<String,Object>)iterator.next();
|
|
|
String lbCode = p.get("labelCode") ==null?"":((String)p.get("labelCode"));
|
|
|
if(labelCode.equals(lbCode)){
|
|
|
Map<String,String> code = new HashMap<>();
|
|
|
code.put("code",(String)p.get("patient"));
|
|
|
while (iterator.hasNext()) {
|
|
|
Map<String, Object> p = (Map<String, Object>) iterator.next();
|
|
|
String lbCode = p.get("labelCode") == null ? "" : ((String) p.get("labelCode"));
|
|
|
if (labelCode.equals(lbCode)) {
|
|
|
Map<String, String> code = new HashMap<>();
|
|
|
code.put("code", (String) p.get("patient"));
|
|
|
codes.add(code);
|
|
|
iterator.remove();
|
|
|
}
|
|
|
}
|
|
|
map.put("codes",codes);
|
|
|
map.put("codes", codes);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
rs.put("patients",patientList);
|
|
|
rs.put("patients", patientList);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
|
|
|
public JSONObject getServerPatientListNum(Long teamCode,String level, String oldDoctorCode){
|
|
|
String serverSql="SELECT " +
|
|
|
public JSONObject getServerPatientListNum(Long teamCode, String level, String oldDoctorCode) {
|
|
|
String serverSql = "SELECT " +
|
|
|
" d.`code` As labelCode, " +
|
|
|
" d.`name` AS label " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_dict d " +
|
|
|
" WHERE " +
|
|
|
" d.type IN ('1', '2') " +
|
|
|
" AND d. YEAR = '"+DateUtil.getSignYear()+"' ";
|
|
|
" AND d. YEAR = '" + DateUtil.getSignYear() + "' ";
|
|
|
|
|
|
String patientSql ="SELECT " +
|
|
|
String patientSql = "SELECT " +
|
|
|
" f.patient, " +
|
|
|
" s.server_type AS serverType, " +
|
|
|
" s.server_type_name AS serverTypeName " +
|
|
@ -3847,68 +3854,67 @@ public class FamilyContractService extends BaseService {
|
|
|
" wlyy_sign_family s " +
|
|
|
" WHERE " +
|
|
|
" s.`status` >= 0 " +
|
|
|
" AND s.admin_team_code = " +teamCode ;
|
|
|
" AND s.admin_team_code = " + teamCode;
|
|
|
//1查询全科,其他查询健管师
|
|
|
if("2".equals(level)){
|
|
|
patientSql = patientSql+" AND s.doctor ='"+oldDoctorCode+"'";
|
|
|
}else{
|
|
|
patientSql = patientSql+" AND s.doctor_health ='"+oldDoctorCode+"'";
|
|
|
if ("2".equals(level)) {
|
|
|
patientSql = patientSql + " AND s.doctor ='" + oldDoctorCode + "'";
|
|
|
} else {
|
|
|
patientSql = patientSql + " AND s.doctor_health ='" + oldDoctorCode + "'";
|
|
|
}
|
|
|
patientSql =patientSql+" ) f WHERE f.`code` =s.sign_code";
|
|
|
patientSql = patientSql + " ) f WHERE f.`code` =s.sign_code";
|
|
|
|
|
|
List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);
|
|
|
String totalSql =" SELECT " +
|
|
|
List<Map<String, Object>> patientList = jdbcTemplate.queryForList(patientSql);
|
|
|
String totalSql = " SELECT " +
|
|
|
" s.patient " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family s " +
|
|
|
" WHERE " +
|
|
|
" s.`status` >= 0 " +
|
|
|
" AND s.admin_team_code =" +teamCode;
|
|
|
" AND s.admin_team_code =" + teamCode;
|
|
|
//1查询全科,其他查询健管师
|
|
|
if("2".equals(level)){
|
|
|
totalSql = totalSql+" AND s.doctor ='"+oldDoctorCode+"'";
|
|
|
}else{
|
|
|
totalSql = totalSql+" AND s.doctor_health ='"+oldDoctorCode+"'";
|
|
|
if ("2".equals(level)) {
|
|
|
totalSql = totalSql + " AND s.doctor ='" + oldDoctorCode + "'";
|
|
|
} else {
|
|
|
totalSql = totalSql + " AND s.doctor_health ='" + oldDoctorCode + "'";
|
|
|
}
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
|
|
|
List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql);
|
|
|
|
|
|
JSONObject rs = new JSONObject();
|
|
|
rs.put("count",(totalList!=null&&totalList.size()>0)?totalList.size():0);
|
|
|
|
|
|
List<Map<String,Object>> serlist = jdbcTemplate.queryForList(serverSql);
|
|
|
if(serlist!=null&&serlist.size()>0){
|
|
|
if(patientList!=null){
|
|
|
for(Map<String,Object> map :serlist){
|
|
|
String labelCode = (String)map.get("labelCode");
|
|
|
List<Map<String,String>> codes = new ArrayList<>();
|
|
|
rs.put("count", (totalList != null && totalList.size() > 0) ? totalList.size() : 0);
|
|
|
|
|
|
List<Map<String, Object>> serlist = jdbcTemplate.queryForList(serverSql);
|
|
|
if (serlist != null && serlist.size() > 0) {
|
|
|
if (patientList != null) {
|
|
|
for (Map<String, Object> map : serlist) {
|
|
|
String labelCode = (String) map.get("labelCode");
|
|
|
List<Map<String, String>> codes = new ArrayList<>();
|
|
|
Iterator iterator = patientList.iterator();
|
|
|
while(iterator.hasNext()){
|
|
|
Map<String,Object> p = ( Map<String,Object>)iterator.next();
|
|
|
String serverType = p.get("serverType") ==null?"":((String)p.get("serverType"));
|
|
|
if(labelCode.equals(serverType)){
|
|
|
Map<String,String> code = new HashMap<>();
|
|
|
code.put("code",(String)p.get("patient"));
|
|
|
while (iterator.hasNext()) {
|
|
|
Map<String, Object> p = (Map<String, Object>) iterator.next();
|
|
|
String serverType = p.get("serverType") == null ? "" : ((String) p.get("serverType"));
|
|
|
if (labelCode.equals(serverType)) {
|
|
|
Map<String, String> code = new HashMap<>();
|
|
|
code.put("code", (String) p.get("patient"));
|
|
|
codes.add(code);
|
|
|
iterator.remove();
|
|
|
}
|
|
|
}
|
|
|
map.put("codes",codes);
|
|
|
map.put("number",(codes!=null&&codes.size()>0)?codes.size():0);
|
|
|
map.put("codes", codes);
|
|
|
map.put("number", (codes != null && codes.size() > 0) ? codes.size() : 0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
rs.put("patients",serlist);
|
|
|
rs.put("patients", serlist);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Map<String,Object>> patientGroupByServerType(String doctor) {
|
|
|
public List<Map<String, Object>> patientGroupByServerType(String doctor) {
|
|
|
|
|
|
// 先根据server_type分组查找wlyy_sign_family表中该医生的签约的患者,然后wlyy_sign_dict left join 得到全部的类型
|
|
|
|
|
|
String sql="SELECT " +
|
|
|
String sql = "SELECT " +
|
|
|
" sd.CODE labelCode, " +
|
|
|
" sd.NAME labelName, " +
|
|
|
" IFNULL(t.count,0) amount " +
|
|
@ -3939,9 +3945,9 @@ public class FamilyContractService extends BaseService {
|
|
|
" s.server_type " +
|
|
|
") t ON sd.CODE = t.server_type " +
|
|
|
"WHERE " +
|
|
|
" sd.`year` = '"+DateUtil.getSignYear()+"'";
|
|
|
" sd.`year` = '" + DateUtil.getSignYear() + "'";
|
|
|
|
|
|
List<Map<String,Object>> queryData=jdbcTemplate.queryForList(sql,doctor,doctor);
|
|
|
List<Map<String, Object>> queryData = jdbcTemplate.queryForList(sql, doctor, doctor);
|
|
|
|
|
|
return queryData;
|
|
|
|
|
@ -3949,16 +3955,17 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
/**
|
|
|
* 判断患者和医生是否有去年的签约记录
|
|
|
*
|
|
|
* @param patient
|
|
|
* @param doctor
|
|
|
* @return
|
|
|
*/
|
|
|
public Map<String,Object> checkLastYearIsSign(String patient,String doctor){
|
|
|
String sql = "SELECT f.id,f.admin_team_code FROM wlyy_sign_family f WHERE f.doctor ='"+doctor+"' AND f.patient='"+patient+"' AND f.sign_year='"+(DateUtil.getSignYear()-1)+"' AND f.`status`=-4 AND f.expenses_status ='1'";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if (list!=null&&list.size()>0){
|
|
|
public Map<String, Object> checkLastYearIsSign(String patient, String doctor) {
|
|
|
String sql = "SELECT f.id,f.admin_team_code FROM wlyy_sign_family f WHERE f.doctor ='" + doctor + "' AND f.patient='" + patient + "' AND f.sign_year='" + (DateUtil.getSignYear() - 1) + "' AND f.`status`=-4 AND f.expenses_status ='1'";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if (list != null && list.size() > 0) {
|
|
|
return list.get(0);
|
|
|
}else{
|
|
|
} else {
|
|
|
return null;
|
|
|
}
|
|
|
}
|