|  | @ -15,6 +15,7 @@ import com.yihu.wlyy.entity.patient.PatientFamilyMember;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.patient.SignFamily;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.patient.SocialSecurityInfo;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.patient.invitation.PatientInvitationLog;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.patient.vo.PatientArchivesDto;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.security.Token;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.address.CityDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.address.ProvinceDao;
 | 
	
	
		
			
				|  | @ -35,10 +36,12 @@ 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 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.JdbcTemplate;
 | 
	
		
			
				|  |  | import org.springframework.objenesis.ObjenesisBase;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Component;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -392,6 +395,8 @@ public class PatientInfoService extends BaseService {
 | 
	
		
			
				|  |  |         json.put("PAST_NONE","1");//  既往史--疾病--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String doctor = doctorCode;
 | 
	
		
			
				|  |  |         String response = jwArchivesService.saveSickArchiveRecord(com.alibaba.fastjson.JSONObject.toJSONString(json, SerializerFeature.WriteMapNullValue),doctor);
 | 
	
		
			
				|  |  |         if("0".equals(response)){
 | 
	
	
		
			
				|  | @ -412,6 +417,318 @@ public class PatientInfoService extends BaseService {
 | 
	
		
			
				|  |  |         socialSecurityInfoDao.save(info);
 | 
	
		
			
				|  |  |         return 1;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public int createProfile(String archiveJson) throws Exception{
 | 
	
		
			
				|  |  |         net.sf.json.JSONObject j  = net.sf.json.JSONObject.fromObject(archiveJson);
 | 
	
		
			
				|  |  |         PatientArchivesDto archive = (PatientArchivesDto) net.sf.json.JSONObject.toBean(j,PatientArchivesDto.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Patient p = patientDao.findByCode(archive.getPatient());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |         json.put("ARCHIVE_TIME", DateUtil.getStringDateShort());//建档时间
 | 
	
		
			
				|  |  |         json.put("ARCHIVE_STATUS","3");//档案状态【1.未管理 2.死亡 3.正常 4.高危】
 | 
	
		
			
				|  |  |         json.put("SICK_NAME",p.getName());//姓名
 | 
	
		
			
				|  |  |         json.put("SICK_SEX",archive.getSex());//性别【1.男 2.女 9 未知】
 | 
	
		
			
				|  |  |         json.put("BIRTHDAY",archive.getBrithday());//出生日期
 | 
	
		
			
				|  |  |         json.put("ZONE_CODE",archive.getJwCountryCode());//所属社区【ZONE_DICT】
 | 
	
		
			
				|  |  |         json.put("IDENTITY_TYPE","1");//证件类型【IDENTITY_TYPE_DICT】
 | 
	
		
			
				|  |  |         json.put("IDENTITY_CARD_NO",p.getIdcard());//身份证号
 | 
	
		
			
				|  |  |         json.put("HOME_PHONE",p.getMobile());//本人电话
 | 
	
		
			
				|  |  |         json.put("HOME_ADDRESS",archive.getAdress());//现住址
 | 
	
		
			
				|  |  |         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("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("ALLERGIC_WITHOUT","1");//药物过敏史--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
 | 
	
		
			
				|  |  |         json.put("TRAUMA","0");// "TRAUMA":"既往史--外伤--【0 无 1 有】(同一类别,新增时,默认选无)",
 | 
	
		
			
				|  |  |         json.put("TRANSFUSION","0");//   "TRANSFUSION":"既往史--输血--【0 无 1 有】(同一类别,新增时,默认选无)",
 | 
	
		
			
				|  |  |         json.put("EXPOSE_WITHOUT","1");//"EXPOSE_WITHOUT":"暴露史--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //教育程度
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(archive.getEducation())){
 | 
	
		
			
				|  |  |             json.put("EDUCATION",archive.getEducation()+"");//文化程度
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //职业
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(archive.getOccupation())){
 | 
	
		
			
				|  |  |             json.put("OCCUPATION",archive.getOccupation()+"");//职业
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //支付方式
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(archive.getPayment())){
 | 
	
		
			
				|  |  |             json.put("MEDICAL_EXPENSES",archive.getPayment()+"");//支付方式
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //药物过敏史
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(archive.getDrugAllergys())){
 | 
	
		
			
				|  |  |             json.put("ALLERGIC_WITHOUT","0");//药物过敏历史
 | 
	
		
			
				|  |  |             String as[] = archive.getDrugAllergys().split(",");
 | 
	
		
			
				|  |  |             for(String str : as){
 | 
	
		
			
				|  |  |                 if("1".equals(str)){
 | 
	
		
			
				|  |  |                     json.put("ALLERGIC_PENICILLIN","1");//药物过敏史--青霉素
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if("2".equals(str)){
 | 
	
		
			
				|  |  |                     json.put("ALLERGIC_SULFANILAMIDE","1");//药物过敏史--磺胺
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if("3".equals(str)){
 | 
	
		
			
				|  |  |                     json.put("ALLERGIC_STREPTOMYCIN","1");//药物过敏史--链霉素
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if("4".equals(str)){
 | 
	
		
			
				|  |  |                     json.put("ALLERGIC_OTHER","1");//药物过敏史--其它
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             json.put("ALLERGIC_WITHOUT","1");//药物过敏历史
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //既往史
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(archive.getPastHistorys())){
 | 
	
		
			
				|  |  |             json.put("PAST_NONE","0");//既往史
 | 
	
		
			
				|  |  |             String phs[] = archive.getPastHistorys().split(",");
 | 
	
		
			
				|  |  |             String dates[] = archive.getPastHistoryDate().split(",");
 | 
	
		
			
				|  |  |             for(int i=0 ;i<phs.length ; i++){
 | 
	
		
			
				|  |  |                 if("1".equals(phs[i])){
 | 
	
		
			
				|  |  |                     json.put("PAST_HYPERTENSION","1");//既往史--疾病--高血压【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     if(StringUtils.isNotBlank(dates[i])){
 | 
	
		
			
				|  |  |                         json.put("PAST_HYPERTENSION_DATE",dates[i]);//既往史--疾病--高血压日期
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if("2".equals(phs[i])){
 | 
	
		
			
				|  |  |                     json.put("PAST_DIABETES","1");//既往史--疾病--糖尿病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     if(StringUtils.isNotBlank(dates[i])){
 | 
	
		
			
				|  |  |                         json.put("PAST_DIABETES_DATE",dates[i]);//既往史--疾病--糖尿病日期
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | //                if("3".equals(phs[i])){
 | 
	
		
			
				|  |  | //                    json.put("SURGERY","1");//既往史--手术--【0 无 1 有】
 | 
	
		
			
				|  |  | //                    if(StringUtils.isNotBlank(dates[i])){
 | 
	
		
			
				|  |  | //                        json.put("PAST_HYPERTENSION_DATE",dates[i]);//既往史--疾病--高血压日期
 | 
	
		
			
				|  |  | //                    }
 | 
	
		
			
				|  |  | //                }
 | 
	
		
			
				|  |  |                 if("4".equals(phs[i])){
 | 
	
		
			
				|  |  |                     json.put("PAST_OTHER","1");//既往史--疾病--其它【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     if(StringUtils.isNotBlank(dates[i])){
 | 
	
		
			
				|  |  |                         json.put("PAST_OTHER_CONTENT_DATE",dates[i]);//既往史--疾病--高血压日期
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             json.put("PAST_NONE","1");//既往史
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //遗传病史
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(archive.getGeneticFlag())){
 | 
	
		
			
				|  |  |             json.put("GENETIC","1");//遗传病史【0 无 1 有】
 | 
	
		
			
				|  |  |             json.put("GENETIC_DISEASENAME",archive.getGeneticContent());//疾病名称
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             json.put("GENETIC","0");//遗传病史【0 无 1 有】
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //残疾
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(archive.getDisabilitys())){
 | 
	
		
			
				|  |  |             String ds[] = archive.getDisabilitys().split(",");
 | 
	
		
			
				|  |  |             for(String d :ds){
 | 
	
		
			
				|  |  |                 if("1".equals(d)){
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_WITHOUT","1");//有无残疾--无残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if("2".equals(d)){
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_EYES","1");//有无残疾--视力残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_WITHOUT","0");//有无残疾--无残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if("3".equals(d)){
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_EAR","1");//有无残疾--听力残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_WITHOUT","0");//有无残疾--无残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if("4".equals(d)){
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_SPEECH","1");//有无残疾--言语残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_WITHOUT","0");//有无残疾--无残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if("5".equals(d)){
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_LIMB","1");//有无残疾--肢体残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_WITHOUT","0");//有无残疾--无残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if("6".equals(d)){
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_INTELLECTUAL","1");//有无残疾--智力残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_WITHOUT","0");//有无残疾--无残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if("7".equals(d)){
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_OTHER","1");//有无残疾--其它残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     json.put("DISABILITY_WITHOUT","0");//有无残疾--无残疾【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             json.put("DISABILITY_WITHOUT","1");//  "DISABILITY_WITHOUT":"有无残疾--无残疾【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //家族史
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(archive.getFamilyHistoryFlag())&&"1".equals(archive.getFamilyHistoryFlag())){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //父亲
 | 
	
		
			
				|  |  |             if(StringUtils.isNotBlank(archive.getFamilyFatherHistorys())){
 | 
	
		
			
				|  |  |                 json.put("FAMILY_FATHER_NONE","0");//家族史--父亲--无【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                 String fhs[] = archive.getFamilyFatherHistorys().split(",");
 | 
	
		
			
				|  |  |                 for(String fh : fhs){
 | 
	
		
			
				|  |  |                     if("1".equals(fh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_FATHER_HYPERTENSION","1");//家族史--父亲--高血压【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("2".equals(fh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_FATHER_DIABETES","1");//家族史--父亲--糖尿病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("3".equals(fh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_FATHER_CORONARY","1");//家族史--父亲--冠心病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("4".equals(fh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_FATHER_ALLERGY","1");//家族史--父亲--慢性阻塞性肺疾病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("5".equals(fh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_FATHER_MALIGNANT","1");//家族史--父亲--恶性肿瘤【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("6".equals(fh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_FATHER_STROKE","1");//家族史--父亲--脑卒中【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("7".equals(fh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_FATHER_SCHIZOPHRENIA","1");//家族史--父亲--重性精神疾病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("8".equals(fh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_FATHER_TB","1");//家族史--父亲--结核病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("9".equals(fh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_FATHER_HEPATITIS","1");//家族史--父亲--肝炎【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("10".equals(fh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_FATHER_CONGENITAL","1");//家族史--父亲--先天畸形【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("11".equals(fh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_FATHER_OTHER","1");//家族史--父亲--其它【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 json.put("FAMILY_FATHER_NONE","1");//家族史--父亲--无【0不勾选 1勾选】
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //母亲
 | 
	
		
			
				|  |  |             if(StringUtils.isNotBlank(archive.getFamilyMotherHistorys())){
 | 
	
		
			
				|  |  |                 json.put("FAMILY_MOTHER_NONE","0");//家族史--母亲--无【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                 String mhs[] = archive.getFamilyMotherHistorys().split(",");
 | 
	
		
			
				|  |  |                 for(String mh : mhs){
 | 
	
		
			
				|  |  |                     if("1".equals(mh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_MOTHER_HYPERTENSION","1");//家族史--母亲--高血压【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("2".equals(mh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_MOTHER_DIABETES","1");//家族史--母亲--糖尿病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("3".equals(mh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_MOTHER_CORONARY","1");//家族史--母亲--冠心病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("4".equals(mh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_MOTHER_ALLERGY","1");//家族史--母亲--慢性阻塞性肺疾病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("5".equals(mh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_MOTHER_MALIGNANT","1");//家族史--母亲--恶性肿瘤【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("6".equals(mh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_MOTHER_STROKE","1");//家族史--母亲--脑卒中【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("7".equals(mh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_MOTHER_SCHIZOPHRENIA","1");//家族史--母亲--重性精神疾病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("8".equals(mh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_MOTHER_TB","1");//家族史--母亲--结核病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("9".equals(mh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_MOTHER_HEPATITIS","1");//家族史--母亲--肝炎【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("10".equals(mh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_MOTHER_CONGENITAL","1");//家族史--母亲--先天畸形【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("11".equals(mh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_MOTHER_OTHER","1");//家族史--母亲--其它【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 json.put("FAMILY_MOTHER_NONE","1");//家族史--母亲--无【0不勾选 1勾选】
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //兄妹
 | 
	
		
			
				|  |  |             if(StringUtils.isNotBlank(archive.getFamilyBrotherHistorys())){
 | 
	
		
			
				|  |  |                 json.put("FAMILY_BROTHERS_NONE","0");//家族史--兄弟姐妹--无【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                 String bhs[] = archive.getFamilyBrotherHistorys().split(",");
 | 
	
		
			
				|  |  |                 for(String bh : bhs){
 | 
	
		
			
				|  |  |                     if("1".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_BROTHERS_HYPERTENSION","1");//家族史--兄弟姐妹--高血压【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("2".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("AMILY_BROTHERS_DIABETES","1");//家族史--兄弟姐妹--糖尿病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("3".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_BROTHERS_CORONARY","1");//家族史--兄弟姐妹--冠心病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("4".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_BROTHERS_ALLERGY","1");//家族史--兄弟姐妹--慢性阻塞性肺疾病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("5".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_BROTHERS_MALIGNANT","1");//家族史--兄弟姐妹--恶性肿瘤【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("6".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_BROTHERS_STROKE","1");//家族史--兄弟姐妹--脑卒中【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("7".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_BROTHERS_SCHIZOPHRENIA","1");//家族史--兄弟姐妹--重性精神疾病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("8".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_BROTHERS_TB","1");//家族史--兄弟姐妹--结核病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("9".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_BROTHERS_HEPATITIS","1");//家族史--兄弟姐妹--肝炎【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("10".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_BROTHERS_CONGENITAL","1");//家族史--兄弟姐妹--先天畸形【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("11".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_BROTHERS_OTHER","1");//家族史--兄弟姐妹--其它【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 json.put("FAMILY_BROTHERS_NONE","1");//家族史--兄弟姐妹--无【0不勾选 1勾选】
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //子女
 | 
	
		
			
				|  |  |             if(StringUtils.isNotBlank(archive.getFamilyBrotherHistorys())){
 | 
	
		
			
				|  |  |                 json.put("FAMILY_CHILDREN_NONE","0");//家族史--兄弟姐妹--无【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                 String bhs[] = archive.getFamilyBrotherHistorys().split(",");
 | 
	
		
			
				|  |  |                 for(String bh : bhs){
 | 
	
		
			
				|  |  |                     if("1".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_CHILDREN_HYPERTENSION","1");//家族史--子女--高血压【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("2".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_CHILDREN_DIABETES","1");//家族史--子女--糖尿病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("3".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_CHILDREN_CORONARY","1");//家族史--子女--冠心病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("4".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_CHILDREN_ALLERGY","1");//家族史--子女--慢性阻塞性肺疾病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("5".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_CHILDREN_MALIGNANT","1");//家族史--子女--恶性肿瘤【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("6".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_CHILDREN_STROKE","1");//家族史--子女--脑卒中【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("7".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_CHILDREN_SCHIZOPHRENIA","1");//家族史--子女--重性精神疾病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("8".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_BROTHERS_TB","1");//家族史--子女--结核病【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("9".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_CHILDREN_HEPATITIS","1");//家族史--子女--肝炎【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("10".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_CHILDREN_CONGENITAL","1");//家族史--子女--先天畸形【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     } else if("11".equals(bh)){
 | 
	
		
			
				|  |  |                         json.put("FAMILY_CHILDREN_OTHER","1");//家族史--子女--其它【0不勾选 1勾选】
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 json.put("FAMILY_CHILDREN_NONE","1");//家族史--子女--无【0不勾选 1勾选】
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             json.put("FAMILY_FATHER_NONE","1");// "FAMILY_FATHER_NONE":"家族史--父亲--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
 | 
	
		
			
				|  |  |             json.put("FAMILY_MOTHER_NONE","1");// "FAMILY_MOTHER_NONE":"家族史--母亲--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
 | 
	
		
			
				|  |  |             json.put("FAMILY_BROTHERS_NONE","1");//  "FAMILY_BROTHERS_NONE":"家族史--兄弟姐妹--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
 | 
	
		
			
				|  |  |             json.put("FAMILY_CHILDREN_NONE","1");//  "FAMILY_CHILDREN_NONE":"家族史--子女--无【0不勾选 1勾选】(同一类别,新增时,默认勾选)",
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         json.put("SURGERY","0");// "SURGERY":"既往史--手术--【0 无 1 有】(同一类别,新增时,默认选无)",
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String response = jwArchivesService.saveSickArchiveRecord(com.alibaba.fastjson.JSONObject.toJSONString(json, SerializerFeature.WriteMapNullValue),archive.getDoctorCode());
 | 
	
		
			
				|  |  |         if("0".equals(response)){
 | 
	
		
			
				|  |  |             return -1;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //保存建档记录
 | 
	
		
			
				|  |  |         SocialSecurityInfo info = new SocialSecurityInfo();
 | 
	
		
			
				|  |  |         info.setXming0(p.getName());
 | 
	
		
			
				|  |  |         info.setXbie00(p.getSex()+"");
 | 
	
		
			
				|  |  |         info.setSfzh18(p.getIdcard());
 | 
	
		
			
				|  |  |         info.setId0000(p.getIdcard());
 | 
	
		
			
				|  |  |         info.setCardno(p.getSsc());
 | 
	
		
			
				|  |  |         info.setCard16(p.getSsc());
 | 
	
		
			
				|  |  |         info.setCsrqi0(archive.getBrithday().replace("-",""));
 | 
	
		
			
				|  |  |         info.setGrsfen("8");
 | 
	
		
			
				|  |  |         info.setGzztai("01");
 | 
	
		
			
				|  |  |         socialSecurityInfoDao.save(info);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return 1;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public  List<Map<String,Object>> getNationDict(){
 | 
	
		
			
				|  |  |         String sql = "SELECT t.NATION_CODE,t.NATION_NAME FROM zy_nation_dict t ";
 | 
	
	
		
			
				|  | @ -521,4 +838,100 @@ public class PatientInfoService extends BaseService {
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject createProfileAndSign(String archiveJson)throws Exception{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         net.sf.json.JSONObject j  = net.sf.json.JSONObject.fromObject(archiveJson);
 | 
	
		
			
				|  |  |         PatientArchivesDto archive = (PatientArchivesDto) net.sf.json.JSONObject.toBean(j,PatientArchivesDto.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         JSONObject rs = new  JSONObject();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         // 解密身份证号
 | 
	
		
			
				|  |  |         rsaUtils.setBaseService(patientService);
 | 
	
		
			
				|  |  |         String idcard = rsaUtils.decryptString(archive.getIdcard());
 | 
	
		
			
				|  |  |         idcard = URLDecoder.decode(idcard, "UTF-8");
 | 
	
		
			
				|  |  |         idcard = StringUtils.reverse(idcard);
 | 
	
		
			
				|  |  |         // 校验身份证号
 | 
	
		
			
				|  |  |         IdcardValidator validator = new IdcardValidator();
 | 
	
		
			
				|  |  |         if (validator.isValidatedAllIdcard(idcard)) {
 | 
	
		
			
				|  |  |             if (idcard.length() == 15) {
 | 
	
		
			
				|  |  |                 idcard = validator.convertIdcarBy15bit(idcard);
 | 
	
		
			
				|  |  |                 if (StringUtils.isEmpty(idcard)) {
 | 
	
		
			
				|  |  |                     rs.put("code","-1");
 | 
	
		
			
				|  |  |                     rs.put("mes","身份证格式不正确!") ;
 | 
	
		
			
				|  |  |                     return rs;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             rs.put("code","-1");
 | 
	
		
			
				|  |  |             rs.put("mes","身份证格式不正确!") ;
 | 
	
		
			
				|  |  |             return rs;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(archive.getMobile().length()!=11){
 | 
	
		
			
				|  |  |             rs.put("code","-2");
 | 
	
		
			
				|  |  |             rs.put("mes","手机格式不正确!") ;
 | 
	
		
			
				|  |  |             return rs;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String salt = UUID.randomUUID().toString().replace("-", "");
 | 
	
		
			
				|  |  |         String password = idcard.substring(idcard.length()-6,idcard.length());
 | 
	
		
			
				|  |  |         password = MD5.GetMD5Code(password + salt);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Patient p = patientService.registerAPPBydoctor(idcard,archive.getSsc(),archive.getName(),archive.getMobile(),password,salt,salt,3);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         createProfile(archiveJson);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         rs.put("code","1");
 | 
	
		
			
				|  |  |         rs.put("mes","操作成功!") ;
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getArchiveComboList(){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<SystemDict> education =systemDictDao.findByDictName("ZY_DEGREE_EDUCATION");
 | 
	
		
			
				|  |  |         List<SystemDict> occupation =systemDictDao.findByDictName("ZY_OCCUPATION");
 | 
	
		
			
				|  |  |         List<SystemDict> payment =systemDictDao.findByDictName("ZY_PAYMENT_METHOD");
 | 
	
		
			
				|  |  |         List<SystemDict> allergy =systemDictDao.findByDictName("ZY_HISTORY_OF_DRUG_ALLERGY");
 | 
	
		
			
				|  |  |         List<SystemDict> pastHistory =systemDictDao.findByDictName("ZY_PAST_HISTORY");
 | 
	
		
			
				|  |  |         List<SystemDict> disability =systemDictDao.findByDictName("ZY_DISABILITY");
 | 
	
		
			
				|  |  |         List<SystemDict> familyHistory =systemDictDao.findByDictName("ZY_FAMILY_HISTORY");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         rs.put("education",education);
 | 
	
		
			
				|  |  |         rs.put("occupation",occupation);
 | 
	
		
			
				|  |  |         rs.put("payment",payment);
 | 
	
		
			
				|  |  |         rs.put("allergy",allergy);
 | 
	
		
			
				|  |  |         rs.put("pastHistory",pastHistory);
 | 
	
		
			
				|  |  |         rs.put("disability",disability);
 | 
	
		
			
				|  |  |         rs.put("familyHistory",familyHistory);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject getPatientJWInfo(String idcard)throws Exception{
 | 
	
		
			
				|  |  |         org.json.JSONArray jsonArray = jwArchivesService.getSickArchiveRecord(idcard);
 | 
	
		
			
				|  |  |         JSONObject rs = (JSONObject) jsonArray.get(0);
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 " TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age, " +
 | 
	
		
			
				|  |  |                 " p.photo, " +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " wlyy_patient p " +
 | 
	
		
			
				|  |  |                 " WHERE " +
 | 
	
		
			
				|  |  |                 " p.idcard = '"+idcard+"'";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |             Map<String,Object>  s = list.get(0);
 | 
	
		
			
				|  |  |             rs.put("age",s.get("age"));
 | 
	
		
			
				|  |  |             rs.put("photo",s.get("photo"));
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public  Map<String,Object> getPatientSignFamily(String idcard){
 | 
	
		
			
				|  |  |         SignFamily f = signFamilyDao.findByIdcard(idcard);
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         rs.put("SignFamily",f);
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |