Преглед на файлове

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

ysj преди 4 години
родител
ревизия
6be2d0380f
променени са 26 файла, в които са добавени 561 реда и са изтрити 182 реда
  1. 6 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDiagnosisDao.java
  2. 7 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionInfoDao.java
  3. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionLogDao.java
  4. 8 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/WlyyInspectionDao.java
  5. 16 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionLogService.java
  6. 94 59
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  7. 1 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  8. 135 57
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  9. 27 3
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  10. 2 2
      business/base-service/src/main/java/com/yihu/jw/internet/service/DataGeneratorService.java
  11. 11 3
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  12. 28 1
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  13. 36 18
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java
  14. 7 4
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  15. 15 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionInfoDO.java
  16. 2 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  17. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionInfoVO.java
  18. 54 0
      svr/svr-base/src/main/resources/application.yml
  19. 14 0
      svr/svr-base/src/main/resources/bootstrap.yml
  20. 6 2
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/XzzxCotroller.java
  21. 5 4
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java
  22. 43 16
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java
  23. 13 5
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  24. 2 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  25. 14 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  26. 4 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ylz/YlzNotifyController.java

+ 6 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDiagnosisDao.java

@ -13,9 +13,14 @@ import java.util.List;
 */
public interface PrescriptionDiagnosisDao extends PagingAndSortingRepository<WlyyPrescriptionDiagnosisDO, String>, JpaSpecificationExecutor<WlyyPrescriptionDiagnosisDO> {
    List<WlyyPrescriptionDiagnosisDO> findByPrescriptionId(String prescriptionId);
    @Query("select a from WlyyPrescriptionDiagnosisDO a where a.prescriptionId = ?1 and a.del=?2 ")
    List<WlyyPrescriptionDiagnosisDO> findByPrescriptionId(String prescriptionId,Integer del);
    @Modifying
    @Query("update WlyyPrescriptionDiagnosisDO p set p.del=0 where p.id=?1")
    void deleteById(String id);
    @Modifying
    @Query("update WlyyPrescriptionDiagnosisDO p set p.del=0 where p.prescriptionId=?1")
    void deleteByPrescriptionId(String prescriptionId);
}

+ 7 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionInfoDao.java

@ -14,7 +14,8 @@ import java.util.Set;
 */
public interface PrescriptionInfoDao extends PagingAndSortingRepository<WlyyPrescriptionInfoDO, String>, JpaSpecificationExecutor<WlyyPrescriptionInfoDO> {
    List<WlyyPrescriptionInfoDO> findByPrescriptionId(String prescriptionId);
    @Query("select a from WlyyPrescriptionInfoDO a where a.prescriptionId = ?1 and a.del=?2 ")
    List<WlyyPrescriptionInfoDO> findByPrescriptionId(String prescriptionId,Integer del);
    List<WlyyPrescriptionInfoDO> queryAllByPrescriptionIdInAndDel(Set ids,Integer del);
@ -22,4 +23,9 @@ public interface PrescriptionInfoDao extends PagingAndSortingRepository<WlyyPres
    @Modifying
    @Query("update WlyyPrescriptionInfoDO p set p.del=0 where p.id=?1")
    void deleteById(String id);
    @Modifying
    @Query("update WlyyPrescriptionInfoDO p set p.del=0 where p.prescriptionId=?1")
    void deleteByPrescriptionId(String prescriptionId);
}

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

@ -16,6 +16,6 @@ public interface PrescriptionLogDao extends PagingAndSortingRepository<WlyyPresc
    List<WlyyPrescriptionLogDO> findByPrescriptionCodeOrderByCreateTimeDesc(String prescriptionCode);
    @Query("select a from WlyyPrescriptionLogDO a where a.prescriptionCode = ?1 and a.status in(20,30,10,100) order by createTime asc ")
    @Query("select a from WlyyPrescriptionLogDO a where a.prescriptionCode = ?1 and a.status in(20,30,10,100)  order by a.createTime asc ")
    List<WlyyPrescriptionLogDO> findByPrescriptionCodeByStatus(String prescriptionCode);
}

+ 8 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/WlyyInspectionDao.java

@ -15,9 +15,16 @@ public interface WlyyInspectionDao extends PagingAndSortingRepository<WlyyInspec
    List<WlyyInspectionDO> findByOutpatientId(String outpatientId);
    List<WlyyInspectionDO> findByPrescriptionId(String prescriptionId);
    @Query("select a from WlyyInspectionDO a where a.prescriptionId = ?1 and a.del=?2 ")
    List<WlyyInspectionDO> findByPrescriptionId(String prescriptionId,Integer del);
    @Modifying
    @Query("update WlyyInspectionDO p set p.del=0 where p.id=?1")
    void deleteById(String id);
    @Modifying
    @Query("update WlyyInspectionDO p set p.del=0 where p.prescriptionId=?1")
    void deleteByPrescriptionId(String prescriptionId);
}

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

@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -85,6 +86,20 @@ public class PrescriptionLogService  extends BaseJpaService<WlyyPrescriptionLogD
     * @return
     */
    public List<WlyyPrescriptionLogDO> findByPrescriptionCodeByStatus(String prescriptionCode){
        return logDao.findByPrescriptionCodeByStatus(prescriptionCode);
        List<WlyyPrescriptionLogDO> wlyyPrescriptionLogDOS = logDao.findByPrescriptionCodeByStatus(prescriptionCode);
        List<Integer> list = new ArrayList<>();
        List<WlyyPrescriptionLogDO> wlyyPrescriptionLogDOList=new ArrayList<>();
        for (WlyyPrescriptionLogDO prescriptionLogDO:wlyyPrescriptionLogDOS){
            if (list!=null&&list.size()!=0){
                if (!list.contains(prescriptionLogDO.getStatus())){
                    list.add(prescriptionLogDO.getStatus());
                    wlyyPrescriptionLogDOList.add(prescriptionLogDO);
                }
            }else {
                wlyyPrescriptionLogDOList.add(prescriptionLogDO);
            }
        }
        list.clear();
        return wlyyPrescriptionLogDOList;
    }
}

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

@ -428,11 +428,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //药品信息
                List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>();
                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()),infoVOs,WlyyPrescriptionInfoVO.class));
                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId(),1),infoVOs,WlyyPrescriptionInfoVO.class));
                //检查检验信息
                List<WlyyInspectionVO> inspectionVOs = new ArrayList<>();
                vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId()),inspectionVOs,WlyyInspectionVO.class));
                vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(),1),inspectionVOs,WlyyInspectionVO.class));
            }
        }
        rs.put("prescriptions",prescriptionVOs);
@ -445,15 +445,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("expressage",null);
        }
        //物流配送新
        List<WlyyPrescriptionExpressageLogDO>  expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
        List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
        if(expressageLogDOs!=null&&expressageLogDOs.size()>0){
            rs.put("expressageLogs",convertToModels(expressageLogDOs,expressageLogVOs, WlyyPrescriptionExpressageLogVO.class));
        }else{
            rs.put("expressageLogs",null);
        if (!wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            //物流配送新
            List<WlyyPrescriptionExpressageLogDO>  expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
            List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
            if(expressageLogDOs!=null&&expressageLogDOs.size()>0){
                rs.put("expressageLogs",convertToModels(expressageLogDOs,expressageLogVOs, WlyyPrescriptionExpressageLogVO.class));
            }else{
                rs.put("expressageLogs",null);
            }
        }
        //预约记录
        List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId);
        if(timeDOs!=null&&timeDOs.size()>0){
@ -568,7 +571,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            for(WlyyPrescriptionVO vo:list){
                vo.setDiagnosisVOs(findDiagnosisById(vo.getId()));
                List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>();
                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()),infoVOs,WlyyPrescriptionInfoVO.class));
                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId(),1),infoVOs,WlyyPrescriptionInfoVO.class));
            }
        }
@ -576,7 +579,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    public List<WlyyPrescriptionDiagnosisVO> findDiagnosisById(String id){
        List<WlyyPrescriptionDiagnosisDO> list = prescriptionDiagnosisDao.findByPrescriptionId(id);
        List<WlyyPrescriptionDiagnosisDO> list = prescriptionDiagnosisDao.findByPrescriptionId(id,1);
        List<WlyyPrescriptionDiagnosisVO> rs = new ArrayList<>();
        if(list!=null&&list.size()>0){
            return convertToModels(list,rs,WlyyPrescriptionDiagnosisVO.class);
@ -608,7 +611,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("diagnosis",findDiagnosisById(wlyyPrescriptionDO.getId()));
        //药品信息
        rs.put("infos",prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId()));
        rs.put("infos",prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1));
        return rs;
    }
@ -1851,10 +1854,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //============================下诊断==============================================================
        //删除之前诊断
       /* List<WlyyPrescriptionDiagnosisDO> ds = prescriptionDiagnosisDao.findByPrescriptionId(prescription.getId());
        List<WlyyPrescriptionDiagnosisDO> ds = prescriptionDiagnosisDao.findByPrescriptionId(prescription.getId(),1);
        if (ds != null && ds.size() > 0) {
            prescriptionDiagnosisDao.delete(ds);
        }*/
            prescriptionDiagnosisDao.deleteByPrescriptionId(prescription.getId());
        }
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = (List<WlyyPrescriptionDiagnosisDO>) com.alibaba.fastjson.JSONArray.parseArray(diagnosisJson, WlyyPrescriptionDiagnosisDO.class);
        String Icd10 = "";
@ -1867,6 +1870,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                Icd10 += diagnosisDO.getCode() + ",";
                Icd10Name += diagnosisDO.getName() + ",";
            }
            diagnosisDO.setDel(1);
            diagnosisDO.setPrescriptionId(prescription.getId());
        }
        prescriptionDiagnosisDao.save(diagnosisDOs);
@ -1892,10 +1896,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //===================药品操作======================================================
            // 删除原有药品信息
            /*List<WlyyPrescriptionInfoDO> oldInfos = prescriptionInfoDao.findByPrescriptionId(prescription.getId());
            List<WlyyPrescriptionInfoDO> oldInfos = prescriptionInfoDao.findByPrescriptionId(prescription.getId(),1);
            if (oldInfos != null && oldInfos.size() > 0) {
                prescriptionInfoDao.delete(oldInfos);
            }*/
                prescriptionInfoDao.deleteByPrescriptionId(prescription.getId());
            }
            //存储药品,构建his开方入参
            if (StringUtils.isNotBlank(infoJsons)) {
@ -1923,15 +1927,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //=====================检查检验=======================================================================
            //存储检查检验,构建his开方入参
            //删除之前检查检验
            /*List<WlyyInspectionDO> inspectionDels = wlyyInspectionDao.findByOutpatientId(outPatientId);
            List<WlyyInspectionDO> inspectionDels = wlyyInspectionDao.findByOutpatientId(outPatientId);
            if (inspectionDels != null && inspectionDels.size() > 0) {
                wlyyInspectionDao.delete(inspectionDels);
            }*/
                wlyyInspectionDao.deleteByPrescriptionId(prescription.getId());
            }
            if (StringUtils.isNotBlank(inspectionJson)) {
                List<WlyyInspectionDO> inspections = (List<WlyyInspectionDO>) com.alibaba.fastjson.JSONArray.parseArray(inspectionJson, WlyyInspectionDO.class);
                for (WlyyInspectionDO ins : inspections) {
                    ins.setDel(1);
                    ins.setCreateTime(new Date());
                    ins.setPrescriptionId(prescription.getId());
                    ins.setOutpatientId(outPatientId);
@ -1954,6 +1958,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                savePrescriptionCheck(prescription.getDoctor(),"开具处方",5,prescription.getId());
            }
            if (prescriptionDOs != null && prescriptionDOs.size() > 0) {
                savePrescriptionCheck(prescription.getDoctor(),"处方修改",3,prescription.getId());
            }
            //=====================保存日志 end=========================================================
            //保存费用
            prescriptionDao.save(prescription);
@ -1981,7 +1989,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //上传his开方
                //sendHisDiagnosis(jsonData, outpatientDO, prescription)
                //zsSynHis(prescription.getId());
                return null;
                Map<String, Object> result1 = new HashedMap();
                result1.put("code", 1);
                result1.put("mes", "开方提交成功");
                return result1;
            }else {
                result.put("code", 1);
                result.put("mes", "诊断完成");
@ -2344,15 +2355,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (rstotal != null && rstotal.size() > 0) {
            count = Long.parseLong(rstotal.get(0).get("total").toString()) ;
        }
        String sql = "SELECT " +
                " e.create_time AS createTime, " +
                " e.`name`, " +
                " e.oneself_pickup_flg AS oneselfPickupFlg, " +
                " o.id AS outpatientId, " +
                " o.icd10_name AS icd10Name, " +
                " p.`status`, " +
                " p.id AS prescriptionId ," +
                " e.id AS expressageId" +
        String sql = "SELECT  " ;
        if("xm_ykyy_wx".equals(wxId)){
            sql =sql+  "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
        }else{
            sql =sql+  "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
        }
                sql=sql+" e.name as \"name\", " +
                " e.oneself_pickup_flg AS \"oneselfPickupFlg\", " +
                " o.id AS \"outpatientId\", " +
                " o.icd10_name AS \"icd10Name\", " +
                " p.status as \"status\", " +
                " p.id AS \"prescriptionId\" ," +
                " e.id AS \"expressageId\"" +
                " FROM " +
                " wlyy_outpatient o " +
                " JOIN wlyy_prescription p ON p.outpatient_id = o.id " +
@ -2370,25 +2385,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if (StringUtils.isNotBlank(startTime)) {
            if("xm_ykyy_wx".equals(wxId)){
                totalSql +=" and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                sql +=" and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            }else {
                totalSql += " AND e.create_time >='" + startTime + " 00:00:00'";
                sql += " AND e.create_time >='" + startTime + " 00:00:00'";
            }
        }
        if (StringUtils.isNotBlank(endTime)) {
            if("xm_ykyy_wx".equals(wxId)){
                totalSql +=" and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
                sql +=" and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
            }else {
                totalSql += " AND e.create_time <='" + endTime + " 23:59:59'";
                sql += " AND e.create_time <='" + endTime + " 23:59:59'";
            }
        }
 /*       sql += " LIMIT " + (page - 1) * size + "," + size + "";*/
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql,page,size);
        for (Map<String,Object> map:list){
            List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(map.get("prescriptionId").toString());
            map.put("info",wlyyPrescriptionInfoDOS);
            if (map.get("prescriptionId")!=null){
                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(map.get("prescriptionId").toString(),1);
                map.put("info",wlyyPrescriptionInfoDOS);
            }
        }
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
@ -5318,7 +5335,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param status
     */
    public void updateStatus(String prescriptionId,Integer status){
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
        prescriptionDao.updateStatus(prescriptionId,status,new Date());
        prescriptionLogService.addPrescriptionLog(prescriptionId,status,1,wlyyPrescriptionDO.getPatientCode(),wlyyPrescriptionDO.getPatientName(),null,new Date());
    }
@ -5356,37 +5375,41 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        prescriptionCheckDO = prescriptionCheckDao.save(prescriptionCheckDO);
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
        if (status==2){
            prescriptionDao.updateCheckStatus(prescriptionId,2,reason,12);
            /*if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            /*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/
            logger.info("开始====="+wlyyPrescriptionDO.getCheckStatus());
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                try {
                    WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
                    List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId);
                    List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId);
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                    List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
                    List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId,1);
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
                    DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                    //his处方拼接开方条件
                    com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
                    for (WlyyPrescriptionInfoDO info:infoDOS){
                        //设置his药品查询条件
                        setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, outpatientDO.getIcd10());
                        setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, info, outpatientDO.getIcd10());
                    }
                    for (WlyyInspectionDO ins:inspectionDOS){
                        //设置his药品查询条件
                        setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, outpatientDO.getIcd10());
                        setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10());
                    }
                    sendHisDiagnosis(jsonData, outpatientDO, prescriptionDO);
                    sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }*/
            }
            prescriptionLogService.addPrescriptionLog(prescriptionId,20,2,operate,operateName,reason,new Date());
            wlyyPrescriptionDO.setCheckStatus(2);
            wlyyPrescriptionDO.setCheckReason(reason);
            wlyyPrescriptionDO.setStatus(20);
        }else{
            wlyyPrescriptionDO.setCheckStatus(status);
            wlyyPrescriptionDO.setCheckReason(reason);
            wlyyPrescriptionDO.setStatus(11);
            prescriptionDao.save(wlyyPrescriptionDO);
        }
        prescriptionDao.save(wlyyPrescriptionDO);
        if (status==2||status==1){
            sendCheckMessage(status,wlyyPrescriptionDO,operate,operateName);
        }
@ -5430,11 +5453,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        prescriptionCheckDO = prescriptionCheckDao.save(prescriptionCheckDO);
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
        if (status==3){
            wlyyPrescriptionDO.setStatus(10);
            wlyyPrescriptionDO.setCheckStatus(0);
            wlyyPrescriptionDO.setCheckReason("未审核");
            wlyyPrescriptionDO.setDealStatus(1);
            wlyyPrescriptionDO.setDealReason(reason);
        }else if (status==4){
            wlyyPrescriptionDO.setStatus(10);
            wlyyPrescriptionDO.setCheckStatus(0);
            wlyyPrescriptionDO.setCheckReason("未审核");
            wlyyPrescriptionDO.setDealStatus(2);
@ -5469,24 +5494,34 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public SystemMessageDO sendCheckMessage(Integer status,WlyyPrescriptionDO prescriptionDO,String operate,String operateName){
        SystemMessageDO systemMessageDO = new SystemMessageDO();
        try{
            systemMessageDO.setType("5");
            systemMessageDO.setReceiver(prescriptionDO.getDoctor());
            systemMessageDO.setReceiverName(prescriptionDO.getDoctorName());
            systemMessageDO.setRelationCode(prescriptionDO.getId());
            systemMessageDO.setSender(operate);
            systemMessageDO.setSenderName(operateName);
            JSONObject data = new JSONObject();
            Integer age = 0;
            String gender = "";
            if (StringUtils.isNoneBlank(prescriptionDO.getIdcard())){
                age = IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard());
                gender=IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard());
            }
            data.put("name",prescriptionDO.getPatientName());
            data.put("age",IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard()));
            data.put("gender",IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard()));
            data.put("age",age);
            data.put("gender",gender);
            data.put("outpatientId",prescriptionDO.getOutpatientId());
            data.put("prescriptionId",prescriptionDO.getId());
            if (status==2){
                systemMessageDO.setType("9");
                systemMessageDO.setTitle("审方通过");
                data.put("message","审方通过");
                data.put("message","您为"+prescriptionDO.getPatientName()+"("+IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard())+"岁 "+IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard())+")开具的处方已审核通过。");
                data.put("message","您为"+prescriptionDO.getPatientName()+"("+age+"岁 "+gender+")开具的处方已审核通过。");
            } else if (status==1) {
                systemMessageDO.setType("8");
                systemMessageDO.setTitle("审方退回");
                data.put("message","审方退回");
                data.put("message","您为"+prescriptionDO.getPatientName()+"("+IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard())+"岁 "+IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard())+")开具的处方被审方退回,请尽快处理");
                data.put("message","您为"+prescriptionDO.getPatientName()+"("+age+"岁 "+gender+")开具的处方被审方退回,请尽快处理");
            }
            systemMessageDO.setData(data.toString());
            systemMessageService.saveMessage(systemMessageDO);
@ -5508,7 +5543,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (wlyyPrescriptionDO!=null){
            com.alibaba.fastjson.JSONObject objectString = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(wlyyPrescriptionDO);
            WlyyPrescriptionVO prescriptionVO =  com.alibaba.fastjson.JSONObject.toJavaObject(objectString,WlyyPrescriptionVO.class);
            List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId);
            List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
            List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
            for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
                com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(wlyyPrescriptionInfoDO);
@ -5517,7 +5552,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
            }
            prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
            List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId);
            List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId,1);
            List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = new ArrayList<>();
            for (WlyyPrescriptionDiagnosisDO prescriptionDiagnosisDO:wlyyPrescriptionDiagnosisDOS){
                com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(prescriptionDiagnosisDO);
@ -5527,7 +5562,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            prescriptionVO.setDiagnosisVOs(wlyyPrescriptionDiagnosisVOS);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId,1);
            List<WlyyInspectionVO> inspectionVOList = new ArrayList<>();
            for (WlyyInspectionDO inspectionDO:inspectionDOS){
                com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(inspectionDO);
@ -5565,8 +5600,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public void zsSynHis(String prescriptionId){
        try {
            WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
            List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId);
            List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId,1);
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
            DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());

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

@ -325,6 +325,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            object.put("jbywbz",map.get("jbywbz"));//基本药物标志
            object.put("ydyp",map.get("ydyp"));//药店药品
            object.put("ypmc2",map.get("ypmc2"));//药品名称2
            object.put("t",map.get("pzwh"));//药品批文
            array.add(object);
        }
        return array;

+ 135 - 57
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -536,7 +536,7 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(idCard)){
        if (!StringUtils.isEmpty(idCard)){
            condition = "<identity_no>"+idCard+"</identity_no>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
@ -575,7 +575,7 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(cardNo)){
        if (!StringUtils.isEmpty(cardNo)){
            condition = "<cardNo>"+cardNo+"</cardNo>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
@ -602,7 +602,7 @@ public class XzzxEntranceService{
     * @throws Exception
     */
    //获取单条门诊就诊记录
    public String findOutpatientInfo(String patient,String conNo)throws Exception{
    public String findOutpatientInfo(String patient,String conNo,String startTime,String endTime)throws Exception{
        String api = "FindOutpatientInfo";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
@ -612,12 +612,19 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(patient)){
        if (!StringUtils.isEmpty(patient)&&!patient.equalsIgnoreCase("null")){
            condition += "<patient>"+patient+"</patient>";
        }
        if (StringUtils.isNoneBlank(conNo)){
        if (!StringUtils.isEmpty(conNo)&&!conNo.equalsIgnoreCase("null")){
            condition += "<conNo>"+conNo+"</conNo>";
        }
        if (!StringUtils.isEmpty(startTime)&&!startTime.equalsIgnoreCase("null")){
            condition += "<startTime>"+startTime+"</startTime>";
        }
        if (!StringUtils.isEmpty(endTime)&&!endTime.equalsIgnoreCase("null")){
            condition += "<endTime>"+endTime+"</endTime>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
@ -655,24 +662,25 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(registerSn)){
        logger.info("registerSn"+registerSn+"patNo"+patNo+"admNo"+admNo+"realOrder"+realOrder);
        if (!StringUtils.isEmpty(registerSn)&&!registerSn.equalsIgnoreCase("null")){
            condition += "<registerSn>"+registerSn+"</registerSn>";
        }
        if (StringUtils.isNoneBlank(patNo)){
        if (!StringUtils.isEmpty(patNo)&&!patNo.equalsIgnoreCase("null")){
            condition += "<patNo>"+patNo+"</patNo>";
        }
        if (StringUtils.isNoneBlank(admNo)){
        if (!StringUtils.isEmpty(admNo)&&!admNo.equalsIgnoreCase("null")){
            condition += "<admNo>"+admNo+"</admNo>";
        }
        if (StringUtils.isNoneBlank(realOrder)){
        if (!StringUtils.isEmpty(realOrder)&&!realOrder.equalsIgnoreCase("null")){
            condition += "<realOrder>"+realOrder+"</realOrder>";
        }
        if (StringUtils.isNoneBlank(startTime)){
        if (!StringUtils.isEmpty(startTime)&&!startTime.equalsIgnoreCase("null")){
            condition += "<startTime>"+startTime+"</startTime>";
        }
        if (StringUtils.isNoneBlank(endTime)){
        if (!StringUtils.isEmpty(endTime)&&!endTime.equalsIgnoreCase("null")){
            condition += "<endTime>"+endTime+"</endTime>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
@ -711,24 +719,24 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(registerSn)){
        if (!StringUtils.isEmpty(registerSn)&&!registerSn.equalsIgnoreCase("null")){
            condition += "<registerSn>"+registerSn+"</registerSn>";
        }
        if (StringUtils.isNoneBlank(patNo)){
        if (!StringUtils.isEmpty(patNo)&&!patNo.equalsIgnoreCase("null")){
            condition += "<patNo>"+patNo+"</patNo>";
        }
        if (StringUtils.isNoneBlank(admNo)){
        if (!StringUtils.isEmpty(admNo)&&!admNo.equalsIgnoreCase("null")){
            condition += "<admNo>"+admNo+"</admNo>";
        }
        if (StringUtils.isNoneBlank(realOrder)){
        if (!StringUtils.isEmpty(realOrder)&&!realOrder.equalsIgnoreCase("null")){
            condition += "<realOrder>"+realOrder+"</realOrder>";
        }
        if (StringUtils.isNoneBlank(startTime)){
        if (!StringUtils.isEmpty(startTime)&&!startTime.equalsIgnoreCase("null")){
            condition += "<startTime>"+startTime+"</startTime>";
        }
        if (StringUtils.isNoneBlank(endTime)){
        if (!StringUtils.isEmpty(endTime)&&!endTime.equalsIgnoreCase("null")){
            condition += "<endTime>"+endTime+"</endTime>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
@ -768,24 +776,24 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(registerSn)){
        if (!StringUtils.isEmpty(registerSn)&&!registerSn.equalsIgnoreCase("null")){
            condition += "<registerSn>"+registerSn+"</registerSn>";
        }
        if (StringUtils.isNoneBlank(patNo)){
        if (!StringUtils.isEmpty(patNo)&&!patNo.equalsIgnoreCase("null")){
            condition += "<patNo>"+patNo+"</patNo>";
        }
        if (StringUtils.isNoneBlank(admNo)){
        if (!StringUtils.isEmpty(admNo)&&!admNo.equalsIgnoreCase("null")){
            condition += "<admNo>"+admNo+"</admNo>";
        }
        if (StringUtils.isNoneBlank(realOrder)){
        if (!StringUtils.isEmpty(realOrder)&&!realOrder.equalsIgnoreCase("null")){
            condition += "<realOrder>"+realOrder+"</realOrder>";
        }
        if (StringUtils.isNoneBlank(startTime)){
        if (!StringUtils.isEmpty(startTime)&&!startTime.equalsIgnoreCase("null")){
            condition += "<startTime>"+startTime+"</startTime>";
        }
        if (StringUtils.isNoneBlank(endTime)){
        if (!StringUtils.isEmpty(endTime)&&!endTime.equalsIgnoreCase("null")){
            condition += "<endTime>"+endTime+"</endTime>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
@ -812,24 +820,24 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(registerSn)){
        if (!StringUtils.isEmpty(registerSn)&&!registerSn.equalsIgnoreCase("null")){
            condition += "<registerSn>"+registerSn+"</registerSn>";
        }
        if (StringUtils.isNoneBlank(patNo)){
        if (!StringUtils.isEmpty(patNo)&&!patNo.equalsIgnoreCase("null")){
            condition += "<patNo>"+patNo+"</patNo>";
        }
        if (StringUtils.isNoneBlank(admNo)){
        if (!StringUtils.isEmpty(admNo)&&!admNo.equalsIgnoreCase("null")){
            condition += "<admNo>"+admNo+"</admNo>";
        }
        if (StringUtils.isNoneBlank(realOrder)){
        if (!StringUtils.isEmpty(realOrder)&&!realOrder.equalsIgnoreCase("null")){
            condition += "<realOrder>"+realOrder+"</realOrder>";
        }
        if (StringUtils.isNoneBlank(startTime)){
        if (!StringUtils.isEmpty(startTime)&&!startTime.equalsIgnoreCase("null")){
            condition += "<startTime>"+startTime+"</startTime>";
        }
        if (StringUtils.isNoneBlank(endTime)){
        if (!StringUtils.isEmpty(endTime)&&!endTime.equalsIgnoreCase("null")){
            condition += "<endTime>"+endTime+"</endTime>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
@ -867,17 +875,17 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(doctor)){
        if (!StringUtils.isEmpty(doctor)&&!doctor.equalsIgnoreCase("null")){
            condition += "<doctor>"+doctor+"</doctor>";
        }
        if (StringUtils.isNoneBlank(dept)){
        if (!StringUtils.isEmpty(dept)&&!dept.equalsIgnoreCase("null")){
            condition +="<dept>"+dept+"</dept>";
        }
        if (StringUtils.isNoneBlank(sickId)){
        if (!StringUtils.isEmpty(sickId)&&!sickId.equalsIgnoreCase("null")){
            condition += "<sickId>"+sickId+"</sickId>";
        }
        if (StringUtils.isNoneBlank(clinicclass)){
        if (!StringUtils.isEmpty(clinicclass)&&!clinicclass.equalsIgnoreCase("null")){
            condition +="<clinicclass>"+clinicclass+"</clinicclass>";
        }
@ -913,13 +921,13 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(admNo)){
        if (!StringUtils.isEmpty(admNo)){
            condition += "<admNo>"+admNo+"</admNo>";
        }
        if (StringUtils.isNoneBlank(realOrder)){
        if (!StringUtils.isEmpty(realOrder)){
            condition +="<realOrder>"+realOrder+"</realOrder>";
        }
        if (StringUtils.isNoneBlank(status)){
        if (!StringUtils.isEmpty(status)){
            condition += "<status>"+status+"</status>";
        }
@ -1124,6 +1132,56 @@ public class XzzxEntranceService{
    }
    /**
     * 获取门诊就诊记录列表
     * @param patient 居民id
     * @return
     */
    public List<WlyyOutpatientVO> selectOutpatientList(String patient,String startTime,String endTime){
        List<WlyyOutpatientVO> wlyyOutpatientVOList = new ArrayList<>();
        JSONArray array = new JSONArray();
        String response="";
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        if (patientMappingDO!=null){
            patient = patientMappingDO.getMappingCode();
        }else {
            patient = null;
        }
        String url = entranceUrl+"findOutpatientInfo?patient="+patient+"&startTime="+startTime+"&endTime="+endTime;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject jsonObject = JSONObject.parseObject(response);
        if (jsonObject.getInteger("status")==200){
            array = JSONArray.parseArray(jsonObject.getString("obj")).getJSONArray(0);
            for (int i=0;i<array.size();i++){
                JSONObject object = array.getJSONObject(i);
                WlyyOutpatientVO outpatientVO = new WlyyOutpatientVO();
                outpatientVO.setAdmNo(isEmty(object.getString("ADMNO")));
                outpatientVO.setOriginAdmNo(isEmty(object.getString("ORIGINADMNO")));
                outpatientVO.setRegisterNo(isEmty(object.getString("REGISTERNO")));
                outpatientVO.setOriginRegisterNo(isEmty(object.getString("ORIGINREGISTERNO")));
                outpatientVO.setDept(isEmty(object.getString("DEPT")));
                outpatientVO.setDeptName(isEmty(object.getString("DEPTNAME")));
                outpatientVO.setPatient(isEmty(object.getString("PATIENT")));
                outpatientVO.setPatientName(isEmty(object.getString("PATIENTNAME")));
                outpatientVO.setDoctor(isEmty(object.getString("DOCTOR")));
                outpatientVO.setDoctorName(isEmty(object.getString("DOCTORNAME")));
                outpatientVO.setIdcard(isEmty(object.getString("IDCARD")));
                outpatientVO.setMjz(isEmty(object.getString("MJZ")));
                outpatientVO.setIcd10(isEmty(object.getString("ICDCODE")));
                outpatientVO.setIcd10Name(isEmty(object.getString("ICDNAME")));
                outpatientVO.setAdmDate(DateUtil.strToDate(object.getString("ADMDATE")));
                outpatientVO.setConDate(DateUtil.strToDate(object.getString("CONDATE")));
                outpatientVO.setDescription(isEmty(object.getString("DESCRIPTION")));
                outpatientVO.setDiseaseImg(isEmty(object.getString("DISEASEIMG")));
                outpatientVO.setCreateTime(DateUtil.strToDate(object.getString("CREATETIME")));
                outpatientVO.setStatus(isEmty(object.getString("STATUS")));
                wlyyOutpatientVOList.add(outpatientVO);
            }
        }
        return wlyyOutpatientVOList;
    }
    /**
     * 获取单条门诊就诊记录
     * @param patient 居民id
@ -1134,33 +1192,41 @@ public class XzzxEntranceService{
        WlyyOutpatientVO outpatientVO = new WlyyOutpatientVO();
        JSONArray array = new JSONArray();
        String response="";
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        if (patientMappingDO!=null){
            patient = patientMappingDO.getMappingCode();
        }else {
            patient = null;
        }
        String url = entranceUrl+"findOutpatientInfo?patient="+patient+"&conNo="+conNo;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject jsonObject = JSONObject.parseObject(response);
        if (jsonObject.getInteger("status")==200){
            array = JSONArray.parseArray(jsonObject.getString("obj")).getJSONArray(0);
            JSONObject object = array.getJSONObject(0);
            outpatientVO.setAdmNo(isEmty(object.getString("ADMNO")));
            outpatientVO.setOriginAdmNo(isEmty(object.getString("ORIGINADMNO")));
            outpatientVO.setRegisterNo(isEmty(object.getString("REGISTERNO")));
            outpatientVO.setOriginRegisterNo(isEmty(object.getString("ORIGINREGISTERNO")));
            outpatientVO.setDept(isEmty(object.getString("DEPT")));
            outpatientVO.setDeptName(isEmty(object.getString("DEPTNAME")));
            outpatientVO.setPatient(isEmty(object.getString("PATIENT")));
            outpatientVO.setPatientName(isEmty(object.getString("PATIENTNAME")));
            outpatientVO.setDoctor(isEmty(object.getString("DOCTOR")));
            outpatientVO.setDoctorName(isEmty(object.getString("DOCTORNAME")));
            outpatientVO.setIdcard(isEmty(object.getString("IDCARD")));
            outpatientVO.setMjz(isEmty(object.getString("MJZ")));
            outpatientVO.setIcd10(isEmty(object.getString("ICDCODE")));
            outpatientVO.setIcd10Name(isEmty(object.getString("ICDNAME")));
            outpatientVO.setAdmDate(DateUtil.strToDate(object.getString("ADMDATE")));
            outpatientVO.setConDate(DateUtil.strToDate(object.getString("CONDATE")));
            outpatientVO.setDescription(isEmty(object.getString("DESCRIPTION")));
            outpatientVO.setDiseaseImg(isEmty(object.getString("DISEASEIMG")));
            outpatientVO.setCreateTime(DateUtil.strToDate(object.getString("CREATETIME")));
            outpatientVO.setStatus(isEmty(object.getString("STATUS")));
            if (array!=null&&array.size()!=0){
                JSONObject object = array.getJSONObject(0);
                outpatientVO.setAdmNo(isEmty(object.getString("ADMNO")));
                outpatientVO.setOriginAdmNo(isEmty(object.getString("ORIGINADMNO")));
                outpatientVO.setRegisterNo(isEmty(object.getString("REGISTERNO")));
                outpatientVO.setOriginRegisterNo(isEmty(object.getString("ORIGINREGISTERNO")));
                outpatientVO.setDept(isEmty(object.getString("DEPT")));
                outpatientVO.setDeptName(isEmty(object.getString("DEPTNAME")));
                outpatientVO.setPatient(isEmty(object.getString("PATIENT")));
                outpatientVO.setPatientName(isEmty(object.getString("PATIENTNAME")));
                outpatientVO.setDoctor(isEmty(object.getString("DOCTOR")));
                outpatientVO.setDoctorName(isEmty(object.getString("DOCTORNAME")));
                outpatientVO.setIdcard(isEmty(object.getString("IDCARD")));
                outpatientVO.setMjz(isEmty(object.getString("MJZ")));
                outpatientVO.setIcd10(isEmty(object.getString("ICDCODE")));
                outpatientVO.setIcd10Name(isEmty(object.getString("ICDNAME")));
                outpatientVO.setAdmDate(DateUtil.strToDate(object.getString("ADMDATE")));
                outpatientVO.setConDate(DateUtil.strToDate(object.getString("CONDATE")));
                outpatientVO.setDescription(isEmty(object.getString("DESCRIPTION")));
                outpatientVO.setDiseaseImg(isEmty(object.getString("DISEASEIMG")));
                outpatientVO.setCreateTime(DateUtil.strToDate(object.getString("CREATETIME")));
                outpatientVO.setStatus(isEmty(object.getString("STATUS")));
            }
        }
        return outpatientVO;
    }
@ -1454,6 +1520,18 @@ public class XzzxEntranceService{
    }
    public List<WlyyPrescriptionVO> selectPrescriptionList(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime) throws Exception {
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patNo);
        if (patientMappingDO==null||!StringUtils.isNoneBlank(patientMappingDO.getMappingCode())){
            throw new Exception("该居民映射表不存在!");
        }
        List<WlyyPrescriptionVO> wlyyPrescriptionVOList = selectOriginPrescriptionList(registerSn,patientMappingDO.getMappingCode(),admNo,realOrder);
        return wlyyPrescriptionVOList;
    }
    public Map<String,Object> updatePreStatus(String admNo,String realOrder,String status) throws Exception {
        Map<String,Object> map = new HashedMap();
        List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByAdmNo(admNo);

+ 27 - 3
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -449,6 +449,29 @@ public class YkyyEntranceService {
        return new JSONArray();
    }
    /**
     * 查找眼科his 已审核未付款的处方
     * @throws Exception
     */
    public JSONArray getNoUnsettledPrescription() throws Exception{
        String sql = "SELECT h.BRID,h.CFSB,h.SJLY from v_ms_dd01 h WHERE h.SPZT = 2 and h.FKZT = 0 order by h.KFRQ desc ";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        params.put("page","1");
        params.put("size","60");
        HttpResponse response = HttpUtils.doGet(jdbcUrl,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            return rs.getJSONArray("detailModelList");
        }
        return new JSONArray();
    }
    /**
     * HIS就诊患者历史查询
     * @throws Exception
@ -1072,7 +1095,8 @@ public class YkyyEntranceService {
                "yp.jbywbz AS \"jbywbz\"," +
                "yp.ydyp AS \"ydyp\"," +
                "yp.ypmc2 AS \"ypmc2\"," +
                "yp.gyffmc as \"gyffmc\""+  " FROM " +
                "yp.gyffmc as \"gyffmc\"," +
                "yp.pzwh as \"pzwh\""+  " FROM " +
                "V_ZKSG_MZ_YPXX yp where 1=1 ";
        if (StringUtils.isNoneBlank(ypdm)){
            sql+=" and yp.ypdm like '%"+ypdm+"%' ";
@ -1315,7 +1339,7 @@ public class YkyyEntranceService {
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOs.get(0);
            JSONObject objectString = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
            WlyyPrescriptionVO prescriptionVO =  JSONObject.toJavaObject(objectString,WlyyPrescriptionVO.class);
            List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId());
            List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
            List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
            for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
                JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionInfoDO);
@ -1528,7 +1552,7 @@ public class YkyyEntranceService {
        }
        Integer icd10Flag = 0;
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(code);
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(code,1);
        if(diagnosisDOs!=null&&diagnosisDOs.size()>0){
            WlyyPrescriptionDiagnosisDO diagnosisDO = diagnosisDOs.get(0);

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/internet/service/DataGeneratorService.java

@ -122,11 +122,11 @@ public class DataGeneratorService extends BaseJpaService<InternetUpErrorLogDO, I
        List<WlyyPrescriptionDO> prescriptionDOs = prescriptionDao.findByDoctorAndCreateTimeAndRemark(doctor,DateUtil.strToDate(date+" 10:00:00"),"test_info");
        if(prescriptionDOs!=null&&prescriptionDOs.size()>0){
            for(WlyyPrescriptionDO prescriptionDO :prescriptionDOs){
                List<WlyyPrescriptionInfoDO> infoDOs = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId());
                List<WlyyPrescriptionInfoDO> infoDOs = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId(),1);
                if(infoDOs!=null&&infoDOs.size()>0){
                    prescriptionInfoDao.delete(infoDOs);
                }
                List<WlyyInspectionDO> inspectionDOs = wlyyInspectionDao.findByPrescriptionId(prescriptionDO.getId());
                List<WlyyInspectionDO> inspectionDOs = wlyyInspectionDao.findByPrescriptionId(prescriptionDO.getId(),1);
                if(inspectionDOs!=null&&inspectionDOs.size()>0){
                    wlyyInspectionDao.delete(inspectionDOs);
                }

+ 11 - 3
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -639,6 +639,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
        String sql ="SELECT " +
                " a.id AS \"id\", " +
                " a.doctor as \"doctor\","+
                " a.doctor_name AS \"name\", " +
                " a.score AS \"score\", " +
                " a.patient_name AS \"patient_name\", " +
@ -650,7 +651,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                "JOIN base_evaluate e ON a.id = e.relation_code " +
                "JOIN base_doctor d ON d.id = a.doctor " +
                "WHERE " +
                " e.score_type = '4'";
                " e.score_type = '4' ";
        Map<String,Object> params = new HashedMap();
        if(StringUtils.isNotBlank(startDate)){
@ -675,6 +676,8 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
            Boolean errorFlag = false;
            JSONObject jb = new JSONObject();
            try{
                String interId = "";
                String idCard = info.get("docIdCard") == null ? "0":info.get("docIdCard").toString();
@ -686,7 +689,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
//                String[] dept = depToSubject(info.get("dept_code").toString());
                jb.put("id",orgCode +"_"+ (String)info.get("id"));
                jb.put("id",interId +"_"+ (String)info.get("id"));
                jb.put("id_doctor",interId == null ? "0":interId);
                jb.put("organ_code",orgCode);
                jb.put("organ_name", orgName);
@ -1180,6 +1183,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                jb.put("pres_dept_code", info.get("dept")== null?"0":info.get("dept"));
                jb.put("pres_dept_name",info.get("dept_name")== null?"0":info.get("dept_name"));
                jb.put("pres_time", info.get("create_time")== null?"1900-01-01 00:00:00":DateUtil.dateToStrLong((Date)info.get("create_time")));
                jb.put("trial_time",DateUtil.dateToStrLong(new Date()));
                jb.put("pres_doc_code", visitDocCode);
                jb.put("pres_doc_name", info.get("doctor_name")== null?"0":info.get("doctor_name"));
                jb.put("pres_doc_id_no", info.get("docIdcard")== null?"0":info.get("docIdcard"));
@ -1251,7 +1255,9 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                "    a.supply_code AS \"supply_code\"," +
                "    a.specification AS \"specification\"," +
                "    a.pack_retprice AS \"pack_retprice\"," +
                "    a.pack_retprice AS \"drug_total_price\"" +
                "    a.pack_retprice AS \"drug_total_price\"," +
                "   a.days as \"days\"," +
                "   a.serial as \"serial\" "+
                "  from wlyy_prescription_info a " +
                "     JOIN wlyy_prescription b " +
                "     on b.id = a.prescription_id" +
@ -1289,7 +1295,9 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                jb.put("drug_code", "");
                jb.put("drug_name", "");
                jb.put("drug_form", "");
                jb.put("approval_no",info.get("serial"));
                jb.put("dosage",info.get("dosage") == null? 0: info.get("dosage"));
                jb.put("Prescription days",Integer.parseInt(info.get("days").toString()));
                jb.put("dosage_unit", info.get("unit") == null? "0": info.get("unit"));
                jb.put("total_dosage", info.get("quantity") == null? 0: info.get("quantity"));
                jb.put("total_dosage_unit", info.get("pack_unit") == null? "0": info.get("pack_unit"));

+ 28 - 1
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -23,6 +23,7 @@ import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.dao.BusinessOrderDao;
@ -53,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -94,6 +96,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private YlzPayService ylzPayService;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
@ -144,7 +148,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                wlyyPrescriptionDO.setOrderId(getCode());
                wlyyPrescriptionDO = prescriptionDao.save(wlyyPrescriptionDO);
                JSONArray array = new JSONArray();
                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(code);
                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(code,1);
                for (WlyyPrescriptionInfoDO prescriptionInfoDO:wlyyPrescriptionInfoDOS){
                    JSONObject object = new JSONObject();
                    //{"commodityName":"","commodityPrice":"","DrugUnit":"","MedicineDoctor":""}
@ -628,6 +632,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                        wlyyPrescriptionDO.setStatus(30);
                        wlyyPrescriptionDO.setPayStatus(1);
                        prescriptionDao.save(wlyyPrescriptionDO);
                        prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(),30,1,wlyyPrescriptionDO.getPatientCode(),wlyyPrescriptionDO.getPatientName(),"",new Date());
                        String sql = " update v_ms_dd01 SET FKZT=1 where CFSB = '"+wlyyPrescriptionDO.getRealOrder()+"'";
                        try {
                            ykyyEntranceService.updateHisStatus(sql);
@ -903,8 +908,30 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
               WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
               wlyyPrescriptionDO.setPayStatus(1);
               prescriptionDao.save(wlyyPrescriptionDO);
               prescriptionLogService.addPrescriptionLog(businessOrderDO.getRelationCode(),30,1,businessOrderDO.getPatient(),businessOrderDO.getPatientName(),businessOrderDO.getDescription(),new Date());
           }
        }
        return businessOrderDO;
    }
    public JSONObject selectOrderTime(String relationCode){
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("PAY_TIME");
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        Date createDate = businessOrderDO.getCreateTime();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(createDate);
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
            calendar.add(Calendar.MINUTE,Integer.parseInt(wlyyHospitalSysDictDO.getPyCode()));
        }else {
            calendar.add(Calendar.MINUTE,Integer.parseInt(wlyyHospitalSysDictDO.getDictCode()));
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = sdf.format(calendar.getTime());
        JSONObject object = new JSONObject();
        object.put("endTime",time);
        object.put("createTime",businessOrderDO.getCreateTime());
        return object;
    }
}

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

@ -14,6 +14,7 @@ import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.oauth.OauthSsoService;
@ -41,10 +42,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * Created by Administrator on 2017/5/19 0019.
@ -99,6 +97,8 @@ public class WxTemplateService {
    private OutpatientDao outpatientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    
    
    /**
@ -158,6 +158,23 @@ public class WxTemplateService {
     */
    public void unSettledHISPrescription() throws Exception{
        if("xm_ykyy_wx".equals(wechatId)){
            //获取审核失败
            JSONArray jsonArray = ykyyEntranceService.getNoUnsettledPrescription();
            if(jsonArray!=null&&jsonArray.size()>0) {
                for (int i = 0; i<jsonArray.size(); i++){
                    JSONObject json = jsonArray.getJSONObject(i);
                    String cfsb = json.getString("CFSB");
                    //查找对应的处方
                    String sql = "SELECT w.OUTPATIENT_ID,w.ID,w.DOCTOR_NAME from WLYY_PRESCRIPTION w WHERE REAL_ORDER = '"+cfsb+"' ORDER BY w.CREATE_TIME desc";
                    List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                    if(pre!=null && pre.size()>0){
                        String prescriptionId = pre.get(0).get("ID").toString();
                        //修改处方状态
                        String updateSql = "update WLYY_PRESCRIPTION set status = 11 where id = '"+prescriptionId+"'";
                        hibenateUtils.updateBySql(updateSql);
                    }
                }
            }
            //获取已审核未结算的处方
            JSONArray array = ykyyEntranceService.getUnsettledPrescription();
            //发送模板
@ -190,6 +207,7 @@ public class WxTemplateService {
                                    //修改处方状态
                                    String updateSql = "update WLYY_PRESCRIPTION set status = 20 where id = '"+prescriptionId+"' and status = 10";
                                    hibenateUtils.updateBySql(updateSql);
                                    prescriptionLogService.addPrescriptionLog(prescriptionId,20,2,"system","system","",new Date());
                                    ps.stream().forEach(one->{
                                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_unsettled_notice","djsxxtz",1);
@ -217,7 +235,6 @@ public class WxTemplateService {
                    }
                }
            }
        }
    }
@ -231,13 +248,13 @@ public class WxTemplateService {
                List<BusinessOrderDO> businessOrderDOS = businessOrderDao.selectByStatus(0);
                //关闭处理
                for (BusinessOrderDO businessOrderDO:businessOrderDOS){
                    long nd = 1000 * 24 * 60 * 60;
                    long nh = 1000 * 60 * 60;
                    long nm = 1000 * 60;
                    Long diff = businessOrderDO.getCreateTime().getTime()- new Date().getTime();
                    Long min = diff % nd % nh / nm;
                    if (min==Long.parseLong(close)){
                    Calendar cal= Calendar.getInstance();
                    cal.setTime(businessOrderDO.getCreateTime());
                    cal.add(Calendar.MINUTE,Integer.parseInt(close));
                    Long now = new Date().getTime();
                    Long min = cal.getTime().getTime();
                    logger.info("关闭处理cal="+cal);
                    if (min==now){
                        String orderCategory = businessOrderDO.getOrderCategory();
                        String relationCode = businessOrderDO.getRelationCode();
                        if (orderCategory.equalsIgnoreCase("1")){
@ -259,13 +276,14 @@ public class WxTemplateService {
                    String orderType =businessOrderDO.getOrderType()+"";
                    String doctor = businessOrderDO.getDoctor();
                    String patient= businessOrderDO.getPatient();
                    long nd = 1000 * 24 * 60 * 60;
                    long nh = 1000 * 60 * 60;
                    long nm = 1000 * 60;
                    Long diff = businessOrderDO.getCreateTime().getTime()- new Date().getTime();
                    Long min = diff % nd % nh / nm;
                    if (min==Long.parseLong(remind)){
                    Calendar cal= Calendar.getInstance();
                    cal.setTime(businessOrderDO.getCreateTime());
                    cal.add(Calendar.MINUTE,Integer.parseInt(remind));
                    Long now = new Date().getTime();
                    Long min = cal.getTime().getTime();
                    logger.info("提醒处理cal="+cal);
                    if (min==now){
                        //判断是否发送过
                        String countSql = "SELECT id from WX_PUSH_LOG w WHERE w.RECEIVER = '"+patient
                                +"' and w.OPENID = '"+relationCode+"' and w.scene = 'zxzfts' and w.WECHAT_ID='"+wechatId+"'";

+ 7 - 4
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -2504,15 +2504,18 @@ public class ImService {
					"patient.idcard AS \"patientIdcard\"," +
					"patient.sex AS \"patientsex\"," +
					"patient.photo AS \"patientphoto\"," +
					"op.id AS \"outpatientid\"," ;
					"op.id AS \"outpatientId\"," ;
			if("xm_ykyy_wx".equals(wxId)){
				sql = sql + "to_char(op.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"registerDate\",";
			}else{
				sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";
			}
							sql = sql +		"op.status AS outpatientstatus " +
					"FROM wlyy_outpatient op," +
					"base_patient patient " +
				sql = sql +		"op.status AS \"outpatientstatus\", " +
						"p.check_status as \"checkStatus\"," +
						"p.check_reason as \"checkReason\""+
					"FROM base_patient patient," +
						"wlyy_outpatient op " +
						" left join wlyy_prescription p on p.outpatient_id = op.id "+
					"WHERE op.patient=patient.id " +
					"AND op.doctor='"+doctorCode+"' " +
					"AND op.status in ('0','1') ";

+ 15 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionInfoDO.java

@ -159,6 +159,12 @@ public class WlyyPrescriptionInfoDO extends UuidIdentityEntity {
    private Integer HisCode;
    /**
     * 药品批文
     */
    private String pzwh;
    @Column(name = "prescription_id")
    public String getPrescriptionId() {
        return prescriptionId;
@ -399,4 +405,13 @@ public class WlyyPrescriptionInfoDO extends UuidIdentityEntity {
    public void setHisCode(Integer hisCode) {
        HisCode = hisCode;
    }
    @Column(name = "pzwh")
    public String getPzwh() {
        return pzwh;
    }
    public void setPzwh(String pzwh) {
        this.pzwh = pzwh;
    }
}

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

@ -405,6 +405,8 @@ public class BaseHospitalRequestMapping {
        public static final String deleteById = "/deleteById";
        public static final String selectExpireTime = "/selectExpireTime";
    }

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionInfoVO.java

@ -158,6 +158,8 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    private String comm;
    private String pzwh;
    public String getPrescriptionId() {
        return prescriptionId;
@ -371,4 +373,12 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    public void setHisCode(Integer hisCode) {
        HisCode = hisCode;
    }
    public String getPzwh() {
        return pzwh;
    }
    public void setPzwh(String pzwh) {
        this.pzwh = pzwh;
    }
}

+ 54 - 0
svr/svr-base/src/main/resources/application.yml

@ -254,6 +254,12 @@ spring:
    url: jdbc:oracle:thin:@172.26.0.141:1521:helowin
    username: normal
    password: normal
  jpa:
      properties:
        hibernate:
          dialect: org.hibernate.dialect.Oracle10gDialect
          show_sql: true
      database: oracle
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
@ -288,6 +294,54 @@ testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
spring:
  profiles: jwOracleProd
  datasource:
    driver-class-name: oracle.jdbc.driver.OracleDriver
    url: jdbc:oracle:thin:@10.10.10.16:1521/rac
    username: normal
    password: normal
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.Oracle10gDialect
        show_sql: true
    database: oracle
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 192.168.33.198:9300,192.168.33.198:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://172.19.103.87:61616
    user: admin
    password: admin
  redis:
    host: 192.168.33.198 # Redis server host.
    port: 6380 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
demo:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
wlyy:
  url: http://www.xmtyw.cn/wlyy/
wechat:
  id: xm_ykyy_wx
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
spring:
  profiles: iotprod

+ 14 - 0
svr/svr-base/src/main/resources/bootstrap.yml

@ -44,6 +44,20 @@ spring:
      uri: ${wlyy.pring.config.uri:http://172.16.100.63:1221}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: jwOracleProd
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.33.199:1221}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: jwOracleTest
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: local
  cloud:

+ 6 - 2
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/XzzxCotroller.java

@ -86,8 +86,12 @@ public class XzzxCotroller extends EnvelopRestEndpoint {
    public ObjEnvelop findOutpatientInfo(@ApiParam(name = "patient", value = "居民id", required = false)
                                  @RequestParam(value = "patient",required = false)String patient,
                                         @ApiParam(name = "conNo", value = "就诊次数", required = false)
                                         @RequestParam(value = "conNo",required = false)String conNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.findOutpatientInfo(patient,conNo));
                                         @RequestParam(value = "conNo",required = false)String conNo,
                                         @ApiParam(name = "startTime", value = "开始时间", required = false)
                                             @RequestParam(value = "startTime",required = false)String startTime,
                                         @ApiParam(name = "endTime", value = "结束时间", required = false)
                                             @RequestParam(value = "endTime",required = false)String endTime)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.findOutpatientInfo(patient,conNo,startTime,endTime));
    }
    /**

+ 5 - 4
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java

@ -161,14 +161,14 @@ public class PrescriptionStatusUpdateService {
        logger.info("autoPush updatePrescriptionInfo ");
        //删除原有药品信息
        List<WlyyPrescriptionInfoDO> oldInfos = prescriptionInfoDao.findByPrescriptionId(preId);
        List<WlyyPrescriptionInfoDO> oldInfos = prescriptionInfoDao.findByPrescriptionId(preId,1);
        if (oldInfos != null && oldInfos.size() > 0) {
            prescriptionInfoDao.delete(oldInfos);
            prescriptionInfoDao.deleteByPrescriptionId(preId);
        }
        //删除之前诊断
        List<WlyyPrescriptionDiagnosisDO> ds = prescriptionDiagnosisDao.findByPrescriptionId(preId);
        List<WlyyPrescriptionDiagnosisDO> ds = prescriptionDiagnosisDao.findByPrescriptionId(preId,1);
        if (ds != null && ds.size() > 0) {
            prescriptionDiagnosisDao.delete(ds);
            prescriptionDiagnosisDao.deleteByPrescriptionId(preId);
        }
        String Icd10 = "";
        String Icd10Name = "";
@ -183,6 +183,7 @@ public class PrescriptionStatusUpdateService {
                Icd10 += diagnosisVO.getCode() + ",";
                Icd10Name += diagnosisVO.getName() + ",";
            }
            diagnosisDO.setDel(1);
            diagnosisDO.setCode(diagnosisVO.getCode());
            diagnosisDO.setName(diagnosisVO.getName());
            diagnosisDO.setType(diagnosisVO.getType());

+ 43 - 16
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java

@ -48,11 +48,23 @@ public class XzyyController extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取卡信息", notes = "获取卡信息")
    public ObjEnvelop getCardInfo(@ApiParam(name = "cardNo", value = "就诊卡", required = false)
                                  @RequestParam(value = "cardNo",required = false)String cardNo)throws Exception{
        try {
            return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectCardInfo(cardNo));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectCardInfo(cardNo));
    }
    /**
     * 获取门诊就诊记录列表
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/findOutpatientList")
    @ApiOperation(value = "获取门诊就诊记录列表", notes = "获取门诊就诊记录列表")
    public ListEnvelop findOutpatientInfo(@ApiParam(name = "patient", value = "居民code", required = true)
                                         @RequestParam(value = "patient",required = true)String patient,
                                         @ApiParam(name = "startTime", value = "开始时间", required = false)
                                         @RequestParam(value = "startTime",required = false)String startTime,
                                         @ApiParam(name = "endTime", value = "结束时间", required = false)
                                             @RequestParam(value = "endTime",required = false)String endTime)throws Exception{
        return success(xzzxEntranceService.selectOutpatientList(patient,startTime,endTime));
    }
    /**
@ -66,11 +78,7 @@ public class XzyyController extends EnvelopRestEndpoint {
                                         @RequestParam(value = "patient",required = true)String patient,
                                         @ApiParam(name = "conNo", value = "就诊次数", required = false)
                                         @RequestParam(value = "conNo",required = false)String conNo)throws Exception{
        try {
            return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectOutpatientInfo(patient,conNo));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
        return success(xzzxEntranceService.selectOutpatientInfo(patient,conNo));
    }
    /**
@ -80,15 +88,34 @@ public class XzyyController extends EnvelopRestEndpoint {
     */
    @GetMapping(value = "/findPrescriptionList")
    @ApiOperation(value = "获取门诊下所有处方信息", notes = "获取门诊下所有处方信息")
    public ObjEnvelop findPrescriptionList(@ApiParam(name = "outPatientId", value = "门诊id", required = true)
    public ListEnvelop findPrescriptionList(@ApiParam(name = "outPatientId", value = "门诊id", required = true)
                                           @RequestParam(value = "outPatientId",required = true)String outPatientId,
                                           @ApiParam(name = "realOrder", value = "处方code", required = false)
                                           @RequestParam(value = "realOrder",required = false)String realOrder)throws Exception{
        try {
            return ObjEnvelop.getSuccess("ok",xzzxEntranceService.findPrescriptionList(outPatientId,realOrder));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
            return success(xzzxEntranceService.findPrescriptionList(outPatientId,realOrder));
    }
    /**
     * 获取门诊下所有处方信息
     * @param registerSn 流水号(必传)
     * @param patNo 病人id(必传)
     * @param admNo 住院唯一号(必传)
     * @param realOrder 处方号(非必传,传相当于查单条处方)
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/getOriginPrescriptionList")
    @ApiOperation(value = "获取门诊下所有处方信息", notes = "获取门诊下所有处方信息")
    public ObjEnvelop getOriginPrescriptionList(@ApiParam(name = "registerSn", value = "流水号", required = false)
                                                @RequestParam(value = "registerSn",required = false)String registerSn,
                                                @ApiParam(name = "patNo", value = "病人id", required = false)
                                                @RequestParam(value = "patNo",required = false)String patNo,
                                                @ApiParam(name = "admNo", value = "住院唯一号", required = false)
                                                @RequestParam(value = "admNo",required = false)String admNo,
                                                @ApiParam(name = "realOrder", value = "处方号", required = false)
                                                @RequestParam(value = "realOrder",required = false)String realOrder)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectPrescriptionList(registerSn,patNo,admNo,realOrder,null,null));
    }

+ 13 - 5
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -92,6 +92,9 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	@Value("${wechat.id}")
	private String wxId;
	@Value("${demo.flag}")
	private String demoFlag;
	
	
	@GetMapping (value = BaseHospitalRequestMapping.DodtorIM.findWaitingRoomOutpatientByDoctor)
@ -191,11 +194,16 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
						rsCode = res.getString("@RESULT");
						mes = res.getString("@MSG");
					}else {
						net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
						rsCode = (String)res.get("@RESULT");
						mes = (String)res.get("@MSG");
			/*			rsCode="0";
						mes="已挂号";*/
						if (demoFlag.equalsIgnoreCase("true")){
							rsCode="0";
							mes="已挂号";
						}else {
							net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
							rsCode = (String)res.get("@RESULT");
							mes = (String)res.get("@MSG");
						}
					}
					if("0".equals(rsCode)||"-2".equals(rsCode)){

+ 2 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -375,7 +375,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                } else {
                    JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
                    JSONObject param = jsonObject.getJSONObject("param");
                    String traceNo = param.getString("traceNo");
                    logger.info("param"+params);
                    String traceNo = param.getString("outChargeNo");
                    businessOrderService.updatePayStatus(traceNo);
                    response.getWriter().write("SUCCESS");
                }

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

@ -1390,5 +1390,19 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.selectExpireTime)
    @ApiOperation("查询过期时间")
    public ObjEnvelop selectExpireTime(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true)String relationCode) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectOrderTime(relationCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
}

+ 4 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ylz/YlzNotifyController.java

@ -155,6 +155,7 @@ public class YlzNotifyController<T> {
			LOGGER.info("解密前:{}", JSON.toJSONString(encryptRes));
			ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
			LOGGER.info("解密后:{}", JSON.toJSONString(decryptRes));
			String param =JSON.toJSONString(decryptRes);
			boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
			if (!isDecrypt) {
				response.getWriter().write("DECRYPT FAILURE");
@ -164,9 +165,10 @@ public class YlzNotifyController<T> {
				if (!isVerify) {
					response.getWriter().write("FAILURE");
				} else {
					String param = JSON.toJSONString(decryptRes.getParam());
					JSONObject object = JSONObject.parseObject(param);
					String orderNo = object.getString("outChargeNo");
					JSONObject jsonObject = object.getJSONObject("param");
					LOGGER.info("object"+object.toJSONString()+"jsonObject"+jsonObject.toJSONString());
					String orderNo = jsonObject.getString("outChargeNo");
					businessOrderService.updatePayStatus(orderNo);
					response.getWriter().write("SUCCESS");
				}