trick9191 7 anni fa
parent
commit
06c8df9a31

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/EvaluateService.java

@ -328,9 +328,9 @@ public class EvaluateService extends BaseService {
        if(page!=null&&size!=null){
            page = page -1;
            sql = sql+ " GROUP BY s.consult ORDER BY date DESC LIMIT "+page*size+","+size+" ";
            sql = sql+ " GROUP BY s.consult ORDER BY c.czrq DESC LIMIT "+page*size+","+size+" ";
        }else{
            sql = sql +" GROUP BY s.consult ORDER BY date DESC ";
            sql = sql +" GROUP BY s.consult ORDER BY c.czrq DESC ";
        }
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);

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

@ -277,30 +277,30 @@ 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.* " +
                        " p.openid " +
                        " FROM " +
                        "    wlyy_sign_family t1 ,wlyy_patient p" +
                        " WHERE p.code = t1.patient " +
                        "    AND (t1.doctor = ? or t1.doctor_health = ?) " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? AND  t1.special_population = '"+label[1]+"' ORDER BY p.openid DESC ";
                args = new Object[]{doctor, doctor, teamCode};
            }else{
                sql = "SELECT " +
                        "    t1.* "+
                        " FROM " +
                        "    wlyy_sign_family t1 ,wlyy_patient p " +
                        " WHERE  p.code = t1.patient " +
                        "    AND (t1.doctor = ? or t1.doctor_health = ?) " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? AND  t1.server_type = '"+labelCode+"'  ORDER BY p.openid DESC ";
                args = new Object[]{doctor, doctor, teamCode};
            }
            sql = "SELECT " +
                    " f.* " +
                    "FROM " +
                    " wlyy_sign_family_server s ,( " +
                    "  SELECT " +
                    "   t1.*, p.openid AS ptOpenid " +
                    "  FROM " +
                    "   wlyy_sign_family t1, " +
                    "   wlyy_patient p " +
                    "  WHERE " +
                    "  p. CODE = t1.patient " +
                    "  AND ( " +
                    "   t1.doctor = ? " +
                    "   OR t1.doctor_health = ? " +
                    "  ) " +
                    "  AND t1. STATUS > 0 " +
                    "  AND t1.admin_team_code = ?" +
                    " ) f " +
                    "WHERE " +
                    " f. CODE = s.sign_code " +
                    " AND s.server_type ='"+labelCode+"' " +
                    " ORDER BY " +
                    " f.ptOpenid DESC";
            args = new Object[]{doctor, doctor, teamCode};
        } else {
            if (labelCode.equals("0")) {
                sql = "SELECT " +
@ -3281,25 +3281,26 @@ public class SignPatientLabelInfoService extends BaseService {
            sql += " order by openid desc,convert(name using gbk) ";
            args = new Object[]{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.status > 0 " +
                        "    AND t1.admin_team_code = ? AND  t1.special_population = '"+label[1]+"'";
            sql = "SELECT " +
                    " f.* " +
                    "FROM " +
                    " wlyy_sign_family_server s ,( " +
                    "  SELECT " +
                    "   t1.*, p.openid AS ptOpenid " +
                    "  FROM " +
                    "   wlyy_sign_family t1, " +
                    "   wlyy_patient p " +
                    "  WHERE " +
                    "  p. CODE = t1.patient " +
                    "  AND t1. STATUS > 0 " +
                    "  AND t1.admin_team_code = ?" +
                    " ) f " +
                    "WHERE " +
                    " f. CODE = s.sign_code " +
                    " AND s.server_type ='"+labelCode+"' " +
                    " ORDER BY " +
                    " f.ptOpenid DESC";
                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 " +

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

@ -1016,10 +1016,17 @@ public class FamilyContractService extends BaseService {
        sf.setTeamCode(doctorTeamCode);
        ///1.3.5判断是否续签
        if(checkLastYearIsSign(sf.getPatient(),sf.getDoctor())){
        Map<String,Object> oldSign = checkLastYearIsSign(sf.getPatient(),sf.getDoctor());
        if(oldSign!=null){
            //如果为续签
            signWebService.setRenewLog(sf);
            sf.setRenewFlag("1");
            Integer adminTCode = (Integer) oldSign.get("admin_team_code");
            Long aTCode = adminTCode.longValue();
            if(aTCode!=null&&aTCode==adminTeamCode){
                sf.setRenewFlag("1");
            }else{
                sf.setRenewFlag("2");
            }
        }else{
            sf.setRenewFlag("0");
        }
@ -3616,25 +3623,32 @@ public class FamilyContractService extends BaseService {
                " wlyy_sign_dict d " +
                " WHERE " +
                " d.type IN ('1', '2') " +
                " AND d. YEAR = '"+DateUtil.getSignYear()+"' " +
                " AND d.`code` NOT IN ( " +
                " SELECT " +
                "  LEFT ( " +
                "   d. CODE, " +
                "   (INSTR(d. CODE, '-') - 1) " +
                "  ) AS CODE " +
                " FROM " +
                "  wlyy_sign_dict d " +
                " WHERE " +
                "  d. CODE LIKE '%-%' " +
                " GROUP BY " +
                "  CODE " +
                ")";
        String patientSql =" SELECT " +
                " s.patient, " +
                " s.server_type AS serverType, " +
                " s.special_population AS specialPopulation, " +
                " s.sign_year " +
                " AND d. YEAR = '"+DateUtil.getSignYear()+"' " ;
        String patientSql ="SELECT " +
                " f.patient, " +
                " f.sign_year, " +
                " t.server_type AS serverType, " +
                " t.server_type_name AS specialPopulation " +
                "FROM " +
                " wlyy_sign_family_server t, " +
                " ( " +
                "  SELECT " +
                "   s.`code`, " +
                "   s.patient, " +
                "   s.sign_year " +
                "  FROM " +
                "   wlyy_sign_family s " +
                "  WHERE " +
                "   s.`status` >= 0 " +
                "  AND s.server_type <> '3'" +
                "  AND s.admin_team_code = " +teamCode+
                "  AND s.doctor_health IS NULL " +
                " ) f " +
                "WHERE " +
                " t.sign_code = f. CODE ";
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);
        String totalSql = " SELECT " +
                " s.patient" +
                " FROM " +
                " wlyy_sign_family s " +
                " WHERE " +
@ -3642,10 +3656,10 @@ public class FamilyContractService extends BaseService {
                " AND s.server_type IS NOT NULL AND s.server_type <>'3' "+
                " AND s.admin_team_code =" +teamCode+
                " AND s.doctor_health IS NULL";
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);
        List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
        JSONObject rs = new JSONObject();
        rs.put("count",(patientList!=null&&patientList.size()>0)?patientList.size():0);
        rs.put("count",(totalList!=null&&totalList.size()>0)?totalList.size():0);
        List<Map<String,Object>> serlist = jdbcTemplate.queryForList(serverSql);
        if(serlist!=null&&serlist.size()>0){
@ -3657,21 +3671,11 @@ public class FamilyContractService extends BaseService {
                    while(iterator.hasNext()){
                        Map<String,Object> p =  ( Map<String,Object>)iterator.next();
                        String serverType = p.get("serverType") ==null?"":((String)p.get("serverType"));
                        if(labelCode.indexOf("-")==-1){
                            if(labelCode.equals(serverType)){
                                Map<String,String> code = new HashMap<>();
                                code.put("code",(String)p.get("patient"));
                                codes.add(code);
                                iterator.remove();
                            }
                        }else{
                            String[] key = labelCode.split("-");
                            if(key[0].equals(serverType)){
                                Map<String,String> code = new HashMap<>();
                                code.put("code",(String)p.get("patient"));
                                codes.add(code);
                                iterator.remove();
                            }
                        if(labelCode.equals(serverType)){
                            Map<String,String> code = new HashMap<>();
                            code.put("code",(String)p.get("patient"));
                            codes.add(code);
                            iterator.remove();
                        }
                    }
                    map.put("codes",codes);
@ -3692,21 +3696,35 @@ public class FamilyContractService extends BaseService {
                " wlyy_sign_dict d " +
                " WHERE " +
                " d.type IN ('1', '2') " +
                " AND d. YEAR = '"+DateUtil.getSignYear()+"' " +
                " AND d.`code` NOT IN ( " +
                " AND d. YEAR = '"+DateUtil.getSignYear()+"' ";
        String patientSql ="SELECT  " +
                " f.patient, " +
                " s.server_type AS serverType, " +
                " s.server_type_name AS serverTypeName " +
                " FROM  " +
                " wlyy_sign_family_server s, " +
                "( " +
                " SELECT " +
                "  LEFT ( " +
                "   d. CODE, " +
                "   (INSTR(d. CODE, '-') - 1) " +
                "  ) AS CODE " +
                " s.patient, " +
                " s.`code` " +
                " FROM " +
                "  wlyy_sign_dict d " +
                " wlyy_sign_family s " +
                " WHERE " +
                "  d. CODE LIKE '%-%' " +
                " GROUP BY " +
                "  CODE " +
                ")";
        String patientSql =" SELECT " +
                " s.`status` >= 0 " +
                " AND s.server_type IS NOT NULL " +
                " AND s.server_type <> '3' " +
                " AND s.admin_team_code = " +teamCode ;
        //1查询全科,其他查询健管师
        if("2".equals(level)){
            patientSql =  patientSql+" AND s.doctor ='"+oldDoctorCode+"'";
        }else{
            patientSql =  patientSql+" AND s.doctor_health ='"+oldDoctorCode+"'";
        }
        patientSql =patientSql+" ) f WHERE f.`code` =s.sign_code";
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);
        String totalSql =" SELECT " +
                " s.patient, " +
                " s.server_type AS serverType, " +
                " s.special_population AS specialPopulation, " +
@ -3719,14 +3737,14 @@ public class FamilyContractService extends BaseService {
                " AND s.admin_team_code =" +teamCode;
        //1查询全科,其他查询健管师
        if("2".equals(level)){
            patientSql =  patientSql+" AND s.doctor ='"+oldDoctorCode+"'";
            totalSql =  totalSql+" AND s.doctor ='"+oldDoctorCode+"'";
        }else{
            patientSql =  patientSql+" AND s.doctor_health ='"+oldDoctorCode+"'";
            totalSql =  totalSql+" AND s.doctor_health ='"+oldDoctorCode+"'";
        }
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);
        List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
        JSONObject rs = new JSONObject();
        rs.put("count",(patientList!=null&&patientList.size()>0)?patientList.size():0);
        rs.put("count",(totalList!=null&&totalList.size()>0)?totalList.size():0);
        List<Map<String,Object>> serlist = jdbcTemplate.queryForList(serverSql);
        if(serlist!=null&&serlist.size()>0){
@ -3738,21 +3756,11 @@ public class FamilyContractService extends BaseService {
                    while(iterator.hasNext()){
                        Map<String,Object> p =  ( Map<String,Object>)iterator.next();
                        String serverType = p.get("serverType") ==null?"":((String)p.get("serverType"));
                        if(labelCode.indexOf("-")==-1){
                            if(labelCode.equals(serverType)){
                                Map<String,String> code = new HashMap<>();
                                code.put("code",(String)p.get("patient"));
                                codes.add(code);
                                iterator.remove();
                            }
                        }else{
                            String[] key = labelCode.split("-");
                            if(key[0].equals(serverType)){
                                Map<String,String> code = new HashMap<>();
                                code.put("code",(String)p.get("patient"));
                                codes.add(code);
                                iterator.remove();
                            }
                        if(labelCode.equals(serverType)){
                            Map<String,String> code = new HashMap<>();
                            code.put("code",(String)p.get("patient"));
                            codes.add(code);
                            iterator.remove();
                        }
                    }
                    map.put("codes",codes);
@ -3823,13 +3831,13 @@ public class FamilyContractService extends BaseService {
     * @param doctor
     * @return
     */
    public boolean checkLastYearIsSign(String patient,String doctor){
        String sql = "SELECT f.id FROM wlyy_sign_family f WHERE f.doctor ='"+doctor+"' AND f.patient='"+patient+"' AND f.sign_year='"+(DateUtil.getSignYear()-1)+"' AND f.`status`=-4 AND f.expenses_status ='1'";
    public Map<String,Object> checkLastYearIsSign(String patient,String doctor){
        String sql = "SELECT f.id,f.admin_team_code FROM wlyy_sign_family f WHERE f.doctor ='"+doctor+"' AND f.patient='"+patient+"' AND f.sign_year='"+(DateUtil.getSignYear()-1)+"' AND f.`status`=-4 AND f.expenses_status ='1'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if (list!=null&&list.size()>0){
            return true;
            return list.get(0);
        }else{
            return false;
            return null;
        }
    }

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

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.app.sign;
import com.sun.corba.se.spi.activation.Server;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
@ -14,10 +15,7 @@ import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyRenewDao;
import com.yihu.wlyy.repository.patient.SignFamilyRenewLogDao;
import com.yihu.wlyy.repository.patient.SignWebDao;
import com.yihu.wlyy.repository.patient.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
@ -40,7 +38,9 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.sql.*;
import java.util.*;
import java.util.Date;
/**
 * 网络签约业务处理类
@ -89,6 +89,8 @@ public class SignWebService extends BaseService {
    private ConsultDao consultDao;
    @Autowired
    private ConsultTeamDao consultTeamDao;
    @Autowired
    private SignFamilyServerDao signFamilyServerDao;
    /**
     * 根据医生代码及签约状态编码 获取该医生签约患者的信息列表
@ -1925,46 +1927,21 @@ public class SignWebService extends BaseService {
     * @param sevId
     */
    public void setSevId(SignFamilyRenew renew, String sevId) {
        if (StringUtils.isNotBlank(sevId)) {
            int flag = sevId.indexOf("-");
            if (flag != -1) {
                String sql = "select d.name from wlyy_sign_dict d where d.code = '" + sevId + "' and d.year ='"+DateUtil.getSignYear()+"' ";
                List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
                String[] keys = sevId.split("-");
                if (list != null && list.size() > 0) {
                    Map<String, Object> name = list.get(0);
                    String populationName = (String) name.get("name");
                    if (StringUtils.isNotBlank(populationName)) {
                        renew.setSpecialPopulation(keys[1]);
                        renew.setSpecialPopulationName(populationName);
                    }
                }
                if (keys != null && keys.length > 0) {
                    String sql2 = "select d.name from wlyy_sign_dict d where d.code = '" + keys[0] + "' and d.year ='"+DateUtil.getSignYear()+"' ";
                    List<Map<String, Object>> list2 = jdbcTemplate.queryForList(sql2);
                    if (list2 != null && list2.size() > 0) {
                        Map<String, Object> name = list2.get(0);
                        String serverTypeName = (String) name.get("name");
                        if (StringUtils.isNotBlank(serverTypeName)) {
                            renew.setServerType(keys[0]);
                            renew.setServerTypeName(serverTypeName);
                        }
                    }
                }
            } else {
                String sql2 = "select d.name from wlyy_sign_dict d where d.code = '" + sevId + "' and d.year ='"+DateUtil.getSignYear()+"' ";
                List<Map<String, Object>> list2 = jdbcTemplate.queryForList(sql2);
                if (list2 != null && list2.size() > 0) {
                    Map<String, Object> name = list2.get(0);
                    String serverTypeName = (String) name.get("name");
                    if (StringUtils.isNotBlank(serverTypeName)) {
                        renew.setServerType(sevId);
                        renew.setServerTypeName(serverTypeName);
                    }
        if (StringUtils.isNotBlank(sevId)){
            if (StringUtils.isNotBlank(sevId)) {
                String[] sevIds = sevId.split(",");
                for(int i=0;i<sevIds.length;i++){
                    String sql = "select d.name from wlyy_sign_dict d where d.code = '" + sevIds[i] + "' and d.year ='"+DateUtil.getSignYear()+"' ";
                    List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
                    SignFamilyServer server = new SignFamilyServer();
                    server.setSignCode(renew.getCode());
                    server.setCreateTime(new Date());
                    server.setServerType(sevIds[i]);
                    Map<String, Object> map = list.get(0);
                    String serverName = (String)  map.get("name");
                    server.setServerTypeName(serverName);
                    server.setCzrq(new Date());
                    signFamilyServerDao.save(server);
                }
            }
        }
@ -1977,48 +1954,19 @@ public class SignWebService extends BaseService {
     */
    public void setSevId(SignFamily renew, String sevId) {
        if (StringUtils.isNotBlank(sevId)) {
            int flag = sevId.indexOf("-");
            if (flag != -1) {
                String sql = "select d.name from wlyy_sign_dict d where d.code = '" + sevId + "' and d.year ='"+DateUtil.getSignYear()+"' ";
            String[] sevIds = sevId.split(",");
            for(int i=0;i<sevIds.length;i++){
                String sql = "select d.name from wlyy_sign_dict d where d.code = '" + sevIds[i] + "' and d.year ='"+DateUtil.getSignYear()+"' ";
                List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
                String[] keys = sevId.split("-");
                if (list != null && list.size() > 0) {
                    Map<String, Object> name = list.get(0);
                    String populationName = (String) name.get("name");
                    if (StringUtils.isNotBlank(populationName)) {
                        renew.setSpecialPopulation(keys[1]);
                        renew.setSpecialPopulationName(populationName);
                    }
                }
                if (keys != null && keys.length > 0) {
                    String sql2 = "select d.name from wlyy_sign_dict d where d.code = '" + keys[0] + "' and d.year ='"+DateUtil.getSignYear()+"' ";
                    List<Map<String, Object>> list2 = jdbcTemplate.queryForList(sql2);
                    if (list2 != null && list2.size() > 0) {
                        Map<String, Object> name = list2.get(0);
                        String serverTypeName = (String) name.get("name");
                        if (StringUtils.isNotBlank(serverTypeName)) {
                            renew.setServerType(keys[0]);
                            renew.setServerTypeName(serverTypeName);
                        }
                    }
                }
            } else {
                String sql2 = "select d.name from wlyy_sign_dict d where d.code = '" +sevId+ "' and d.year ='"+DateUtil.getSignYear()+"' ";
                List<Map<String, Object>> list2 = jdbcTemplate.queryForList(sql2);
                if (list2 != null && list2.size() > 0) {
                    Map<String, Object> name = list2.get(0);
                    String serverTypeName = (String) name.get("name");
                    if (StringUtils.isNotBlank(serverTypeName)) {
                        renew.setServerType(sevId);
                        renew.setServerTypeName(serverTypeName);
                    }
                }
                SignFamilyServer server = new SignFamilyServer();
                server.setSignCode(renew.getCode());
                server.setCreateTime(new Date());
                server.setServerType(sevIds[i]);
                Map<String, Object> map = list.get(0);
                String serverName = (String)  map.get("name");
                server.setServerTypeName(serverName);
                server.setCzrq(new Date());
                signFamilyServerDao.save(server);
            }
        }
    }

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -1709,7 +1709,7 @@ public class StatisticsService extends BaseService {
    public JSONObject getAVGSocre(String level, String area) {
        String sql = "SELECT ROUND(AVG(s.score),1) avgCount FROM wlyy_evaluate_score s ,wlyy_doctor d WHERE s.doctor = d.code ";
        String sql = "SELECT ifnull(ROUND(AVG(s.score),1),0) avgCount FROM wlyy_evaluate_score s ,wlyy_doctor d WHERE s.doctor = d.code ";
        //市级
        if ("4".equals(level)) {
            sql += " AND d.city = ? ";

File diff suppressed because it is too large
+ 268 - 145
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java


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

@ -163,6 +163,7 @@ public class SignPatientLabelInfoController extends BaseController {
            }
            JSONArray result = labelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize);
            //JSONArray result = labelInfoService.getPatientByLabel("xh1D201703150222", labelCode, labelType, teamCode, page, pagesize);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {

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

@ -222,7 +222,10 @@ public class DoctorFamilyContractController extends WeixinBaseController {
     */
    @RequestMapping(value = "/getPatientLables")
    @ResponseBody
    public String getPatientLables(String labelType, String level, String oldDoctorCode, Long teamCode) {
    public String getPatientLables( @RequestParam(required = false)String labelType,
                                    @RequestParam(required = false)String level,
                                    @RequestParam(required = false)String oldDoctorCode,
                                    @RequestParam(required = false)Long teamCode) {
        try {
            //修改年度服务类型1.3.4需求
            if ("1".equals(labelType)) {