|  | @ -1,6 +1,7 @@
 | 
												
													
														
															|  | package com.yihu.wlyy.service.app.sign;
 |  | package com.yihu.wlyy.service.app.sign;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import com.sun.corba.se.spi.activation.Server;
 |  | import com.sun.corba.se.spi.activation.Server;
 | 
												
													
														
															|  | 
 |  | import com.yihu.wlyy.entity.charge.WlyyCharge;
 | 
												
													
														
															|  | import com.yihu.wlyy.entity.consult.Consult;
 |  | import com.yihu.wlyy.entity.consult.Consult;
 | 
												
													
														
															|  | import com.yihu.wlyy.entity.dict.SystemDict;
 |  | import com.yihu.wlyy.entity.dict.SystemDict;
 | 
												
													
														
															|  | import com.yihu.wlyy.entity.doctor.profile.Doctor;
 |  | import com.yihu.wlyy.entity.doctor.profile.Doctor;
 | 
												
											
												
													
														
															|  | @ -9,6 +10,7 @@ import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
 | 
												
													
														
															|  | import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
 |  | import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
 | 
												
													
														
															|  | import com.yihu.wlyy.entity.message.Message;
 |  | import com.yihu.wlyy.entity.message.Message;
 | 
												
													
														
															|  | import com.yihu.wlyy.entity.patient.*;
 |  | import com.yihu.wlyy.entity.patient.*;
 | 
												
													
														
															|  | 
 |  | import com.yihu.wlyy.repository.charge.ChargeDao;
 | 
												
													
														
															|  | import com.yihu.wlyy.repository.consult.ConsultDao;
 |  | import com.yihu.wlyy.repository.consult.ConsultDao;
 | 
												
													
														
															|  | import com.yihu.wlyy.repository.consult.ConsultTeamDao;
 |  | import com.yihu.wlyy.repository.consult.ConsultTeamDao;
 | 
												
													
														
															|  | import com.yihu.wlyy.repository.doctor.DoctorDao;
 |  | import com.yihu.wlyy.repository.doctor.DoctorDao;
 | 
												
											
												
													
														
															|  | @ -91,6 +93,8 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |     private ConsultTeamDao consultTeamDao;
 |  |     private ConsultTeamDao consultTeamDao;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private SignFamilyServerDao signFamilyServerDao;
 |  |     private SignFamilyServerDao signFamilyServerDao;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private ChargeDao chargeDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 根据医生代码及签约状态编码 获取该医生签约患者的信息列表
 |  |      * 根据医生代码及签约状态编码 获取该医生签约患者的信息列表
 | 
												
											
												
													
														
															|  | @ -149,7 +153,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 "    ,b.openid" +
 |  |                 "    ,b.openid" +
 | 
												
													
														
															|  |                 "    ,a.renew_flag as renewFlag" +
 |  |                 "    ,a.renew_flag as renewFlag" +
 | 
												
													
														
															|  |                 " from " +
 |  |                 " from " +
 | 
												
													
														
															|  |                 " ( select renew_flag,code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family where (doctor = ? or doctor_health = ?) and status > ? and type = 2 order by begin desc ) a " +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " ( select renew_flag,code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family where doctor = ?  and status > ? and type = 2 order by begin desc ) a " +
 | 
												
													
														
															|  |                 " ,wlyy_patient b " +
 |  |                 " ,wlyy_patient b " +
 | 
												
													
														
															|  |                 " where a.patient = b.code and (a.expenses_status = '0' or a.len < 1) order by a.begin desc limit " + page * pageSize + "," + pageSize;
 |  |                 " where a.patient = b.code and (a.expenses_status = '0' or a.len < 1) order by a.begin desc limit " + page * pageSize + "," + pageSize;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -174,7 +178,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 "    ,b.openid" +
 |  |                 "    ,b.openid" +
 | 
												
													
														
															|  |                 "    ,a.renew_flag as renewFlag" +
 |  |                 "    ,a.renew_flag as renewFlag" +
 | 
												
													
														
															|  |                 " from " +
 |  |                 " from " +
 | 
												
													
														
															|  |                 " ( select renew_flag,code,patient,doctor,status,id,apply_date,apply_unsign_date,reason,begin from wlyy_sign_family where (doctor = ? or doctor_health = ?) and ( status = ? or status = ? ) and type = 2 order by begin desc ) a " +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " ( select renew_flag,code,patient,doctor,status,id,apply_date,apply_unsign_date,reason,begin from wlyy_sign_family where doctor = ?  and ( status = ? or status = ? ) and type = 2 order by begin desc ) a " +
 | 
												
													
														
															|  |                 " ,wlyy_patient b " +
 |  |                 " ,wlyy_patient b " +
 | 
												
													
														
															|  |                 " where a.patient = b.code  order by a.begin desc limit " + page * pageSize + "," + pageSize;
 |  |                 " where a.patient = b.code  order by a.begin desc limit " + page * pageSize + "," + pageSize;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -194,10 +198,10 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 1});
 |  |                 patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 1});
 | 
												
													
														
															|  |                 break;
 |  |                 break;
 | 
												
													
														
															|  |             case 4:// 4已经解约
 |  |             case 4:// 4已经解约
 | 
												
													
														
															|  |                 patients = jdbcTemplate.queryForList(surrSql, new Object[]{doctor,doctor, -3, -4});
 |  | 
 | 
												
													
														
															|  | 
 |  |                 patients = jdbcTemplate.queryForList(surrSql, new Object[]{doctor, -3, -4});
 | 
												
													
														
															|  |                 break;
 |  |                 break;
 | 
												
													
														
															|  |             case 5: // 未缴费
 |  |             case 5: // 未缴费
 | 
												
													
														
															|  |                 patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor,doctor,0});
 |  | 
 | 
												
													
														
															|  | 
 |  |                 patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, 0});
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         return patients;
 |  |         return patients;
 | 
												
											
												
													
														
															|  | @ -412,12 +416,13 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 adminTeam = adminTeamService.getTeam(renew.getAdminTeamId());
 |  |                 adminTeam = adminTeamService.getTeam(renew.getAdminTeamId());
 | 
												
													
														
															|  |                 doctor = doctorService.findDoctorByCode(adminTeam.getLeaderCode());
 |  |                 doctor = doctorService.findDoctorByCode(adminTeam.getLeaderCode());
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  |             String renewCode = renew.getCode();
 | 
												
													
														
															|  |             if (adminTeam == null) adminTeam = new AdminTeam();
 |  |             if (adminTeam == null) adminTeam = new AdminTeam();
 | 
												
													
														
															|  |             if (doctor == null) doctor = new Doctor();
 |  |             if (doctor == null) doctor = new Doctor();
 | 
												
													
														
															|  |             JSONObject jsonObject = new JSONObject();
 |  |             JSONObject jsonObject = new JSONObject();
 | 
												
													
														
															|  |             jsonObject.put("hospitalName", renew.getHospitalName());
 |  |             jsonObject.put("hospitalName", renew.getHospitalName());
 | 
												
													
														
															|  |             jsonObject.put("hospital", renew.getHospital());
 |  |             jsonObject.put("hospital", renew.getHospital());
 | 
												
													
														
															|  |             jsonObject.put("code", renew.getCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |             jsonObject.put("code", renewCode);
 | 
												
													
														
															|  |             jsonObject.put("teamCode", renew.getTeamCode());
 |  |             jsonObject.put("teamCode", renew.getTeamCode());
 | 
												
													
														
															|  |             jsonObject.put("begin", renew.getBegin());
 |  |             jsonObject.put("begin", renew.getBegin());
 | 
												
													
														
															|  |             jsonObject.put("end", renew.getEnd());
 |  |             jsonObject.put("end", renew.getEnd());
 | 
												
											
												
													
														
															|  | @ -434,6 +439,13 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |             jsonObject.put("type", renew.getType());
 |  |             jsonObject.put("type", renew.getType());
 | 
												
													
														
															|  |             jsonObject.put("typeName", renew.getType() == 1 ? "三师签约" : "家庭签约续签");
 |  |             jsonObject.put("typeName", renew.getType() == 1 ? "三师签约" : "家庭签约续签");
 | 
												
													
														
															|  |             jsonObject.put("isRenew", "1");
 |  |             jsonObject.put("isRenew", "1");
 | 
												
													
														
															|  | 
 |  |             //        新增补贴类型
 | 
												
													
														
															|  | 
 |  |             jsonObject.put("expensesType", renew.getExpensesType());
 | 
												
													
														
															|  | 
 |  | //            新增缴费流水号
 | 
												
													
														
															|  | 
 |  |             WlyyCharge charge = chargeDao.findByChargeRelation(renewCode);
 | 
												
													
														
															|  | 
 |  |             if (charge != null) {
 | 
												
													
														
															|  | 
 |  |                 jsonObject.put("chargeNo", charge.getChargeNo());
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  |             String statusName = "";
 |  |             String statusName = "";
 | 
												
													
														
															|  |             switch (jsonObject.getInt("status")) {
 |  |             switch (jsonObject.getInt("status")) {
 | 
												
													
														
															|  |                 case -4:
 |  |                 case -4:
 | 
												
											
												
													
														
															|  | @ -473,12 +485,13 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 adminTeam = adminTeamService.getTeam(signFamily.getAdminTeamId());
 |  |                 adminTeam = adminTeamService.getTeam(signFamily.getAdminTeamId());
 | 
												
													
														
															|  |                 doctor = doctorService.findDoctorByCode(adminTeam.getLeaderCode());
 |  |                 doctor = doctorService.findDoctorByCode(adminTeam.getLeaderCode());
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  |             String signCode = signFamily.getCode();
 | 
												
													
														
															|  |             if (adminTeam == null) adminTeam = new AdminTeam();
 |  |             if (adminTeam == null) adminTeam = new AdminTeam();
 | 
												
													
														
															|  |             if (doctor == null) doctor = new Doctor();
 |  |             if (doctor == null) doctor = new Doctor();
 | 
												
													
														
															|  |             JSONObject jsonObject = new JSONObject();
 |  |             JSONObject jsonObject = new JSONObject();
 | 
												
													
														
															|  |             jsonObject.put("hospitalName", signFamily.getHospitalName());
 |  |             jsonObject.put("hospitalName", signFamily.getHospitalName());
 | 
												
													
														
															|  |             jsonObject.put("hospital", signFamily.getHospital());
 |  |             jsonObject.put("hospital", signFamily.getHospital());
 | 
												
													
														
															|  |             jsonObject.put("code", signFamily.getCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |             jsonObject.put("code", signCode);
 | 
												
													
														
															|  |             jsonObject.put("teamCode", signFamily.getTeamCode());
 |  |             jsonObject.put("teamCode", signFamily.getTeamCode());
 | 
												
													
														
															|  |             jsonObject.put("begin", signFamily.getBegin());
 |  |             jsonObject.put("begin", signFamily.getBegin());
 | 
												
													
														
															|  |             jsonObject.put("end", signFamily.getEnd());
 |  |             jsonObject.put("end", signFamily.getEnd());
 | 
												
											
												
													
														
															|  | @ -494,9 +507,16 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |             jsonObject.put("createTime", signFamily.getCzrq());
 |  |             jsonObject.put("createTime", signFamily.getCzrq());
 | 
												
													
														
															|  |             jsonObject.put("type", signFamily.getType());
 |  |             jsonObject.put("type", signFamily.getType());
 | 
												
													
														
															|  |             jsonObject.put("typeName", signFamily.getType() == 1 ? "三师签约" : "家庭签约");
 |  |             jsonObject.put("typeName", signFamily.getType() == 1 ? "三师签约" : "家庭签约");
 | 
												
													
														
															|  |             if(StringUtils.isNotBlank(signFamily.getRenewFlag())){
 |  | 
 | 
												
													
														
															|  | 
 |  |             //        新增补贴类型
 | 
												
													
														
															|  | 
 |  |             jsonObject.put("expensesType", signFamily.getExpensesType());
 | 
												
													
														
															|  | 
 |  |             //            新增缴费流水号
 | 
												
													
														
															|  | 
 |  |             WlyyCharge charge = chargeDao.findByChargeRelation(signCode);
 | 
												
													
														
															|  | 
 |  |             if (charge != null) {
 | 
												
													
														
															|  | 
 |  |                 jsonObject.put("chargeNo", charge.getChargeNo());
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if (StringUtils.isNotBlank(signFamily.getRenewFlag())) {
 | 
												
													
														
															|  |                 jsonObject.put("isRenew", "1");
 |  |                 jsonObject.put("isRenew", "1");
 | 
												
													
														
															|  |             }else{
 |  | 
 | 
												
													
														
															|  | 
 |  |             } else {
 | 
												
													
														
															|  |                 jsonObject.put("isRenew", "0");
 |  |                 jsonObject.put("isRenew", "0");
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             String statusName = "";
 |  |             String statusName = "";
 | 
												
											
												
													
														
															|  | @ -543,13 +563,112 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |         return jsonArray;
 |  |         return jsonArray;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 根据签约code获取签约详情
 | 
												
													
														
															|  | 
 |  |      *
 | 
												
													
														
															|  | 
 |  |      * @param signCode 签约code
 | 
												
													
														
															|  | 
 |  |      * @return
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public List<JSONObject> getSignInfo(String signCode) {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<JSONObject> jsonArray = new ArrayList<JSONObject>();
 | 
												
													
														
															|  | 
 |  |         // 直接查询签约缴费流水号 可能为空
 | 
												
													
														
															|  | 
 |  |         WlyyCharge charge = chargeDao.findByChargeRelation(signCode);
 | 
												
													
														
															|  | 
 |  |         //查询签约表数据
 | 
												
													
														
															|  | 
 |  |         SignFamily signFamily = signFamilyDao.findByCode(signCode);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         AdminTeam adminTeam = null;
 | 
												
													
														
															|  | 
 |  |         Doctor doctor = null;
 | 
												
													
														
															|  | 
 |  |         if (signFamily.getAdminTeamId() != null) {
 | 
												
													
														
															|  | 
 |  |             adminTeam = adminTeamService.getTeam(signFamily.getAdminTeamId());
 | 
												
													
														
															|  | 
 |  |             doctor = doctorService.findDoctorByCode(adminTeam.getLeaderCode());
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (adminTeam == null) adminTeam = new AdminTeam();
 | 
												
													
														
															|  | 
 |  |         if (doctor == null) doctor = new Doctor();
 | 
												
													
														
															|  | 
 |  |         JSONObject jsonObject = new JSONObject();
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("hospitalName", signFamily.getHospitalName());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("hospital", signFamily.getHospital());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("code", signFamily.getCode());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("teamCode", signFamily.getTeamCode());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("begin", signFamily.getBegin());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("end", signFamily.getEnd());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("status", signFamily.getStatus());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("leader", adminTeam.getLeaderCode());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("leaderName", doctor.getName());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("doctor", signFamily.getDoctor());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("doctorHealth", signFamily.getDoctorHealth());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("doctorName", signFamily.getDoctorName());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("doctorHealthName", signFamily.getDoctorHealthName());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("expensesStatus", StringUtils.isNotBlank(signFamily.getExpensesStatus()) ? signFamily.getExpensesStatus() : "1");
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("applyDate", signFamily.getApplyDate());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("createTime", signFamily.getCzrq());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("type", signFamily.getType());
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("typeName", signFamily.getType() == 1 ? "三师签约" : "家庭签约");
 | 
												
													
														
															|  | 
 |  | //        新增补贴类型
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("expensesType", signFamily.getExpensesType());
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(signFamily.getRenewFlag())) {
 | 
												
													
														
															|  | 
 |  |             jsonObject.put("isRenew", "1");
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             jsonObject.put("isRenew", "0");
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         String statusName = "";
 | 
												
													
														
															|  | 
 |  |         switch (jsonObject.getInt("status")) {
 | 
												
													
														
															|  | 
 |  |             case -4:
 | 
												
													
														
															|  | 
 |  |                 statusName = "已到期";
 | 
												
													
														
															|  | 
 |  |                 break;
 | 
												
													
														
															|  | 
 |  |             case -3:
 | 
												
													
														
															|  | 
 |  |                 statusName = "已解约";
 | 
												
													
														
															|  | 
 |  |                 break;
 | 
												
													
														
															|  | 
 |  |             case 0:
 | 
												
													
														
															|  | 
 |  |                 statusName = "待签约";
 | 
												
													
														
															|  | 
 |  |                 break;
 | 
												
													
														
															|  | 
 |  |             case 1:
 | 
												
													
														
															|  | 
 |  |                 if (jsonObject.getInt("expensesStatus") == 1) {
 | 
												
													
														
															|  | 
 |  |                     statusName = "已签约";
 | 
												
													
														
															|  | 
 |  |                 } else {
 | 
												
													
														
															|  | 
 |  |                     statusName = "待缴费";
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 break;
 | 
												
													
														
															|  | 
 |  |             case 2:
 | 
												
													
														
															|  | 
 |  |                 statusName = "患者申请取消签约";
 | 
												
													
														
															|  | 
 |  |                 break;
 | 
												
													
														
															|  | 
 |  |             case 3:
 | 
												
													
														
															|  | 
 |  |                 statusName = "医生申请取消签约";
 | 
												
													
														
															|  | 
 |  |                 break;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         jsonObject.put("statusName", statusName);
 | 
												
													
														
															|  | 
 |  | //            增加支付流水号
 | 
												
													
														
															|  | 
 |  |         if (charge!=null) {
 | 
												
													
														
															|  | 
 |  |             String chargeNo = charge.getChargeNo();
 | 
												
													
														
															|  | 
 |  |             jsonObject.put("chargeNo", chargeNo);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         jsonArray.add(jsonObject);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         Collections.sort(jsonArray, new Comparator<JSONObject>() {
 | 
												
													
														
															|  | 
 |  |             @Override
 | 
												
													
														
															|  | 
 |  |             public int compare(JSONObject o1, JSONObject o2) {
 | 
												
													
														
															|  | 
 |  |                 Date o1Date = (Date) o1.get("createTime");
 | 
												
													
														
															|  | 
 |  |                 Date o2Date = (Date) o2.get("createTime");
 | 
												
													
														
															|  | 
 |  |                 if (o1Date.before(o2Date)) {
 | 
												
													
														
															|  | 
 |  |                     return 1;
 | 
												
													
														
															|  | 
 |  |                 } else if (o1Date.after(o2Date)) {
 | 
												
													
														
															|  | 
 |  |                     return -1;
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 return 0;
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         });
 | 
												
													
														
															|  | 
 |  |         return jsonArray;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 进行中的咨询获取服务团队信息
 |  |      * 进行中的咨询获取服务团队信息
 | 
												
													
														
															|  | 
 |  |      *
 | 
												
													
														
															|  |      * @param teamCode
 |  |      * @param teamCode
 | 
												
													
														
															|  |      * @param code
 |  |      * @param code
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public JSONObject getConsultSignInfoOrRenewInfo(String teamCode, String code,String patient,String consultCode,Integer status) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getConsultSignInfoOrRenewInfo(String teamCode, String code, String patient, String consultCode, Integer status) {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //签约或续签参数
 |  |         //签约或续签参数
 | 
												
													
														
															|  |         String patientCode = null;
 |  |         String patientCode = null;
 | 
												
											
												
													
														
															|  | @ -562,20 +681,20 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |         if (renews == null || renews.size() == 0) {
 |  |         if (renews == null || renews.size() == 0) {
 | 
												
													
														
															|  |             //再查找签约表记录
 |  |             //再查找签约表记录
 | 
												
													
														
															|  |             SignFamily signFamily = null;
 |  |             SignFamily signFamily = null;
 | 
												
													
														
															|  |             if(consultCode==null){
 |  | 
 | 
												
													
														
															|  |                 if(status==1){
 |  | 
 | 
												
													
														
															|  |                     signFamily = signFamilyDao.findByPatientCodeStatus(patient,status);
 |  | 
 | 
												
													
														
															|  |                 }else {
 |  | 
 | 
												
													
														
															|  | 
 |  |             if (consultCode == null) {
 | 
												
													
														
															|  | 
 |  |                 if (status == 1) {
 | 
												
													
														
															|  | 
 |  |                     signFamily = signFamilyDao.findByPatientCodeStatus(patient, status);
 | 
												
													
														
															|  | 
 |  |                 } else {
 | 
												
													
														
															|  |                     signFamily = signFamilyDao.findOutTimeSigningByPatient(patient);
 |  |                     signFamily = signFamilyDao.findOutTimeSigningByPatient(patient);
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }else {
 |  | 
 | 
												
													
														
															|  | 
 |  |             } else {
 | 
												
													
														
															|  |                 signFamily = signFamilyDao.findByPatient(patient);
 |  |                 signFamily = signFamilyDao.findByPatient(patient);
 | 
												
													
														
															|  |                 Consult consult = consultDao.findByCode(consultCode);
 |  |                 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);
 |  |                     signFamily = signFamilyDao.findOutTimeSigningByPatient(patient);
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             if(signFamily==null){
 |  | 
 | 
												
													
														
															|  | 
 |  |             if (signFamily == null) {
 | 
												
													
														
															|  |                 throw new RuntimeException("找不到签约关系!");
 |  |                 throw new RuntimeException("找不到签约关系!");
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             patientCode = signFamily.getPatient();
 |  |             patientCode = signFamily.getPatient();
 | 
												
											
												
													
														
															|  | @ -963,7 +1082,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 "    ,b.sex" +
 |  |                 "    ,b.sex" +
 | 
												
													
														
															|  |                 "    ,b.openid" +
 |  |                 "    ,b.openid" +
 | 
												
													
														
															|  |                 "    ,a.czrq" +
 |  |                 "    ,a.czrq" +
 | 
												
													
														
															|  |                 "    ,a.renew_flag as renewFlag "+
 |  | 
 | 
												
													
														
															|  | 
 |  |                 "    ,a.renew_flag as renewFlag " +
 | 
												
													
														
															|  |                 " from " +
 |  |                 " from " +
 | 
												
													
														
															|  |                 " ( select czrq,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin,renew_flag from wlyy_sign_family_renew where doctor = ? and status = ? and type = 2" +
 |  |                 " ( select czrq,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin,renew_flag from wlyy_sign_family_renew where doctor = ? and status = ? and type = 2" +
 | 
												
													
														
															|  |                 " order by begin desc ) a " +
 |  |                 " order by begin desc ) a " +
 | 
												
											
												
													
														
															|  | @ -990,7 +1109,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 "    ,b.sex" +
 |  |                 "    ,b.sex" +
 | 
												
													
														
															|  |                 "    ,b.openid" +
 |  |                 "    ,b.openid" +
 | 
												
													
														
															|  |                 "    ,a.czrq" +
 |  |                 "    ,a.czrq" +
 | 
												
													
														
															|  |                 "    ,a.renew_flag as renewFlag "+
 |  | 
 | 
												
													
														
															|  | 
 |  |                 "    ,a.renew_flag as renewFlag " +
 | 
												
													
														
															|  |                 " from " +
 |  |                 " from " +
 | 
												
													
														
															|  |                 " ( select czrq,renew_flag,code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family_renew where doctor = ? and status > ? and type = 2 order by begin desc ) a " +
 |  |                 " ( select czrq,renew_flag,code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family_renew where doctor = ? and status > ? and type = 2 order by begin desc ) a " +
 | 
												
													
														
															|  |                 " ,wlyy_patient b " +
 |  |                 " ,wlyy_patient b " +
 | 
												
											
												
													
														
															|  | @ -1016,7 +1135,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 "    ,b.sex" +
 |  |                 "    ,b.sex" +
 | 
												
													
														
															|  |                 "    ,b.openid" +
 |  |                 "    ,b.openid" +
 | 
												
													
														
															|  |                 "    ,a.czrq" +
 |  |                 "    ,a.czrq" +
 | 
												
													
														
															|  |                 "    ,a.renew_flag as renewFlag "+
 |  | 
 | 
												
													
														
															|  | 
 |  |                 "    ,a.renew_flag as renewFlag " +
 | 
												
													
														
															|  |                 " from " +
 |  |                 " from " +
 | 
												
													
														
															|  |                 " ( select expenses_status,czrq,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin,renew_flag from wlyy_sign_family_renew where doctor = ? and status = ? and type = 2" +
 |  |                 " ( select expenses_status,czrq,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin,renew_flag from wlyy_sign_family_renew where doctor = ? and status = ? and type = 2" +
 | 
												
													
														
															|  |                 " order by begin desc ) a " +
 |  |                 " order by begin desc ) a " +
 | 
												
											
												
													
														
															|  | @ -1067,7 +1186,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 JSONObject json = new JSONObject();
 |  |                 JSONObject json = new JSONObject();
 | 
												
													
														
															|  |                 String patient = (String) signFamily.get("code");
 |  |                 String patient = (String) signFamily.get("code");
 | 
												
													
														
															|  |                 json.put("toUser", patient);
 |  |                 json.put("toUser", patient);
 | 
												
													
														
															|  |                 json.put("represented",patient);//被代理人
 |  | 
 | 
												
													
														
															|  | 
 |  |                 json.put("represented", patient);//被代理人
 | 
												
													
														
															|  |                 json.put("keyword1", "续签家庭医生");
 |  |                 json.put("keyword1", "续签家庭医生");
 | 
												
													
														
															|  |                 json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
 |  |                 json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
 | 
												
													
														
															|  |                 json.put("remark", "提醒医生 :" + doctorName + "\n"
 |  |                 json.put("remark", "提醒医生 :" + doctorName + "\n"
 | 
												
											
												
													
														
															|  | @ -1079,16 +1198,16 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                     PushMsgTask.getInstance().putWxMsg(access_token, 16, openid, name, json);
 |  |                     PushMsgTask.getInstance().putWxMsg(access_token, 16, openid, name, json);
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 //发送代理人
 |  |                 //发送代理人
 | 
												
													
														
															|  |                 JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient,openid);
 |  | 
 | 
												
													
														
															|  |                 if(jsonArray!=null&&jsonArray.length()>0){
 |  | 
 | 
												
													
														
															|  | 
 |  |                 JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openid);
 | 
												
													
														
															|  | 
 |  |                 if (jsonArray != null && jsonArray.length() > 0) {
 | 
												
													
														
															|  |                     Patient p = patientService.findByCode(patient);
 |  |                     Patient p = patientService.findByCode(patient);
 | 
												
													
														
															|  |                     for (int i = 0;i<jsonArray.length();i++){
 |  | 
 | 
												
													
														
															|  | 
 |  |                     for (int i = 0; i < jsonArray.length(); i++) {
 | 
												
													
														
															|  |                         flag = false;
 |  |                         flag = false;
 | 
												
													
														
															|  |                         JSONObject j  = jsonArray.getJSONObject(i);
 |  | 
 | 
												
													
														
															|  | 
 |  |                         JSONObject j = jsonArray.getJSONObject(i);
 | 
												
													
														
															|  |                         Patient member = (Patient) j.get("member");
 |  |                         Patient member = (Patient) j.get("member");
 | 
												
													
														
															|  |                         JSONObject data = json;
 |  |                         JSONObject data = json;
 | 
												
													
														
															|  |                         data.remove("toUser");
 |  |                         data.remove("toUser");
 | 
												
													
														
															|  |                         data.put("toUser",member.getCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |                         data.put("toUser", member.getCode());
 | 
												
													
														
															|  |                         json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) j.get("relation"), p.getName()) + "\n" +
 |  |                         json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) j.get("relation"), p.getName()) + "\n" +
 | 
												
													
														
															|  |                                 name + ",您好!\n" +
 |  |                                 name + ",您好!\n" +
 | 
												
													
														
															|  |                                 "您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
 |  |                                 "您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
 | 
												
											
												
													
														
															|  | @ -1096,7 +1215,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 if(flag){
 |  | 
 | 
												
													
														
															|  | 
 |  |                 if (flag) {
 | 
												
													
														
															|  |                     //发送短信
 |  |                     //发送短信
 | 
												
													
														
															|  |                     String mobile = (String) signFamily.get("mobile");
 |  |                     String mobile = (String) signFamily.get("mobile");
 | 
												
													
														
															|  |                     if (StringUtils.isNotBlank(mobile)) {
 |  |                     if (StringUtils.isNotBlank(mobile)) {
 | 
												
											
												
													
														
															|  | @ -1151,10 +1270,10 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 " wlyy_patient p " +
 |  |                 " wlyy_patient p " +
 | 
												
													
														
															|  |                 " WHERE " +
 |  |                 " WHERE " +
 | 
												
													
														
															|  |                 " t.patient = p. CODE " +
 |  |                 " t.patient = p. CODE " +
 | 
												
													
														
															|  |                 " AND t.doctor = '"+doctor+"' " +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " AND t.doctor = '" + doctor + "' " +
 | 
												
													
														
															|  |                 " AND t.status =-4 " +
 |  |                 " AND t.status =-4 " +
 | 
												
													
														
															|  |                 " AND t.expenses_status = '1' " +
 |  |                 " AND t.expenses_status = '1' " +
 | 
												
													
														
															|  |                 " AND t.sign_year = '"+(DateUtil.getSignYear()-1)+"' " +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " AND t.sign_year = '" + (DateUtil.getSignYear() - 1) + "' " +
 | 
												
													
														
															|  |                 " AND NOT EXISTS ( " +
 |  |                 " AND NOT EXISTS ( " +
 | 
												
													
														
															|  |                 " SELECT " +
 |  |                 " SELECT " +
 | 
												
													
														
															|  |                 "  1 " +
 |  |                 "  1 " +
 | 
												
											
												
													
														
															|  | @ -1163,7 +1282,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 " WHERE " +
 |  |                 " WHERE " +
 | 
												
													
														
															|  |                 "  a.patient = t.patient " +
 |  |                 "  a.patient = t.patient " +
 | 
												
													
														
															|  |                 " AND a.status>0  " +
 |  |                 " AND a.status>0  " +
 | 
												
													
														
															|  |                 " AND a.sign_year = '"+DateUtil.getSignYear()+"' " +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " AND a.sign_year = '" + DateUtil.getSignYear() + "' " +
 | 
												
													
														
															|  |                 ")";
 |  |                 ")";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         List<Map<String, Object>> signFamilies = jdbcTemplate.queryForList(sql);
 |  |         List<Map<String, Object>> signFamilies = jdbcTemplate.queryForList(sql);
 | 
												
											
												
													
														
															|  | @ -1177,7 +1296,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 Boolean flag = true;
 |  |                 Boolean flag = true;
 | 
												
													
														
															|  |                 String patient = (String) signFamily.get("code");
 |  |                 String patient = (String) signFamily.get("code");
 | 
												
													
														
															|  |                 json.put("toUser", patient);
 |  |                 json.put("toUser", patient);
 | 
												
													
														
															|  |                 json.put("represented",patient);//被代理人
 |  | 
 | 
												
													
														
															|  | 
 |  |                 json.put("represented", patient);//被代理人
 | 
												
													
														
															|  |                 json.put("keyword1", "续签家庭医生");
 |  |                 json.put("keyword1", "续签家庭医生");
 | 
												
													
														
															|  |                 json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
 |  |                 json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
 | 
												
													
														
															|  |                 json.put("remark", "提醒医生 :" + doctorName + "\n"
 |  |                 json.put("remark", "提醒医生 :" + doctorName + "\n"
 | 
												
											
												
													
														
															|  | @ -1188,23 +1307,23 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                     PushMsgTask.getInstance().putWxMsg(access_token, 16, openid, name, json);
 |  |                     PushMsgTask.getInstance().putWxMsg(access_token, 16, openid, name, json);
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 //发送代理人
 |  |                 //发送代理人
 | 
												
													
														
															|  |                 JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient,openid);
 |  | 
 | 
												
													
														
															|  |                 if(jsonArray!=null&&jsonArray.length()>0){
 |  | 
 | 
												
													
														
															|  | 
 |  |                 JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openid);
 | 
												
													
														
															|  | 
 |  |                 if (jsonArray != null && jsonArray.length() > 0) {
 | 
												
													
														
															|  |                     Patient p = patientService.findByCode(patient);
 |  |                     Patient p = patientService.findByCode(patient);
 | 
												
													
														
															|  |                     for (int i = 0;i<jsonArray.length();i++){
 |  | 
 | 
												
													
														
															|  | 
 |  |                     for (int i = 0; i < jsonArray.length(); i++) {
 | 
												
													
														
															|  |                         flag = false;
 |  |                         flag = false;
 | 
												
													
														
															|  |                         JSONObject j  = jsonArray.getJSONObject(i);
 |  | 
 | 
												
													
														
															|  | 
 |  |                         JSONObject j = jsonArray.getJSONObject(i);
 | 
												
													
														
															|  |                         Patient member = (Patient) j.get("member");
 |  |                         Patient member = (Patient) j.get("member");
 | 
												
													
														
															|  |                         JSONObject data = json;
 |  |                         JSONObject data = json;
 | 
												
													
														
															|  |                         data.remove("toUser");
 |  |                         data.remove("toUser");
 | 
												
													
														
															|  |                         data.put("toUser",member.getCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |                         data.put("toUser", member.getCode());
 | 
												
													
														
															|  |                         json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) j.get("relation"), p.getName()) + "\n" +
 |  |                         json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) j.get("relation"), p.getName()) + "\n" +
 | 
												
													
														
															|  |                                 name + ",您好!\n" +
 |  |                                 name + ",您好!\n" +
 | 
												
													
														
															|  |                                 "您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
 |  |                                 "您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
 | 
												
													
														
															|  |                         PushMsgTask.getInstance().putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 16, member.getOpenid(), p.getName(), data);
 |  |                         PushMsgTask.getInstance().putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 16, member.getOpenid(), p.getName(), data);
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 if(flag){
 |  | 
 | 
												
													
														
															|  | 
 |  |                 if (flag) {
 | 
												
													
														
															|  |                     //发送短信
 |  |                     //发送短信
 | 
												
													
														
															|  |                     String mobile = (String) signFamily.get("mobile");
 |  |                     String mobile = (String) signFamily.get("mobile");
 | 
												
													
														
															|  |                     if (StringUtils.isNotBlank(mobile)) {
 |  |                     if (StringUtils.isNotBlank(mobile)) {
 | 
												
											
												
													
														
															|  | @ -1252,7 +1371,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                           String health,
 |  |                           String health,
 | 
												
													
														
															|  |                           String disease,
 |  |                           String disease,
 | 
												
													
														
															|  |                           String custom,
 |  |                           String custom,
 | 
												
													
														
															|  |                           String sevId,String healthDoctor,
 |  | 
 | 
												
													
														
															|  | 
 |  |                           String sevId, String healthDoctor,
 | 
												
													
														
															|  |                           Long teamCode,
 |  |                           Long teamCode,
 | 
												
													
														
															|  |                           String expenses) throws Exception {
 |  |                           String expenses) throws Exception {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -1273,18 +1392,18 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                         renew.setStatus(1);
 |  |                         renew.setStatus(1);
 | 
												
													
														
															|  |                         //1.3.3.2新增需求
 |  |                         //1.3.3.2新增需求
 | 
												
													
														
															|  |                         //设置居民服务类型
 |  |                         //设置居民服务类型
 | 
												
													
														
															|  |                         if(StringUtils.isNotBlank(sevId)){
 |  | 
 | 
												
													
														
															|  |                             setSevId(renew,sevId);
 |  | 
 | 
												
													
														
															|  | 
 |  |                         if (StringUtils.isNotBlank(sevId)) {
 | 
												
													
														
															|  | 
 |  |                             setSevId(renew, sevId);
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                         //1.3.3.2新增需求
 |  |                         //1.3.3.2新增需求
 | 
												
													
														
															|  |                         //设置居民标签
 |  |                         //设置居民标签
 | 
												
													
														
															|  |                         signPatientLabelInfoService.setRenewPatientLabels(renew.getPatient(), health, disease,custom, renew.getDoctor(),renew.getDoctor());
 |  | 
 | 
												
													
														
															|  | 
 |  |                         signPatientLabelInfoService.setRenewPatientLabels(renew.getPatient(), health, disease, custom, renew.getDoctor(), renew.getDoctor());
 | 
												
													
														
															|  |                         //1.3.3.2设置可修改健康管理师
 |  |                         //1.3.3.2设置可修改健康管理师
 | 
												
													
														
															|  |                         if(StringUtils.isNotBlank(healthDoctor)){
 |  | 
 | 
												
													
														
															|  |                             updateHealthDoctor(renew,healthDoctor);
 |  | 
 | 
												
													
														
															|  | 
 |  |                         if (StringUtils.isNotBlank(healthDoctor)) {
 | 
												
													
														
															|  | 
 |  |                             updateHealthDoctor(renew, healthDoctor);
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                         //1.3.3.2设置新团队
 |  |                         //1.3.3.2设置新团队
 | 
												
													
														
															|  |                         if(teamCode!=null&&teamCode!=0){
 |  | 
 | 
												
													
														
															|  | 
 |  |                         if (teamCode != null && teamCode != 0) {
 | 
												
													
														
															|  |                             renew.setAdminTeamId(teamCode);
 |  |                             renew.setAdminTeamId(teamCode);
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                         renew.setExpensesType(StringUtils.isEmpty(expenses) ? "01" : expenses);//收费类别
 |  |                         renew.setExpensesType(StringUtils.isEmpty(expenses) ? "01" : expenses);//收费类别
 | 
												
											
												
													
														
															|  | @ -1296,15 +1415,13 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                     setRenewLog(renew);
 |  |                     setRenewLog(renew);
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 //1.3.3.4 根据团队设置标识
 |  |                 //1.3.3.4 根据团队设置标识
 | 
												
													
														
															|  |                 setRenewFlag(renew,teamCode);
 |  | 
 | 
												
													
														
															|  | 
 |  |                 setRenewFlag(renew, teamCode);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 signFamilyRenewDao.save(renew);
 |  |                 signFamilyRenewDao.save(renew);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 setMessState(mesId);
 |  |                 setMessState(mesId);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 //发送微信模板消息
 |  |                 //发送微信模板消息
 | 
												
													
														
															|  |                 JSONObject data = new JSONObject();
 |  |                 JSONObject data = new JSONObject();
 | 
												
													
														
															|  |                 data.put("doctorName", renew.getDoctorName());
 |  |                 data.put("doctorName", renew.getDoctorName());
 | 
												
											
												
													
														
															|  | @ -1314,8 +1431,8 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 data.put("represented", patientCode);
 |  |                 data.put("represented", patientCode);
 | 
												
													
														
															|  |                 data.put("toUser", patientCode);
 |  |                 data.put("toUser", patientCode);
 | 
												
													
														
															|  |                 data.put("toName", renew.getName());
 |  |                 data.put("toName", renew.getName());
 | 
												
													
														
															|  |                 data.put("isRenew","1");
 |  | 
 | 
												
													
														
															|  |                 data.put("signState",state);
 |  | 
 | 
												
													
														
															|  | 
 |  |                 data.put("isRenew", "1");
 | 
												
													
														
															|  | 
 |  |                 data.put("signState", state);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 Patient patient = patientService.findByCode(renew.getPatient());
 |  |                 Patient patient = patientService.findByCode(renew.getPatient());
 | 
												
													
														
															|  |                 if (patient != null && StringUtils.isNotBlank(patient.getOpenid())) {
 |  |                 if (patient != null && StringUtils.isNotBlank(patient.getOpenid())) {
 | 
												
											
												
													
														
															|  | @ -1333,13 +1450,13 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 //发送代理人
 |  |                 //发送代理人
 | 
												
													
														
															|  |                 JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient.getCode(),patient.getOpenid());
 |  | 
 | 
												
													
														
															|  |                 if(jsonArray!=null&&jsonArray.length()>0){
 |  | 
 | 
												
													
														
															|  |                     for (int i = 0;i<jsonArray.length();i++){
 |  | 
 | 
												
													
														
															|  |                         JSONObject j  = jsonArray.getJSONObject(i);
 |  | 
 | 
												
													
														
															|  | 
 |  |                 JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient.getCode(), patient.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");
 |  |                         Patient member = (Patient) j.get("member");
 | 
												
													
														
															|  |                         data.remove("toUser");
 |  |                         data.remove("toUser");
 | 
												
													
														
															|  |                         data.put("toUser",member.getCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |                         data.put("toUser", member.getCode());
 | 
												
													
														
															|  |                         //String first = (String) json.get("first");
 |  |                         //String first = (String) json.get("first");
 | 
												
													
														
															|  |                         if ("0".equals(state)) {
 |  |                         if ("0".equals(state)) {
 | 
												
													
														
															|  |                             data.put("first", weiXinOpenIdUtils.getTitleMes(patient, (int) j.get("relation"), patient.getName()) + "\n" +
 |  |                             data.put("first", weiXinOpenIdUtils.getTitleMes(patient, (int) j.get("relation"), patient.getName()) + "\n" +
 | 
												
											
												
													
														
															|  | @ -1419,7 +1536,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |     public int agreeRenewOverDue(String access_token, String dotorCode, String patientCode, String state, Long mesId, String signYear, String signCode, String health,
 |  |     public int agreeRenewOverDue(String access_token, String dotorCode, String patientCode, String state, Long mesId, String signYear, String signCode, String health,
 | 
												
													
														
															|  |                                  String disease,
 |  |                                  String disease,
 | 
												
													
														
															|  |                                  String custom,
 |  |                                  String custom,
 | 
												
													
														
															|  |                                  String sevId,String healthDoctor,
 |  | 
 | 
												
													
														
															|  | 
 |  |                                  String sevId, String healthDoctor,
 | 
												
													
														
															|  |                                  Long teamCode,
 |  |                                  Long teamCode,
 | 
												
													
														
															|  |                                  String expenses) throws Exception {
 |  |                                  String expenses) throws Exception {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -1441,16 +1558,16 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                         //1.3.3.2新增需求
 |  |                         //1.3.3.2新增需求
 | 
												
													
														
															|  |                         //设置居民服务类型
 |  |                         //设置居民服务类型
 | 
												
													
														
															|  |                         setSevId(renew,sevId);
 |  | 
 | 
												
													
														
															|  | 
 |  |                         setSevId(renew, sevId);
 | 
												
													
														
															|  |                         //1.3.3.2新增需求
 |  |                         //1.3.3.2新增需求
 | 
												
													
														
															|  |                         //设置居民标签
 |  |                         //设置居民标签
 | 
												
													
														
															|  |                         signPatientLabelInfoService.setPatientLabels(renew.getPatient(), renew.getIdcard(),"", health, disease, custom, renew.getDoctor(), renew.getDoctor());
 |  | 
 | 
												
													
														
															|  | 
 |  |                         signPatientLabelInfoService.setPatientLabels(renew.getPatient(), renew.getIdcard(), "", health, disease, custom, renew.getDoctor(), renew.getDoctor());
 | 
												
													
														
															|  |                         //1.3.3.2设置可修改健康管理师
 |  |                         //1.3.3.2设置可修改健康管理师
 | 
												
													
														
															|  |                         if(StringUtils.isNotBlank(healthDoctor)){
 |  | 
 | 
												
													
														
															|  |                             updateHealthDoctor(renew,healthDoctor);
 |  | 
 | 
												
													
														
															|  | 
 |  |                         if (StringUtils.isNotBlank(healthDoctor)) {
 | 
												
													
														
															|  | 
 |  |                             updateHealthDoctor(renew, healthDoctor);
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                         //1.3.3.2设置新团队
 |  |                         //1.3.3.2设置新团队
 | 
												
													
														
															|  |                         if(teamCode!=null&&teamCode!=0){
 |  | 
 | 
												
													
														
															|  | 
 |  |                         if (teamCode != null && teamCode != 0) {
 | 
												
													
														
															|  |                             renew.setAdminTeamId(teamCode);
 |  |                             renew.setAdminTeamId(teamCode);
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                         renew.setExpensesType(StringUtils.isEmpty(expenses) ? "01" : expenses);//收费类别
 |  |                         renew.setExpensesType(StringUtils.isEmpty(expenses) ? "01" : expenses);//收费类别
 | 
												
											
												
													
														
															|  | @ -1458,7 +1575,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 renew.setApplyDate(new Date());
 |  |                 renew.setApplyDate(new Date());
 | 
												
													
														
															|  |                 //1.3.3.4 根据团队设置标识
 |  |                 //1.3.3.4 根据团队设置标识
 | 
												
													
														
															|  |                 setRenewFlag(renew,teamCode);
 |  | 
 | 
												
													
														
															|  | 
 |  |                 setRenewFlag(renew, teamCode);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 signFamilyDao.save(renew);
 |  |                 signFamilyDao.save(renew);
 | 
												
													
														
															|  |                 //消息设为已读
 |  |                 //消息设为已读
 | 
												
											
												
													
														
															|  | @ -1477,7 +1594,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 data.put("toUser", patientCode);
 |  |                 data.put("toUser", patientCode);
 | 
												
													
														
															|  |                 data.put("represented", patientCode);
 |  |                 data.put("represented", patientCode);
 | 
												
													
														
															|  |                 data.put("toName", renew.getName());
 |  |                 data.put("toName", renew.getName());
 | 
												
													
														
															|  |                 data.put("isRenew","1");//表示为续签操作
 |  | 
 | 
												
													
														
															|  | 
 |  |                 data.put("isRenew", "1");//表示为续签操作
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 Patient patient = patientService.findByCode(renew.getPatient());
 |  |                 Patient patient = patientService.findByCode(renew.getPatient());
 | 
												
													
														
															|  |                 if (patient != null && StringUtils.isNotBlank(patient.getOpenid())) {
 |  |                 if (patient != null && StringUtils.isNotBlank(patient.getOpenid())) {
 | 
												
											
												
													
														
															|  | @ -1495,13 +1612,13 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 //发送代理人
 |  |                 //发送代理人
 | 
												
													
														
															|  |                 JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient.getCode(),patient.getOpenid());
 |  | 
 | 
												
													
														
															|  |                 if(jsonArray!=null&&jsonArray.length()>0){
 |  | 
 | 
												
													
														
															|  |                     for (int i = 0;i<jsonArray.length();i++){
 |  | 
 | 
												
													
														
															|  |                         JSONObject j  = jsonArray.getJSONObject(i);
 |  | 
 | 
												
													
														
															|  | 
 |  |                 JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient.getCode(), patient.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");
 |  |                         Patient member = (Patient) j.get("member");
 | 
												
													
														
															|  |                         data.remove("toUser");
 |  |                         data.remove("toUser");
 | 
												
													
														
															|  |                         data.put("toUser",member.getCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |                         data.put("toUser", member.getCode());
 | 
												
													
														
															|  |                         //String first = (String) json.get("first");
 |  |                         //String first = (String) json.get("first");
 | 
												
													
														
															|  |                         if ("0".equals(state)) {
 |  |                         if ("0".equals(state)) {
 | 
												
													
														
															|  |                             data.put("first", weiXinOpenIdUtils.getTitleMes(patient, (int) j.get("relation"), patient.getName()) + "\n" +
 |  |                             data.put("first", weiXinOpenIdUtils.getTitleMes(patient, (int) j.get("relation"), patient.getName()) + "\n" +
 | 
												
											
												
													
														
															|  | @ -1568,6 +1685,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 获取年度列表
 |  |      * 获取年度列表
 | 
												
													
														
															|  |      * 团队
 |  |      * 团队
 | 
												
													
														
															|  | 
 |  |      *
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public JSONObject getRenewYearCount(Long teamCode) {
 |  |     public JSONObject getRenewYearCount(Long teamCode) {
 | 
												
											
												
													
														
															|  | @ -1582,11 +1700,12 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 获取年度列表
 |  |      * 获取年度列表
 | 
												
													
														
															|  |      * 团队
 |  |      * 团队
 | 
												
													
														
															|  | 
 |  |      *
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public JSONObject getRenewYearCountByDoctor(Long teamCode,String doctor) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getRenewYearCountByDoctor(Long teamCode, String doctor) {
 | 
												
													
														
															|  |         StringBuffer sql = new StringBuffer("SELECT t.sign_year labelCode,t.sign_year labelName,COUNT(1) amount " +
 |  |         StringBuffer sql = new StringBuffer("SELECT t.sign_year labelCode,t.sign_year labelName,COUNT(1) amount " +
 | 
												
													
														
															|  |                 "FROM  wlyy_sign_family t WHERE t.doctor ='"+doctor+"' AND  t.admin_team_code =" + teamCode + "  AND t.status=-4 AND sign_year IS NOT NULL GROUP BY t.sign_year DESC");
 |  | 
 | 
												
													
														
															|  | 
 |  |                 "FROM  wlyy_sign_family t WHERE t.doctor ='" + doctor + "' AND  t.admin_team_code =" + teamCode + "  AND t.status=-4 AND sign_year IS NOT NULL GROUP BY t.sign_year DESC");
 | 
												
													
														
															|  |         List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql.toString());
 |  |         List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql.toString());
 | 
												
													
														
															|  |         JSONObject json = new JSONObject();
 |  |         JSONObject json = new JSONObject();
 | 
												
													
														
															|  |         json.put("result", rs);
 |  |         json.put("result", rs);
 | 
												
											
												
													
														
															|  | @ -1598,13 +1717,13 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |      *
 |  |      *
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public JSONObject getOverDuePatients(String year, Long teamCode,String doctor, Integer page, Integer pageSize) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getOverDuePatients(String year, Long teamCode, String doctor, Integer page, Integer pageSize) {
 | 
												
													
														
															|  |         StringBuffer sql = new StringBuffer("SELECT IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
 |  |         StringBuffer sql = new StringBuffer("SELECT IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
 | 
												
													
														
															|  |                 "t.patient code,t.idcard,t.name,t.mobile,t.openid," +
 |  |                 "t.patient code,t.idcard,t.name,t.mobile,t.openid," +
 | 
												
													
														
															|  |                 "t.ssc,t.type signType,p.sex ,t.expenses_status expensesStatus " +
 |  |                 "t.ssc,t.type signType,p.sex ,t.expenses_status expensesStatus " +
 | 
												
													
														
															|  |                 " FROM wlyy_sign_family t " +
 |  |                 " FROM wlyy_sign_family t " +
 | 
												
													
														
															|  |                 " LEFT JOIN wlyy_patient p ON t.patient = p.code " +
 |  |                 " LEFT JOIN wlyy_patient p ON t.patient = p.code " +
 | 
												
													
														
															|  |                 " WHERE t.doctor ='"+doctor+"' AND t.admin_team_code =" + teamCode + " AND t.sign_year ='" + year + "' AND t.status =-4 LIMIT " + page * pageSize + "," + pageSize);
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " WHERE t.doctor ='" + doctor + "' AND t.admin_team_code =" + teamCode + " AND t.sign_year ='" + year + "' AND t.status =-4 LIMIT " + page * pageSize + "," + pageSize);
 | 
												
													
														
															|  |         List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql.toString());
 |  |         List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql.toString());
 | 
												
													
														
															|  |         JSONObject json = new JSONObject();
 |  |         JSONObject json = new JSONObject();
 | 
												
													
														
															|  |         json.put("result", rs);
 |  |         json.put("result", rs);
 | 
												
											
												
													
														
															|  | @ -1725,7 +1844,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |         Patient p = patientService.findByCode(patientCode);
 |  |         Patient p = patientService.findByCode(patientCode);
 | 
												
													
														
															|  |         JSONObject json = new JSONObject();
 |  |         JSONObject json = new JSONObject();
 | 
												
													
														
															|  |         json.put("toUser", patientCode);
 |  |         json.put("toUser", patientCode);
 | 
												
													
														
															|  |         json.put("represented",patientCode);//被代理人
 |  | 
 | 
												
													
														
															|  | 
 |  |         json.put("represented", patientCode);//被代理人
 | 
												
													
														
															|  |         json.put("keyword1", "续签家庭医生");
 |  |         json.put("keyword1", "续签家庭医生");
 | 
												
													
														
															|  |         json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
 |  |         json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
 | 
												
													
														
															|  |         json.put("remark", "提醒医生 :" + d.getName() + "\n"
 |  |         json.put("remark", "提醒医生 :" + d.getName() + "\n"
 | 
												
											
												
													
														
															|  | @ -1743,22 +1862,22 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //发送代理人
 |  |         //发送代理人
 | 
												
													
														
															|  |         boolean flag = true;
 |  |         boolean flag = true;
 | 
												
													
														
															|  |         JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patientCode,openid);
 |  | 
 | 
												
													
														
															|  |         if(jsonArray!=null&&jsonArray.length()>0){
 |  | 
 | 
												
													
														
															|  |             for (int i = 0;i<jsonArray.length();i++){
 |  | 
 | 
												
													
														
															|  | 
 |  |         JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patientCode, openid);
 | 
												
													
														
															|  | 
 |  |         if (jsonArray != null && jsonArray.length() > 0) {
 | 
												
													
														
															|  | 
 |  |             for (int i = 0; i < jsonArray.length(); i++) {
 | 
												
													
														
															|  |                 flag = false;
 |  |                 flag = false;
 | 
												
													
														
															|  |                 JSONObject j  = jsonArray.getJSONObject(i);
 |  | 
 | 
												
													
														
															|  | 
 |  |                 JSONObject j = jsonArray.getJSONObject(i);
 | 
												
													
														
															|  |                 Patient member = (Patient) j.get("member");
 |  |                 Patient member = (Patient) j.get("member");
 | 
												
													
														
															|  |                 JSONObject data = json;
 |  |                 JSONObject data = json;
 | 
												
													
														
															|  |                 data.remove("toUser");
 |  |                 data.remove("toUser");
 | 
												
													
														
															|  |                 data.put("toUser",member.getCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |                 data.put("toUser", member.getCode());
 | 
												
													
														
															|  |                 json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) j.get("relation"), p.getName()) + "\n" +
 |  |                 json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) j.get("relation"), p.getName()) + "\n" +
 | 
												
													
														
															|  |                         name + ",您好!\n" +
 |  |                         name + ",您好!\n" +
 | 
												
													
														
															|  |                         "您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
 |  |                         "您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
 | 
												
													
														
															|  |                 PushMsgTask.getInstance().putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 16, member.getOpenid(), p.getName(), data);
 |  |                 PushMsgTask.getInstance().putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 16, member.getOpenid(), p.getName(), data);
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         if(flag){
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (flag) {
 | 
												
													
														
															|  |             //发送短信
 |  |             //发送短信
 | 
												
													
														
															|  |             String mobile = p.getMobile();
 |  |             String mobile = p.getMobile();
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(mobile)) {
 |  |             if (StringUtils.isNotBlank(mobile)) {
 | 
												
											
												
													
														
															|  | @ -1766,7 +1885,7 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |                 patientSetReminFlag(patientCode);
 |  |                 patientSetReminFlag(patientCode);
 | 
												
													
														
															|  |                 return 2;
 |  |                 return 2;
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }else {
 |  | 
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  |             return 1;
 |  |             return 1;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -1925,22 +2044,23 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 设置服务表服务类型
 |  |      * 设置服务表服务类型
 | 
												
													
														
															|  | 
 |  |      *
 | 
												
													
														
															|  |      * @param renew
 |  |      * @param renew
 | 
												
													
														
															|  |      * @param sevId
 |  |      * @param sevId
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public void setSevId(SignFamilyRenew renew, String sevId) {
 |  |     public void setSevId(SignFamilyRenew renew, String sevId) {
 | 
												
													
														
															|  |         if (StringUtils.isNotBlank(sevId)){
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(sevId)) {
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(sevId)) {
 |  |             if (StringUtils.isNotBlank(sevId)) {
 | 
												
													
														
															|  |                 String[] sevIds = sevId.split(",");
 |  |                 String[] sevIds = sevId.split(",");
 | 
												
													
														
															|  |                 for(int i=0;i<sevIds.length;i++){
 |  | 
 | 
												
													
														
															|  |                     String sql = "select d.name from wlyy_sign_dict d where d.code = '" + sevIds[i] + "' and d.year ='"+DateUtil.getSignYear()+"' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 for (int i = 0; i < sevIds.length; i++) {
 | 
												
													
														
															|  | 
 |  |                     String sql = "select d.name from wlyy_sign_dict d where d.code = '" + sevIds[i] + "' and d.year ='" + DateUtil.getSignYear() + "' ";
 | 
												
													
														
															|  |                     List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 |  |                     List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  |                     SignFamilyServer server = new SignFamilyServer();
 |  |                     SignFamilyServer server = new SignFamilyServer();
 | 
												
													
														
															|  |                     server.setSignCode(renew.getCode());
 |  |                     server.setSignCode(renew.getCode());
 | 
												
													
														
															|  |                     server.setCreateTime(new Date());
 |  |                     server.setCreateTime(new Date());
 | 
												
													
														
															|  |                     server.setServerType(sevIds[i]);
 |  |                     server.setServerType(sevIds[i]);
 | 
												
													
														
															|  |                     Map<String, Object> map = list.get(0);
 |  |                     Map<String, Object> map = list.get(0);
 | 
												
													
														
															|  |                     String serverName = (String)  map.get("name");
 |  | 
 | 
												
													
														
															|  | 
 |  |                     String serverName = (String) map.get("name");
 | 
												
													
														
															|  |                     server.setServerTypeName(serverName);
 |  |                     server.setServerTypeName(serverName);
 | 
												
													
														
															|  |                     server.setCzrq(new Date());
 |  |                     server.setCzrq(new Date());
 | 
												
													
														
															|  |                     signFamilyServerDao.save(server);
 |  |                     signFamilyServerDao.save(server);
 | 
												
											
												
													
														
															|  | @ -1951,21 +2071,22 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 设置签约表服务类型
 |  |      * 设置签约表服务类型
 | 
												
													
														
															|  | 
 |  |      *
 | 
												
													
														
															|  |      * @param renew
 |  |      * @param renew
 | 
												
													
														
															|  |      * @param sevId
 |  |      * @param sevId
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public void setSevId(SignFamily renew, String sevId) {
 |  |     public void setSevId(SignFamily renew, String sevId) {
 | 
												
													
														
															|  |         if (StringUtils.isNotBlank(sevId)) {
 |  |         if (StringUtils.isNotBlank(sevId)) {
 | 
												
													
														
															|  |             String[] sevIds = sevId.split(",");
 |  |             String[] sevIds = sevId.split(",");
 | 
												
													
														
															|  |             for(int i=0;i<sevIds.length;i++){
 |  | 
 | 
												
													
														
															|  |                 String sql = "select d.name from wlyy_sign_dict d where d.code = '" + sevIds[i] + "' and d.year ='"+DateUtil.getSignYear()+"' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |             for (int i = 0; i < sevIds.length; i++) {
 | 
												
													
														
															|  | 
 |  |                 String sql = "select d.name from wlyy_sign_dict d where d.code = '" + sevIds[i] + "' and d.year ='" + DateUtil.getSignYear() + "' ";
 | 
												
													
														
															|  |                 List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 |  |                 List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  |                 SignFamilyServer server = new SignFamilyServer();
 |  |                 SignFamilyServer server = new SignFamilyServer();
 | 
												
													
														
															|  |                 server.setSignCode(renew.getCode());
 |  |                 server.setSignCode(renew.getCode());
 | 
												
													
														
															|  |                 server.setCreateTime(new Date());
 |  |                 server.setCreateTime(new Date());
 | 
												
													
														
															|  |                 server.setServerType(sevIds[i]);
 |  |                 server.setServerType(sevIds[i]);
 | 
												
													
														
															|  |                 Map<String, Object> map = list.get(0);
 |  |                 Map<String, Object> map = list.get(0);
 | 
												
													
														
															|  |                 String serverName = (String)  map.get("name");
 |  | 
 | 
												
													
														
															|  | 
 |  |                 String serverName = (String) map.get("name");
 | 
												
													
														
															|  |                 server.setServerTypeName(serverName);
 |  |                 server.setServerTypeName(serverName);
 | 
												
													
														
															|  |                 server.setCzrq(new Date());
 |  |                 server.setCzrq(new Date());
 | 
												
													
														
															|  |                 signFamilyServerDao.save(server);
 |  |                 signFamilyServerDao.save(server);
 | 
												
											
												
													
														
															|  | @ -1985,15 +2106,15 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  | //        signFamilyRenew.setDoctorHealthName(doctor.getName());
 |  | //        signFamilyRenew.setDoctorHealthName(doctor.getName());
 | 
												
													
														
															|  | //    }
 |  | //    }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public int setRenewLog(SignFamilyRenew renew){
 |  | 
 | 
												
													
														
															|  |         if(renew ==null) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public int setRenewLog(SignFamilyRenew renew) {
 | 
												
													
														
															|  | 
 |  |         if (renew == null) {
 | 
												
													
														
															|  |             return -1;
 |  |             return -1;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String sql = "SELECT * FROM wlyy_sign_family f WHERE f.patient ='"+renew.getPatient()+"' AND (f.`status` =-4 OR f.`status`>0) AND f.expenses_status ='1' AND f.sign_year >='"+(Integer.parseInt(renew.getSignYear())-1)+"' ";
 |  | 
 | 
												
													
														
															|  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 |  | 
 | 
												
													
														
															|  |         Map<String,Object> sign = null;
 |  | 
 | 
												
													
														
															|  |         if(list!=null&&list.size()>0){
 |  | 
 | 
												
													
														
															|  | 
 |  |         String sql = "SELECT * FROM wlyy_sign_family f WHERE f.patient ='" + renew.getPatient() + "' AND (f.`status` =-4 OR f.`status`>0) AND f.expenses_status ='1' AND f.sign_year >='" + (Integer.parseInt(renew.getSignYear()) - 1) + "' ";
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  | 
 |  |         Map<String, Object> sign = null;
 | 
												
													
														
															|  | 
 |  |         if (list != null && list.size() > 0) {
 | 
												
													
														
															|  |             sign = list.get(0);
 |  |             sign = list.get(0);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         SignFamilyRenewLog log = new SignFamilyRenewLog();
 |  |         SignFamilyRenewLog log = new SignFamilyRenewLog();
 | 
												
											
												
													
														
															|  | @ -2006,12 +2127,12 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |         log.setHospital(renew.getHospital());
 |  |         log.setHospital(renew.getHospital());
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //存储旧签约记录
 |  |         //存储旧签约记录
 | 
												
													
														
															|  |         if(sign!=null){
 |  | 
 | 
												
													
														
															|  |             Integer id =(Integer) sign.get("admin_team_code");
 |  | 
 | 
												
													
														
															|  |             log.setOldSignCode((String)sign.get("code"));
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (sign != null) {
 | 
												
													
														
															|  | 
 |  |             Integer id = (Integer) sign.get("admin_team_code");
 | 
												
													
														
															|  | 
 |  |             log.setOldSignCode((String) sign.get("code"));
 | 
												
													
														
															|  |             log.setOldAdminTeamId(id.longValue());
 |  |             log.setOldAdminTeamId(id.longValue());
 | 
												
													
														
															|  |             log.setOldHospital((String)sign.get("hospital"));
 |  | 
 | 
												
													
														
															|  |             log.setOldDoctor((String)sign.get("doctor"));
 |  | 
 | 
												
													
														
															|  | 
 |  |             log.setOldHospital((String) sign.get("hospital"));
 | 
												
													
														
															|  | 
 |  |             log.setOldDoctor((String) sign.get("doctor"));
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         log.setNeedUpload("1");
 |  |         log.setNeedUpload("1");
 | 
												
													
														
															|  |         log.setCreateTime(new Date());
 |  |         log.setCreateTime(new Date());
 | 
												
											
												
													
														
															|  | @ -2020,15 +2141,15 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |         return 1;
 |  |         return 1;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public int setRenewLog(SignFamily renew){
 |  | 
 | 
												
													
														
															|  |         if(renew ==null) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public int setRenewLog(SignFamily renew) {
 | 
												
													
														
															|  | 
 |  |         if (renew == null) {
 | 
												
													
														
															|  |             return -1;
 |  |             return -1;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String sql = "SELECT * FROM wlyy_sign_family f WHERE f.patient ='"+renew.getPatient()+"' AND (f.`status` =-4 OR f.`status`>0) AND f.expenses_status ='1' AND f.sign_year >='"+(Integer.parseInt(renew.getSignYear())-1)+"' ";
 |  | 
 | 
												
													
														
															|  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 |  | 
 | 
												
													
														
															|  |         Map<String,Object> sign = null;
 |  | 
 | 
												
													
														
															|  |         if(list!=null&&list.size()>0){
 |  | 
 | 
												
													
														
															|  | 
 |  |         String sql = "SELECT * FROM wlyy_sign_family f WHERE f.patient ='" + renew.getPatient() + "' AND (f.`status` =-4 OR f.`status`>0) AND f.expenses_status ='1' AND f.sign_year >='" + (Integer.parseInt(renew.getSignYear()) - 1) + "' ";
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  | 
 |  |         Map<String, Object> sign = null;
 | 
												
													
														
															|  | 
 |  |         if (list != null && list.size() > 0) {
 | 
												
													
														
															|  |             sign = list.get(0);
 |  |             sign = list.get(0);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         SignFamilyRenewLog log = new SignFamilyRenewLog();
 |  |         SignFamilyRenewLog log = new SignFamilyRenewLog();
 | 
												
											
												
													
														
															|  | @ -2041,19 +2162,19 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |         log.setHospital(renew.getHospital());
 |  |         log.setHospital(renew.getHospital());
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //存储旧签约记录
 |  |         //存储旧签约记录
 | 
												
													
														
															|  |         if(sign!=null){
 |  | 
 | 
												
													
														
															|  |             Integer id =(Integer) sign.get("admin_team_code");
 |  | 
 | 
												
													
														
															|  |             log.setOldSignCode((String)sign.get("code"));
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (sign != null) {
 | 
												
													
														
															|  | 
 |  |             Integer id = (Integer) sign.get("admin_team_code");
 | 
												
													
														
															|  | 
 |  |             log.setOldSignCode((String) sign.get("code"));
 | 
												
													
														
															|  |             log.setOldAdminTeamId(id.longValue());
 |  |             log.setOldAdminTeamId(id.longValue());
 | 
												
													
														
															|  |             log.setOldHospital((String)sign.get("hospital"));
 |  | 
 | 
												
													
														
															|  |             log.setOldDoctor((String)sign.get("doctor"));
 |  | 
 | 
												
													
														
															|  | 
 |  |             log.setOldHospital((String) sign.get("hospital"));
 | 
												
													
														
															|  | 
 |  |             log.setOldDoctor((String) sign.get("doctor"));
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         log.setNeedUpload("1");
 |  |         log.setNeedUpload("1");
 | 
												
													
														
															|  |         log.setCreateTime(new Date());
 |  |         log.setCreateTime(new Date());
 | 
												
													
														
															|  |         log.setUpdateTime(new Date());
 |  |         log.setUpdateTime(new Date());
 | 
												
													
														
															|  |         //1.3.4新增字段
 |  |         //1.3.4新增字段
 | 
												
													
														
															|  |         log.setStatus(renew.getStatus());
 |  |         log.setStatus(renew.getStatus());
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(renew.getRenewChangeReason())){
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(renew.getRenewChangeReason())) {
 | 
												
													
														
															|  |             log.setRenewChangeReason(renew.getRenewChangeReason());
 |  |             log.setRenewChangeReason(renew.getRenewChangeReason());
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         log.setApplyDate(renew.getApplyDate());
 |  |         log.setApplyDate(renew.getApplyDate());
 | 
												
											
												
													
														
															|  | @ -2063,18 +2184,18 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |         return 1;
 |  |         return 1;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public void updateHealthDoctor(SignFamilyRenew renew ,String healthDoctor){
 |  | 
 | 
												
													
														
															|  | 
 |  |     public void updateHealthDoctor(SignFamilyRenew renew, String healthDoctor) {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         DoctorTeam team =  doctorTeamDao.findByCode(renew.getTeamCode());
 |  | 
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(renew.getDoctorHealth())){
 |  | 
 | 
												
													
														
															|  | 
 |  |         DoctorTeam team = doctorTeamDao.findByCode(renew.getTeamCode());
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(renew.getDoctorHealth())) {
 | 
												
													
														
															|  |             //删除之前健管师成员
 |  |             //删除之前健管师成员
 | 
												
													
														
															|  |             doctorTeamMemberDao.deleteMember(renew.getDoctorHealth());
 |  |             doctorTeamMemberDao.deleteMember(renew.getDoctorHealth());
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         Doctor hd = doctorDao.findByCode(healthDoctor);
 |  |         Doctor hd = doctorDao.findByCode(healthDoctor);
 | 
												
													
														
															|  |         if(hd==null){
 |  | 
 | 
												
													
														
															|  |             return ;
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (hd == null) {
 | 
												
													
														
															|  | 
 |  |             return;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         team.setName(renew.getDoctorName()+","+hd.getName()+","+renew.getName());
 |  | 
 | 
												
													
														
															|  | 
 |  |         team.setName(renew.getDoctorName() + "," + hd.getName() + "," + renew.getName());
 | 
												
													
														
															|  |         //新建健康管理师
 |  |         //新建健康管理师
 | 
												
													
														
															|  |         DoctorTeamMember hdmb = new DoctorTeamMember();
 |  |         DoctorTeamMember hdmb = new DoctorTeamMember();
 | 
												
													
														
															|  |         hdmb.setName(hd.getName());
 |  |         hdmb.setName(hd.getName());
 | 
												
											
												
													
														
															|  | @ -2094,18 +2215,18 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |         renew.setDoctorHealth(hd.getCode());
 |  |         renew.setDoctorHealth(hd.getCode());
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public void updateHealthDoctor(SignFamily renew ,String healthDoctor){
 |  | 
 | 
												
													
														
															|  | 
 |  |     public void updateHealthDoctor(SignFamily renew, String healthDoctor) {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         DoctorTeam team =  doctorTeamDao.findByCode(renew.getTeamCode());
 |  | 
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(renew.getDoctorHealth())){
 |  | 
 | 
												
													
														
															|  | 
 |  |         DoctorTeam team = doctorTeamDao.findByCode(renew.getTeamCode());
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(renew.getDoctorHealth())) {
 | 
												
													
														
															|  |             //删除之前健管师成员
 |  |             //删除之前健管师成员
 | 
												
													
														
															|  |             doctorTeamMemberDao.deleteMember(renew.getDoctorHealth());
 |  |             doctorTeamMemberDao.deleteMember(renew.getDoctorHealth());
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         Doctor hd = doctorDao.findByCode(healthDoctor);
 |  |         Doctor hd = doctorDao.findByCode(healthDoctor);
 | 
												
													
														
															|  |         if(hd==null){
 |  | 
 | 
												
													
														
															|  |             return ;
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (hd == null) {
 | 
												
													
														
															|  | 
 |  |             return;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         team.setName(renew.getDoctorName()+","+hd.getName()+","+renew.getName());
 |  | 
 | 
												
													
														
															|  | 
 |  |         team.setName(renew.getDoctorName() + "," + hd.getName() + "," + renew.getName());
 | 
												
													
														
															|  |         //新建健康管理师
 |  |         //新建健康管理师
 | 
												
													
														
															|  |         DoctorTeamMember hdmb = new DoctorTeamMember();
 |  |         DoctorTeamMember hdmb = new DoctorTeamMember();
 | 
												
													
														
															|  |         hdmb.setName(hd.getName());
 |  |         hdmb.setName(hd.getName());
 | 
												
											
												
													
														
															|  | @ -2125,68 +2246,68 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |         renew.setDoctorHealth(hd.getCode());
 |  |         renew.setDoctorHealth(hd.getCode());
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public JSONArray getRenewChangeReason(){
 |  | 
 | 
												
													
														
															|  |        List<SystemDict> systemDict = systemDictService.getDictByDictName("RENEW_CHANGE_REASON");
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONArray getRenewChangeReason() {
 | 
												
													
														
															|  | 
 |  |         List<SystemDict> systemDict = systemDictService.getDictByDictName("RENEW_CHANGE_REASON");
 | 
												
													
														
															|  |         return new JSONArray(systemDict);
 |  |         return new JSONArray(systemDict);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public JSONObject getPatientSignLogInfo(String patient){
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getPatientSignLogInfo(String patient) {
 | 
												
													
														
															|  |         Patient p = patientService.findByCode(patient);
 |  |         Patient p = patientService.findByCode(patient);
 | 
												
													
														
															|  |         if(p!=null){
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (p != null) {
 | 
												
													
														
															|  |             String sql = "SELECT f.hospital_name as oldHospitalName,t.name AS oldTeamName,d.name as OldLeaderName,f.doctor_name AS OldDoctorName,f.doctor_health_name AS OldHealthDoctorName FROM wlyy_sign_family_renew_log r  " +
 |  |             String sql = "SELECT f.hospital_name as oldHospitalName,t.name AS oldTeamName,d.name as OldLeaderName,f.doctor_name AS OldDoctorName,f.doctor_health_name AS OldHealthDoctorName FROM wlyy_sign_family_renew_log r  " +
 | 
												
													
														
															|  |                     " LEFT JOIN wlyy_sign_family f ON r.old_sign_code = f.code " +
 |  |                     " LEFT JOIN wlyy_sign_family f ON r.old_sign_code = f.code " +
 | 
												
													
														
															|  |                     " LEFT JOIN wlyy_admin_team t ON r.old_admin_team_id = t.id " +
 |  |                     " LEFT JOIN wlyy_admin_team t ON r.old_admin_team_id = t.id " +
 | 
												
													
														
															|  |                     " LEFt JOIN wlyy_doctor d ON t.leader_code = d.code  " +
 |  |                     " LEFt JOIN wlyy_doctor d ON t.leader_code = d.code  " +
 | 
												
													
														
															|  |                     " WHERE r.idcard ='"+p.getIdcard()+"' AND r.sign_year='"+DateUtil.getSignYear()+"'";
 |  | 
 | 
												
													
														
															|  |             List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 |  | 
 | 
												
													
														
															|  |             if(list!=null&&list.size()>0){
 |  | 
 | 
												
													
														
															|  |                return new JSONObject(list.get(0));
 |  | 
 | 
												
													
														
															|  | 
 |  |                     " WHERE r.idcard ='" + p.getIdcard() + "' AND r.sign_year='" + DateUtil.getSignYear() + "'";
 | 
												
													
														
															|  | 
 |  |             List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  | 
 |  |             if (list != null && list.size() > 0) {
 | 
												
													
														
															|  | 
 |  |                 return new JSONObject(list.get(0));
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         return new JSONObject();
 |  |         return new JSONObject();
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public void setRenewFlag(SignFamily renew,Long teamCode){
 |  | 
 | 
												
													
														
															|  |         if(teamCode==null){
 |  | 
 | 
												
													
														
															|  |             return ;
 |  | 
 | 
												
													
														
															|  | 
 |  |     public void setRenewFlag(SignFamily renew, Long teamCode) {
 | 
												
													
														
															|  | 
 |  |         if (teamCode == null) {
 | 
												
													
														
															|  | 
 |  |             return;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         String sql = "SELECT * FROM wlyy_sign_family f WHERE f.patient ='"+renew.getPatient()+"' AND (f.`status` =-4 OR f.`status`>0) AND f.expenses_status ='1' AND f.sign_year >='"+(Integer.parseInt(renew.getSignYear())-1)+"' ";
 |  | 
 | 
												
													
														
															|  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 |  | 
 | 
												
													
														
															|  |         Map<String,Object> sign = null;
 |  | 
 | 
												
													
														
															|  |         if(list!=null&&list.size()>0){
 |  | 
 | 
												
													
														
															|  | 
 |  |         String sql = "SELECT * FROM wlyy_sign_family f WHERE f.patient ='" + renew.getPatient() + "' AND (f.`status` =-4 OR f.`status`>0) AND f.expenses_status ='1' AND f.sign_year >='" + (Integer.parseInt(renew.getSignYear()) - 1) + "' ";
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  | 
 |  |         Map<String, Object> sign = null;
 | 
												
													
														
															|  | 
 |  |         if (list != null && list.size() > 0) {
 | 
												
													
														
															|  |             sign = list.get(0);
 |  |             sign = list.get(0);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         Integer i = (Integer)sign.get("admin_team_code");
 |  | 
 | 
												
													
														
															|  | 
 |  |         Integer i = (Integer) sign.get("admin_team_code");
 | 
												
													
														
															|  |         Long id = i.longValue();
 |  |         Long id = i.longValue();
 | 
												
													
														
															|  |         if(id==null){
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (id == null) {
 | 
												
													
														
															|  |             renew.setRenewFlag("2");
 |  |             renew.setRenewFlag("2");
 | 
												
													
														
															|  |         }else{
 |  | 
 | 
												
													
														
															|  |             if(id==teamCode){
 |  | 
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             if (id == teamCode) {
 | 
												
													
														
															|  |                 renew.setRenewFlag("1");
 |  |                 renew.setRenewFlag("1");
 | 
												
													
														
															|  |             }else{
 |  | 
 | 
												
													
														
															|  | 
 |  |             } else {
 | 
												
													
														
															|  |                 renew.setRenewFlag("2");
 |  |                 renew.setRenewFlag("2");
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public void setRenewFlag(SignFamilyRenew renew,Long teamCode){
 |  | 
 | 
												
													
														
															|  |         if(teamCode==null){
 |  | 
 | 
												
													
														
															|  |             return ;
 |  | 
 | 
												
													
														
															|  | 
 |  |     public void setRenewFlag(SignFamilyRenew renew, Long teamCode) {
 | 
												
													
														
															|  | 
 |  |         if (teamCode == null) {
 | 
												
													
														
															|  | 
 |  |             return;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         String sql = "SELECT * FROM wlyy_sign_family f WHERE f.patient ='"+renew.getPatient()+"' AND (f.`status` =-4 OR f.`status`>0) AND f.expenses_status ='1' AND f.sign_year >='"+(Integer.parseInt(renew.getSignYear())-1)+"' ";
 |  | 
 | 
												
													
														
															|  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 |  | 
 | 
												
													
														
															|  |         Map<String,Object> sign = null;
 |  | 
 | 
												
													
														
															|  |         if(list!=null&&list.size()>0){
 |  | 
 | 
												
													
														
															|  | 
 |  |         String sql = "SELECT * FROM wlyy_sign_family f WHERE f.patient ='" + renew.getPatient() + "' AND (f.`status` =-4 OR f.`status`>0) AND f.expenses_status ='1' AND f.sign_year >='" + (Integer.parseInt(renew.getSignYear()) - 1) + "' ";
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  | 
 |  |         Map<String, Object> sign = null;
 | 
												
													
														
															|  | 
 |  |         if (list != null && list.size() > 0) {
 | 
												
													
														
															|  |             sign = list.get(0);
 |  |             sign = list.get(0);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         Integer i = (Integer)sign.get("admin_team_code");
 |  | 
 | 
												
													
														
															|  | 
 |  |         Integer i = (Integer) sign.get("admin_team_code");
 | 
												
													
														
															|  |         Long id = i.longValue();
 |  |         Long id = i.longValue();
 | 
												
													
														
															|  |         if(id==null){
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (id == null) {
 | 
												
													
														
															|  |             renew.setRenewFlag("2");
 |  |             renew.setRenewFlag("2");
 | 
												
													
														
															|  |         }else{
 |  | 
 | 
												
													
														
															|  |             if(id==teamCode){
 |  | 
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             if (id == teamCode) {
 | 
												
													
														
															|  |                 renew.setRenewFlag("1");
 |  |                 renew.setRenewFlag("1");
 | 
												
													
														
															|  |             }else{
 |  | 
 | 
												
													
														
															|  | 
 |  |             } else {
 | 
												
													
														
															|  |                 renew.setRenewFlag("2");
 |  |                 renew.setRenewFlag("2");
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -2217,4 +2338,5 @@ public class SignWebService extends BaseService {
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         return -1;
 |  |         return -1;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | }
 |  | }
 |