|
@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
import com.yihu.jw.care.aop.RedisLockAOP;
|
|
|
|
import com.yihu.jw.care.dao.family.PatientFamilyMemberDao;
|
|
import com.yihu.jw.care.dao.label.BaseCapacityLabelDao;
|
|
import com.yihu.jw.care.dao.label.BaseCapacityLabelDao;
|
|
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
|
|
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
|
|
import com.yihu.jw.care.service.common.DictService;
|
|
import com.yihu.jw.care.service.common.DictService;
|
|
@ -12,27 +14,35 @@ import com.yihu.jw.care.service.family.PatientFamilyMemberService;
|
|
import com.yihu.jw.care.service.sign.CapacityAssessmentRecordService;
|
|
import com.yihu.jw.care.service.sign.CapacityAssessmentRecordService;
|
|
import com.yihu.jw.care.service.sign.ServicePackageService;
|
|
import com.yihu.jw.care.service.sign.ServicePackageService;
|
|
import com.yihu.jw.care.util.ConstantUtil;
|
|
import com.yihu.jw.care.util.ConstantUtil;
|
|
|
|
import com.yihu.jw.care.vo.JczdPersonVo;
|
|
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
|
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
|
|
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
|
|
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
|
|
import com.yihu.jw.entity.care.label.BaseCapacityLabelDO;
|
|
import com.yihu.jw.entity.care.label.BaseCapacityLabelDO;
|
|
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
|
|
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
|
|
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
|
|
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
|
|
|
|
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
|
|
|
|
import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
|
|
import com.yihu.jw.im.util.ImUtil;
|
|
import com.yihu.jw.im.util.ImUtil;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
|
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.service.BasePatientService;
|
|
import com.yihu.jw.patient.service.BasePatientService;
|
|
import com.yihu.jw.restmodel.ResponseContant;
|
|
import com.yihu.jw.restmodel.ResponseContant;
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.sms.dao.HospitalSysDictDao;
|
|
import com.yihu.jw.sms.dao.HospitalSysDictDao;
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
|
import com.yihu.jw.util.common.LatitudeUtils;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import com.yihu.utils.security.MD5;
|
|
import com.yihu.utils.security.MD5;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
@ -56,12 +66,12 @@ import java.util.stream.Collectors;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatientDao> {
|
|
public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatientDao> {
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(CarePatientService.class);
|
|
@Autowired
|
|
@Autowired
|
|
private BasePatientDao patientDao;
|
|
private BasePatientDao patientDao;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private BasePatientMedicardCardService basePatientMedicardCardService;
|
|
|
|
|
|
private BasePatientMedicareCardDao basePatientMedicareCardDao;
|
|
@Autowired
|
|
@Autowired
|
|
private ServicePackageService servicePackageService;
|
|
private ServicePackageService servicePackageService;
|
|
@Autowired
|
|
@Autowired
|
|
@ -73,6 +83,8 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
|
|
@Autowired
|
|
@Autowired
|
|
private PatientFamilyMemberService familyMemberService;
|
|
private PatientFamilyMemberService familyMemberService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
private WlyyPatientFamilyMemberDao familyMemberDao;
|
|
|
|
@Autowired
|
|
private BaseDoctorHospitalDao doctorHospitalDao;
|
|
private BaseDoctorHospitalDao doctorHospitalDao;
|
|
@Value("${wechat.id}")
|
|
@Value("${wechat.id}")
|
|
private String wxId;
|
|
private String wxId;
|
|
@ -87,6 +99,114 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
|
|
@Autowired
|
|
@Autowired
|
|
private BasePatientService basePatientService;
|
|
private BasePatientService basePatientService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 初始化杭州老人,只保存有身份证且有手机号的数据
|
|
|
|
*/
|
|
|
|
public void initJczdPerson(){
|
|
|
|
Map<String,String> lableCodeMap = new HashMap<>();
|
|
|
|
Map<String,String> lableCodeNameMap = new HashMap<>();
|
|
|
|
lableCodeMap.put("1","1");//低保
|
|
|
|
lableCodeMap.put("9","2");//低边
|
|
|
|
lableCodeMap.put("41","3");//独居
|
|
|
|
lableCodeMap.put("73","3");//独居
|
|
|
|
lableCodeMap.put("40","4");//孤寡
|
|
|
|
lableCodeMap.put("10","7");//特困
|
|
|
|
lableCodeNameMap.put("1","低保");//低保
|
|
|
|
lableCodeNameMap.put("2","低边");//低边
|
|
|
|
lableCodeNameMap.put("3","独居");//独居
|
|
|
|
lableCodeNameMap.put("4","孤寡");//孤寡
|
|
|
|
lableCodeNameMap.put("7","特困");//特困
|
|
|
|
String sqlPatient = "select idcard from base_patient where idcard is not null";
|
|
|
|
List<String> list1 = jdbcTemplate.queryForList(sqlPatient,String.class);
|
|
|
|
|
|
|
|
String sqlCount = "SELECT COUNT(*) c from hz.jczd_person WHERE data_flag =1 and dead_date is null ";
|
|
|
|
Integer total = jdbcTemplate.queryForObject(sqlCount,Integer.class);
|
|
|
|
int start = 0;
|
|
|
|
int size = 100;
|
|
|
|
int num = total/size +1;
|
|
|
|
String hzPhoto = "group1/M00/00/04/ChIrKGIxsyeACOH4AAAj7meuq5Y176.png";
|
|
|
|
|
|
|
|
String sql = "SELECT * from hz.jczd_person WHERE id>? and data_flag =1 and certificate_number is not null and dead_date is null" +
|
|
|
|
" and (person_phone is not null or telephone is not null) order by id limit ?";
|
|
|
|
int j = 0;
|
|
|
|
for (int i=0;i<num;i++){
|
|
|
|
List<JczdPersonVo> list = jdbcTemplate.query(sql,new Object[]{start,size},new BeanPropertyRowMapper<>(JczdPersonVo.class));
|
|
|
|
if (list.size()>0){
|
|
|
|
j = 0;
|
|
|
|
for (JczdPersonVo person:list){
|
|
|
|
String idcard = person.getCertificateNumber();
|
|
|
|
if(list1.contains(idcard)){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
BasePatientDO patient = new BasePatientDO();
|
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
|
patient.setPassword(MD5.md5Hex(idcard + "{" + salt + "}"));
|
|
|
|
patient.setSalt(salt);
|
|
|
|
String mobile = StringUtil.isEmpty(person.getPersonPhone())?person.getTelephone():person.getPersonPhone();
|
|
|
|
patient.setMobile(mobile);
|
|
|
|
patient.setDel("1");
|
|
|
|
patient.setEnabled(1);
|
|
|
|
patient.setLocked(0);
|
|
|
|
patient.setSignStatus(0);
|
|
|
|
patient.setDeviceFlag(0);
|
|
|
|
patient.setCreateTime(new Date());
|
|
|
|
patient.setUpdateTime(new Date());
|
|
|
|
patient.setName(person.getPersonName());
|
|
|
|
patient.setIdcard(idcard);
|
|
|
|
patient.setSex(person.getSex());
|
|
|
|
patient.setBirthday(person.getBirthday());
|
|
|
|
patient.setArchiveType(1);
|
|
|
|
patient.setArchiveStatus(1);
|
|
|
|
patient.setPhoto(hzPhoto);
|
|
|
|
String address = StringUtil.isEmpty(person.getLiveAddress())?person.getRegistryAddress():person.getLiveAddress();
|
|
|
|
patient.setAddress(address);
|
|
|
|
if(StringUtils.isNotBlank(address)){
|
|
|
|
Map<String,String> map = LatitudeUtils.getGeocoderLatitude(address);
|
|
|
|
if(map!=null){
|
|
|
|
String latlon = map.get("lat")+","+map.get("lng");
|
|
|
|
patient.setLatLon(latlon);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
patientDao.save(patient);
|
|
|
|
String pateintId = patient.getId();
|
|
|
|
WlyyPatientFamilyMemberDO wlyyPatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
|
|
|
|
wlyyPatientFamilyMemberDO.setIsDel(1);
|
|
|
|
wlyyPatientFamilyMemberDO.setPatient(pateintId);
|
|
|
|
wlyyPatientFamilyMemberDO.setFamilyMember(patient.getId());
|
|
|
|
wlyyPatientFamilyMemberDO.setFamilyRelation("7");
|
|
|
|
wlyyPatientFamilyMemberDO.setFamilyRelationName("本人");
|
|
|
|
wlyyPatientFamilyMemberDO.setCardNo(idcard);
|
|
|
|
familyMemberDao.save(wlyyPatientFamilyMemberDO);
|
|
|
|
|
|
|
|
String persionTags = person.getPersonTags();
|
|
|
|
if(StringUtils.isNotBlank(persionTags)){
|
|
|
|
String pertags[] = persionTags.split(",");
|
|
|
|
for (String tag:pertags){
|
|
|
|
String label = lableCodeMap.get(tag);
|
|
|
|
if(StringUtils.isNotBlank(label)){
|
|
|
|
WlyyPatientLabelDO patientLabelDO = new WlyyPatientLabelDO();
|
|
|
|
patientLabelDO.setCzrq(new Date());
|
|
|
|
patientLabelDO.setLabelType("3");
|
|
|
|
patientLabelDO.setPatient(pateintId);
|
|
|
|
patientLabelDO.setLabelCode(label);
|
|
|
|
patientLabelDO.setLabelName(lableCodeNameMap.get(label));
|
|
|
|
patientLabelDao.save(patientLabelDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
logger.info("新增人数="+j);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取能力状况
|
|
* 获取能力状况
|
|
* @param patient
|
|
* @param patient
|