|
@ -1,10 +1,10 @@
|
|
|
package com.yihu.wlyy.service.app.account;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.yihu.wlyy.entity.address.*;
|
|
|
import com.yihu.wlyy.entity.demographic.DemographicInfo;
|
|
|
import com.yihu.wlyy.entity.dict.SystemDict;
|
|
|
import com.yihu.wlyy.entity.doctor.archive.Archive;
|
|
|
import com.yihu.wlyy.entity.doctor.archive.ArchiveInfo;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.login.LoginLog;
|
|
@ -17,6 +17,7 @@ import com.yihu.wlyy.entity.patient.vo.PatientArchivesDto;
|
|
|
import com.yihu.wlyy.entity.patient.vo.PatientVO;
|
|
|
import com.yihu.wlyy.entity.security.Token;
|
|
|
import com.yihu.wlyy.repository.address.*;
|
|
|
import com.yihu.wlyy.repository.archive.PatientArchiveDao;
|
|
|
import com.yihu.wlyy.repository.archive.PatientArchiveInfoDao;
|
|
|
import com.yihu.wlyy.repository.demographic.TblBasicDao;
|
|
|
import com.yihu.wlyy.repository.dict.SystemDictDao;
|
|
@ -27,21 +28,18 @@ import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.repository.patient.SocialSecurityInfoDao;
|
|
|
import com.yihu.wlyy.service.app.family.FamilyMemberService;
|
|
|
import com.yihu.wlyy.service.app.family.FamilyService;
|
|
|
import com.yihu.wlyy.service.app.sign.FamilyContractService;
|
|
|
import com.yihu.wlyy.service.common.SMSService;
|
|
|
import com.yihu.wlyy.service.common.account.PatientService;
|
|
|
import com.yihu.wlyy.service.common.account.TokenService;
|
|
|
import com.yihu.wlyy.service.common.login.LoginLogService;
|
|
|
import com.yihu.wlyy.service.third.jw.JwArchivesService;
|
|
|
import com.yihu.wlyy.util.*;
|
|
|
import io.swagger.models.auth.In;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.objenesis.ObjenesisBase;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@ -102,6 +100,8 @@ public class PatientInfoService extends BaseService {
|
|
|
@Autowired
|
|
|
DoctorDao doctorDao;
|
|
|
@Autowired
|
|
|
PatientArchiveDao patientArchiveDao;
|
|
|
@Autowired
|
|
|
PatientArchiveInfoDao patientArchiveInfoDao;
|
|
|
/**
|
|
|
* 患者更换手机号
|
|
@ -423,38 +423,42 @@ public class PatientInfoService extends BaseService {
|
|
|
|
|
|
//保存建档信息到服务器数据库
|
|
|
Doctor doctorObj = doctorDao.findByCode(doctorCode);
|
|
|
ArchiveInfo archiveInfo = new ArchiveInfo();
|
|
|
archiveInfo.setCode(getCode());
|
|
|
archiveInfo.setArchiveCode(response);
|
|
|
archiveInfo.setSickName(p.getName());
|
|
|
archiveInfo.setDoctorCode(doctorCode);
|
|
|
Archive archive = new Archive();
|
|
|
String code = getCode();
|
|
|
archive.setCode(code);
|
|
|
archive.setArchiveCode(response);
|
|
|
archive.setSickName(p.getName());
|
|
|
archive.setDoctorCode(doctorCode);
|
|
|
if (doctorObj!=null){
|
|
|
archiveInfo.setArchiveOperatorName(doctorObj.getName());
|
|
|
archive.setArchiveOperatorName(doctorObj.getName());
|
|
|
}
|
|
|
archiveInfo.setArchiveTime(DateUtil.getStringDateShort());
|
|
|
archive.setArchiveTime(DateUtil.getStringDateShort());
|
|
|
int isSign = signFamilyDao.hasSingStatus(p.getIdcard());
|
|
|
if (isSign>0){
|
|
|
archiveInfo.setSignStatus(1);
|
|
|
archive.setSignStatus(1);
|
|
|
}else{
|
|
|
archiveInfo.setSignStatus(0);
|
|
|
archive.setSignStatus(0);
|
|
|
}
|
|
|
archiveInfo.setArchiveStatus(3);
|
|
|
archiveInfo.setSickSex(p.getSex());
|
|
|
archiveInfo.setBirthday(brithday);
|
|
|
archiveInfo.setJwZoneCode(jwCountryCode);
|
|
|
archiveInfo.setIdentityType(1);
|
|
|
archiveInfo.setIdentityCardNo(p.getIdcard());
|
|
|
archiveInfo.setHomePhone(p.getMobile());
|
|
|
archiveInfo.setHomeAddress(adress);
|
|
|
archiveInfo.setOrgId("0");
|
|
|
archiveInfo.setResidence(1);
|
|
|
archiveInfo.setNational(nation);
|
|
|
archiveInfo.setOrigo("350200");
|
|
|
archiveInfo.setBlood(Integer.valueOf(blood));
|
|
|
archiveInfo.setBloodRh(1);
|
|
|
archiveInfo.setMarriage(Integer.valueOf(marry));
|
|
|
archiveInfo.setInsurCardNo(p.getSsc());
|
|
|
archive.setArchiveStatus(3);
|
|
|
archive.setSickSex(p.getSex());
|
|
|
archive.setBirthday(brithday);
|
|
|
archive.setJwZoneCode(jwCountryCode);
|
|
|
archive.setIdentityType(1);
|
|
|
archive.setIdentityCardNo(p.getIdcard());
|
|
|
archive.setHomePhone(p.getMobile());
|
|
|
archive.setHomeAddress(adress);
|
|
|
archive.setOrgId("0");
|
|
|
archive.setResidence(1);
|
|
|
archive.setNational(nation);
|
|
|
archive.setOrigo("350200");
|
|
|
archive.setBlood(Integer.valueOf(blood));
|
|
|
archive.setBloodRh(1);
|
|
|
archive.setMarriage(Integer.valueOf(marry));
|
|
|
archive.setInsurCardNo(p.getSsc());
|
|
|
patientArchiveDao.save(archive);
|
|
|
//补充参数
|
|
|
ArchiveInfo archiveInfo = new ArchiveInfo();
|
|
|
archiveInfo.setArchiveCode(code);
|
|
|
archiveInfo.setAllergic("0");
|
|
|
archiveInfo.setPast("0");
|
|
|
archiveInfo.setGenetic(0);
|
|
@ -465,7 +469,6 @@ public class PatientInfoService extends BaseService {
|
|
|
archiveInfo.setFamilyChildren("0");
|
|
|
archiveInfo.setDisability("1");
|
|
|
patientArchiveInfoDao.save(archiveInfo);
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
public int createProfile(String archiveJson) throws Exception{
|
|
@ -473,6 +476,7 @@ public class PatientInfoService extends BaseService {
|
|
|
PatientArchivesDto archive = (PatientArchivesDto) net.sf.json.JSONObject.toBean(j,PatientArchivesDto.class);
|
|
|
|
|
|
Patient p = patientDao.findByCode(archive.getPatient());
|
|
|
Archive archiveDateBase = new Archive();
|
|
|
ArchiveInfo archiveInfo = new ArchiveInfo();
|
|
|
Doctor doctorObj = doctorDao.findByCode(archive.getDoctorCode());
|
|
|
|
|
@ -490,41 +494,50 @@ public class PatientInfoService extends BaseService {
|
|
|
json.put("ORG_ID","0");//新增默认传0
|
|
|
json.put("RESIDENCE","1");//户籍【1.户籍 2.非户籍】
|
|
|
json.put("NATIONAL",archive.getNation());//民族【NATION_DICT】
|
|
|
json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
|
|
|
//json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
|
|
|
if (StringUtils.isEmpty(archive.getOrgGo())){
|
|
|
json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
|
|
|
}else{
|
|
|
json.put("ORIGO",archive.getOrgGo());//户口所在地【ZONE_DICT】
|
|
|
}
|
|
|
json.put("BLOOD",archive.getBlood());//血型【1.A型 2.3.O型4.AB型 5.不详】
|
|
|
json.put("BLOOD_RH","1");//RH阴性【1.否 2.是 3.不详】
|
|
|
json.put("MARRIAGE",archive.getMarry());//婚姻状况【10.未婚 20.已婚 30.丧偶 40.离婚 90.未说明的婚姻状况】
|
|
|
json.put("INSUR_CARD_NO",p.getSsc());//医保卡号
|
|
|
|
|
|
//保存建档记录信息
|
|
|
archiveInfo.setSickName(p.getName());
|
|
|
archiveInfo.setDoctorCode(archive.getDoctorCode());
|
|
|
archiveDateBase.setSickName(p.getName());
|
|
|
archiveDateBase.setDoctorCode(archive.getDoctorCode());
|
|
|
if (doctorObj!=null){
|
|
|
archiveInfo.setArchiveOperatorName(doctorObj.getName());
|
|
|
archiveDateBase.setArchiveOperatorName(doctorObj.getName());
|
|
|
}
|
|
|
archiveInfo.setArchiveTime(DateUtil.getStringDateShort());
|
|
|
archiveDateBase.setArchiveTime(DateUtil.getStringDateShort());
|
|
|
int isSign = signFamilyDao.hasSingStatus(p.getIdcard());
|
|
|
if (isSign>0){
|
|
|
archiveInfo.setSignStatus(1);
|
|
|
archiveDateBase.setSignStatus(1);
|
|
|
}else{
|
|
|
archiveInfo.setSignStatus(0);
|
|
|
archiveDateBase.setSignStatus(0);
|
|
|
}
|
|
|
archiveInfo.setArchiveStatus(3);
|
|
|
archiveInfo.setSickSex(p.getSex());
|
|
|
archiveInfo.setBirthday(archive.getBrithday());
|
|
|
archiveInfo.setJwZoneCode(archive.getJwCountryCode());
|
|
|
archiveInfo.setIdentityType(1);
|
|
|
archiveInfo.setIdentityCardNo(p.getIdcard());
|
|
|
archiveInfo.setHomePhone(p.getMobile());
|
|
|
archiveInfo.setHomeAddress(archive.getAdress());
|
|
|
archiveInfo.setOrgId("0");
|
|
|
archiveInfo.setResidence(1);
|
|
|
archiveInfo.setNational(archive.getNation());
|
|
|
archiveInfo.setOrigo("350200");
|
|
|
archiveInfo.setBlood(Integer.valueOf(archive.getBlood()));
|
|
|
archiveInfo.setBloodRh(1);
|
|
|
archiveInfo.setMarriage(Integer.valueOf(archive.getMarry()));
|
|
|
archiveInfo.setInsurCardNo(p.getSsc());
|
|
|
archiveDateBase.setArchiveStatus(3);
|
|
|
archiveDateBase.setSickSex(p.getSex());
|
|
|
archiveDateBase.setBirthday(archive.getBrithday());
|
|
|
archiveDateBase.setJwZoneCode(archive.getJwCountryCode());
|
|
|
archiveDateBase.setIdentityType(1);
|
|
|
archiveDateBase.setIdentityCardNo(p.getIdcard());
|
|
|
archiveDateBase.setHomePhone(p.getMobile());
|
|
|
archiveDateBase.setHomeAddress(archive.getAdress());
|
|
|
archiveDateBase.setOrgId("0");
|
|
|
archiveDateBase.setResidence(1);
|
|
|
archiveDateBase.setNational(archive.getNation());
|
|
|
if (StringUtils.isEmpty(archive.getOrgGo())){
|
|
|
archiveDateBase.setOrigo("350200");
|
|
|
}else{
|
|
|
archiveDateBase.setOrigo(archive.getOrgGo());
|
|
|
}
|
|
|
archiveDateBase.setBlood(Integer.valueOf(archive.getBlood()));
|
|
|
archiveDateBase.setBloodRh(1);
|
|
|
archiveDateBase.setMarriage(Integer.valueOf(archive.getMarry()));
|
|
|
archiveDateBase.setInsurCardNo(p.getSsc());
|
|
|
|
|
|
|
|
|
//补充参数
|
|
@ -930,8 +943,11 @@ public class PatientInfoService extends BaseService {
|
|
|
socialSecurityInfoDao.save(info);
|
|
|
|
|
|
//保存建档记录信息到服务器数据库
|
|
|
archiveInfo.setCode(getCode());
|
|
|
archiveInfo.setArchiveCode(response);
|
|
|
String code = getCode();
|
|
|
archiveDateBase.setCode(code);
|
|
|
archiveDateBase.setArchiveCode(response);//基卫code
|
|
|
archiveInfo.setArchiveCode(code);//详细信息表关联建档记录表code
|
|
|
patientArchiveDao.save(archiveDateBase);
|
|
|
patientArchiveInfoDao.save(archiveInfo);
|
|
|
|
|
|
return 1;
|
|
@ -940,6 +956,7 @@ public class PatientInfoService extends BaseService {
|
|
|
public int createProfile(PatientArchivesDto archive) throws Exception{
|
|
|
|
|
|
Patient p = patientDao.findByCode(archive.getPatient());
|
|
|
Archive archiveDataBase = new Archive();
|
|
|
ArchiveInfo archiveInfo = new ArchiveInfo();
|
|
|
Doctor doctorObj = doctorDao.findByCode(archive.getDoctorCode());
|
|
|
|
|
@ -957,41 +974,49 @@ public class PatientInfoService extends BaseService {
|
|
|
json.put("ORG_ID","0");//新增默认传0
|
|
|
json.put("RESIDENCE","1");//户籍【1.户籍 2.非户籍】
|
|
|
json.put("NATIONAL",archive.getNation());//民族【NATION_DICT】
|
|
|
json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
|
|
|
if (StringUtils.isEmpty(archive.getOrgGo())){
|
|
|
json.put("ORIGO","350200");//户口所在地【ZONE_DICT】
|
|
|
}else{
|
|
|
json.put("ORIGO",archive.getOrgGo());//户口所在地【ZONE_DICT】
|
|
|
}
|
|
|
json.put("BLOOD",archive.getBlood());//血型【1.A型 2.3.O型4.AB型 5.不详】
|
|
|
json.put("BLOOD_RH","1");//RH阴性【1.否 2.是 3.不详】
|
|
|
json.put("MARRIAGE",archive.getMarry());//婚姻状况【10.未婚 20.已婚 30.丧偶 40.离婚 90.未说明的婚姻状况】
|
|
|
json.put("INSUR_CARD_NO",p.getSsc());//医保卡号
|
|
|
|
|
|
//保存建档记录信息
|
|
|
archiveInfo.setSickName(p.getName());
|
|
|
archiveInfo.setDoctorCode(archive.getDoctorCode());
|
|
|
archiveDataBase.setSickName(p.getName());
|
|
|
archiveDataBase.setDoctorCode(archive.getDoctorCode());
|
|
|
if (doctorObj!=null){
|
|
|
archiveInfo.setArchiveOperatorName(doctorObj.getName());
|
|
|
archiveDataBase.setArchiveOperatorName(doctorObj.getName());
|
|
|
}
|
|
|
archiveInfo.setArchiveTime(DateUtil.getStringDateShort());
|
|
|
archiveDataBase.setArchiveTime(DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
int isSign = signFamilyDao.hasSingStatus(p.getIdcard());
|
|
|
if (isSign>0){
|
|
|
archiveInfo.setSignStatus(1);
|
|
|
archiveDataBase.setSignStatus(1);
|
|
|
}else{
|
|
|
archiveInfo.setSignStatus(0);
|
|
|
archiveDataBase.setSignStatus(0);
|
|
|
}
|
|
|
archiveDataBase.setArchiveStatus(3);
|
|
|
archiveDataBase.setSickSex(p.getSex());
|
|
|
archiveDataBase.setBirthday(archive.getBrithday());
|
|
|
archiveDataBase.setJwZoneCode(archive.getJwCountryCode());
|
|
|
archiveDataBase.setIdentityType(1);
|
|
|
archiveDataBase.setIdentityCardNo(p.getIdcard());
|
|
|
archiveDataBase.setHomePhone(p.getMobile());
|
|
|
archiveDataBase.setHomeAddress(archive.getAdress());
|
|
|
archiveDataBase.setOrgId("0");
|
|
|
archiveDataBase.setResidence(1);
|
|
|
archiveDataBase.setNational(archive.getNation());
|
|
|
if (StringUtils.isEmpty(archive.getOrgGo())){
|
|
|
archiveDataBase.setOrigo("350200");
|
|
|
}else {
|
|
|
archiveDataBase.setOrigo(archive.getOrgGo());
|
|
|
}
|
|
|
archiveInfo.setArchiveStatus(3);
|
|
|
archiveInfo.setSickSex(p.getSex());
|
|
|
archiveInfo.setBirthday(archive.getBrithday());
|
|
|
archiveInfo.setJwZoneCode(archive.getJwCountryCode());
|
|
|
archiveInfo.setIdentityType(1);
|
|
|
archiveInfo.setIdentityCardNo(p.getIdcard());
|
|
|
archiveInfo.setHomePhone(p.getMobile());
|
|
|
archiveInfo.setHomeAddress(archive.getAdress());
|
|
|
archiveInfo.setOrgId("0");
|
|
|
archiveInfo.setResidence(1);
|
|
|
archiveInfo.setNational(archive.getNation());
|
|
|
archiveInfo.setOrigo("350200");
|
|
|
archiveInfo.setBlood(Integer.valueOf(archive.getBlood()));
|
|
|
archiveInfo.setBloodRh(1);
|
|
|
archiveInfo.setMarriage(Integer.valueOf(archive.getMarry()));
|
|
|
archiveInfo.setInsurCardNo(p.getSsc());
|
|
|
archiveDataBase.setBlood(Integer.valueOf(archive.getBlood()));
|
|
|
archiveDataBase.setBloodRh(1);
|
|
|
archiveDataBase.setMarriage(Integer.valueOf(archive.getMarry()));
|
|
|
archiveDataBase.setInsurCardNo(p.getSsc());
|
|
|
|
|
|
//补充参数
|
|
|
json.put("ALLERGIC_WITHOUT","1");//药物过敏史--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
|
|
@ -1016,7 +1041,8 @@ public class PatientInfoService extends BaseService {
|
|
|
}
|
|
|
|
|
|
//药物过敏史
|
|
|
if(StringUtils.isNotBlank(archive.getDrugAllergys())){
|
|
|
//if(StringUtils.isNotBlank(archive.getDrugAllergys())){
|
|
|
if (archive.getDrugAllergys()!=null){
|
|
|
String allergicStr = "";
|
|
|
json.put("ALLERGIC_WITHOUT","0");//药物过敏历史
|
|
|
String as[] = archive.getDrugAllergys().split(",");
|
|
@ -1033,7 +1059,8 @@ public class PatientInfoService extends BaseService {
|
|
|
json.put("ALLERGIC_STREPTOMYCIN","1");//药物过敏史--链霉素
|
|
|
allergicStr +="3,";
|
|
|
}
|
|
|
if("4".equals(str)){
|
|
|
//if("4".equals(str)){
|
|
|
if (StringUtils.isBlank(str)){
|
|
|
json.put("ALLERGIC_OTHER","1");//药物过敏史--其它
|
|
|
allergicStr +="4,";
|
|
|
archiveInfo.setAllergicOtherContent(archive.getDrugOtherContent());
|
|
@ -1048,7 +1075,8 @@ public class PatientInfoService extends BaseService {
|
|
|
archiveInfo.setAllergic("0");
|
|
|
}
|
|
|
//既往史
|
|
|
if(StringUtils.isNotBlank(archive.getPastHistorys())){
|
|
|
//if(StringUtils.isNotBlank(archive.getPastHistorys())){
|
|
|
if (archive.getPastHistorys() != null){
|
|
|
String pastStr = "";
|
|
|
String pastDateStr = "";
|
|
|
json.put("PAST_NONE","0");//既往史
|
|
@ -1076,7 +1104,8 @@ public class PatientInfoService extends BaseService {
|
|
|
// json.put("PAST_HYPERTENSION_DATE",dates[i]);//既往史--疾病--高血压日期
|
|
|
// }
|
|
|
// }
|
|
|
else if("4".equals(phs[i])){
|
|
|
//else if("4".equals(phs[i])){
|
|
|
else if(StringUtils.isBlank(phs[i])){
|
|
|
json.put("PAST_OTHER","1");//既往史--疾病--其它【0不勾选 1勾选】
|
|
|
pastStr +="4,";
|
|
|
if(!"0".equals(dates[i])){
|
|
@ -1319,10 +1348,10 @@ public class PatientInfoService extends BaseService {
|
|
|
}
|
|
|
|
|
|
//子女
|
|
|
if(StringUtils.isNotBlank(archive.getFamilyBrotherHistorys())){
|
|
|
if(StringUtils.isNotBlank(archive.getFamilyChildrenHistorys())){
|
|
|
String chidrenStr = "";
|
|
|
json.put("FAMILY_CHILDREN_NONE","0");//家族史--兄弟姐妹--无【0不勾选 1勾选】
|
|
|
String bhs[] = archive.getFamilyBrotherHistorys().split(",");
|
|
|
json.put("FAMILY_CHILDREN_NONE","0");//家族史--子女--无【0不勾选 1勾选】
|
|
|
String bhs[] = archive.getFamilyChildrenHistorys().split(",");
|
|
|
for(String bh : bhs){
|
|
|
if("1".equals(bh)){
|
|
|
json.put("FAMILY_CHILDREN_HYPERTENSION","1");//家族史--子女--高血压【0不勾选 1勾选】
|
|
@ -1402,8 +1431,11 @@ public class PatientInfoService extends BaseService {
|
|
|
socialSecurityInfoDao.save(info);
|
|
|
|
|
|
//保存建档记录信息到服务器数据库
|
|
|
archiveInfo.setCode(getCode());
|
|
|
archiveInfo.setArchiveCode(response);
|
|
|
String code = getCode();
|
|
|
archiveDataBase.setCode(code);
|
|
|
archiveDataBase.setArchiveCode(response);//基卫返回的建档code
|
|
|
archiveInfo.setArchiveCode(code);//详细信息表关联建档记录的唯一标识code
|
|
|
patientArchiveDao.save(archiveDataBase);
|
|
|
patientArchiveInfoDao.save(archiveInfo);
|
|
|
|
|
|
return 1;
|