Browse Source

Merge branch 'dev' of trick9191/patient-co-management into dev

trick9191 7 years ago
parent
commit
aa8259f055

+ 5 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/address/StreetDao.java

@ -10,6 +10,8 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.wlyy.entity.address.Street;
import java.util.List;
public interface StreetDao extends PagingAndSortingRepository<Street, Long> {
	
	// 根據CODE查詢街道名稱
@ -18,5 +20,7 @@ public interface StreetDao extends PagingAndSortingRepository<Street, Long> {
	
	@Query("select a from Street a where a.town = ?1 order by id")
	Iterable<Street> findByTown(String town);
	
	@Query("select a from Street a where a.town = ?1 order by id")
	List<Street> findListByTown(String town);
}

+ 58 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -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, " +

+ 7 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -2389,7 +2389,7 @@ public class SignWebService extends BaseService {
        return new JSONArray(towns);
    }
    public JSONArray getStreetListByTown(String town){
        Iterable<Street> streets = streetDao.findByTown(town);
        List<Street> streets = streetDao.findListByTown(town);
        return new JSONArray(streets);
    }
    public JSONArray getCountryListByStreet(String street){
@ -2408,11 +2408,11 @@ public class SignWebService extends BaseService {
            return -1;
        }
        Country country = countryDao.findByCode(countryCode);
        if(country!=null){
        if(country==null){
            return -1;
        }
        Patient patient = patientService.findByCode(countryCode);
        if(patient!=null){
        Patient patient = patientService.findByCode(patientCode);
        if(patient==null){
            return -1;
        }
        patient.setSickVillage(countryCode);
@ -2438,11 +2438,11 @@ public class SignWebService extends BaseService {
            return -1;
        }
        Country country = countryDao.findByCode(countryCode);
        if(country!=null){
        if(country==null){
            return -1;
        }
        Patient patient = patientService.findByCode(countryCode);
        if(patient!=null){
        Patient patient = patientService.findByCode(signFamily.getPatient());
        if(patient==null){
            return -1;
        }
        patient.setSickVillage(countryCode);

+ 5 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -1161,6 +1161,11 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                JSONObject rs = familyContractService.getServerPatientList(teamCode);
                return write(200, "查询成功!", "data", rs);
            }
            //1.3.5按居委会字段划分居民
            if("5".equals(labelType)){
                JSONObject rs = familyContractService.getCountryPatientList(teamCode);
                return write(200, "查询成功!", "data", rs);
            }
            List listNum = new ArrayList();
            Map patients = new HashMap();

+ 36 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -696,6 +696,10 @@ public class DoctorSignController extends WeixinBaseController {
        }
    }
    /**
     * 获取厦门市区
     * @return
     */
    @RequestMapping(value = "/getTownList", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getTownList(){
@ -706,9 +710,15 @@ public class DoctorSignController extends WeixinBaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 获取区域下街道
     * @param town
     * @return
     */
    @RequestMapping(value = "/getStreetListByTown", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getStreetListByTown(String town){
    public String getStreetListByTown(@RequestParam(required = true)String town){
        try {
            return write(200, "查询成功", "data", signWebService.getStreetListByTown(town));
        } catch (Exception e) {
@ -717,9 +727,15 @@ public class DoctorSignController extends WeixinBaseController {
        }
    }
    /**
     * 获取街道下居委会
     * @param street
     * @return
     */
    @RequestMapping(value = "/getCountryListByStreet", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getCountryListByStreet(String street){
    public String getCountryListByStreet(@RequestParam(required = true)String street){
        try {
            return write(200, "查询成功", "data", signWebService.getCountryListByStreet(street));
        } catch (Exception e) {
@ -727,4 +743,22 @@ public class DoctorSignController extends WeixinBaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 获取居委会字段
     * @param countryCode
     * @return
     */
    @RequestMapping(value = "/updatePatientCountry", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String setPatientCountry(@RequestParam(required = true)String countryCode){
        try {
            return write(200, "保存成功", "data", signWebService.setPatientCountry(countryCode,getRepUID()));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
}

+ 2 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -125,7 +125,8 @@ public class PatientController extends WeixinBaseController {
                json.put("address", temp.getAddress());
                // 设置签约状态:0未签约,1三师,2家庭,3三师和家庭
                json.put("sign", sign);
                json.put("countryCode",temp.getSickVillage()==null?"":temp.getSickVillage());
                json.put("countryName",temp.getSickVillageName()==null?"":temp.getSickVillageName());
                json.put("idcardAll", temp.getIdcard());//完整身份证
                return write(200, "患者信息查询成功!", "data", json);
            } else {

+ 4 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -464,13 +464,15 @@ public class FamilyContractController extends BaseController {
     */
    @RequestMapping(value = "sign")
    @ResponseBody
    public String sign(String doctor,String patient) {
    public String sign(@RequestParam(required = false)String doctor,
                       @RequestParam(required = false)String patient,
                       @RequestParam(required = false)String countryCode) {
        try {
            if (StringUtils.isEmpty(doctor)) {
                return error(-1, "签约医生不能为空");
            }
            int result = familyContractService.sign(doctor,patient);
            int result = familyContractService.sign(doctor,patient,countryCode);
            if (result == -1) {
                return error(-1, "用户信息查询失败");