| 
															
																@ -647,17 +647,18 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                String integrateSql = "select * from wlyy_health_bank_credits_detail where patient_id = '"+patientId+"' " + 
															 | 
															
															 | 
															
																                String integrateSql = "select * from wlyy_health_bank_credits_detail where patient_id = '"+patientId+"' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        "AND transaction_id IN (SELECT id FROM wlyy_health_bank_task WHERE task_code IN ('BP_BIND','GLU_BIND','BP_MEASURE','GLU_MEASURE','RULE'))"; 
															 | 
															
															 | 
															
																                        "AND transaction_id IN (SELECT id FROM wlyy_health_bank_task WHERE task_code IN ('BP_BIND','GLU_BIND','BP_MEASURE','GLU_MEASURE','RULE'))"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(integrateSql,new BeanPropertyRowMapper(CreditsDetailDO.class)); 
															 | 
															
															 | 
															
																                List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(integrateSql,new BeanPropertyRowMapper(CreditsDetailDO.class)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                AccountDO accountDO = accountDOS.get(0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                for (CreditsDetailDO creditsDetailDO:creditsDetailDOS){ 
															 | 
															
															 | 
															
																                for (CreditsDetailDO creditsDetailDO:creditsDetailDOS){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    if (creditsDetailDO.getTradeDirection()==1&&creditsDetailDO.getStatus()!=0){ 
															 | 
															
															 | 
															
																                    if (creditsDetailDO.getTradeDirection()==1&&creditsDetailDO.getStatus()!=0){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        AccountDO accountDO = accountDOS.get(0); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        int total = accountDO.getTotal() - creditsDetailDO.getIntegrate(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                  /*      int total = accountDO.getTotal() - creditsDetailDO.getIntegrate();*/ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        creditsDetailDO.setStatus(0); 
															 | 
															
															 | 
															
																                        creditsDetailDO.setStatus(0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        creditsDetailDO.setDescription(description); 
															 | 
															
															 | 
															
																                        creditsDetailDO.setDescription(description); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        credittsLogDetailDao.save(creditsDetailDO); 
															 | 
															
															 | 
															
																                        credittsLogDetailDao.save(creditsDetailDO); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        accountDO.setTotal(total); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        accountDao.save(accountDO); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    } 
															 | 
															
															 | 
															
																                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                } 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                accountDO.setTotal(0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                accountDao.save(accountDO); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                CreditsDetailDO creditsDetailDO1 = new CreditsDetailDO(); 
															 | 
															
															 | 
															
																                CreditsDetailDO creditsDetailDO1 = new CreditsDetailDO(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                creditsDetailDO1.setStatus(1); 
															 | 
															
															 | 
															
																                creditsDetailDO1.setStatus(1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                creditsDetailDO1.setSaasId("dev"); 
															 | 
															
															 | 
															
																                creditsDetailDO1.setSaasId("dev"); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -688,21 +689,28 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                creditsDetailDO.setUpdateTime(new Date()); 
															 | 
															
															 | 
															
																                creditsDetailDO.setUpdateTime(new Date()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                creditsDetailDO.setTransactionId(taskDO1.getId()); 
															 | 
															
															 | 
															
																                creditsDetailDO.setTransactionId(taskDO1.getId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                creditsDetailDO.setTradeType("ACTIVITY_TASK"); 
															 | 
															
															 | 
															
																                creditsDetailDO.setTradeType("ACTIVITY_TASK"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                credittsLogDetailDao.save(creditsDetailDO); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                creditsDetailDO = credittsLogDetailDao.save(creditsDetailDO); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                if (taskRuleDO.getTradeDirection() == -1){ 
															 | 
															
															 | 
															
																                if (taskRuleDO.getTradeDirection() == -1){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    String integrateSql = "select * from wlyy_health_bank_credits_detail where patient_id = '"+patientId+"' " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                            "AND transaction_id IN (SELECT id FROM wlyy_health_bank_task WHERE task_code IN ('BP_BIND','GLU_BIND','BP_MEASURE','GLU_MEASURE','RULE'))"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(integrateSql,new BeanPropertyRowMapper(CreditsDetailDO.class)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    for (CreditsDetailDO creditsDetailDO1:creditsDetailDOS){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        if (creditsDetailDO1.getTradeDirection()==1&&creditsDetailDO1.getStatus()!=0){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                            AccountDO accountDO = accountDOS.get(0); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                            int total = accountDO.getTotal() - creditsDetailDO1.getIntegrate(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                            creditsDetailDO1.setStatus(0); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                            creditsDetailDO1.setDescription(description); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                            credittsLogDetailDao.save(creditsDetailDO1); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                            accountDO.setTotal(total); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                            accountDao.save(accountDO); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    if (taskRuleDO.getIntegrate() == 0){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        String integrateSql = "select * from wlyy_health_bank_credits_detail where patient_id = '"+patientId+"' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                "AND transaction_id IN (SELECT id FROM wlyy_health_bank_task WHERE task_code IN ('BP_BIND','GLU_BIND','BP_MEASURE','GLU_MEASURE','RULE'))"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(integrateSql,new BeanPropertyRowMapper(CreditsDetailDO.class)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        AccountDO accountDO = accountDOS.get(0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        for (CreditsDetailDO creditsDetailDO1:creditsDetailDOS){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                            if (creditsDetailDO1.getTradeDirection()==1&&creditsDetailDO1.getStatus()!=0){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                int total = accountDO.getTotal() - creditsDetailDO1.getIntegrate(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                creditsDetailDO1.setStatus(0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                creditsDetailDO1.setDescription(description); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                credittsLogDetailDao.save(creditsDetailDO1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        } 
															 | 
															
															 | 
															
																                        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        accountDO.setTotal(0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        accountDao.save(accountDO); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    }else if (taskRuleDO.getIntegrate()!=0){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        AccountDO accountDO = accountDOS.get(0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        int total = accountDO.getTotal() - creditsDetailDO.getIntegrate(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        accountDO.setTotal(total); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        accountDao.save(accountDO); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    } 
															 | 
															
															 | 
															
																                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                }else if (taskRuleDO.getTradeDirection() == 1){ 
															 | 
															
															 | 
															
																                }else if (taskRuleDO.getTradeDirection() == 1){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    AccountDO accountDO = accountDOS.get(0); 
															 | 
															
															 | 
															
																                    AccountDO accountDO = accountDOS.get(0); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -993,7 +1001,7 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt 
															 | 
														
													
												
													
														
															| 
															 | 
															
																           taskPatientDetailDO.setStatus(1); 
															 | 
															
															 | 
															
																           taskPatientDetailDO.setStatus(1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																           taskPatientDetailDao.save(taskPatientDetailDO); 
															 | 
															
															 | 
															
																           taskPatientDetailDao.save(taskPatientDetailDO); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       } 
															 | 
															
															 | 
															
																       } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       if (accountDO.getTotal().compareTo(integrate)>=1){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																       if (accountDO.getTotal().compareTo(integrate)>=0){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																           CreditsDetailDO creditsDetailDO = new CreditsDetailDO(); 
															 | 
															
															 | 
															
																           CreditsDetailDO creditsDetailDO = new CreditsDetailDO(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																           creditsDetailDO.setAccountId(accountDO.getId()); 
															 | 
															
															 | 
															
																           creditsDetailDO.setAccountId(accountDO.getId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																           creditsDetailDO.setIdCard(accountDO.getIdCard()); 
															 | 
															
															 | 
															
																           creditsDetailDO.setIdCard(accountDO.getIdCard()); 
															 |