Browse Source

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

humingfen 3 years ago
parent
commit
99eccba093

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

@ -81,4 +81,10 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    @Query("update WlyyOutpatientDO p set p.hisStatus=?2 where p.id=?1")
    void updateHisStatusById(String id,Integer hisStatus);
    @Transactional
    @Modifying
    @Query("update WlyyOutpatientDO p set p.channelId=?2 where p.id=?1")
    void updateChannelId(String id,String channelId);
}

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

@ -19,6 +19,10 @@ public interface WlyyInspectionDao extends PagingAndSortingRepository<WlyyInspec
    List<WlyyInspectionDO> findByPrescriptionId(String prescriptionId,Integer del);
    @Query("select a from WlyyInspectionDO a where a.prescriptionId = ?1 and a.code=?2 and a.del=?3 ")
    List<WlyyInspectionDO> findByPrescriptionIdAndCode(String prescriptionId,String code,Integer del);
    @Modifying
    @Query("update WlyyInspectionDO p set p.del=0 where p.id=?1")
    void deleteById(String id);

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

@ -11267,13 +11267,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param idcard 身份证
     * @param payStatus 支付状态
     * @param medicare 社保卡
     * @param createTime 创建时间
     * @param appointmentTime 预约时间
     * @param appointmentTimeStart
     * @param appointmentTimeEnd
     * @param page
     * @param pageSize
     * @param size
     * @return
     */
    public Envelop getNatAppointmentList(String realOrder, String name, String hospitalFlag, String mobile, String idcard, String payStatus, String medicare, String createTimeStart, String createTimeEnd, String appointmentTimeStart, String appointmentTimeEnd, Integer isSuccess, Integer page, Integer pageSize,String orderNo) {
@ -11393,4 +11390,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public  BaseDoctorDO findByIdCard(String idCard){
        return  baseDoctorDao.findByIdcardAndDel(idCard);
    }
    public  void updateChannelId(String id,String channelId){
        outpatientDao.updateChannelId(id,channelId);
    }
}

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

@ -1902,6 +1902,7 @@ public class YkyyEntranceService {
        String admNo= null;
        String registNo=null;
        String deptNo = null;
        String prescriptionId=null;
        if (inspectionDOS!=null&&inspectionDOS.size()!=0){
            WlyyInspectionDO inspectionDO = inspectionDOS.get(0);
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(inspectionDO.getOutpatientId());
@ -1910,6 +1911,7 @@ public class YkyyEntranceService {
            registNo = prescriptionDO.getRealOrder();
            doctor=outpatientDO.getDoctor();
            patient=outpatientDO.getPatient();
            prescriptionId=prescriptionDO.getId();
        }
        for (WlyyInspectionDO wlyyInspectionDO:inspectionDOS){
            YkEmrJcsqDO ykEmrJcsqDO = new YkEmrJcsqDO();
@ -1940,7 +1942,22 @@ public class YkyyEntranceService {
        System.out.println(message.get("code")+"-----"+message.get("msg"));
        if ("-1".equalsIgnoreCase(message.get("code").toString())){
           logger.info("同步检查检验失败,错误信息为:"+message.get("msg").toString());
        }else {
            String msg = message.get("msg").toString();
            JSONObject object = JSONObject.parseObject(msg);
            JSONArray array = object.getJSONArray("detailModelList");
            for (int i=0;i<array.size();i++){
                JSONObject jsonObject = array.getJSONObject(i);
                String xmid = jsonObject.getString("xmid");
                String yjxh = jsonObject.getString("yjxh");
                List<WlyyInspectionDO> inspectionDOList = wlyyInspectionDao.findByPrescriptionIdAndCode(prescriptionId,xmid,1);
                for (WlyyInspectionDO inspectionDO:inspectionDOList){
                    inspectionDO.setHisCode(yjxh);
                    wlyyInspectionDao.save(inspectionDO);
                }
            }
        }
        System.out.println(message.get("code")+"-----"+message.get("msg"));
    }

+ 12 - 0
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -134,6 +134,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private BaseSmsTemplateDao smsTemplateDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    @Autowired
    private WlyyInspectionDao inspectionDao;
@ -880,6 +882,16 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                        wlyyPrescriptionDO.setPayStatus(1);
                        wlyyPrescriptionDO.setPayTime(new Date());
                        prescriptionDao.save(wlyyPrescriptionDO);
                        List<WlyyInspectionDO> inspectionDOList = inspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                        for (WlyyInspectionDO wlyyInspectionDO:inspectionDOList){
                            String updateMsYj01 = "update V_MS_YJ01 t set t.HLWJF=1 where t.yjxh='"+wlyyInspectionDO.getHisCode()+"'";
                            try {
                                ykyyEntranceService.updateHisStatus(updateMsYj01);
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                        prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(),30,1,wlyyPrescriptionDO.getPatientCode(),wlyyPrescriptionDO.getPatientName(),"",new Date());
                        try {
                            String sql = " update v_ms_dd01 SET FKZT=1 where CFSB = '"+wlyyPrescriptionDO.getRealOrder()+"'";

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyInspectionDO.java

@ -56,6 +56,8 @@ public class WlyyInspectionDO extends UuidIdentityEntity {
    private Integer del;//1可用 0删除
    private String totalUnit;//单位
    private String hisCode;
    public String getTotalUnit() {
        return totalUnit;
    }
@ -306,4 +308,12 @@ public class WlyyInspectionDO extends UuidIdentityEntity {
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getHisCode() {
        return hisCode;
    }
    public void setHisCode(String hisCode) {
        this.hisCode = hisCode;
    }
}

+ 14 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -274,6 +274,11 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
     * 处方号
     */
    private String chargeType;
    /**
     * 云信房间号
     */
    private String channelId;
    @Column(name = "charge_type")
    public String getChargeType() {
        return chargeType;
@ -729,4 +734,13 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    public void setRealOrder(String realOrder) {
        this.realOrder = realOrder;
    }
    @Column(name = "channel_id")
    public String getChannelId() {
        return channelId;
    }
    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }
}

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

@ -38,6 +38,8 @@ public class BaseHospitalRequestMapping {
        public static final String PREFIX  = "/prescription";
        public static final String findDoctorByIdCard = "/findDoctorByIdCard";
        public static final String updateChannelId = "/updateChannelId";
        //=====================start=======================================
        /**
         * 获取门诊记录

+ 1 - 5
svr/svr-internet-hospital/pom.xml

@ -235,11 +235,7 @@
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>xom</groupId>
            <artifactId>xom</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>

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

@ -22,6 +22,7 @@ import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.es.service.StatisticsEsService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.service.WlyyHttpLogService;
@ -53,6 +54,7 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.sms.service.YkyyINSMSService;
import com.yihu.jw.util.common.FileUtil;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
@ -195,6 +197,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private SystemMessageService systemMessageService;
    @Autowired
    private ConsultDao consultDao;
    @Autowired
    FileUploadService fileUploadService;
    @Autowired
    private FileUtil fileUtil;
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
@ -1602,4 +1610,68 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                      @RequestParam(value = "idCard", required = false)String idCard) {
        return success(prescriptionService.findByIdCard(idCard));
    }
    @PostMapping(value = "updateChannelId")
    @ApiOperation(value = "保存云信channelId", notes = "保存云信channelId")
    public Envelop updateChannelId(@ApiParam(name = "id", value = "outpatientId")
                                      @RequestParam(value = "id", required = false)String id,
                                      @ApiParam(name = "channelId", value = "渠道id")
                                      @RequestParam(value = "channelId", required = false)String channelId) {
        prescriptionService.updateChannelId(id,channelId);
        return success("保存成功");
    }
    @PostMapping(value = "uploadFileToWx")
    @ApiOperation(value = "上传语音文件或者视频")
    public Envelop append(
            @ApiParam(name = "type", value = "追问内容类型:1文字,2图片,3语音  ... (im消息类型)")
            @RequestParam(value = "type",required = true) Integer type,
            @ApiParam(name = "times", value = "")
            @RequestParam(value = "times",required = false) Integer times) throws Exception {
        JSONObject object = new JSONObject();
        //处理语音文件
        if(!org.springframework.util.StringUtils.isEmpty(wxId)){
//			imService.getInputStream("1",wechat_appid);
            if(3 == type){//语音文件
                String voicepath = imService.fetchWxVoices(wxId);
                logger.info("voice_path:"+voicepath);
                JSONObject obj = new JSONObject();
                String voiceurl = "";
                // 将临时语音拷贝到正式存储路径下
                if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
                    if("xm_ihealth_wx".equals(wxId)){
                        logger.info("voice_wx_type:"+wxId);
                        voiceurl = fileUploadService.uploadWxVoice(voicepath);
//					uploadVO.setFullUri(map.get("accessory").toString());
                    }else {
                        voiceurl = fileUtil.copyTempVoice(voicepath,fastdfs_file_url);
                    }
                    obj.put("path", voiceurl);
                    obj.put("times", times);
                }
                object.put("path",voiceurl);
            }else if(2 == type){//图片文件
                String imagepath = imService.fetchWxImages(wxId);
                logger.info("image_path:"+imagepath);
                JSONObject obj = new JSONObject();
                String imgeUrl = "";
                // 将临时语音拷贝到正式存储路径下
                if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
                    if("xm_ihealth_wx".equals(wxId)){
                        logger.info("imge_wx_type:"+wxId);
                        imgeUrl = fileUploadService.uploadWxImage(imagepath);
//					uploadVO.setFullUri(map.get("accessory").toString());
                    }else{
                        imgeUrl = fileUtil.copyTempVoice(imagepath,fastdfs_file_url);
                    }
                    object.put("path",imgeUrl);
                }
            }else{}
        }
        return success(object);
    }
}

+ 2 - 2
svr/svr-internet-hospital/src/main/resources/application.yml

@ -455,9 +455,9 @@ spring:
    host: 192.168.33.198 # Redis server host.
    port: 6380 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
  fastdfs_file_url: http://192.168.33.198:8888/
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
  tracker-server: 192.168.33.198:22122 #服务器地址
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle

+ 28 - 30
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -89,48 +89,43 @@ public class RehabilitationManageService {
     */
    public MixEnvelop<Map<String,Object>, Map<String,Object>> findRehabilitationPlan(Integer doctorType,String doctorCode, String diseaseCode, Integer planType,Integer todaybacklog, String patientCondition,Integer page, Integer pageSize) throws Exception{
        String leftSql = "";
        String sql = " select p.*  from wlyy_specialist.wlyy_patient_rehabilitation_plan p  " ;
        String sql = " select DISTINCT p.* " +
                " from wlyy_specialist.wlyy_rehabilitation_plan_detail a INNER JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p " +
                " on a.plan_id = p.id  " ;
        if(doctorType==2){//家医是根据签约关系过滤
            leftSql =" join "+basedb+".wlyy_sign_family f on f.patient=p.patient and f.expenses_status='1' and f.status=1 ";
            leftSql+=" and (f.doctor='"+doctorCode+"' or f.doctor_health='"+doctorCode+"') ";
            sql.replace("from", ",f.idcard,f.hospital_name from");
            sql += leftSql;
            sql+=" INNER JOIN wlyy.wlyy_sign_family f ON f.patient = p.patient \n" +
                    "\tand f.expenses_status=1\n" +
                    "\tAND f.STATUS >= 1 \n" +
                    "\tAND ( f.doctor = '"+doctorCode+"' OR f.doctor_health = '"+doctorCode+"' )  ";
        }
        sql += " where 1=1 ";
        if(todaybacklog!=null&&todaybacklog==1){
            String todayStart = DateUtil.getStringDateShort()+" "+"00:00:00";
            String todayEnd = DateUtil.getStringDateShort()+" "+"23:59:59";
            sql += " and a.execute_time>='"+todayStart+"' and a.execute_time<='"+todayEnd+"'";
        }
        if(planType!=null){
            sql += " and p.plan_type="+planType;
        }
        if(StringUtils.isNotEmpty(diseaseCode)){
            sql+=" and p.disease='"+diseaseCode+"'";
        }
        if(StringUtils.isNotEmpty(patientCondition)){
            sql += " and " + AesEncryptUtils.decryptMysqlNo("p.name") + " like '%"+patientCondition+"%' ";
        if(StringUtils.isNotEmpty(patientCondition)){//姓名idcard模糊查询
            sql +=" AND EXISTS (select code from wlyy.wlyy_patient where  `code` = p.patient and ( `name` LIKE '%"+patientCondition+"%' or idcard like '%"+patientCondition+"%') )";
        }
        if (doctorType==1){
            sql +=" AND (p.create_user = '"+doctorCode+"' \n" +
                    "\tOR a.doctor = '"+doctorCode+"' ) ";
        }
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planAll2(sql);
        String finalSql = "";
        String todayStart = DateUtil.getStringDateShort()+" "+"00:00:00";
        String todayEnd = DateUtil.getStringDateShort()+" "+"23:59:59";
        String condition ="";
        if(todaybacklog!=null&&todaybacklog==1){
            condition += " and execute_time>='"+todayStart+"' and execute_time<='"+todayEnd+"'";
        }
        finalSql =" select DISTINCT b.* from (select  plan_id,doctor from wlyy_specialist.wlyy_rehabilitation_plan_detail where  1=1 "+condition+") a " +
                " JOIN ("+sql+") b on a.plan_id=b.id ";
        if(doctorType==1){//专科医生是根据计划的创建者字段过滤
            finalSql += " where  b.create_user = '"+doctorCode+"' or a.doctor ='"+doctorCode+"'";
        }
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(finalSql);
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        int count = 0;
        if(rstotal!=null&&rstotal.size()>0&&rstotal.get(0).get("id")!=null){
            count = rstotal.size();
        }
        finalSql += " ORDER BY b.create_time DESC LIMIT "+(page-1)*pageSize+","+pageSize;
        List<Map<String,Object>> patientRehabilitationPlanDOList = jdbcTemplate.queryForList(finalSql);
        sql += " ORDER BY p.create_time DESC LIMIT "+(page-1)*pageSize+","+pageSize;
        List<Map<String,Object>> patientRehabilitationPlanDOList = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> resultList = new ArrayList<>();
        if(patientRehabilitationPlanDOList.size()>0&&patientRehabilitationPlanDOList.get(0).get("id")!=null){
@ -1198,14 +1193,17 @@ public class RehabilitationManageService {
                detailDO.setRelationCode(relationCode);
            }
            rehabilitationDetailDao.save(detailDO);
            if (StringUtils.isNoneBlank(node)){
            if (StringUtils.isNoneBlank(image)&&StringUtils.isNoneBlank(node)){
                int j = rehabilitationOperateRecordsDao.updateNodeAndRelationRecordImg(node,image,planDeatilId);
            }
            else if (StringUtils.isNoneBlank(node)){
                int j = rehabilitationOperateRecordsDao.updateNodeByPlanDetailId(node,planDeatilId);
            }
            if (StringUtils.isNoneBlank(image)){//
            else if (StringUtils.isNoneBlank(image)){//
                int j = rehabilitationOperateRecordsDao.updateImagByPlanDetailId(image,planDeatilId);
            }
            if (StringUtils.isNoneBlank(image)&&StringUtils.isNoneBlank(node)){
                int j = rehabilitationOperateRecordsDao.updateNodeAndRelationRecordImg(node,image,planDeatilId);
            else{//跟新为已完成
                int j = rehabilitationOperateRecordsDao.updateStatus(1,planDeatilId);
            }
            //如果整个计划的服务项都完成了,整个计划也完成了
            String allSql ="SELECT * FROM wlyy_rehabilitation_plan_detail where plan_id = (SELECT plan_id FROM `wlyy_rehabilitation_plan_detail` WHERE id='"+planDeatilId+"')";