|
@ -11,10 +11,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* Created by Trick on 2017/4/20.
|
|
@ -132,8 +129,38 @@ public class WeiXinOpenIdUtils {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查找代理人的openId
|
|
|
* @param code
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getAgentOpenId(String code,Set<String> openidSet) {
|
|
|
JSONArray result = new JSONArray();
|
|
|
StringBuffer sql = new StringBuffer("SELECT * FROM wlyy_patient_family_member t WHERE t.patient = '" + code + "' and t.is_authorize =1 ");
|
|
|
|
|
|
List<Map<String, Object>> members = jdbcTemplate.queryForList(sql.toString());
|
|
|
if (members != null && members.size() > 0) {
|
|
|
for (Map<String, Object> member : members) {
|
|
|
String memberCode = (String) member.get("family_member");
|
|
|
if (StringUtils.isNotBlank(memberCode)) {
|
|
|
Patient p = patientDao.findByCode(memberCode);
|
|
|
if (StringUtils.isNotBlank(p.getOpenid())&&!openidSet.contains(p.getOpenid())) {
|
|
|
openidSet.add(p.getOpenid());
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("member", p);
|
|
|
json.put("relation", (int) member.get("family_relation"));
|
|
|
result.put(json);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public String getTitleMes(Patient p, int ralation, String dealerName) throws Exception {
|
|
|
return "因您是" + relations.get(familyRelationTrans(p, ralation)) + p.getName() + "的代理人,故请将该消息传达给" + dealerName + ":";
|
|
|
// return "因您是" + relations.get(familyRelationTrans(p, ralation)) + p.getName() + "的代理人,故请将该消息传达给" + dealerName + ":";
|
|
|
return "因您是家人" + p.getName() + "的代理人,故请将该消息传达给" + dealerName + ":";
|
|
|
}
|
|
|
|
|
|
/**
|