trick9191 7 anni fa
parent
commit
3385801cbd

+ 7 - 7
patient-co-statistics/pom.xml

@ -376,7 +376,7 @@
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <version>${version.spring-boot}</version>
            <scope>provided</scope>
            <!--<scope>provided</scope>-->
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
@ -404,12 +404,12 @@
    <build>
        <plugins>
            <!--打成war包需要的配置-->
            <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
            <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
            </plugin>
            <!--<plugin>-->
            <!--<artifactId>maven-war-plugin</artifactId>-->
            <!--<configuration>-->
            <!--<failOnMissingWebXml>false</failOnMissingWebXml>-->
            <!--</configuration>-->
            <!--</plugin>-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>

+ 6 - 6
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/war/ServletInitializer.java

@ -7,9 +7,9 @@ import org.springframework.boot.context.web.SpringBootServletInitializer;
/**
 * Created by Administrator on 2016.10.14.
 */
public class ServletInitializer extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }
}
//public class ServletInitializer extends SpringBootServletInitializer {
//    @Override
//    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//        return application.sources(Application.class);
//    }
//}

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -390,6 +390,6 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @Query("select count(1) from SignFamily f where f.status > 0 and f.patient = ?1 and ( f.doctor = ?2 or doctorHealth = ?2  )")
    int findByPatientAndDoctor(String patient, String doctor);
    @Query(value = "select a from SignFamily a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3 and a.status >= 0")
    List<SignFamily> findByDoctorAndPatientHossPost(String doctor, String patient, String signYear);
    @Query(value = "select a from SignFamily a where a.patient = ?1 and a.signYear =?2 and a.status >= 0")
    List<SignFamily> findByDoctorAndPatientHossPost(String patient, String signYear);
}

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyRenewDao.java

@ -30,8 +30,8 @@ public interface SignFamilyRenewDao extends PagingAndSortingRepository<SignFamil
    @Query(value = "select a from SignFamilyRenew a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3 ")
    List<SignFamilyRenew> findByDoctorAndPatient(String doctor,String patient,String signYear);
    @Query(value = "select a from SignFamilyRenew a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3 and a.status >= 0")
    List<SignFamilyRenew> findByDoctorAndPatientHossPost(String doctor,String patient,String signYear);
    @Query(value = "select a from SignFamilyRenew a where a.patient = ?1 and a.signYear =?2 and a.status >= 0")
    List<SignFamilyRenew> findByDoctorAndPatientHossPost(String patient,String signYear);
    @Query(value = "select a from SignFamilyRenew a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3 and a.status = 1 and a.expensesStatus ='1'")
    List<SignFamilyRenew> findByDoctorAndPatientIsValid(String doctor,String patient,String signYear);

+ 44 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -282,6 +282,28 @@ public class SignPatientLabelInfoService extends BaseService {
            }
            sql += " order by openid desc,convert(name using gbk) ";
            args = new Object[]{doctor, doctor, teamCode};
        }else if("1".equals(labelType)){
            int flag =   labelCode.indexOf("-");
            if(flag!=-1){
                String label[] = labelCode.split("-");
                sql = "SELECT " +
                        "    t1.* " +
                        " FROM " +
                        "    wlyy_sign_family t1 " +
                        " WHERE (t1.doctor = ? or t1.doctor_health = ?) " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? AND  t1.special_population = '"+label[0]+"'";
                args = new Object[]{doctor, doctor, teamCode};
            }else{
                sql = "SELECT " +
                        "    t1.* " +
                        " FROM " +
                        "    wlyy_sign_family t1 " +
                        " WHERE (t1.doctor = ? or t1.doctor_health = ?) " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? AND  t1.server_type = '"+labelCode+"'";
                args = new Object[]{doctor, doctor, teamCode};
            }
        } else {
            if (labelCode.equals("0")) {
                sql = "SELECT " +
@ -298,7 +320,7 @@ public class SignPatientLabelInfoService extends BaseService {
                        "    AND t1.admin_team_code = ? order by t1.openid desc,convert(t1.name using gbk) ";
                args = new Object[]{labelType, doctor, doctor, teamCode};
            } else {
            }else {
                sql = "SELECT " +
                        "    t1.* " +
                        " FROM " +
@ -2839,7 +2861,27 @@ public class SignPatientLabelInfoService extends BaseService {
            }
            sql += " order by openid desc,convert(name using gbk) ";
            args = new Object[]{teamCode};
        } else {
        }else if("1".equals(labelType)){
            int flag =   labelCode.indexOf("-");
            if(flag!=-1){
                String label[] = labelCode.split("-");
                sql = "SELECT " +
                        "    t1.* " +
                        " FROM " +
                        "    wlyy_sign_family t1 " +
                        " WHERE t1.status > 0 " +
                        "    AND t1.admin_team_code = ? AND  t1.special_population = '"+label[0]+"'";
                args = new Object[]{teamCode};
            }else{
                sql = "SELECT " +
                        "    t1.* " +
                        " FROM " +
                        "    wlyy_sign_family t1 " +
                        " WHERE t1.status > 0 " +
                        "    AND t1.admin_team_code = ? AND  t1.server_type = '"+labelCode+"'";
                args = new Object[]{teamCode};
            }
        }else {
            if (labelCode.equals("0")) {
                sql = "SELECT " +
                        "    DISTINCT  t1.* " +

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

@ -2962,7 +2962,7 @@ public class FamilyContractService extends BaseService {
        int year =cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONTH)+1;
        List<SignFamilyRenew> res = signFamilyRenewDao.findByDoctorAndPatientHossPost(doctor,patient,DateUtil.getSignYear()+"");
        List<SignFamilyRenew> res = signFamilyRenewDao.findByDoctorAndPatientHossPost(patient,DateUtil.getSignYear()+"");
        if(res!=null&&res.size()>0){
            return -2;
        }
@ -3146,7 +3146,7 @@ public class FamilyContractService extends BaseService {
        }
        List<SignFamily> res = signFamilyDao.findByDoctorAndPatientHossPost(doctor,patient,DateUtil.getSignYear()+"");
        List<SignFamily> res = signFamilyDao.findByDoctorAndPatientHossPost(patient,DateUtil.getSignYear()+"");
        if(res!=null&&res.size()>0){
            return -2;
        }

+ 178 - 6
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -587,33 +587,205 @@ public class PatientService extends TokenService {
        return adminTeam.getName();
    }
    public JSONArray getSignByTeamCodeGpbyServer(String teamCode){
    /**
     * 获取团队分组签约数据
     * @param teamCode
     * @return
     */
    public JSONArray getSignByTeamCodeGpbyServer(Long teamCode){
        // 获取总分组数量
        String totalGSql = "SELECT count(1) AS Amount,f.server_type,f.server_type_name FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' GROUP BY f.server_type ";
        String totalGSql = "SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' GROUP BY f.server_type ORDER BY f.server_type DESC";
        List<Map<String,Object>> totalG = jdbcTemplate.queryForList(totalGSql);
        //获取关注量分组数量
        String fousGSql ="SELECT count(1) As focusAmount,f.server_type,f.server_type_name FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' AND f.openid IS NOT NULL GROUP BY f.server_type ";
        String fousGSql ="SELECT count(1) As focusAmount,f.server_type AS serverType,f.server_type_name AS serverTypeName  FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' AND f.openid IS NOT NULL GROUP BY f.server_type ";
        List<Map<String,Object>> fousG = jdbcTemplate.queryForList(fousGSql);
        //获取二级节点分组总数
        String sesTotalSql ="SELECT count(1) AS Amount,f.server_type,f.server_type_name,f.special_population,f.special_population_name FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' AND f.special_population Is NOT NULL GROUP BY f.special_population ";
        String sesTotalSql ="SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name As serverTypeName ,f.special_population AS specialPopulation,f.special_population_name AS specialPopulationName  FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' AND f.special_population Is NOT NULL GROUP BY f.special_population ORDER BY f.special_population DESC ";
        List<Map<String,Object>> sesTotal = jdbcTemplate.queryForList(sesTotalSql);
        //获取二级节点分组数量
        String sesFousGSql ="SELECT count(1) AS Amount,f.server_type,f.server_type_name,f.special_population,f.special_population_name FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' AND f.special_population Is NOT NULL AND f.openid IS NOT NULL GROUP BY f.special_population ";
        String sesFousGSql ="SELECT count(1) AS focusAmount,f.server_type  AS serverType,f.server_type_name As serverTypeName,f.special_population  AS specialPopulation,f.special_population_name  AS specialPopulationName FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.expenses_status ='1' AND f.special_population Is NOT NULL AND f.openid IS NOT NULL GROUP BY f.special_population ";
        List<Map<String,Object>> sesFousG =jdbcTemplate.queryForList(sesFousGSql);
        List<ServerLabelTree> listTree = new ArrayList<>();
        if(totalG!=null&&totalG.size()>0){
           //得到微信关注量总数层级
            Map<String,Object> fousGMap = new HashMap<>();
            if(fousG!=null&&fousG.size()>0){
                 //将List转换为Map 降低循环层级
                for(Map<String,Object> fg: fousG){
                    String serverType = (String)fg.get("serverType");
                    fousGMap.put(serverType,fg);
                }
            }
            //得到二级总数层级
//            Map<String,Object> sesTotalMap = new HashMap<>();
//            if(sesTotal!=null&&sesTotal.size()>0){
//                //将List转换为Map 降低循环层级
//                for(Map<String,Object> st: sesTotal){
//                    String serverType = (String)st.get("serverType");
//                    sesTotalMap.put(serverType,st);
//                }
//            }
            //得到二级关注度总数层数
            Map<String,Object> sesFousGMap = new HashMap<>();
            if(sesFousG!=null&&sesFousG.size()>0){
                //将List转换为Map 降低循环层级
                for(Map<String,Object> sf: sesFousG){
                    String specialPopulation = (String)sf.get("specialPopulation");
                    sesFousGMap.put(specialPopulation,sf);
                }
            }
            //遍历第一层级总数
            for(Map<String,Object> ttg : totalG){
                //添加第一层级数节点
                ServerLabelTree tree = new ServerLabelTree();
                tree.setAmount((Long)ttg.get("Amount"));
                //设置关注数
                String sevtype = (String)ttg.get("serverType");
                Map<String,Object> st =  (Map<String,Object>)fousGMap.get(sevtype);
                if(st!=null){
                    tree.setFocusAmount((Long)st.get("focusAmount"));
                }else{
                    tree.setFocusAmount(0L);
                }
                tree.setLabelCode((String)ttg.get("serverType"));
                tree.setLabelName((String)ttg.get("serverTypeName"));
                List<ServerLabelTree> ch = new ArrayList<>();
                //遍历节点总数
                if(sesTotal!=null&&sesTotal.size()>0){
                    for(Map<String,Object> sesT:sesTotal){
                        String serType = (String)sesT.get("serverType");
                        if(tree.getLabelCode().equals(serType)){
                            ServerLabelTree chTree = new ServerLabelTree();
                            String specialPopulation = (String)sesT.get("specialPopulation");
                            chTree.setLabelCode(tree.getLabelCode()+"-"+specialPopulation);
                            chTree.setLabelName((String)sesT.get("specialPopulationName"));
                            chTree.setAmount((Long)sesT.get("Amount"));
                            Map<String,Object> sFousG = (Map<String,Object>)sesFousGMap.get(specialPopulation);
                            if(sFousG!=null){
                                chTree.setFocusAmount((Long)sFousG.get("focusAmount"));
                            }else{
                                chTree.setFocusAmount(0L);
                            }
                            ch.add(chTree);
                        }
                    }
                }
                tree.setCh(ch);
                listTree.add(tree);
            }
        }
        return null;
        return new JSONArray(listTree);
    }
    /**
     * 获取团队分组签约数据
     * @return
     */
    public JSONArray getSignByDoctorCodeGpbyServer(String doctor){
        // 获取总分组数量
        String totalGSql = "SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE f.doctor ='"+doctor+"' AND f.`status`>0 AND f.expenses_status ='1' GROUP BY f.server_type ORDER BY f.server_type DESC";
        List<Map<String,Object>> totalG = jdbcTemplate.queryForList(totalGSql);
        //获取关注量分组数量
        String fousGSql ="SELECT count(1) As focusAmount,f.server_type AS serverType,f.server_type_name AS serverTypeName  FROM wlyy_sign_family f WHERE f.doctor ='"+doctor+"' AND f.`status`>0 AND f.expenses_status ='1' AND f.openid IS NOT NULL GROUP BY f.server_type ";
        List<Map<String,Object>> fousG = jdbcTemplate.queryForList(fousGSql);
        //获取二级节点分组总数
        String sesTotalSql ="SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name As serverTypeName ,f.special_population AS specialPopulation,f.special_population_name AS specialPopulationName  FROM wlyy_sign_family f WHERE f.doctor ='"+doctor+"'  AND f.`status`>0 AND f.expenses_status ='1' AND f.special_population Is NOT NULL GROUP BY f.special_population ORDER BY f.special_population DESC ";
        List<Map<String,Object>> sesTotal = jdbcTemplate.queryForList(sesTotalSql);
        //获取二级节点分组数量
        String sesFousGSql ="SELECT count(1) AS focusAmount,f.server_type  AS serverType,f.server_type_name As serverTypeName,f.special_population  AS specialPopulation,f.special_population_name  AS specialPopulationName FROM wlyy_sign_family f WHERE f.doctor ='"+doctor+"'  AND f.`status`>0 AND f.expenses_status ='1' AND f.special_population Is NOT NULL AND f.openid IS NOT NULL GROUP BY f.special_population ";
        List<Map<String,Object>> sesFousG =jdbcTemplate.queryForList(sesFousGSql);
        List<ServerLabelTree> listTree = new ArrayList<>();
        if(totalG!=null&&totalG.size()>0){
            //得到微信关注量总数层级
            Map<String,Object> fousGMap = new HashMap<>();
            if(fousG!=null&&fousG.size()>0){
                //将List转换为Map 降低循环层级
                for(Map<String,Object> fg: fousG){
                    String serverType = (String)fg.get("serverType");
                    fousGMap.put(serverType,fg);
                }
            }
            //得到二级总数层级
//            Map<String,Object> sesTotalMap = new HashMap<>();
//            if(sesTotal!=null&&sesTotal.size()>0){
//                //将List转换为Map 降低循环层级
//                for(Map<String,Object> st: sesTotal){
//                    String serverType = (String)st.get("serverType");
//                    sesTotalMap.put(serverType,st);
//                }
//            }
            //得到二级关注度总数层数
            Map<String,Object> sesFousGMap = new HashMap<>();
            if(sesFousG!=null&&sesFousG.size()>0){
                //将List转换为Map 降低循环层级
                for(Map<String,Object> sf: sesFousG){
                    String specialPopulation = (String)sf.get("specialPopulation");
                    sesFousGMap.put(specialPopulation,sf);
                }
            }
            //遍历第一层级总数
            for(Map<String,Object> ttg : totalG){
                //添加第一层级数节点
                ServerLabelTree tree = new ServerLabelTree();
                tree.setAmount((Long)ttg.get("Amount"));
                //设置关注数
                String sevtype = (String)ttg.get("serverType");
                Map<String,Object> st =  (Map<String,Object>)fousGMap.get(sevtype);
                if(st!=null){
                    tree.setFocusAmount((Long)st.get("focusAmount"));
                }else{
                    tree.setFocusAmount(0L);
                }
                tree.setLabelCode((String)ttg.get("serverType"));
                tree.setLabelName((String)ttg.get("serverTypeName"));
                List<ServerLabelTree> ch = new ArrayList<>();
                //遍历节点总数
                if(sesTotal!=null&&sesTotal.size()>0){
                    for(Map<String,Object> sesT:sesTotal){
                        String serType = (String)sesT.get("serverType");
                        if(tree.getLabelCode().equals(serType)){
                            ServerLabelTree chTree = new ServerLabelTree();
                            String specialPopulation = (String)sesT.get("specialPopulation");
                            chTree.setLabelCode(tree.getLabelCode()+"-"+specialPopulation);
                            chTree.setLabelName((String)sesT.get("specialPopulationName"));
                            chTree.setAmount((Long)sesT.get("Amount"));
                            Map<String,Object> sFousG = (Map<String,Object>)sesFousGMap.get(specialPopulation);
                            if(sFousG!=null){
                                chTree.setFocusAmount((Long)sFousG.get("focusAmount"));
                            }else{
                                chTree.setFocusAmount(0L);
                            }
                            ch.add(chTree);
                        }
                    }
                }
                tree.setCh(ch);
                listTree.add(tree);
            }
        }
        return new JSONArray(listTree);
    }
}

+ 13 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.app.sign.SignWebService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -28,6 +29,8 @@ public class SignPatientLabelInfoController extends BaseController {
    SignPatientLabelInfoService labelInfoService;
    @Autowired
    SignWebService signWebService;
    @Autowired
    PatientService patientService;
    /**
     * 根据姓名,地址,身份证号搜索团队内居民
@ -159,11 +162,13 @@ public class SignPatientLabelInfoController extends BaseController {
                return write(200, "查询成功", "data", jsonObject);
            }
            //JSONArray result = labelInfoService.getPatientByLabel("xh1D201703150222", labelCode, labelType, teamCode, page, pagesize);
            JSONArray result = labelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -254,6 +259,10 @@ public class SignPatientLabelInfoController extends BaseController {
                return write(200, "查询成功", "data", r);
            }
            if(labelType.equals("1")){
                JSONArray r= patientService.getSignByDoctorCodeGpbyServer(getUID());
                return write(200, "查询成功", "data", r);
            }
            JSONArray result = labelInfoService.getPatientAmountByLabelType(getUID(), labelType, teamCode);
@ -280,7 +289,10 @@ public class SignPatientLabelInfoController extends BaseController {
            if (teamCode == null) {
                teamCode = 0L;
            }
            if("1".equals(labelType)){
                JSONArray result =patientService.getSignByTeamCodeGpbyServer(teamCode);
                return  write(200, "查询成功", "data", result);
            }
            JSONArray result = labelInfoService.getPatientAmountByTeamGroupLable(teamCode, labelType);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {

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

@ -608,7 +608,24 @@ public class DoctorSignController extends WeixinBaseController {
    @ResponseBody
    public String getSigndictTree(@RequestParam(required = true) Long teamCode){
        try {
            JSONArray result = patientService.getSigndictTree(teamCode);
            JSONArray result = patientService.getSignByTeamCodeGpbyServer(teamCode);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    /**
     * 获取当前医生签约关系分组
     * @return
     */
    @RequestMapping(value = "/getSignByDoctorCodeGpbyServer", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String getSignByDoctorCodeGpbyServer(){
        try {
            //JSONArray result = patientService.getSignByDoctorCodeGpbyServer(getUID());
            JSONArray result = patientService.getSignByDoctorCodeGpbyServer("xh1D201703150222");
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            error(e);

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

@ -512,7 +512,7 @@ public class FamilyContractController extends BaseController {
            if (result == -1) {
                return error(-1, "用户信息查询失败");
            } else if (result == -2) {
                return error(-1, "续签已经提交");
                return error(-1, "您已提交过续签申请,无需再次提交");
            } else if (result == -3) {
                return error(-1, "医生信息查询失败");
            } else if (result == -4) {