|
@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
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;
|
|
@ -13,27 +15,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;
|
|
@ -57,12 +67,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
|
|
@ -74,6 +84,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;
|
|
@ -88,6 +100,72 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
|
|
@Autowired
|
|
@Autowired
|
|
private BasePatientService basePatientService;
|
|
private BasePatientService basePatientService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 初始化杭州老人,只保存有身份证且有手机号的数据
|
|
|
|
*/
|
|
|
|
public void initJczdPerson(Integer size){
|
|
|
|
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 sql = "select * from base_patient where openid = 'jczd' limit ?";
|
|
|
|
List<BasePatientDO> list = jdbcTemplate.query(sql,new Object[]{size},new BeanPropertyRowMapper<>(BasePatientDO.class));
|
|
|
|
for (BasePatientDO patient:list){
|
|
|
|
String idcard = patient.getIdcard();
|
|
|
|
String persionTags = patient.getSsc();
|
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
|
patient.setPassword(MD5.md5Hex(idcard + "{" + salt + "}"));
|
|
|
|
patient.setSalt(salt);
|
|
|
|
patient.setOpenid(null);
|
|
|
|
patient.setSsc(null);
|
|
|
|
String address = patient.getAddress();
|
|
|
|
patient.setAddress(address);
|
|
|
|
if(StringUtils.isNotBlank(address)){
|
|
|
|
if(!address.contains("杭州市")){
|
|
|
|
address = "杭州市"+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();
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("idcard=="+patient.getIdcard());
|
|
|
|
}
|
|
|
|
logger.info("新增人数="+list.size());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取能力状况
|
|
* 获取能力状况
|
|
* @param patient
|
|
* @param patient
|