|
@ -34,6 +34,7 @@ import com.yihu.wlyy.util.*;
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.hibernate.sql.Select;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -548,7 +549,7 @@ public class FamilyContractService extends BaseService {
|
|
|
* @param patient 居民code
|
|
|
* @return
|
|
|
*/
|
|
|
public int sign(String doctor, String patient) throws Exception {
|
|
|
public int sign(String doctor, String patient,String countryCode) throws Exception {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
if (p == null) {
|
|
|
return -1;
|
|
@ -599,6 +600,10 @@ public class FamilyContractService extends BaseService {
|
|
|
sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear()+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear()+1+"-06-30 23:59:59","yyyy-MM-dd HH:mmm:ss"));
|
|
|
sf.setSignYear(DateUtil.getSignYear()+"");
|
|
|
|
|
|
//1.3.5新增居委会字段
|
|
|
signWebService.setPatientCountryFamily(countryCode,sf);
|
|
|
|
|
|
SignFamily temp = signFamilyDao.save(sf);
|
|
|
|
|
|
if (temp != null) {
|
|
@ -3698,6 +3703,58 @@ public class FamilyContractService extends BaseService {
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public JSONObject getCountryPatientList(Long teamCode){
|
|
|
String totalSql = " SELECT " +
|
|
|
" s.patient,ifnull(s.sick_village,0) as labelCode" +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family s " +
|
|
|
" WHERE " +
|
|
|
" s.`status` >= 0 " +
|
|
|
" AND s.admin_team_code = ? "+
|
|
|
" AND s.doctor_health IS NULL";
|
|
|
JSONObject rs = new JSONObject();
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql,new Object[]{teamCode});
|
|
|
rs.put("count",(totalList!=null&&totalList.size()>0)?totalList.size():0);
|
|
|
String patientSql ="SELECT " +
|
|
|
" f.sick_village AS labelCode, " +
|
|
|
" f.sick_village_name AS label, " +
|
|
|
" COUNT(1) AS number " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family f " +
|
|
|
" WHERE " +
|
|
|
" f.`status` >= 0 " +
|
|
|
" AND f.admin_team_code = ? " +
|
|
|
" AND f.doctor_health IS NULL " +
|
|
|
" GROUP BY " +
|
|
|
" f.sick_village " +
|
|
|
" ORDER BY " +
|
|
|
" number DESC ";
|
|
|
List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql,new Object[]{teamCode});
|
|
|
if(patientList!=null&&patientList.size()>0){
|
|
|
for(Map<String,Object> map : patientList){
|
|
|
String labelCode = (String)map.get("labelCode");
|
|
|
if(StringUtils.isNotBlank(labelCode)){
|
|
|
List<Map<String,String>> codes = new ArrayList<>();
|
|
|
Iterator iterator = patientList.iterator();
|
|
|
while(iterator.hasNext()){
|
|
|
Map<String,Object> p = ( Map<String,Object>)iterator.next();
|
|
|
String lbCode = p.get("labelCode") ==null?"":((String)p.get("labelCode"));
|
|
|
if(labelCode.equals(lbCode)){
|
|
|
Map<String,String> code = new HashMap<>();
|
|
|
code.put("code",(String)p.get("patient"));
|
|
|
codes.add(code);
|
|
|
iterator.remove();
|
|
|
}
|
|
|
}
|
|
|
map.put("codes",codes);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
rs.put("patients",patientList);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
|
|
|
public JSONObject getServerPatientListNum(Long teamCode,String level, String oldDoctorCode){
|
|
|
String serverSql="SELECT " +
|
|
|
" d.`code` As labelCode, " +
|