|  | @ -3,9 +3,11 @@ package com.yihu.jw.service;/**
 | 
												
													
														
															|  |  */
 |  |  */
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import com.yihu.base.mysql.query.BaseJpaService;
 |  | import com.yihu.base.mysql.query.BaseJpaService;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.dao.AccountDao;
 | 
												
													
														
															|  | import com.yihu.jw.dao.ActivityDao;
 |  | import com.yihu.jw.dao.ActivityDao;
 | 
												
													
														
															|  | import com.yihu.jw.dao.TaskDao;
 |  | import com.yihu.jw.dao.TaskDao;
 | 
												
													
														
															|  | import com.yihu.jw.dao.TaskPatientDetailDao;
 |  | import com.yihu.jw.dao.TaskPatientDetailDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.health.bank.AccountDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.health.bank.TaskDO;
 |  | import com.yihu.jw.entity.health.bank.TaskDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
 |  | import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.health.bank.TaskRangDO;
 |  | import com.yihu.jw.entity.health.bank.TaskRangDO;
 | 
												
											
												
													
														
															|  | @ -35,6 +37,8 @@ public class TaskPatientDtailService extends BaseJpaService<TaskPatientDetailDO,
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private JdbcTemplate jdbcTemplate;
 |  |     private JdbcTemplate jdbcTemplate;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private AccountDao accountDao;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  |     private TaskDao taskDao;
 |  |     private TaskDao taskDao;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private ActivityDao activityDao;
 |  |     private ActivityDao activityDao;
 | 
												
											
												
													
														
															|  | @ -72,6 +76,27 @@ public class TaskPatientDtailService extends BaseJpaService<TaskPatientDetailDO,
 | 
												
													
														
															|  |         taskPatientDetailDO.setCreateTime(new Date());
 |  |         taskPatientDetailDO.setCreateTime(new Date());
 | 
												
													
														
															|  |         taskPatientDetailDO.setUpdateTime(new Date());
 |  |         taskPatientDetailDO.setUpdateTime(new Date());
 | 
												
													
														
															|  |         taskPatientDetailDO.setStatus(Integer.parseInt("0"));
 |  |         taskPatientDetailDO.setStatus(Integer.parseInt("0"));
 | 
												
													
														
															|  | 
 |  |         String accountSql = "select * from wlyy_health_bank_account where patient_id = '"+taskPatientDetailDO.getPatientId()+"'";
 | 
												
													
														
															|  | 
 |  |         List<AccountDO> accountDOS = jdbcTemplate.query(accountSql,new BeanPropertyRowMapper(AccountDO.class));
 | 
												
													
														
															|  | 
 |  |         if (accountDOS == null || accountDOS.size() ==0){
 | 
												
													
														
															|  | 
 |  |             AccountDO accountDO = new AccountDO();
 | 
												
													
														
															|  | 
 |  |             accountDO.setSaasId("dev");
 | 
												
													
														
															|  | 
 |  |             accountDO.setStatus(1);
 | 
												
													
														
															|  | 
 |  |             if(taskPatientDetailDO.getPatientIdcard().length()>=4){// 判断是否长度大于等于4
 | 
												
													
														
															|  | 
 |  |                 String cardNumber=taskPatientDetailDO.getPatientIdcard().substring(taskPatientDetailDO.getPatientIdcard().length()- 4,taskPatientDetailDO.getPatientIdcard().length());//截取两个数字之间的部分
 | 
												
													
														
															|  | 
 |  |                 int random = (int)((Math.random()*9+1)*100000);
 | 
												
													
														
															|  | 
 |  |                 accountDO.setCardNumber(cardNumber+Integer.toString(random));
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             accountDO.setAccountName(taskPatientDetailDO.getName());
 | 
												
													
														
															|  | 
 |  |             accountDO.setTotal(0);
 | 
												
													
														
															|  | 
 |  |             accountDO.setPatientId(taskPatientDetailDO.getPatientId());
 | 
												
													
														
															|  | 
 |  |             accountDO.setCardNumber(taskPatientDetailDO.getPatientIdcard());
 | 
												
													
														
															|  | 
 |  |             accountDO.setHospital(taskPatientDetailDO.getHospital());
 | 
												
													
														
															|  | 
 |  |             accountDO.setHospitalName(taskPatientDetailDO.getHospitalName());
 | 
												
													
														
															|  | 
 |  |             accountDO.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  |             accountDO.setUpdateTime(new Date());
 | 
												
													
														
															|  | 
 |  |             accountDao.save(accountDO);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |         String activitySql = "select * from wlyy_health_bank_task where transaction_id = '" + taskPatientDetailDO.getActivityId() +"'";
 |  |         String activitySql = "select * from wlyy_health_bank_task where transaction_id = '" + taskPatientDetailDO.getActivityId() +"'";
 | 
												
													
														
															|  |         List<TaskDO> taskDOList = jdbcTemplate.query(activitySql,new BeanPropertyRowMapper(TaskDO.class));
 |  |         List<TaskDO> taskDOList = jdbcTemplate.query(activitySql,new BeanPropertyRowMapper(TaskDO.class));
 | 
												
													
														
															|  |         StringBuffer buffer = new StringBuffer();
 |  |         StringBuffer buffer = new StringBuffer();
 |