Parcourir la source

海沧医院接口开发

wangzhinan il y a 1 an
Parent
commit
ae4184c667

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

@ -3914,7 +3914,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            WritableSheet ws;
            ws = wwb.createSheet("sheet", 1);
            String[] header = {"序号","充值时间","商户订单号","医院订单号","患者姓名","证件号码","就诊卡号","手机号码","金额","状态","业务类型","咨询方式","代问诊人","问诊医生"};
            String[] header = {"序号","充值时间","商户订单号","医院订单号","患者姓名","证件号码","就诊卡号","手机号码","自费金额","医保金额","状态","业务类型","咨询方式","代问诊人","问诊医生"};
            int k = 0;
            for (String h : header) {
                addCell(ws, 0, k, h);//表名,行,列,header
@ -3960,6 +3960,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        }else if (orderCategory.equals("5")) {
                            odry += "就诊卡充值";
                            odte += "就诊卡充值";
                        }else if (orderCategory.equals("6")) {
                            odry += "处方";
                            odte += "处方";
                        }else {
                            odry += " ";
                        }
@ -4030,11 +4033,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                addCell(ws, i, 6, (String) m.get("medicard")!=null?(String) m.get("medicard"):n);
                addCell(ws, i, 7, (String) m.get("mobile")!=null?(String) m.get("mobile"):n);
                addCell(ws, i, 8, pay!=null?pay:n);
                addCell(ws, i, 9, status!=null?status:n);
                addCell(ws, i, 10, odry!=null?odry:n);
                addCell(ws, i, 11, odte!=null?odte:n);
                addCell(ws, i, 12, (String) m.get("patientName")!=null?(String) m.get("patientName"):n);
                addCell(ws, i, 13, doctorName!=null?doctorName:n);
                addCell(ws, i, 9, m.get("medicalPrice")!=null?m.get("medicalPrice").toString():n);
                addCell(ws, i, 10, status!=null?status:n);
                addCell(ws, i, 11, odry!=null?odry:n);
                addCell(ws, i, 12, odte!=null?odte:n);
                addCell(ws, i, 13, (String) m.get("patientName")!=null?(String) m.get("patientName"):n);
                addCell(ws, i, 14, doctorName!=null?doctorName:n);
                i++;
            }
            wwb.write();
@ -15053,6 +15057,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }
                }
                object.put("getSettleInfo",ylzMedicalRelationDO);
                businessOrderService.ylzRechargePreYk(outpatientId,"WX_MIN",wechatId,null);
                return object;
            }else {
                BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
@ -15582,19 +15587,25 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<Map<String, Object>> selectPriceTotal(String startTime,String endTime){
        List<Map<String, Object>> mapList = new ArrayList<>();
        Map<String, Object> params = new HashedMap();
        String sql =" SELECT ORDER_CATEGORY as \"orderCategory\",\"SUM\"(PAY_PRICE)/100 as \"payPrice\" FROM BASE_BUSINESS_ORDER_PAY WHERE ORDER_CATEGORY IN(1,2,3,4)  and STATUS=1 ";
        String sql =" SELECT t.ORDER_CATEGORY as \"orderCategory\"," +
                "SUM(t.PAY_PRICE)/100 as \"payPrice\"," +
                "nvl(SUM(ymr.person_account),0) as \"personAccount\",\n" +
                "nvl(SUM(ymr.medical_price),0) as \"medicalPrice\", " +
                "nvl(SUM(ymr.medical_price),0)+nvl(SUM(ymr.person_account),0) as \"medicalPrice1\" "+
                " FROM BASE_BUSINESS_ORDER_PAY t" +
                " left join base_ylz_medical_relation ymr on ymr.id=t.relation_code WHERE t.ORDER_CATEGORY IN(1,2,3,4,6)  and t.STATUS=1 ";
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
            sql+=" and create_time <= to_date('" + endTime + "', 'yyyy-mm-dd hh24:mi:ss') ";
            sql+=" and t.create_time <= to_date('" + endTime + "', 'yyyy-mm-dd hh24:mi:ss') ";
        } else {
            sql+=" and create_time <='"+endTime+"' ";
            sql+=" and t.create_time <='"+endTime+"' ";
        }
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
            sql+=" and create_time >= to_date('" + startTime + "', 'yyyy-mm-dd hh24:mi:ss') ";
            sql+=" and t.create_time >= to_date('" + startTime + "', 'yyyy-mm-dd hh24:mi:ss') ";
        } else {
            sql+=" and create_time >='"+startTime+"' ";
            sql+=" and t.create_time >='"+startTime+"' ";
        }
        sql+=" GROUP BY ORDER_CATEGORY ";
        sql+=" GROUP BY t.ORDER_CATEGORY ";
        logger.info("sql="+sql);
        mapList = hibenateUtils.createSQLQuery(sql, params);
        return mapList;
@ -15632,10 +15643,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            String j2="";
            String j3 ="";
            String j4="";
            String price1 = "";
            String price2 = "";
            String price3 = "";
            String price4 = "";
            String price1 = "0";
            String price2 = "0";
            String price3 = "0";
            String price4 = "0";
            String price6 = "0";
            String medicalPrice= "0";
            String medicalPrice1= "0";
            for (Map<String, Object> m : ls) {
                if (m.get("orderCategory").toString().equalsIgnoreCase("1")){
                    j1 = m.get("orderCategory").toString();
@ -15649,11 +15663,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }else if (m.get("orderCategory").toString().equalsIgnoreCase("4")){
                    j4 = m.get("orderCategory").toString();
                    price4=m.get("payPrice").toString();
                    medicalPrice1 ="0";
                }else if (m.get("orderCategory").toString().equalsIgnoreCase("6")){
                    j4 = m.get("orderCategory").toString();
                    price6=m.get("payPrice").toString();
                    medicalPrice = m.get("medicalPrice1").toString();
                }
            }
            DecimalFormat df = new DecimalFormat("#.00");
            Double price5 =Double.parseDouble(price2)+Double.parseDouble(price3);
            String[] header2 = {"咨询费",df.format(Double.parseDouble(price1)),"复诊费",df.format(price5),"处方费",df.format(Double.parseDouble(price4))};//
            Double price7= Double.parseDouble(price4)+Double.parseDouble(price6);
            Double medicalPrices=Double.parseDouble(medicalPrice)+Double.parseDouble(medicalPrice1);
            String[] header2 = {"咨询费",df.format(Double.parseDouble(price1)),"复诊费",df.format(price5),"处方费","自费:"+price7+"医保:"+medicalPrices};//
            int k2 = 0;
            for (String h : header2) {
                addCell(ws, 2, k2, h);//表名,行,列,header
@ -15973,6 +15994,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }else {
                objectString.put("consumerName","");
            }
            List<YlzMedicalRelationDO> medicalRelationDOList = ylzMedicailRelationDao.findByOutpatientNoStatus(prescriptionDO.getOutpatientId());
            logger.info("prescriptionDO.getOutpatientId()"+prescriptionDO.getOutpatientId());
            DecimalFormat df = new DecimalFormat("#.00");
            if (medicalRelationDOList!=null&&medicalRelationDOList.size()!=0){
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(medicalRelationDOList.get(0).getId());
                Double personAccount = Double.parseDouble(medicalRelationDOList.get(0).getPersonAccount());
                Double medicalPrice = Double.parseDouble(medicalRelationDOList.get(0).getMedicalPrice());
                objectString.put("medicalPrice",personAccount+medicalPrice);
                objectString.put("price",businessOrderDO.getPayPrice()==0?businessOrderDO.getPayPrice():df.format(businessOrderDO.getPayPrice()/100));
            }else {
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(prescriptionDO.getId());
                objectString.put("medicalPrice",0);
                objectString.put("price",businessOrderDO.getPayPrice()==0?businessOrderDO.getPayPrice():df.format(businessOrderDO.getPayPrice()/100));
            }
            Map<String,Object> map = new HashedMap();
            map.put("prescription",objectString);
            mapList.add(map);
@ -16007,7 +16044,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                addCell(ws, 1, k1, h);//表名,行,列,header
                k1++;
            }
            String[] header2 = {"患者名称","代问诊人","订单药品","规格","总量","单位","进价","零售价","进货金额","零售金额","发药时间","审方时间","开方时间","开方医生"};//
            String[] header2 = {"患者名称","代问诊人","订单药品","规格","总量","单位","零售价","零售金额","医保金额","自费金额","发药时间","审方时间","开方时间","开方医生"};//
            int k2 = 0;
            for (String h : header2) {
                addCell(ws, 2, k2, h);//表名,行,列,header
@ -16031,13 +16068,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        addCell(ws, i, 3, object.get("specification")!=null?object.get("specification").toString():n);
                        addCell(ws, i, 4, object.get("quantity")!=null?object.get("quantity").toString():n);
                        addCell(ws, i, 5, object.get("packUnitName")!=null?object.get("packUnitName").toString():n);
                        addCell(ws, i, 6, "无");
                        addCell(ws, i, 7, object.get("packRetprice")!=null?object.get("packRetprice").toString():n);
                        addCell(ws, i, 8, "无");
                        addCell(ws, i, 6, object.get("packRetprice")!=null?object.get("packRetprice").toString():n);
                        if (object.get("quantity")!=null){
                            Double quantity = Double.parseDouble(object.get("quantity").toString());
                            Double packRetprice = Double.parseDouble(object.get("packRetprice").toString());
                            addCell(ws, i, 9,df.format(packRetprice*quantity));
                            addCell(ws, i, 7,df.format(packRetprice*quantity));
                        }else {
                            addCell(ws, i, 7,"");
                        }
                        if (jsonObject.get("medicalPrice")!=null){
                            addCell(ws, i, 8,jsonObject.getString("medicalPrice"));
                        }else {
                            addCell(ws, i, 8,"");
                        }
                        if (jsonObject.get("price")!=null){
                            addCell(ws, i, 9,jsonObject.getString("price"));
                        }else {
                            addCell(ws, i, 9,"");
                        }
@ -16045,20 +16090,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        addCell(ws, i, 11,jsonObject.get("checkTime")!=null?DateUtil.stampToString(jsonObject.get("checkTime").toString()):n);
                        addCell(ws, i, 12,jsonObject.get("createTime")!=null?DateUtil.stampToString(jsonObject.get("createTime").toString()):n);
                        addCell(ws, i, 13,jsonObject.get("doctorName")!=null?jsonObject.get("doctorName").toString():n);
                        i++;
                    }
                    ws.mergeCells(0,j,0,i-1);
                    ws.mergeCells(1,j,1,i-1);
                    ws.mergeCells(8,j,8,i-1);
                    ws.mergeCells(9,j,9,i-1);
                }else {
                    i++;
                }
            }
            ws.mergeCells(0,0,13,0);
            ws.mergeCells(0,1,13,1);
            ws.mergeCells(0,0,14,0);
            ws.mergeCells(0,1,14,1);
            wwb.write();
            wwb.close();
        } catch (IOException e) {

+ 6 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java

@ -1381,6 +1381,12 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            }
            if (flag){
                Double cash = Double.parseDouble(ylzMedicalRelationDO.getPersonCash());
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
                if (cash==0.0){
                    businessOrderDO.setStatus(1);
                    businessOrderDao.save(businessOrderDO);
                }
                ylzMedicalRelationDO.setState(1);
                ylzMedicalRelationDO.setSettleDate(new Date());
                ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);

+ 31 - 4
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -2386,7 +2386,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
     * @return
     * @throws Exception
     */
    public Map<String,Object> ylzRechargePreYk(String code,String depositType,String wechatId,String cardType,String cardNo,boolean demoFlag,String appletCode) throws Exception {
    public Map<String,Object> ylzRechargePreYk(String code,String depositType,String wechatId,String appletCode) throws Exception {
        try {
            WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
            if(wxWechatDO==null){
@ -2609,9 +2609,14 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                " t.yk_order_id as \"ykOrderId\","+
                " b.idcard as \"idcard\", "+
                " b.mobile as \"mobile\", "+
                " case t.order_category when '2' then '2' when '3' then '2' else t.order_category end  as \"orderCategory\" "+
                " case t.order_category when '2' then '2' when '3' then '2' else t.order_category end  as \"orderCategory\", "+
                "ymr.person_cash as \"personCash\",\n" +
                "ymr.person_account as \"personAccount\",\n" +
                "ymr.medical_price as \"medicalPrice\" "+
                " from base_business_order_pay t" +
                " left join base_patient b on t.patient = b.id  where 1=1  ";
                " left join base_patient b on t.patient = b.id" +
                " left join base_ylz_medical_relation ymr on ymr.id=t.relation_code "+
                "  where 1=1  ";
        if (StringUtils.isNoneBlank(startTime)){
            if("xm_ykyy_wx".equals(wechatId)){
                if (flag){
@ -2675,20 +2680,26 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    Double prie = price/100;
                    logger.info("price"+prie);
                    map.put("payPrice",prie);
                    map.put("medicalPrice",0);
                }if (orderCategoryFlag.equalsIgnoreCase("1")||orderCategoryFlag.equalsIgnoreCase("2")||orderCategoryFlag.equalsIgnoreCase("3")){
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(relationCode);
                    map.put("doctorName",outpatientDO.getDoctorName());
                    map.put("consumerName",outpatientDO.getConsumerName());
                    map.put("patientName",outpatientDO.getPatientName());
                    map.put("medicalPrice",0);
                }else if (orderCategoryFlag.equalsIgnoreCase("4")){
                    WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(relationCode);
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                    map.put("doctorName",outpatientDO.getDoctorName());
                    map.put("consumerName",outpatientDO.getConsumerName());
                    map.put("patientName",outpatientDO.getPatientName());
                    map.put("medicalPrice",0);
                }else if (orderCategoryFlag.equalsIgnoreCase("6")){
                    YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findOne(relationCode);
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(ylzMedicalRelationDO.getRelationCode());
                    Double personAccount = Double.parseDouble(map.get("personAccount").toString());
                    Double medicalPrice = Double.parseDouble(map.get("medicalPrice").toString());
                    map.put("medicalPrice",medicalPrice+personAccount);
                    map.put("doctorName",outpatientDO.getDoctorName());
                    map.put("consumerName",outpatientDO.getConsumerName());
                    map.put("patientName",outpatientDO.getPatientName());
@ -2734,10 +2745,14 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                "\tb.idcard AS \"idcard\",\n" +
                "\tb.mobile AS \"mobile\",\n" +
                "\tt. STATUS AS \"status\",\n" +
                "\tt.order_category AS \"orderCategory\"\n" +
                "\tt.order_category AS \"orderCategory\",\n" +
                "ymr.person_cash as \"personCash\",\n" +
                "ymr.person_account as \"personAccount\",\n" +
                "ymr.medical_price as \"medicalPrice\" "+
                "FROM\n" +
                "\tbase_business_order_pay t\n" +
                "LEFT JOIN base_patient b ON t.patient = b.id\n" +
                " left join base_ylz_medical_relation ymr on ymr.id=t.relation_code "+
                "WHERE\n" +
                "\t1 = 1";
        if (StringUtils.isNoneBlank(startTime)){
@ -2796,6 +2811,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql);
        for (Map<String,Object> map:mapList){
            if (map.get("orderCategory")!=null){
                map.put("medicalPrice",0);
                String orderCategoryFlag = map.get("orderCategory").toString();
                String relationCode =map.get("relationCode").toString();
                if (!orderCategoryFlag.equalsIgnoreCase("5")){
@ -2806,6 +2822,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                }
                if (orderCategoryFlag.equalsIgnoreCase("1")||orderCategoryFlag.equalsIgnoreCase("2")||orderCategoryFlag.equalsIgnoreCase("3")){
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(relationCode);
                    map.put("medicalPrice",0);
                    if (outpatientDO!=null){
                        map.put("doctorName",outpatientDO.getDoctorName());
                        map.put("consumerName",outpatientDO.getPatientName());
@ -2817,6 +2834,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                }else if (orderCategoryFlag.equalsIgnoreCase("4")){
                    WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(relationCode);
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                    map.put("medicalPrice",0);
                    if (outpatientDO!=null){
                        map.put("doctorName",outpatientDO.getDoctorName());
                        map.put("consumerName",outpatientDO.getPatientName());
@ -2824,6 +2842,15 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                        map.put("doctorName","");
                        map.put("consumerName","");
                    }
                }else if (orderCategoryFlag.equalsIgnoreCase("6")){
                    YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findOne(relationCode);
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(ylzMedicalRelationDO.getRelationCode());
                    Double personAccount = Double.parseDouble(map.get("personAccount").toString());
                    Double medicalPrice = Double.parseDouble(map.get("medicalPrice").toString());
                    map.put("medicalPrice",medicalPrice+personAccount);
                    map.put("doctorName",outpatientDO.getDoctorName());
                    map.put("consumerName",outpatientDO.getConsumerName());
                    map.put("patientName",outpatientDO.getPatientName());
                }
            }
        }

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -19,13 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
//==========mysql 环境 id策略======================================================
    @GeneratedValue(generator = "generator")
/*    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
    @Column(name = "id", unique = true, nullable = false)*/
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
/*   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 2 - 2
svr/svr-internet-hospital/pom.xml

@ -11,7 +11,7 @@
    </parent>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-internet-hospital</artifactId>
    <artifactId>svr-internet-hospital-test</artifactId>
    <packaging>jar</packaging>
    <version>${parent.version}</version>
@ -268,7 +268,7 @@
    </dependencies>
    <build>
        <finalName>svr-internet-hospital</finalName>
        <finalName>svr-internet-hospital-test</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>

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

@ -873,7 +873,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                @ApiParam(name = "businessType", value = "1查询2导出")
                                    @RequestParam(value = "businessType", required = false) String businessType,
                                 HttpServletResponse response) throws Exception {
        try{
            List<Map<String, Object>> list = new ArrayList<>();
            if (type.equalsIgnoreCase("1")){
                //收入日报
@ -920,11 +920,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                }
            }
            return success(list);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.selectListDrug)
@ -937,7 +934,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                @RequestParam(value = "endTime", required = false) String endTime,
                                @ApiParam(name = "businessType", value = "1查询2导出")
                                @RequestParam(value = "businessType", required = false) String businessType,
                                HttpServletResponse response) throws Exception {
                                HttpServletResponse response) {
        try{
            List<Map<String, Object>> list = new ArrayList<>();
            if (type.equalsIgnoreCase("1")){
@ -2177,7 +2174,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
                return ObjEnvelop.getSuccess("ok", businessOrderService.ylzRechargePreHc(relationCode, depositType, wxId, cardType, cardNo, demoFlag));
            } else if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
                return ObjEnvelop.getSuccess("ok", businessOrderService.ylzRechargePreYk(relationCode, depositType, wxId, cardType, cardNo, demoFlag,appletCode));
                return ObjEnvelop.getSuccess("ok", businessOrderService.ylzRechargePreYk(relationCode, depositType, wxId,appletCode));
            }
            return ObjEnvelop.getSuccess("ok", businessOrderService.ylzRechargePre(relationCode, depositType, wxId, cardType, cardNo, demoFlag));
        } catch (Exception e) {