Browse Source

Merge branch 'dev' of yeshijie/wlyy2.0 into dev

叶仕杰 4 years ago
parent
commit
6e49a70fac

+ 42 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java

@ -431,7 +431,7 @@ public class DoorOrderController extends BaseController {
    }
    @ApiOperation("导出工单到excel")
    @GetMapping(value = "/doorOrderOutExcel")
    @GetMapping(value = "excelControl/doorOrderOutExcel")
    public void doorOrderOutExcel(
            @ApiParam(value = "工单id", name = "orderId",required = false)
            @RequestParam(value = "orderId", required = false) String orderId,
@ -1280,6 +1280,47 @@ public class DoorOrderController extends BaseController {
        }
    }
    @ApiOperation("批量导出服务小结到word-----pathName  本地测试和线上不一样")
    @RequestMapping(value = "excelControl/exportConclusionList", method = RequestMethod.GET)
    public void writeWordFileList(
            @ApiParam(value = "医生的code", name = "doctorCode",required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(value = "状态 ;  5-需要,待补录   6-已完成", name = "status",required = false) @RequestParam(value = "status", required = false) Integer status,
            HttpServletResponse response) throws Exception {
        try {
            List<Map<String,Object>> list = doorOrderService.getOrderIdList(status,doctorCode);
            if (list.size()<0){
                response.setStatus(500);
            }else {
                List<String> list1 = new ArrayList<>();
                for (int i=0;i<list.size();i++){
                    list1.add(list.get(i).get("orderId").toString());
                }
                File file = doorOrderService.writeWordFile(list1,response);
                if (file != null) {
                    response.setCharacterEncoding("utf-8");
                    response.setContentType("multipart/form-data");
                    response.setHeader("Content-Disposition", "attachment;fileName=service_summary.zip");
                    InputStream inputStream = new FileInputStream(file);
                    OutputStream outputStream = response.getOutputStream();
                    byte[] b = new byte[2048];
                    int length = 0;
                    while ((length = inputStream.read(b)) > 0) {
                        outputStream.write(b, 0, length);
                    }
                    outputStream.flush();
                    outputStream.close();
                    inputStream.close();
                } else {
                    response.setStatus(500);
                }
            }
        } catch (Exception e) {
            response.setStatus(500);
        }
    }
    @ApiOperation("推送知情同意書")
    @RequestMapping(value = "/sendInformedConsent" , method = RequestMethod.GET)
    public String sendInformedConsent(   @ApiParam(value = "医生code", name = "doctor")

+ 10 - 18
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorOrderService.java

@ -23,7 +23,6 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import jxl.Workbook;
import jxl.write.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.jsoup.Jsoup;
@ -774,11 +773,10 @@ public class DoorOrderService {
        WritableWorkbook book = null;
        OutputStream os = null;
        try {
            String sql = "select DISTINCT o.id as orderId,o.number,o.status,f.hospital,f.hospital_name as hospitalName1,o.is_trans_other_org," +
                    " o.transed_org_code,h.name as hospitalName2,o.patient_name,f.idcard,o.doctor_sign_time,o.total_fee," +
            String sql = "select DISTINCT o.id as orderId,o.number,o.status,o.is_trans_other_org," +
                    " o.transed_org_code,o.patient_name,p.idcard,o.doctor_sign_time,o.total_fee," +
                    " o.patient_phone,o.remark,o.create_time,o.patient as patientCode from wlyy_door_service_order o " +
                    " LEFT JOIN wlyy_sign_family f ON f.patient = o.patient AND f. STATUS = 1 AND f.expenses_status = 1 " +
                    " LEFT JOIN base_org h on h.code=o.transed_org_code and h.del=1 " ;
                    " LEFT JOIN base_patient p on p.id=o.patient " ;
            if(!StringUtils.isEmpty(serverDoctorName)){
                sql+=" RIGHT JOIN wlyy_door_doctor d on d.order_id = o.id";
            }
@ -793,11 +791,13 @@ public class DoorOrderService {
            if (!StringUtils.isEmpty(patientPhone)) {
                sql += " and o.patient_phone ='" + patientPhone + "'";
            }
            if (StringUtils.isNotBlank(hospitalCode) && !hospitalCode.contains("%")) {
                sql += " and (f.hospital = '" + hospitalCode + "' or o.transed_org_code='" + hospitalCode + "') ";
/*            if (StringUtils.isNotBlank(hospitalCode) && !hospitalCode.contains("%")) {
//                sql += " and (h.code = '" + hospitalCode + "' or o.transed_org_code='" + hospitalCode + "') ";
                sql += " and ( o.transed_org_code='" + hospitalCode + "') ";
            }else if(StringUtils.isNotBlank(hospitalCode) && hospitalCode.contains("%")){
                sql += " and (f.hospital like '" + hospitalCode + "' or o.transed_org_code like '" + hospitalCode + "') ";
            }
//                sql += " and (h.code like '" + hospitalCode + "' or o.transed_org_code like '" + hospitalCode + "') ";
                sql += " and ( o.transed_org_code like '" + hospitalCode + "') ";
            }*/
            if (status != null) {
                sql += " and o.status ='" + status + "'";
            }
@ -889,14 +889,7 @@ public class DoorOrderService {
                sheet.addCell(new Label(1, b + 1, statusName,cellFormat));//工单状态
                //工单是否转给其他机构,0-不转,1-已转
                String transOtherOrg = list.get(i).get("is_trans_other_org") + "";
                String hospitalName = null;
                if ("0".equals(transOtherOrg)) {
                    hospitalName = list.get(i).get("hospitalName1") + "";//签约表中的机构
                } else if ("1".equals(transOtherOrg)) {
                    hospitalName = list.get(i).get("hospitalName2") + "";//转机构中的机构
                }else if("null".equals(transOtherOrg)){
                    hospitalName = list.get(i).get("hospitalName1") + "";//签约表中的机构
                }
                String hospitalName = "泰安市中医医院";
                sheet.addCell(new Label(2, b + 1, hospitalName,cellFormat));//服务机构
                Date createTime = (Date) list.get(i).get("create_time");
@ -1773,7 +1766,6 @@ public class DoorOrderService {
   public List<Map<String,Object>> getOrderIdList(Integer status,String doctorCode){
       String sqlList = "select DISTINCT o.id as orderId";
       String sql = " from wlyy_door_service_order o " +
               " LEFT JOIN wlyy_sign_family f ON f.patient = o.patient AND f. STATUS = 1 AND f.expenses_status = 1 " +
               " LEFT JOIN base_org h on h.code=o.hospital and h.del=1 "
               +" LEFT JOIN wlyy_door_doctor d on d.order_id = o.id ";
       sql+= " where 1=1 ";

+ 42 - 25
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/ServerPackageService.java

@ -6,6 +6,7 @@ import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -25,7 +26,8 @@ public class ServerPackageService  {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Value("${wechat.id}")
    private String wxId;
    /**
@ -85,30 +87,45 @@ public class ServerPackageService  {
//            HospitalMapping hospitalMapping = hospitalMappingDao.findByCode(hospital);
//            buffer.append(" and ziocad.org_code = '"+hospitalMapping.getMappingCode()+"'");
        }
        String sql ="SELECT " +
                "ziocad.org_code AS hospital," +
                "zicd.clinic_code AS diagnosis_code," +
                "zicd.clinic_code AS code," +
                "zicd.clinic_name AS title," +
                "zicd.clinic_spec AS spec," +
                "zicd.clinic_unit AS unit," +
                "ziccad.allot_quantity AS quantity," +
                "zicd.subject_class AS subjectClass," +
                "ziccad.item_code AS itemCode," +
                " SUBSTR(zicd.subject_class, 1, 4) AS subjectCatagory," +
                " (CASE WHEN ISNULL(ziocd.price) THEN 0 ELSE ziocd.price END) as expense " +
                " FROM zy_iv_org_clinic_allot_dict ziocad " +
                " LEFT JOIN zy_iv_clinic_charge_allot_dict ziccad ON ziccad.clinic_code = ziocad.clinic_code AND ziccad.org_code = ziocad.org_code" +
                " LEFT JOIN zy_iv_clinic_dict zicd ON zicd.clinic_code = ziocad.clinic_code" +
                " LEFT JOIN zy_iv_org_charge_allot_dict ziocd ON ziocd.charge_code = ziccad.item_code and ziocd.org_code = ziccad.org_code  " ;
        if("used".equals(type)){
            sql += " LEFT JOIN wlyy_door_order_item i on i.code = zicd.clinic_code and (i.patient = '"+patient+"' or i.doctor='"+doctor+"') ";
            sql += " WHERE SUBSTR(zicd.subject_class, 1, 4) = '"+type+"' ";
        }else{
            sql += " WHERE SUBSTR(zicd.subject_class, 1, 4) = '"+type+"' ";
        String sql = "";
        if("sd_tnzyy_wx".equals(wxId)){
            sql = "SELECT a.FYXH code,a.FYMC title,a.FYDW unit,a.FYDJ expense from gy_ylsf a ";
            if("used".equals(type)){
                sql += " JOIN wlyy_door_order_item i on i.code = a.FYXH and (i.patient = '"+patient+"' or i.doctor='"+doctor+"') ";
            }else if("other".equals(type)){
                sql = " where a.FYGB not in (SELECT code from base_system_dict_entry WHERE dict_code = 'door_service_subject_class_dict')";
            }else{
                sql += " WHERE a.FYGB ="+type;
            }
        }else {
            sql ="SELECT " +
                    "ziocad.org_code AS hospital," +
                    "zicd.clinic_code AS diagnosis_code," +
                    "zicd.clinic_code AS code," +
                    "zicd.clinic_name AS title," +
                    "zicd.clinic_spec AS spec," +
                    "zicd.clinic_unit AS unit," +
                    "ziccad.allot_quantity AS quantity," +
                    "zicd.subject_class AS subjectClass," +
                    "ziccad.item_code AS itemCode," +
                    " SUBSTR(zicd.subject_class, 1, 4) AS subjectCatagory," +
                    " (CASE WHEN ISNULL(ziocd.price) THEN 0 ELSE ziocd.price END) as expense " +
                    " FROM zy_iv_org_clinic_allot_dict ziocad " +
                    " LEFT JOIN zy_iv_clinic_charge_allot_dict ziccad ON ziccad.clinic_code = ziocad.clinic_code AND ziccad.org_code = ziocad.org_code" +
                    " LEFT JOIN zy_iv_clinic_dict zicd ON zicd.clinic_code = ziocad.clinic_code" +
                    " LEFT JOIN zy_iv_org_charge_allot_dict ziocd ON ziocd.charge_code = ziccad.item_code and ziocd.org_code = ziccad.org_code  " ;
            if("used".equals(type)){
                sql += " LEFT JOIN wlyy_door_order_item i on i.code = zicd.clinic_code and (i.patient = '"+patient+"' or i.doctor='"+doctor+"') ";
                sql += " WHERE SUBSTR(zicd.subject_class, 1, 4) = '"+type+"' ";
            }else{
                sql += " WHERE SUBSTR(zicd.subject_class, 1, 4) = '"+type+"' ";
            }
            sql += buffer;
        }
        sql += buffer;
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        return mapList;
@ -116,7 +133,7 @@ public class ServerPackageService  {
    public List<Map<String,Object>> selectTypes(){
        String sql = "SELECT code,value type from base_system_dict_entry WHERE dict_code = 'PROFESSIONAL_STATE' ORDER BY sort";
        String sql = "SELECT code,value type from base_system_dict_entry WHERE dict_code = 'door_service_subject_class_dict' ORDER BY sort";
        List<Map<String,Object>> mapList1 = jdbcTemplate.queryForList(sql);
        Map<String,Object> map1 = new HashedMap();
        map1.put("code","used");

+ 4 - 4
svr/svr-door-serivce/src/main/resources/application.yml

@ -101,7 +101,7 @@ wechat:
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fweixin.xmtyw.cn%2fwlyy-dev
  accId: gh_ffd64560fb21
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  id: sd_tnzyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
im:
@ -181,7 +181,7 @@ wechat:
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fehr.yihu.com%2fwlyy
  accId: gh_ffd64560fb21
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  id: sd_tnzyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
im:
@ -260,8 +260,8 @@ wechat:
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fwww.xmtyw.cn%2fwlyy
  accId: gh_ffd64560fb21
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
  id: sd_tnzyy_wx  # base库中,wx_wechat 的id字段
  flag: true #演示环境  true走Mysql数据库  false走Oracle
im:
  im_list_get: http://27.155.101.77:3000/