|
@ -8,6 +8,7 @@ import com.yihu.jw.care.service.wechat.WeiXinAccessTokenUtils;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientFamilyMemberDO;
|
|
|
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
|
|
|
import com.yihu.jw.im.util.ImUtil;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.security.MD5;
|
|
@ -37,6 +38,8 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
|
|
|
private ServicePackageSignRecordDao signRecordDao;
|
|
|
@Autowired
|
|
|
private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
|
|
|
@Autowired
|
|
|
private ImUtil imUtil;
|
|
|
|
|
|
|
|
|
|
|
@ -444,6 +447,79 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
|
|
|
return resultArray;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取居民的家庭成员
|
|
|
|
|
|
*/
|
|
|
public JSONArray membersWithOnLineFlag(String patient) {
|
|
|
JSONArray resultArray = new JSONArray();
|
|
|
String sql = "select *,CAST(t2.archive_type as char) as archive_type " +
|
|
|
" from " +
|
|
|
" base_patient_family_member t1, " +
|
|
|
" base_patient t2 " +
|
|
|
" where " +
|
|
|
" t2.id in (select family_member from base_patient_family_member where patient = ? ) " +
|
|
|
" and t1.patient = ? " +
|
|
|
" and t1.family_member = t2.id ";
|
|
|
List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{patient, patient});
|
|
|
if (result != null && result.size() > 0) {
|
|
|
for (Map<String, Object> map : result) {
|
|
|
JSONObject obj = new JSONObject();
|
|
|
List<ServicePackageSignRecordDO> signs = signRecordDao.findByStatusAndPatient(1,map.get("family_member").toString());
|
|
|
boolean jtSign = false;
|
|
|
int status = 0;
|
|
|
if(signs.size()>0){
|
|
|
jtSign = true;
|
|
|
status = 1;
|
|
|
}
|
|
|
|
|
|
Integer isAuthorize = (Integer) map.get("is_authorize");
|
|
|
|
|
|
obj.put("id", map.get("id"));
|
|
|
obj.put("name", map.get("name"));
|
|
|
obj.put("isContacts", map.get("is_contacts"));
|
|
|
obj.put("sex", map.get("sex"));
|
|
|
obj.put("isAuthorize", isAuthorize);//0:未授权,1:已授权
|
|
|
obj.put("birthday", map.get("birthday"));
|
|
|
obj.put("idcard", StringUtils.isEmpty(String.valueOf(map.get("idcard"))) ? "" : map.get("idcard").toString());
|
|
|
obj.put("photo", map.get("photo"));
|
|
|
obj.put("mobile", map.get("mobile"));
|
|
|
obj.put("address", StringUtils.isEmpty(String.valueOf(map.get("address"))) ? "" : map.get("address"));
|
|
|
obj.put("familyRelation", map.get("family_relation"));
|
|
|
obj.put("familyRelationName", relations.get(map.get("family_relation")));
|
|
|
if (jtSign) {
|
|
|
obj.put("signType", 1);
|
|
|
} else {
|
|
|
obj.put("signType", 0);
|
|
|
}
|
|
|
obj.put("state", "1");//0 :未处理;1:已同意;2:已拒绝
|
|
|
String archive_type = null;
|
|
|
Integer oneLineFlag =0;
|
|
|
switch (map.get("archive_type").toString()){
|
|
|
case "1":
|
|
|
archive_type = "older";//老人
|
|
|
break;
|
|
|
case "2":
|
|
|
archive_type = "child";//新生儿
|
|
|
break;
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(archive_type)){
|
|
|
String onLineStr = imUtil.findByUserIdAndType(map.get("id").toString(),archive_type);
|
|
|
JSONObject oneLineObj = JSONObject.parseObject(onLineStr);
|
|
|
if (200 == oneLineObj.getInteger("status")){
|
|
|
if (oneLineObj.getInteger("data")>0){
|
|
|
oneLineFlag=1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
obj.put("oneLineFlag", oneLineFlag);
|
|
|
resultArray.add(obj);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return resultArray;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取有授权的家庭成员
|
|
|
*
|