Jelajahi Sumber

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangzhinan 5 tahun lalu
induk
melakukan
ce2b8765ca

+ 161 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -21,6 +21,7 @@ import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
@ -52,7 +53,9 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.PinYinUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
import com.yihu.mysql.query.BaseJpaService;
@ -1216,11 +1219,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public net.sf.json.JSONObject registerOutPatient(String outPatientId,String doctor)throws Exception{
        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outPatientId);
        
        
        DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(doctor,outpatientDO.getHospital());
        if(doctorMappingDO==null){
            throw new RuntimeException("未找到医生映射信息");
        }
        
        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
    
        Integer manageType = 1;//处理类型(1-新增 2-修改 3-删除) 必填
        //查找居民当天挂号记录
        String date = DateUtil.dateToStr(new Date(),"yyyy-MM-dd");
@ -1239,7 +1248,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                outpatientDO.setRegisterNo(registerDO.getRegisterNo());
                outpatientDO.setAdmDate(registerDO.getCreateTime());
                outpatientDao.save(outpatientDO);
                //调用电子病历注册
                manageType =2;
                registDianziBingli(outPatientId,basePatientDO,manageType);
                return res;
            }
        }
@ -1249,6 +1260,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        net.sf.json.JSONObject res = rs.getJSONObject("resquest");
        logger.info("挂号结果 res: " +res.toString());
        String rsCode = res.getString("@RESULT");
        
        if("0".equals(rsCode)){
            //存储挂号号
            // {"resquest":{"@RESULT":"0","@MSG":"完成","@serial_no":"47770476","@times":"28"}}
@ -1276,6 +1288,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            registerDO.setCreateTime(new Date());
            registerDO.setDate(DateUtil.dateToStr(new Date(),"yyyy-MM-dd"));
            patientRegisterDao.save(registerDO);
            
            
        }else if("-2".equals(rsCode)){
            String serialNo = (String)res.get("@serial_no");
@ -1303,6 +1317,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            patientRegisterDao.save(registerDO);
        }
    
        manageType = 1;//处理类型(1-新增 2-修改 3-删除) 必填
    
        registDianziBingli(outPatientId,basePatientDO,manageType);
        
            //保存日志
        WlyyHttpLogDO log = new WlyyHttpLogDO();
        log.setCode("registerOutPatient");
@ -1316,6 +1336,104 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        wlyyHttpLogDao.save(log);
        return res;
    }
    
    public String registDianziBingli(String outPatientId,BasePatientDO basePatientDO,Integer manageType) throws Exception {
    
        //调用电子病历接口注册居民信息
            String patientMappingCode =  patientMappingService.findHisPatNoByIdCard(basePatientDO.getIdcard());
            Map<String,String> params = new HashedMap();
            params.put("type","PatientInfo");
            String xmlStr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<HtRequest >" +
                    "<PatientInfo>" +
                    "<RecordFlow>"+outPatientId+"</RecordFlow >" +
                    "<PID>"+patientMappingCode+"</PID>" +
                    "<InsuranceNo>"+basePatientDO.getIdcard()+"</InsuranceNo>" +
                    "<PatientName>"+basePatientDO.getName()+"</PatientName>" +
                    "<TmpFlag>正式</TmpFlag>" +
                    "<LastName>"+basePatientDO.getName().substring(1,basePatientDO.getName().length())+"</LastName>" +
                    "<FirstName>"+basePatientDO.getName().substring(0,1)+"</FirstName>" +
                    "<PY>"+ PinYinUtils.getUpEname(basePatientDO.getName())+"</PY>" +
                    "<WB></WB>" +
                    "<SexCode>"+basePatientDO.getSex()+"</SexCode>";
            if(1 == basePatientDO.getSex()){
                xmlStr = xmlStr + "<Sex>男</Sex>";
            }else{
                xmlStr = xmlStr +  "<Sex>女</Sex>";
            }
        
            xmlStr = xmlStr +    "<DateOfBirth>"+DateUtil.dateToStrShort(IdCardUtil.getBirthdayForIdcard(basePatientDO.getIdcard()))+"</DateOfBirth>" +
                    "<TimeOfBirth></TimeOfBirth>" +
                    "<MarriageStatusCode></MarriageStatusCode>" +
                    "<MarriageStatus></MarriageStatus>" +
                    "<OccupationCode></OccupationCode>" +
                    "<Occupation></Occupation>" +
                    "<NationalityCode></NationalityCode>" +
                    "<Nationality></Nationality>" +
                    "<CountryCode>CN</CountryCode>" +
                    "<Country>中国</Country>" +
                    "<FormalSchoolingCode></FormalSchoolingCode>" +
                    "<FormalSchooling></FormalSchooling>" +
                    "<Religion></Religion>" +
                    "<BirthPlaceCode></BirthPlaceCode>" +
                    "<BirthPlace></BirthPlace>" +
                    "<NativePlaceCode></NativePlaceCode>" +
                    "<NativePlace></NativePlace>" +
                    "<BloodType></BloodType>" +
                    "<CertTypeCode>111</CertTypeCode>" +
                    "<CertType>身份证</CertType>" +
                    "<CertNo>"+basePatientDO.getIdcard()+"</CertNo>" +
                    "<PatientClassCode></PatientClassCode>" +
                    "<PatientClass></PatientClass>" +
                    "<FeeTypeCode></FeeTypeCode>" +
                    "<FeeType></FeeType>" +
                    "<Company></Company>" +
                    "<PublicExpenseNo></PublicExpenseNo>" +
                    "<ContractUnitCode></ContractUnitCode> " +
                    "<ContractUnit></ContractUnit>" +
                    "<BusinessAddressCode></BusinessAddressCode>" +
                    "<BusinessAddress></BusinessAddress>" +
                    "<BusinessPostCode></BusinessPostCode>" +
                    "<BusinessPhone></BusinessPhone>" +
                    "<HomeAddressCode></HomeAddressCode>" +
                    "<HomeAddress></HomeAddress>" +
                    "<HomePostCode></HomePostCode>" +
                    "<MobilePhone></MobilePhone>" +
                    "<Contact></Contact>" +
                    "<RelationCode></RelationCode>" +
                    "<Relation></Relation>" +
                    "<ContactEmail></ContactEmail>" +
                    "<ContactMethod></ContactMethod>" +
                    "<VIPType></VIPType>" +
                    "<OperatorID></OperatorID>" +
                    "<Operator></Operator>" +
                    "<OperatorTime>0</OperatorTime>" +
                    "<Available></Available>" +
                    "<ManageType>"+manageType+"</ManageType>" +
                    "<InsuranceTypeCode></InsuranceTypeCode>" +
                    "<InsuranceType></InsuranceType>" +
                    "<RegisteredAddressCode></RegisteredAddressCode>" +
                    "<RegisteredAddress></RegisteredAddress>" +
                    "<ContactAddressCode></ContactAddressCode>" +
                    "<ContactAddress></ContactAddress>" +
                    "<RegisteredPostCode></RegisteredPostCode>" +
                    "<ContactPostcode></ContactPostcode>" +
                    "<BloodType></BloodType>" +
                    "<RhBloodType></RhBloodType>" +
                    "</PatientInfo>" +
                    "</HtRequest>";
            String returnValue = "";
            params.put("xmlStr",xmlStr);
        
            returnValue = WebserviceUtil.post("http://192.10.33.34:9080/HtMzWebService/services/Manage",
                    "http://business.htemr.haitaiinc.com",
                    "manageAdt",
                    params);
        
            logger.info("调用电子病历注册接口请求成功,返回值xmlstr:"+returnValue);
            
            return returnValue;
    }
    /**
     * 获取诊断
@ -4460,4 +4578,46 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        logger.info("sql:"+sql);
        return list;
    }
    public List<Map<String,Object>> findDeptWithDoctorWorkTime(String hospital,String keyWord,Integer page,Integer pagesize ){
        String now = DateUtil.dateToStr(new Date(),"yyyy-MM-dd");
        Date startDate = DateUtil.stringToDate(now+" 00:00:00","yyyy-MM-dd HH:mm:ss");
        Date endDate = DateUtil.stringToDate(now+" 23:59:59","yyyy-MM-dd HH:mm:ss");
        String sql ="SELECT  " +
                " DISTINCT " +
                " h.dept_code AS \"deptCode\", " +
                " h.dept_name AS \"deptName\"," +
                " h.org_code AS \"orgCode\"," +
                " h.org_name AS \"orgName\"" +
                " FROM " +
                " base_doctor_hospital h " +
                " WHERE " +
                " EXISTS ( " +
                " SELECT " +
                "  w.doctor " +
                " FROM " +
                "  wlyy_doctor_work_time w " +
                " WHERE " +
                "  w.doctor = h.doctor_code " +
                " AND start_time >=:startTime " +
                " AND start_time <=:endDate " +
                " ) " +
                " AND h.dept_code IS NOT NULL " +
                " AND h.dept_code !=''";
        Map<String,Object> params = new HashedMap();
        params.put("startTime",startDate);
        params.put("endDate",endDate);
        if(StringUtils.isNotBlank(hospital)){
            sql +=" AND h.org_code =:hospital";
            params.put("hospital",hospital);
        }
        if(StringUtils.isNotBlank(keyWord)){
            sql +=" AND h.dept_name like:keyWord";
            params.put("keyWord","%"+keyWord+"%");
        }
        return hibenateUtils.createSQLQuery(sql,params,page,pagesize);
    }
}

+ 116 - 81
business/base-service/src/main/java/com/yihu/jw/internet/service/ykyy/YkyyInternetService.java

@ -32,6 +32,7 @@ import org.springframework.util.LinkedCaseInsensitiveMap;
import sun.misc.BASE64Encoder;
import java.io.*;
import java.math.BigDecimal;
import java.net.URL;
import java.util.Date;
import java.util.List;
@ -71,6 +72,7 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
    static String orgName = "厦门大学附属厦门眼科中心";
    static String orgArea = "350203000";
    static String orgSub = "350200000";
    static String imgPath =File.separator+"usr"+File.separator+"local"+File.separator+"hospital"+File.separator+"svr-internet-hospital-job"+File.separator+"img"+File.separator;
    public ObjectMapper objectMapper;
@ -145,13 +147,13 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
        jb.put("hospital_phone", "0592-2112111");
        jb.put("hospital_img","");
        jb.put("bus_lic", ImgUtils.getImageStr("C:\\Users\\Administrator\\Desktop\\眼科医院\\监管平台\\附件\\资质证明-营业执照\\营业执照.jpg"));
        jb.put("corp_idcord_head", ImgUtils.getImageStr("C:\\Users\\Administrator\\Desktop\\眼科医院\\监管平台\\附件\\法人身份证正反面\\a.jpg"));
        jb.put("corp_idcord_tail", ImgUtils.getImageStr("C:\\Users\\Administrator\\Desktop\\眼科医院\\监管平台\\附件\\法人身份证正反面\\b.jpg"));
        jb.put("pra_lic", ImgUtils.getImageStr("C:\\Users\\Administrator\\Desktop\\眼科医院\\监管平台\\附件\\执业许可证\\zyxkz.jpg"));
        jb.put("bus_lic", ImgUtils.getImageStr(imgPath+"hospital"+File.separator+"yyzz.jpg"));
        jb.put("corp_idcord_head", ImgUtils.getImageStr(imgPath+"hospital"+File.separator+"a.jpg"));
        jb.put("corp_idcord_tail", ImgUtils.getImageStr(imgPath+"hospital"+File.separator+"b.jpg"));
        jb.put("pra_lic", ImgUtils.getImageStr(imgPath+"hospital"+File.separator+"zyxkz.jpg"));
        jb.put("secu_level","3");
        jb.put("secu_level_cert",ImgUtils.getImageStr("C:\\Users\\Administrator\\Desktop\\眼科医院\\监管平台\\附件\\等保图片\\等保图片.jpg"));
        jb.put("secu_level_cert",ImgUtils.getImageStr(imgPath+"hospital"+File.separator+"dbtp.jpg"));
        jb.put("net_service", "1,3,4,5,7");
        jb.put("net_service_ot", "");
@ -349,10 +351,10 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                jb.put("net_service", "1,3,4,5,7,9,10");
                jb.put("cert_no",  info.get("cert_no")== null ? "0":info.get("cert_no"));
                jb.put("prac_no",  info.get("prac_no")== null ? "0":info.get("prac_no"));
                //资质证书
                jb.put("doc_cert",ImgUtils.getImageStr("D:"+ File.separator+"zstp"+File.separator+info.get("name")+File.separator+"zg.jpg"));
                //资格证书
                jb.put("doc_cert",ImgUtils.getImageStr(imgPath+"doctor"+ File.separator+info.get("name")+File.separator+"zg.jpg"));
                //执业证书
                jb.put("cert_doc_prac", ImgUtils.getImageStr("D:"+ File.separator+"zstp"+File.separator+info.get("name")+File.separator+"zy.jpg"));
                jb.put("cert_doc_prac", ImgUtils.getImageStr(imgPath+"doctor"+ File.separator+info.get("name")+File.separator+"zy.jpg"));
                jb.put("txt_introduction", "厦门大学附属厦门眼科中心成立于1997年11月8日,是集医疗、教学、科研、防盲为一体的三级甲等眼科医院、国家临床重点专科、国家药物临床试验机构。设有国家博士后科研工作站、院士专家工作站、全国住院医师规培基地、转化医学研究所等。");
            }catch (Exception e){
@ -431,11 +433,11 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                " WHERE 1=1" ;
        Map<String,Object> params = new HashedMap();
        if(StringUtils.isNotBlank(startDate)){
            sql =  sql + "  and reg.create_time >=:startDate ";
            sql =  sql + "  and p.create_time >=:startDate ";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(endDate)){
            sql =  sql +  "  and reg.create_time <=:endDate";
            sql =  sql +  "  and p.create_time <=:endDate";
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(keyId)){
@ -703,15 +705,7 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
        int error = 0;
        int dataError = 0;
       /* String sql = "select a.id,a.type,c.name as docName,c.idcard as docIdCard,c.id as docId\n" +
                "      ,b.patient,b.name as patientName,b.birthday,a.czrq,a.end_time\n" +
                "      ,a.symptoms,d.sex,d.mobile,d.idcard as patIdCard,d.city_code, e.dept_code, e.dept_name\n" +
                "  from wlyy_consult a \n" +
                "      ,wlyy_consult_team b\n" +
                "         JOIN base_doctor c on c.id = b.doctor\n" +
                "         JOIN base_patient d on d.id = b.patient\n" +
                "         JOIN base_doctor_hospital e on e.doctor_code = b.doctor\n" +
                " where a.id = b.consult AND a.symptoms <>'' AND a.symptoms IS NOT NULL ";*/
       String sql = "SELECT\n" +
               "\ta.id as \"id\",\n" +
               "\ta.type as \"type\",\n" +
@ -740,7 +734,7 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
               "JOIN topics t ON t.id = b.consult\n" +
               "WHERE\n" +
               "\ta.id = b.consult\n" +
               "AND a.symptoms IS NOT NULL AND b.status=1";
               " AND a.symptoms IS NOT NULL AND b.status=1 ";
        Map<String,Object> params = new HashedMap();
@ -787,7 +781,7 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
        for(int i=0; i<total; i++) {
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i);
            Map<String,Object> info = list.get(i);
            JSONObject jb = new JSONObject();
            Boolean errorFlag = false;
            try {
@ -898,22 +892,27 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                " where a.register_no is NOT NULL and a.dept is not null " +
                " and a.register_date is not null " ;
        Map<String,Object> params = new HashedMap();
        if(StringUtils.isNotBlank(startDate)){
            sql =  sql + "  and a.create_time >=  '" + startDate + "' ";
            sql =  sql + "  and a.create_time >=:startDate ";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(endDate)){
            sql =  sql +  "  and a.create_time < '" + endDate + "' ";
            sql =  sql +  "  and a.create_time <=:endDate";
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(keyId)){
            sql =  sql +  "  and a.id = '" + keyId + "' ";
            sql =  sql +  "  and  a.id =:keyId ";
            params.put("keyId",keyId);
        }
        List list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params);
        total = list.size();
        for(int i=0; i<list.size(); i++) {
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i);
            Map<String,Object> info = list.get(i);
            JSONObject jb = new JSONObject();
            Boolean errorFlag = false;
            try {
@ -1037,22 +1036,27 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                "     JOIN wlyy_outpatient p on p.id = a.outpatient_id  " +
                "  where  c.idcard is not null  and a.real_order is not null and p.icd10 is not null ";
        Map<String,Object> params = new HashedMap();
        if(StringUtils.isNotBlank(startDate)){
            sql =  sql + "  and a.create_time >=  '" + startDate + "' ";
            sql =  sql + "  and a.create_time >=:startDate ";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(endDate)){
            sql =  sql +  "  and a.create_time < '" + endDate + "' ";
            sql =  sql +  "  and a.create_time <=:endDate";
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(keyId)){
            sql =  sql +  "  and a.id = '" + keyId + "' ";
            sql =  sql +  "  and  a.id =:keyId ";
            params.put("keyId",keyId);
        }
        List list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params);
        total = list.size();
        for(int i=0; i<total; i++) {
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i);
            Map<String,Object> info = list.get(i);
            JSONObject jb = new JSONObject();
            Boolean errorFlag = false;
@ -1161,27 +1165,33 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                "    a.supply_code AS \"supply_code\"," +
                "    a.specification AS \"specification\"," +
                "    a.pack_retprice AS \"pack_retprice\"," +
                "    a.quantity AS \"quantity\"," +
                "    a.pack_retprice AS \"drug_total_price\"" +
                "  from wlyy_prescription_info a " +
                "     JOIN wlyy_prescription b " +
                "     on b.id = a.prescription_id" +
                "  where  a.dosage is not null and b.real_order is not null";
        Map<String,Object> params = new HashedMap();
        if(StringUtils.isNotBlank(startDate)){
            sql =  sql + "  and b.create_time >=  '" + startDate + "' ";
            sql =  sql + "  and b.create_time >=:startDate ";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(endDate)){
            sql =  sql +  "  and b.create_time < '" + endDate + "' ";
            sql =  sql +  "  and b.create_time <=:endDate";
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(keyId)){
            sql =  sql +  "  and a.id = '" + keyId + "' ";
            sql =  sql +  "  and  a.id =:keyId ";
            params.put("keyId",keyId);
        }
        List list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params);
        total = list.size();
        for(int i=0; i<total; i++) {
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i);
            Map<String,Object> info = list.get(i);
            JSONObject jb = new JSONObject();
            Boolean errorFlag = false;
            try {
@ -1201,7 +1211,11 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                jb.put("drug_use", info.get("supply_code") == null? "0": info.get("supply_code"));
                jb.put("standard_desc", info.get("specification") == null? "0": info.get("specification"));
                jb.put("single_price",info.get("pack_retprice") == null? 0: info.get("pack_retprice"));
                jb.put("drug_total_price",info.get("drug_total_price") == null? 0: info.get("drug_total_price"));
                BigDecimal pack_retprice = (BigDecimal)info.get("pack_retprice");
                Long quantity = Long.parseLong((String)info.get("quantity"));
                Double price = pack_retprice.doubleValue()*quantity;
                jb.put("drug_total_price",price);
                jb.put("comments", "");
                jb.put("anti_comments", "");
                jb.put("dec_meth_name", "");
@ -1248,21 +1262,28 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                "   p.disease_img AS \"disease_img\" " +
                " FROM wlyy_outpatient p " +
                " WHERE p.disease_img is not null ";
        Map<String,Object> params = new HashedMap();
        if(StringUtils.isNotBlank(startDate)){
            sql =  sql + "  and p.create_time >=  '" + startDate + "' ";
            sql =  sql + "  and p.create_time >=:startDate ";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(endDate)){
            sql =  sql +  "  and p.create_time < '" + endDate + "' ";
            sql =  sql +  "  and p.create_time <=:endDate";
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(keyId)){
            sql =  sql +  "  and p.id = '" + keyId + "' ";
            sql =  sql +  "  and  p.id =:keyId ";
            params.put("keyId",keyId);
        }
        List list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params);
        total = list.size();
        for(int i=0; i<total; i++) {
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i);
            Map<String,Object> info = list.get(i);
            String pathimg[] = ((String)info.get("disease_img")).split(",");
            if(pathimg!=null&&pathimg.length>0){
                for(String img:pathimg){
@ -1420,7 +1441,8 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
        return resInfo;
    }
    public String upNsInvokeTotal(String startDate, String endDate,String keyId) throws Exception {
    //14.数据上传汇总信息
    public String upNsInvokeTotal(String startDate, String endDate) throws Exception {
        String url = getUrl();
        String api = "micc.upNsInvokeTotal";
        String upid = getCode();
@ -1431,21 +1453,26 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
        int error = 0;
        int dataError = 0;
        //时间参数
        Map<String,Object> params = new HashedMap();
        //5.统计预约量
        String yyghSql = "SELECT " +
                "   count(1) AS \"yyghtotal\"" +
                " FROM wlyy_outpatient p " +
                " WHERE 1=1" ;
        if(StringUtils.isNotBlank(startDate)){
            yyghSql =  yyghSql + "  and reg.create_time >=  '" + startDate + "' ";
            yyghSql =  yyghSql + "  and p.create_time >=:startDate ";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(endDate)){
            yyghSql =  yyghSql +  "  and reg.create_time < '" + endDate + "' ";
            yyghSql =  yyghSql +  "  and p.create_time <=:endDate";
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        List<Map<String,Object>> yygh = hibenateUtils.createSQLQuery(yyghSql);
        List<Map<String,Object>> yygh = hibenateUtils.createSQLQuery(yyghSql,params);
        Long yyghtotal = 0L;
        if(yyghtotal!=null){
        if(yygh!=null&&yygh.size()>0){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            yyghtotal = hibenateUtils.objTransformLong(yygh.get(0).get("yyghtotal"));
        }
@ -1461,14 +1488,15 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                " e.score_type = '4'";
        if(StringUtils.isNotBlank(startDate)){
            yypjSql =  yypjSql + "  and a.create_time >=  '" + startDate + "' ";
            yypjSql =  yypjSql + "  and a.create_time >=:startDate ";
        }
        if(StringUtils.isNotBlank(endDate)){
            yypjSql =  yypjSql +  "  and a.create_time < '" + endDate + "' ";
            yypjSql =  yypjSql +  "  and a.create_time <=:endDate";
        }
        List<Map<String,Object>> yypj = hibenateUtils.createSQLQuery(yypjSql);
        List<Map<String,Object>> yypj = hibenateUtils.createSQLQuery(yypjSql,params);
        Long yypjtotal = 0L;
        if(yyghtotal!=null){
        if(yypj!=null&&yypj.size()>0){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            yypjtotal = hibenateUtils.objTransformLong(yypj.get(0).get("yypjtotal"));
        }
@ -1488,14 +1516,15 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                "AND a.symptoms IS NOT NULL AND b.status=1";
        if(StringUtils.isNotBlank(startDate)){
            wlzxSql =  wlzxSql + "  and a.czrq >=  '" + startDate + "' ";
            wlzxSql =  wlzxSql + "  and a.czrq >=:startDate ";
        }
        if(StringUtils.isNotBlank(endDate)){
            wlzxSql =  wlzxSql +  "  and a.czrq < '" + endDate + "' ";
            wlzxSql =  wlzxSql +  "  and a.czrq <=:endDate";
        }
        List<Map<String,Object>> wlzx = hibenateUtils.createSQLQuery(wlzxSql);
        List<Map<String,Object>> wlzx = hibenateUtils.createSQLQuery(wlzxSql,params);
        Long wlzxtotal = 0L;
        if(yyghtotal!=null){
        if(wlzx!=null&&wlzx.size()>0){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            wlzxtotal = hibenateUtils.objTransformLong(wlzx.get(0).get("wlzxtotal"));
        }
@ -1508,16 +1537,16 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                "      join base_patient c on c.id = a.patient" +
                " where a.register_no is NOT NULL and a.dept is not null " +
                " and a.register_date is not null " ;
        if(StringUtils.isNotBlank(startDate)){
            wlzlSql =  wlzlSql + "  and a.create_time >=  '" + startDate + "' ";
            wlzlSql =  wlzlSql + "  and a.create_time >=:startDate ";
        }
        if(StringUtils.isNotBlank(endDate)){
            wlzlSql =  wlzlSql +  "  and a.create_time < '" + endDate + "' ";
            wlzlSql =  wlzlSql +  "  and a.create_time <=:endDate";
        }
        List<Map<String,Object>> wlzl = hibenateUtils.createSQLQuery(wlzlSql);
        List<Map<String,Object>> wlzl = hibenateUtils.createSQLQuery(wlzlSql,params);
        Long wlzltotal = 0L;
        if(yyghtotal!=null){
        if(wlzl!=null&&wlzl.size()>0){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            wlzltotal = hibenateUtils.objTransformLong(wlzl.get(0).get("wlzltotal"));
        }
@ -1532,14 +1561,15 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                "  where  c.idcard is not null  and a.real_order is not null and p.icd10 is not null ";
        if(StringUtils.isNotBlank(startDate)){
            dzcfsql =  dzcfsql + "  and a.create_time >=  '" + startDate + "' ";
            dzcfsql =  dzcfsql + "  and a.create_time >=:startDate ";
        }
        if(StringUtils.isNotBlank(endDate)){
            dzcfsql =  dzcfsql +  "  and a.create_time < '" + endDate + "' ";
            dzcfsql =  dzcfsql +  "  and a.create_time <=:endDate";
        }
        List<Map<String,Object>> dzcf = hibenateUtils.createSQLQuery(dzcfsql);
        List<Map<String,Object>> dzcf = hibenateUtils.createSQLQuery(dzcfsql,params);
        Long dzcftotal = 0L;
        if(yyghtotal!=null){
        if(dzcf!=null&&dzcf.size()>0){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            dzcftotal = hibenateUtils.objTransformLong(dzcf.get(0).get("dzcftotal"));
        }
@ -1551,15 +1581,16 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                "     JOIN wlyy_prescription b " +
                "     on b.id = a.prescription_id" +
                "  where  a.dosage is not null and b.real_order is not null";
        if(StringUtils.isNotBlank(startDate)){
            infosql =  infosql + "  and b.create_time >=  '" + startDate + "' ";
            infosql =  infosql + "  and b.create_time >=:startDate ";
        }
        if(StringUtils.isNotBlank(endDate)){
            infosql =  infosql +  "  and b.create_time < '" + endDate + "' ";
            infosql =  infosql +  "  and b.create_time <=:endDate";
        }
        List<Map<String,Object>> info = hibenateUtils.createSQLQuery(infosql);
        List<Map<String,Object>> info = hibenateUtils.createSQLQuery(infosql,params);
        Long infototal = 0L;
        if(yyghtotal!=null){
        if(info!=null&&info.size()>0){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            infototal = hibenateUtils.objTransformLong(info.get(0).get("infototal"));
        }
@ -1569,16 +1600,17 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                "   count(1) AS \"gctptotal\"" +
                " FROM wlyy_outpatient p " +
                " WHERE p.disease_img is not null ";
        if(StringUtils.isNotBlank(startDate)){
            gctpsql =  gctpsql + "  and p.create_time >=  '" + startDate + "' ";
            gctpsql =  gctpsql + "  and p.create_time >=:startDate ";
        }
        if(StringUtils.isNotBlank(endDate)){
            gctpsql =  gctpsql +  "  and p.create_time < '" + endDate + "' ";
            gctpsql =  gctpsql +  "  and p.create_time <=:endDate";
        }
        List<Map<String,Object>> gctp = hibenateUtils.createSQLQuery(gctpsql);
        List<Map<String,Object>> gctp = hibenateUtils.createSQLQuery(gctpsql,params);
        Long gctptotal = 0L;
        if(yyghtotal!=null){
        if(gctp!=null&&gctp.size()>0){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            gctptotal = hibenateUtils.objTransformLong(gctp.get(0).get("gctptotal"));
        }
@ -1587,9 +1619,10 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
        Boolean errorFlag = false;
        try {
            jb.put("id_ws_invoke_total",upid);
            jb.put("organ_code", orgCode);
            jb.put("organ_name",orgName);
            jb.put("org_code", orgCode);
            jb.put("org_name",orgName);
            jb.put("wsyy_upload_count", yyghtotal);
            jb.put("zxyj_upload_count", 0);
            jb.put("yspj_upload_count", yypjtotal);
            jb.put("wlzx_upload_count", wlzxtotal);
            jb.put("wlzl_upload_count", wlzltotal);
@ -1597,15 +1630,17 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
            jb.put("ypmx_upload_count", infototal);
            jb.put("gctp_upload_count", gctptotal);
            jb.put("ywsj", DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
            jb.put("ywsj", DateUtil.dateToStr(new Date(),"yyyy-MM-dd"));
            jb.put("crt_time", DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
        }catch (Exception e){
            errorFlag = true;
            saveErrorLog(upid,"13",upid,res,1);
            saveErrorLog(upid,"14",upid,res,1);
            dataError++;
            logger.error(e.toString());
        }
        logger.info(jb.toString());
        if(!errorFlag){
            JSONArray jsonArray = new JSONArray();
            jsonArray.add(jb);
@ -1615,13 +1650,13 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
            if("200".equals(resJson.get("msg").toString())){
                success++;
            }else{
                saveErrorLog(upid,"13",upid,res,2);
                saveErrorLog(upid,"14",upid,res,2);
                error++;
            }
        }
        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条。";
        saveUpLog(upid,"13",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"),success,error,dataError,resInfo);
        saveUpLog(upid,"14",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"),success,error,dataError,resInfo);
        return resInfo;
    }

+ 4 - 1
business/base-service/src/main/java/com/yihu/jw/utils/ImgUtils.java

@ -78,6 +78,9 @@ public class ImgUtils {
        }
        //对字节数组Base64编码
        BASE64Encoder encoder = new BASE64Encoder();
        return encoder.encode(data);//返回Base64编码过的字节数组字符串
        if(data!=null){
            return encoder.encode(data);//返回Base64编码过的字节数组字符串
        }
        return "0";
    }
}

+ 62 - 0
business/base-service/src/main/java/com/yihu/jw/utils/PinYinUtils.java

@ -0,0 +1,62 @@
package com.yihu.jw.utils;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
/**
 * @author huangwenjie
 * @date 2020/3/13 09:32
 */
public class PinYinUtils {
	 //将中文转换为英文
	public static String getEname(String name) throws  Exception
    {
		HanyuPinyinOutputFormat pyFormat = new HanyuPinyinOutputFormat();
		pyFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
		pyFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
		pyFormat.setVCharType(HanyuPinyinVCharType.WITH_V);
		
		return PinyinHelper.toHanyuPinyinString(name, pyFormat, "");
	}
	
	//姓、名的第一个字母需要为大写
	public static String getUpEname(String name) throws  Exception {
		char[] strs = name.toCharArray();
		String newname = null;
		
		//名字的长度
		if (strs.length == 2) {
			newname = toUpCase(getEname("" + strs[0])) + " "
					+ toUpCase(getEname("" + strs[1]));
		} else if (strs.length == 3)
		{
			newname = toUpCase(getEname("" + strs[0])) + " "
					+ toUpCase(getEname("" + strs[1] + strs[2]));
		}
		else if (strs.length == 4)
		{
			newname = toUpCase(getEname("" + strs[0] + strs[1])) + " "
					+ toUpCase(getEname("" + strs[2] + strs[3]));
		} else
		{
			newname = toUpCase(getEname(name));
		}
		return newname;
	}
	
	//首字母大写
	private static String toUpCase(String str) {
		StringBuffer newstr = new StringBuffer();
		newstr.append((str.substring(0, 1)).toUpperCase()).append(
				str.substring(1, str.length()));
		
		return newstr.toString();
	}
	public static void main(String[] args)  throws  Exception{
		System.out.println(getUpEname("李宇春"));
		
	}
}

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -43,7 +43,7 @@ public class WxTemplateService {
    @Autowired
    private WeixinMessagePushUtils weixinMessagePushUtils;
    
    @Value("${wechat.id}")
    private String wechatId;
    

+ 3 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -356,6 +356,9 @@ public class BaseHospitalRequestMapping {
        public static final String findPatientRecord = "/findPatientRecord";
        public static final String findDoctorByName = "/findDoctorByName";
        public static final String findDeptWithDoctorWorkTime = "/findDeptWithDoctorWorkTime";
    }

File diff ditekan karena terlalu besar
+ 63 - 63
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/UpPrescription.java


+ 15 - 11
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -407,7 +407,7 @@ public class JobController extends BaseController {
    @RequestMapping(value = "/ykyyUpload", method = RequestMethod.GET)
    @ApiOperation("上传")
    public String ykyyUpload(String id) {
    public String ykyyUpload(String id,String startDate,String endDate,String keyId) {
        try {
            switch(id){
                case "2.2" :
@ -415,43 +415,47 @@ public class JobController extends BaseController {
                    break; //可选
                case "2.3" :
                    //语句
                    ykyyInternetService.upNsDoctorRecord(null);
                    ykyyInternetService.upNsDoctorRecord(keyId);
                    break; //可选
                case "2.5" :
                    //语句
                    ykyyInternetService.upAppointmentOnline(null,null,null);
                    ykyyInternetService.upAppointmentOnline(startDate,endDate,keyId);
                    break; //可选
                case "2.6" :
                    //语句
                    ykyyInternetService.upMedicalOnline(null,null,null);
                    ykyyInternetService.upMedicalOnline(startDate,endDate,keyId);
                    break; //可选
                case "2.7" :
                    //语句
                    ykyyInternetService.upNsDoctorScore(null,null,null);
                    ykyyInternetService.upNsDoctorScore(startDate,endDate,keyId);
                    break; //可选upNsDoctorScore
                case "2.8" :
                    //语句
                    ykyyInternetService.upNsOnlineAsk(null,null,null);
                    ykyyInternetService.upNsOnlineAsk(startDate,endDate,keyId);
                    break; //可选
                case "2.9" :
                    //语句
                    ykyyInternetService.upNsOnlineMed(null,null,null);
                    ykyyInternetService.upNsOnlineMed(startDate,endDate,keyId);
                    break; //可选
                case "2.10" :
                    //语句
                    ykyyInternetService.upPrescription(null,null,null);
                    ykyyInternetService.upPrescription(startDate,endDate,keyId);
                    break; //可选
                case "2.11" :
                    //语句
                    ykyyInternetService.upPrescriptionDrug(null,null,null);
                    ykyyInternetService.upPrescriptionDrug(startDate,endDate,keyId);
                    break; //可选
                case "2.12" :
                    //语句
                    ykyyInternetService.upNsOnlineImg(null,null,null);
                    ykyyInternetService.upNsOnlineImg(startDate,endDate,keyId);
                    break; //可选
                case "2.13" :
                    //语句
                    ykyyInternetService.upNsOrganProtocol(null,null,null);
                    ykyyInternetService.upNsOrganProtocol(startDate,endDate,keyId);
                    break; //可选
                case "2.14" :
                    //语句
                    ykyyInternetService.upNsInvokeTotal(startDate,endDate);
                    break; //可选
                default : //可选
                    //语句

+ 11 - 1
svr/svr-internet-hospital-job/src/main/resources/application.yml

@ -76,6 +76,8 @@ im:
  data_base_name: im_internet_hospital
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
---
spring:
  profiles: jwtest
@ -102,6 +104,8 @@ fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
---
spring:
  profiles: jwOracleTest
@ -135,6 +139,8 @@ fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
---
spring:
  profiles: jwOracleProd
@ -168,6 +174,8 @@ fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
---
spring:
  profiles: jwprod
@ -193,4 +201,6 @@ im:
fastDFS:
  fastdfs_file_url: http://192.0.33.26:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段

+ 12 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -956,5 +956,16 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(prescriptionService.findDoctorByName(hospital,name,chargeType));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptWithDoctorWorkTime)
    @ApiOperation(value = "获取带排班部门")
    public ListEnvelop findDeptWithDoctorWorkTime(@ApiParam(name = "hospital", value = "医院code")
                                                  @RequestParam(value = "hospital",required = false)String hospital,
                                                  @ApiParam(name = "keyWord", value = "科室关键字")
                                                  @RequestParam(value = "keyWord",required = false)String keyWord,
                                                  @ApiParam(name = "page", value = "第几页")
                                                  @RequestParam(value = "page",required = false)Integer page,
                                                  @ApiParam(name = "pagesize", value = "每页大小")
                                                  @RequestParam(value = "pagesize",required = false)Integer pagesize) {
        return success(prescriptionService.findDeptWithDoctorWorkTime(hospital,keyWord,page,pagesize));
    }
}