|  | @ -5,6 +5,7 @@ import com.yihu.jw.exception.business.patient.PatientCardNotFoundException;
 | 
												
													
														
															|  | import com.yihu.jw.exception.business.patient.PatientNotFoundException;
 |  | import com.yihu.jw.exception.business.patient.PatientNotFoundException;
 | 
												
													
														
															|  | import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
 |  | import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
 | 
												
													
														
															|  | import com.yihu.jw.patient.service.BasePatientMedicardCardService;
 |  | import com.yihu.jw.patient.service.BasePatientMedicardCardService;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.patient.util.JavaBeanUtils;
 | 
												
													
														
															|  | import com.yihu.jw.util.security.MD5;
 |  | import com.yihu.jw.util.security.MD5;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Autowired;
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
													
														
															|  | import org.springframework.jdbc.core.JdbcTemplate;
 |  | import org.springframework.jdbc.core.JdbcTemplate;
 | 
												
											
												
													
														
															|  | @ -14,6 +15,7 @@ import org.springframework.util.Assert;
 | 
												
													
														
															|  | import org.springframework.util.CollectionUtils;
 |  | import org.springframework.util.CollectionUtils;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import javax.validation.constraints.NotNull;
 |  | import javax.validation.constraints.NotNull;
 | 
												
													
														
															|  | 
 |  | import java.util.ArrayList;
 | 
												
													
														
															|  | import java.util.List;
 |  | import java.util.List;
 | 
												
													
														
															|  | import java.util.Map;
 |  | import java.util.Map;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -43,15 +45,13 @@ public class PatientMedicareCardService extends BasePatientMedicardCardService<P
 | 
												
													
														
															|  |      * @param medicareCardNumber
 |  |      * @param medicareCardNumber
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     @Transactional(rollbackFor = Exception.class)
 |  |     @Transactional(rollbackFor = Exception.class)
 | 
												
													
														
															|  |     public void bindMedicareCard(String patientCode, String idcard,String medicareCardNumber,String password) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public void bindMedicareCard(String patientCode, String idcard,String medicareCardNumber) {
 | 
												
													
														
															|  |         Assert.notNull(patientCode,"居民code不可为空!");
 |  |         Assert.notNull(patientCode,"居民code不可为空!");
 | 
												
													
														
															|  |         Assert.notNull(idcard,"身份证号不可为空!");
 |  |         Assert.notNull(idcard,"身份证号不可为空!");
 | 
												
													
														
															|  |         Assert.notNull(medicareCardNumber,"医保卡号不可为空!");
 |  | 
 | 
												
													
														
															|  |         Assert.notNull(password,"密码不可为空!");
 |  | 
 | 
												
													
														
															|  | 
 |  |         Assert.notNull(medicareCardNumber,"医(社)保卡号不可为空!");
 | 
												
													
														
															|  |         PatientMedicareCardDO card = makeCardInfo(patientCode,idcard,medicareCardNumber);
 |  |         PatientMedicareCardDO card = makeCardInfo(patientCode,idcard,medicareCardNumber);
 | 
												
													
														
															|  |         card.setParentType(PatientMedicareCardDO.ParentType.CareCard.name());
 |  | 
 | 
												
													
														
															|  |         card.setType(PatientMedicareCardDO.Type.MedicareCard.name());
 |  | 
 | 
												
													
														
															|  |         card.setPassword(MD5.GetMD5Code(password));
 |  | 
 | 
												
													
														
															|  | 
 |  |         card.setParentType(PatientMedicareCardDO.ParentType.CareCard.getType());
 | 
												
													
														
															|  | 
 |  |         card.setType(PatientMedicareCardDO.Type.MedicareCard.getType());
 | 
												
													
														
															|  |         this.save(card);
 |  |         this.save(card);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -79,30 +79,13 @@ public class PatientMedicareCardService extends BasePatientMedicardCardService<P
 | 
												
													
														
															|  |         Assert.notNull(idcard,"身份证号不可为空!");
 |  |         Assert.notNull(idcard,"身份证号不可为空!");
 | 
												
													
														
															|  |         Assert.notNull(medicareCardNumber,"就诊卡号不可为空!");
 |  |         Assert.notNull(medicareCardNumber,"就诊卡号不可为空!");
 | 
												
													
														
															|  |         PatientMedicareCardDO card = makeCardInfo(patientCode,idcard,medicareCardNumber);
 |  |         PatientMedicareCardDO card = makeCardInfo(patientCode,idcard,medicareCardNumber);
 | 
												
													
														
															|  |         card.setParentType(PatientMedicareCardDO.ParentType.CareCard.name());
 |  | 
 | 
												
													
														
															|  |         card.setType(PatientMedicareCardDO.Type.MedicareCard.name());
 |  | 
 | 
												
													
														
															|  |         card.setOrgCode(PatientMedicareCardDO.Type.PatientIDCard.name());
 |  | 
 | 
												
													
														
															|  | 
 |  |         card.setParentType(PatientMedicareCardDO.ParentType.CareCard.getType());
 | 
												
													
														
															|  | 
 |  |         card.setType(PatientMedicareCardDO.Type.PatientIDCard.getType());
 | 
												
													
														
															|  | 
 |  |         card.setOrgCode(orgCode);
 | 
												
													
														
															|  |         card.setRemark(remark);
 |  |         card.setRemark(remark);
 | 
												
													
														
															|  |         this.save(card);
 |  |         this.save(card);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  | 
 | 
												
													
														
															|  |      * 绑定电子社保卡
 |  | 
 | 
												
													
														
															|  |      *
 |  | 
 | 
												
													
														
															|  |      * @param patientCode
 |  | 
 | 
												
													
														
															|  |      * @param cardNumber
 |  | 
 | 
												
													
														
															|  |      */
 |  | 
 | 
												
													
														
															|  |     @Transactional(rollbackFor = Exception.class)
 |  | 
 | 
												
													
														
															|  |     public void bindSocialSecurityCard(String patientCode, String cardNumber) {
 |  | 
 | 
												
													
														
															|  |         Assert.notNull(patientCode,"id不可为空!");
 |  | 
 | 
												
													
														
															|  |         Assert.notNull(cardNumber,"社保卡号不可为空!");
 |  | 
 | 
												
													
														
															|  |         PatientMedicareCardDO card = new PatientMedicareCardDO();
 |  | 
 | 
												
													
														
															|  |         card.setPatientCode(patientCode);
 |  | 
 | 
												
													
														
															|  |         card.setCode(cardNumber);
 |  | 
 | 
												
													
														
															|  |         card.setParentType(PatientMedicareCardDO.ParentType.CareCard.name());
 |  | 
 | 
												
													
														
															|  |         card.setType(PatientMedicareCardDO.Type.SocialSecurityCard.name());
 |  | 
 | 
												
													
														
															|  |         this.save(card);
 |  | 
 | 
												
													
														
															|  |     }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 解除卡的绑定
 |  |      * 解除卡的绑定
 | 
												
											
												
													
														
															|  | @ -146,4 +129,35 @@ public class PatientMedicareCardService extends BasePatientMedicardCardService<P
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |        return cards;
 |  |        return cards;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 查询居民的卡包的卡列表
 | 
												
													
														
															|  | 
 |  |      * @param patientCode
 | 
												
													
														
															|  | 
 |  |      * @return
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public List queryCardList(String patientCode){
 | 
												
													
														
															|  | 
 |  |         List result = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  |         String sql = "SELECT" +
 | 
												
													
														
															|  | 
 |  |                 " card.code as cardNumber," +
 | 
												
													
														
															|  | 
 |  |                 " org.name," +
 | 
												
													
														
															|  | 
 |  |                 " card.parent_type as parentType," +
 | 
												
													
														
															|  | 
 |  |                 " card.type as type " +
 | 
												
													
														
															|  | 
 |  |                 " FROM" +
 | 
												
													
														
															|  | 
 |  |                 " patient_medicare_card card " +
 | 
												
													
														
															|  | 
 |  |                 " LEFT JOIN base_org org ON card.org_code = org.`code` " +
 | 
												
													
														
															|  | 
 |  |                 " WHERE" +
 | 
												
													
														
															|  | 
 |  |                 " card.patient_code = '"+ patientCode + "'";
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> cardlist = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  | 
 |  |         try {
 | 
												
													
														
															|  | 
 |  |             result = JavaBeanUtils.getInstance().mapListJson(cardlist);
 | 
												
													
														
															|  | 
 |  |         } catch (Exception e) {
 | 
												
													
														
															|  | 
 |  |             e.printStackTrace();
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public List queryCardOrgSortedList(){
 | 
												
													
														
															|  | 
 |  |         List result = new ArrayList();
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | }
 |  | }
 |