|  | @ -8,12 +8,18 @@ import com.yihu.jw.patient.dao.BasePatientDao;
 | 
												
													
														
															|  | import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
 |  | import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
 | 
												
													
														
															|  | import com.yihu.jw.util.common.IdCardUtil;
 |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
												
													
														
															|  | import com.yihu.jw.util.date.DateUtil;
 |  | import com.yihu.jw.util.date.DateUtil;
 | 
												
													
														
															|  | 
 |  | import org.apache.commons.collections.map.HashedMap;
 | 
												
													
														
															|  | import org.apache.commons.lang3.StringUtils;
 |  | import org.apache.commons.lang3.StringUtils;
 | 
												
													
														
															|  | import org.json.JSONObject;
 |  | import org.json.JSONObject;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Autowired;
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
													
														
															|  | 
 |  | import org.springframework.jdbc.core.BeanPropertyRowMapper;
 | 
												
													
														
															|  | 
 |  | import org.springframework.jdbc.core.JdbcTemplate;
 | 
												
													
														
															|  | import org.springframework.stereotype.Service;
 |  | import org.springframework.stereotype.Service;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import java.util.ArrayList;
 | 
												
													
														
															|  | import java.util.Date;
 |  | import java.util.Date;
 | 
												
													
														
															|  | 
 |  | import java.util.List;
 | 
												
													
														
															|  | 
 |  | import java.util.Map;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | /**
 |  | /**
 | 
												
													
														
															|  |  * Created by yeshijie on 2020/12/31.
 |  |  * Created by yeshijie on 2020/12/31.
 | 
												
											
												
													
														
															|  | @ -26,6 +32,57 @@ public class PatientService {
 | 
												
													
														
															|  |     private SignFamilyDao signFamilyDao;
 |  |     private SignFamilyDao signFamilyDao;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private BasePatientMedicareCardDao patientMedicareCardDao;
 |  |     private BasePatientMedicareCardDao patientMedicareCardDao;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private JdbcTemplate jdbcTemplate;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public List<Map<String,Object>> patientList(String name, Integer page, Integer size){
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> resultList = new ArrayList<>(32);
 | 
												
													
														
															|  | 
 |  |         String sql = "select p.* from base_patient p where p.del = '1' and p.enabled = 1 ";
 | 
												
													
														
															|  | 
 |  |         if(StringUtils.isNoneBlank(name)){
 | 
												
													
														
															|  | 
 |  |             sql += " and p.name like '%"+name+"%'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         int start = 0 == page ? page++ : (page - 1) * size;
 | 
												
													
														
															|  | 
 |  |         int end = 0 == size ? 15 : size;
 | 
												
													
														
															|  | 
 |  |         sql += " limit "+start+","+end;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<BasePatientDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BasePatientDO.class));
 | 
												
													
														
															|  | 
 |  |         for (BasePatientDO p:list){
 | 
												
													
														
															|  | 
 |  |             Map<String,Object> json = new HashedMap();
 | 
												
													
														
															|  | 
 |  |             json.put("id", p.getId());
 | 
												
													
														
															|  | 
 |  |             json.put("code", p.getId());
 | 
												
													
														
															|  | 
 |  |             // 设置患者姓名
 | 
												
													
														
															|  | 
 |  |             json.put("name", p.getName());
 | 
												
													
														
															|  | 
 |  |             // 设置患者手机号
 | 
												
													
														
															|  | 
 |  |             json.put("mobile", p.getMobile());
 | 
												
													
														
															|  | 
 |  |             // 设置患者微信openid
 | 
												
													
														
															|  | 
 |  |             json.put("openid", StringUtils.isNotEmpty(p.getOpenid()) ? p.getOpenid() : "");
 | 
												
													
														
															|  | 
 |  |             json.put("openidTime", DateUtil.dateToStr(p.getOpenidTime(), DateUtil.YYYY_MM_DD_HH_MM_SS));
 | 
												
													
														
															|  | 
 |  |             // 设置患者联系电话
 | 
												
													
														
															|  | 
 |  |             json.put("phone", p.getPhone());
 | 
												
													
														
															|  | 
 |  |             // 设置患者头像
 | 
												
													
														
															|  | 
 |  |             json.put("photo", p.getPhoto());
 | 
												
													
														
															|  | 
 |  |             // 设置患者年龄
 | 
												
													
														
															|  | 
 |  |             json.put("age", IdCardUtil.getAgeByIdcardOrBirthday(p.getIdcard(),p.getBirthday()));
 | 
												
													
														
															|  | 
 |  |             // 设置患者性别
 | 
												
													
														
															|  | 
 |  |             json.put("sex", p.getSex());
 | 
												
													
														
															|  | 
 |  |             // 身份证号
 | 
												
													
														
															|  | 
 |  |             json.put("idcard", p.getIdcard());
 | 
												
													
														
															|  | 
 |  |             //1.4.2新增medicareNumber
 | 
												
													
														
															|  | 
 |  | //        json.put("medicareNumber", p.getMedicareNumber());
 | 
												
													
														
															|  | 
 |  |             // 设置患者居住省份
 | 
												
													
														
															|  | 
 |  |             json.put("provinceName", p.getProvinceName());
 | 
												
													
														
															|  | 
 |  |             json.put("cityName", p.getCityName());
 | 
												
													
														
															|  | 
 |  |             json.put("townName", p.getTownName());
 | 
												
													
														
															|  | 
 |  |             json.put("streetName", p.getStreetName());
 | 
												
													
														
															|  | 
 |  |             // 设置患者地址
 | 
												
													
														
															|  | 
 |  |             json.put("address", p.getAddress());
 | 
												
													
														
															|  | 
 |  |             resultList.add(json);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         return resultList;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 查询单个居民信息
 |  |      * 查询单个居民信息
 | 
												
											
												
													
														
															|  | @ -101,8 +158,6 @@ public class PatientService {
 | 
												
													
														
															|  |             json.put("qyrq", familySign.getApplyDate() != null ? DateUtil.dateToStr((Date) familySign.getApplyDate(), DateUtil.YYYY_MM_DD) : "");
 |  |             json.put("qyrq", familySign.getApplyDate() != null ? DateUtil.dateToStr((Date) familySign.getApplyDate(), DateUtil.YYYY_MM_DD) : "");
 | 
												
													
														
															|  |             // 设置签约日期
 |  |             // 设置签约日期
 | 
												
													
														
															|  |             json.put("patientApplyDate", familySign.getPatientApplyDate() != null ? DateUtil.dateToStr((Date) familySign.getPatientApplyDate(), DateUtil.YYYY_MM_DD) : "");
 |  |             json.put("patientApplyDate", familySign.getPatientApplyDate() != null ? DateUtil.dateToStr((Date) familySign.getPatientApplyDate(), DateUtil.YYYY_MM_DD) : "");
 | 
												
													
														
															|  |             // 设置签约类型
 |  | 
 | 
												
													
														
															|  |             json.put("signType", json.has("signType") ? 3 : 2);
 |  | 
 | 
												
													
														
															|  |             // 缴费情况
 |  |             // 缴费情况
 | 
												
													
														
															|  |             json.put("expensesStatus", StringUtils.isNotEmpty(familySign.getExpensesStatus()) ? String.valueOf(familySign.getExpensesStatus()) : "0");
 |  |             json.put("expensesStatus", StringUtils.isNotEmpty(familySign.getExpensesStatus()) ? String.valueOf(familySign.getExpensesStatus()) : "0");
 | 
												
													
														
															|  |             // 缴费时间
 |  |             // 缴费时间
 | 
												
											
												
													
														
															|  | @ -114,18 +169,6 @@ public class PatientService {
 | 
												
													
														
															|  |             json.put("jtBeginDate", DateUtil.dateToStr(familySign.getBegin(), DateUtil.YYYY_MM_DD));
 |  |             json.put("jtBeginDate", DateUtil.dateToStr(familySign.getBegin(), DateUtil.YYYY_MM_DD));
 | 
												
													
														
															|  |             json.put("jtEndDate", DateUtil.dateToStr(familySign.getEnd(), DateUtil.YYYY_MM_DD));
 |  |             json.put("jtEndDate", DateUtil.dateToStr(familySign.getEnd(), DateUtil.YYYY_MM_DD));
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | //            Doctor jtDoctor = doctorDao.findByCode(familySign.getDoctor());
 |  | 
 | 
												
													
														
															|  | //            json.put("jtDoctor", familySign.getDoctor());
 |  | 
 | 
												
													
														
															|  | //            json.put("jtDoctorName", familySign.getDoctorName());
 |  | 
 | 
												
													
														
															|  | //            json.put("jtDoctorSex", jtDoctor.getSex());
 |  | 
 | 
												
													
														
															|  | //            json.put("jtDoctorPhoto", jtDoctor.getPhoto());
 |  | 
 | 
												
													
														
															|  | //            json.put("jtDoctorHealth", familySign.getDoctorHealth());
 |  | 
 | 
												
													
														
															|  | //            json.put("jtDoctorHealthName", familySign.getDoctorHealthName());
 |  | 
 | 
												
													
														
															|  | //            json.put("jtSpecialist", familySign.getSpecialist());
 |  | 
 | 
												
													
														
															|  | //            json.put("jtSpecialistName", familySign.getSpecialistName());
 |  | 
 | 
												
													
														
															|  | //            json.put("jtAdminTeam", familySign.getAdminTeamId());
 |  | 
 | 
												
													
														
															|  | //            json.put("jtHospital", familySign.getHospital());
 |  | 
 | 
												
													
														
															|  | //            json.put("jtHospitalName", familySign.getHospitalName());
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 |