|
@ -62,7 +62,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
|
|
|
//添加关联家属
|
|
|
@Transactional
|
|
|
public MixEnvelop addFamily(String id,String patientId, String familyName, String dictId, String cardType, String idCard, String phoneNum,boolean demo,String medicareType,String medicare) throws Exception {
|
|
|
public MixEnvelop addFamily(String id,String patientId, String familyName, String dictId, String cardType, String idCard, String phoneNum,boolean demo,String medicareType,String medicare,String clinicId) throws Exception {
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
try{
|
|
|
BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.findOne(dictId);
|
|
@ -91,7 +91,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
//获取his家属数据
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
jsonArray = ykyyEntranceService.findHisPatientBymMedicare(medicare,"",false);
|
|
|
jsonArray = ykyyEntranceService.findHisPatientBymMedicare(medicare,clinicId,false);
|
|
|
if(jsonArray!=null&&jsonArray.size()>0){
|
|
|
net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(jsonArray.get(0).toString());
|
|
|
if (null!=jsonObject.get("brid")){
|
|
@ -107,6 +107,13 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
birth = sf.format(lt);
|
|
|
String familySex = IdCardUtil.getSexForIdcard(idCard);
|
|
|
if (familySex.equalsIgnoreCase("男")){
|
|
|
familySex= "1";
|
|
|
}else if (familySex.equalsIgnoreCase("女")){
|
|
|
familySex = "0";
|
|
|
}else {
|
|
|
familySex = "2";
|
|
|
}
|
|
|
String familyAge = String.valueOf(IdCardUtil.getAgeForIdcard(idCard));
|
|
|
BasePatientMemberDictDO basePatientMemberDictDO1 = basePatientMemberDictDao.findOne(dictId);
|
|
|
String relationName = "";
|
|
@ -118,7 +125,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
//id不为空则为修改家人关系
|
|
|
if (StringUtils.isNotBlank(id)){
|
|
|
if (null!=basePatientDO1){
|
|
|
res = ykyyService.updateYktFamily(familyName,idCard, familySex,familyAge,phoneNum,medicare,relationName,"1",id,birth);
|
|
|
res = ykyyService.updateYktFamily(familyName,idCard, familySex,familyAge,phoneNum,medicare,relationName,clinicId,result.getYktFamilyId(),birth);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(res)){
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(res);
|
|
@ -259,7 +266,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
}
|
|
|
}
|
|
|
patientMedicareCardDO.setCode(medicare);
|
|
|
patientMedicareCardDO.setType(medicareType);
|
|
|
//patientMedicareCardDO.setType(medicareType);
|
|
|
patientMedicareCardDO.setPatientCode(patientNewId);
|
|
|
patientMedicareCardDO.setDel("1");
|
|
|
basePatientMedicareCardDao.save(patientMedicareCardDO);
|
|
@ -376,7 +383,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
|
|
|
String sql = "select t.id as \"id\",t.card_type as \"cardType\", " +
|
|
|
"t.patient as \"patient\",b.name as \"name\",b.sex as \"sex\","+
|
|
|
"b.birthday as\"birthday\",b.idcard as \"idcard\",t.clinicid as \"clinicid\"," +
|
|
|
"to_char(b.birthday,'yyyy-MM-dd') as\"birthday\",b.idcard as \"idcard\",t.clinicid as \"clinicid\"," +
|
|
|
"t.family_member as \"familyMember\",c.relation_name as \"relationName\" "+
|
|
|
" from wlyy_patient_family_member t left join base_patient b" +
|
|
|
" on t.family_member = b.id left join base_patient_member_dict c on t.family_relation=c.id where 1=1 and t.is_del=1 ";
|
|
@ -386,14 +393,11 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
|
|
|
if (list!=null&&list.size()>0){
|
|
|
for (Map<String,Object> map:list){
|
|
|
if (map.get("birthday")!=null){
|
|
|
SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
map.put("birthday",sp.parse(map.get("birthday").toString()));
|
|
|
}
|
|
|
if (null!=map.get("idcard")){
|
|
|
map.put("age",IdCardUtil.getAgeForIdcard(map.get("idcard").toString()));
|
|
|
}
|
|
|
if (null!=map.get("idcard")){
|
|
|
map.put("age",IdCardUtil.getAgeForIdcard(map.get("idcard").toString()));
|
|
|
}
|
|
|
if (null!=map.get("birthday")){
|
|
|
System.out.println("birthday:"+map.get("birthday").toString());
|
|
|
}
|
|
|
List<PatientMedicareCardDO> list1 = basePatientMedicareCardDao.findByPatientCode(patientId);
|
|
|
if (null!=list1&&list.size()>0){
|
|
@ -433,6 +437,13 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
return list;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
String ss ="561657600000";
|
|
|
Date da = new Date(Long.parseLong(ss));
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
System.out.println(simpleDateFormat.format(da));
|
|
|
}
|
|
|
private static int getAgeByBirth(Date birthday) {
|
|
|
int age = 0;
|
|
|
try {
|
|
@ -492,7 +503,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
public List<Map<String,Object>> findMemberById(String id) throws ParseException {
|
|
|
String sql="select t.id as \"id\",t.card_type as \"cardType\"," +
|
|
|
"t.family_member as \"familyMember\",t.patient as \"patient\"," +
|
|
|
"b.name as \"name\",b.idcard as \"idcard\",b.mobile as \"mobile\"," +
|
|
|
"b.name as \"name\",b.idcard as \"idcard\",b.mobile as \"mobile\",t.clinicid as \"clinicid\"," +
|
|
|
"c.relation_name \"relationName\",b.birthday as\"birthday\",b.sex as\"sex\"" +
|
|
|
" from wlyy_patient_family_member t left join base_patient b" +
|
|
|
" on t.family_member = b.id left join base_patient_member_dict c on t.family_relation=c.id " +
|
|
@ -508,6 +519,16 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
int age = getAgeByBirth(sp.parse(map.get("birthday").toString()));
|
|
|
map.put("age",age);
|
|
|
}
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
if(null!=map.get("familyMember")){
|
|
|
List<PatientMedicareCardDO> list1 = basePatientMedicareCardDao.findByPatientCode(map.get("familyMember").toString());
|
|
|
if (null!=list1&&list.size()>0){
|
|
|
map.put("card",list1.get(0));
|
|
|
}else {
|
|
|
map.put("card","");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return list;
|