|
@ -26,10 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import javax.management.MXBean;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMemberDO, WlyyPatientFamilyMemberDao> {
|
|
@ -50,6 +47,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
public MixEnvelop addFamily(String id,String patientId, String familyName, String dictId, String cardType, String idCard, String phoneNum,boolean demo) throws Exception {
|
|
|
BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.findOne(dictId);
|
|
|
BasePatientDO basePatientDO = basePatientDao.findByIdcard(idCard);
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
|
if(null==basePatientDO){
|
|
|
basePatientDO = new BasePatientDO();
|
|
|
}
|
|
@ -78,6 +76,8 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
result.setFamilyRelationName(dictName);
|
|
|
result.setIsDel(1);
|
|
|
result.setPatient(patientId);
|
|
|
result.setCardNo(idCard);
|
|
|
result.setCardType(cardType);
|
|
|
//保存到base_patient表中
|
|
|
basePatientDO.setMobile(phoneNum);
|
|
|
if(null!=jsonObject.get("Birth_Date")){
|
|
@ -105,8 +105,16 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
patientMappingDO.setPatient(patientNewId);
|
|
|
patientMappingDO.setCreateTime(new Date());
|
|
|
patientMappingDao.save(patientMappingDO);
|
|
|
resultMap.put("patientId",patientId);
|
|
|
resultMap.put("familyId",patientNewId);
|
|
|
resultMap.put("idCard",idCard);
|
|
|
resultMap.put("phoneNum",phoneNum);
|
|
|
resultMap.put("relationName",dictName);
|
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
|
resultList.add(resultMap);
|
|
|
mixEnvelop.setStatus(200);
|
|
|
mixEnvelop.setMessage("添加成功");
|
|
|
mixEnvelop.setDetailModelList(resultList);
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
@ -118,10 +126,10 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
|
|
|
//根据患者id查询关联家属
|
|
|
public List<Map<String,Object>> findFamilyByPatientId(String patientId) throws ParseException {
|
|
|
String sql = "select t.patient as \"patient\",b.name as \"name\",b.sex as \"sex\"," +
|
|
|
"b.birthday as\"birthday\",b.idcard as \"idcard\" " +
|
|
|
String sql = "select 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\",c.relation_name as \"relationName\" " +
|
|
|
" from wlyy_patient_family_member t left join base_patient b" +
|
|
|
" on t.family_member = b.id where 1=1";
|
|
|
" on t.family_member = b.id left join base_patient_member_dict c on t.family_relation=c.id where 1=1";
|
|
|
if (StringUtils.isNotBlank(patientId)){
|
|
|
sql += " and t.patient = '"+patientId+"'";
|
|
|
}
|
|
@ -175,7 +183,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
}
|
|
|
//获取单个亲属详细信息
|
|
|
public List<Map<String,Object>> findMemberById(String id){
|
|
|
String sql="select t.id as \"id\",t.patient as \"patient\"," +
|
|
|
String sql="select t.id as \"id\",t.card_type as \"cardType\",t.patient as \"patient\"," +
|
|
|
"b.name as \"name\",b.idcard as \"idcard\",b.mobile as \"mobile\"," +
|
|
|
"c.relation_name \"relation_name\" 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 " +
|