Compare commits

...

14 Commits

Author SHA1 Message Date
zhangye 832a6b54f2 柳铁同步相关 23 hours ago
zhangye 144999f7cd Merge branch 'master' into ltszxyy 3 days ago
zhangye 1170b88ff1 修改同步时其他信息的添加 3 days ago
zhangye c0ee0f5597 暂存 4 days ago
zhangye a759cc61ab 暂存 4 days ago
lzp bb158a771c 量表套餐界面,套餐添加权限按钮 4 days ago
lzp 64769d26b9 柳铁默认筛查版本 4 days ago
zhangye 6b346542f1 修改同步用户 5 days ago
zhangye 93120bd663 修改柳铁bug 6 days ago
zhangye c57d2a6af4 修改柳铁数据源 6 days ago
zhangye 997f81f6ae 修改同步用户信息 1 week ago
zhangye 5569d19ad2 修改配置信息 1 week ago
zhangye 09496981a0 部署柳铁 1 week ago
zhangye a5bb791511 柳铁调用his接口同步部门和用户,未内网测试 1 week ago
  1. 2
      ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/enums/DataSourceType.java
  2. 8
      ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/config/DruidConfig.java
  3. 4
      ruisi_java/ruisi-system/src/main/resources/mapper/system/SysUserMapper.xml
  4. 2
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/ReportPdfController.java
  5. 17
      ruisi_java/ruisi-web-admin/src/main/resources/application-prod.yml
  6. 2
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/DockController.java
  7. 43
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/PmsController.java
  8. 74
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/scheduled/SyncHospitalData.java
  9. 12
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/scheduled/SyncHospitalViwe.java
  10. 18
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/HisConnectionDao.java
  11. 13
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/ILtHisConnectionService.java
  12. 4
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IPmsPatientService.java
  13. 562
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/LtHisConnectionServiceImpl.java
  14. 57
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/PmsPatientServiceImpl.java
  15. 7
      ruisi_java/ruisi-web-client/src/main/resources/application-dev.yml
  16. 38
      ruisi_java/ruisi-web-client/src/main/resources/application-prod.yml
  17. 6
      ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/HisConnectionDao.xml
  18. 185
      web_admin/adminapi/index.html
  19. BIN
      web_admin/adminapi/index.html.gz
  20. 2
      web_client/src/views/evaluation/index.vue
  21. 2
      web_client/vue.config.js

2
ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/enums/DataSourceType.java

@ -19,5 +19,5 @@ public enum DataSourceType {
/**
* 柳铁
*/
ORACLE
LTSZXYYORACLE
}

8
ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/config/DruidConfig.java

@ -54,9 +54,9 @@ public class DruidConfig {
}
@Bean
@ConfigurationProperties("spring.datasource.druid.oracle")
@ConditionalOnProperty(prefix = "spring.datasource.druid.oracle", name = "enabled", havingValue = "true")
public DataSource oracleDataSource(DruidProperties druidProperties) {
@ConfigurationProperties("spring.datasource.druid.ltszxyyoracle")
@ConditionalOnProperty(prefix = "spring.datasource.druid.ltszxyyoracle", name = "enabled", havingValue = "true")
public DataSource ltszxyyDataSource(DruidProperties druidProperties) {
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
@ -67,7 +67,7 @@ public class DruidConfig {
Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
setDataSource(targetDataSources, DataSourceType.ORACLE.name(), "oracleDataSource"); // 添加这一行
setDataSource(targetDataSources, DataSourceType.LTSZXYYORACLE.name(), "ltszxyyDataSource"); // 添加这一行
return new DynamicDataSource(masterDataSource, targetDataSources);
}

4
ruisi_java/ruisi-system/src/main/resources/mapper/system/SysUserMapper.xml

@ -11,8 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="postId" column="post_id" />
<result property="titleId" column="title_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="emplCode" column="empl_code" />
<result property="nickName" column="nick_name" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.post_id, u.title_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_name, d.leader, d1.dept_name as parent_name, d1.dept_id as parent_id,
p.post_name, p.post_code, u.empl_code, u.valid_date,
p.post_name, p.post_code,u.empl_code, u.valid_date,
t.title_name, u.skip_check_device, t.title_code
from ums_user u
left join ums_dept d on u.dept_id = d.dept_id

2
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/ReportPdfController.java

@ -40,7 +40,7 @@ public class ReportPdfController {
@ApiOperation(value = "通过就诊号查询患者的评估报告单",notes = "")
@PostMapping(value="/reportPDF")
public JsonResponse<PageInfo<RmsVo.ReportPDF>> reportPDF(@RequestBody @Validated BaseDto<RmsDto.ReportPDF> dto){
log.info("通过就诊号查询患者的评估报告单:{}", dto);
log.info("院内对接his通过就诊号查询患者的评估报告单:{}", dto);
startPage(dto);
List<RmsVo.ReportPDF> list = rmsService.viewReportPDF(dto.getParam());
return JsonResponse.ok(new PageInfo<>(list));

17
ruisi_java/ruisi-web-admin/src/main/resources/application-prod.yml

@ -6,9 +6,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.0.128:3306/ruisi_cga?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://200.1.8.141:23306/ruisi_cga?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: Sxinf18aA
password: xian#2024!!!
# 从库数据源
slave:
# 从数据源开关/默认关闭
@ -62,13 +62,13 @@ spring:
# redis 配置
redis:
# 地址
host: localhost
host: 172.17.0.1
# 端口,默认为6379
port: 6379
# 数据库索引
database: 1
# 密码
password: 123456
password: "redis111^#"
# 连接超时时间
timeout: 10s
lettuce:
@ -99,12 +99,12 @@ ht:
patientUrl: https://api.tall.wiki/ruisi/client/#
name: 认知功能评测云平台系统
file:
path: /data/cgav2/profile/
path: /data/cgav2/server/profile/
#domain: https://api.ccsens.com/test/
domain: http://116.204.40.58/ruisiClient
imgDomain: http://116.204.40.58/ruisiClient/profile
reportDomain: /data/cgav2/server/profile
imgDomain: https://test.tall.wiki/htageClient/profile
reportPath: /data/cgav2/server/profile
reportDomain: /data/cgav2/server/profile
ldTemplate: /data/cgav2/server/profile/upload/dTemplate.xlsx
ldTjbgDir: /data/cgav2/server/profile/tjbg/
ldExportDir: /data/cgav2/server/profile/ldExport
@ -112,9 +112,10 @@ file:
ldZQTYTemplate: /data/cgav2/server/profile/upload/2024年河津流调知情同意书模板-V1.docx
grPath: /data/cgav2/server/profile/grReportTemplate.docx
ysPath: /data/cgav2/server/profile/ysReportTemplate.docx
allPath: /data/cgav2/server/profile/allReportTemplate.docx
informed:
studySign: /data/cgav2/server/profile/studySign.png
template: /data/cgav2/server/profile/知情同意模板.docx
wordUrl: /data/cgav2/server/profile/informed/
prefixWord: /data/cgav2/server/profile/

2
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/DockController.java

@ -50,10 +50,12 @@ public class DockController {
@ApiOperation("对接院内登录重定向至本系统")
@GetMapping("/redirect")
public void loginRedirect(String visitNo, String emplCode, HttpServletResponse response) throws IOException {
log.info("院内登录重定向至本系统{}--{}", visitNo, emplCode);
//根据emplCode获取token
String token = loginService.getLoginByEmplCode(emplCode);
// 3. 构建前端URL
String frontendUrl = redirectPath + "?idCard=" + visitNo + "&token=Bearer " + token;
log.info("重定向至本系统路径:{}", frontendUrl);
// 4. 重定向
response.sendRedirect(frontendUrl);
}

43
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/PmsController.java

@ -15,9 +15,11 @@ import com.ccsens.common.core.controller.BaseController;
import com.ccsens.common.core.domain.BaseDto;
import com.ccsens.common.core.domain.JsonResponse;
import com.ccsens.common.core.domain.model.LoginUser;
import com.ccsens.common.enums.DataSourceType;
import com.ccsens.common.exception.base.BaseException;
import com.ccsens.common.utils.SecurityUtils;
import com.ccsens.common.utils.sign.Md5Utils;
import com.ccsens.framework.datasource.DynamicDataSourceContextHolder;
import com.ccsens.system.domain.dto.LdPatientDto;
import com.ccsens.system.domain.dto.PmsPatientDto;
import com.ccsens.system.domain.po.HmsHospitalConfig;
@ -54,22 +56,25 @@ public class PmsController extends BaseController {
private IPmsPatientService patientService;
@Resource
private IHmsService hmsService;
// @Resource
// private ILtHisConnectionService ltHisConnectionService;
@Resource
private ILtHisConnectionService ltHisConnectionService;
private final String hospitalConfKey = "patient_encryption";
@ApiOperation("获取患者信息列表")
@PostMapping("/queryList")
public JsonResponse<PageInfo<PmsPatientVo.PatientList>> queryPatientList(@RequestBody @Validated BaseDto<PmsPatientDto.QueryPatient> dto) {
// List<PmsPatientVo.PatientList> list = new ArrayList<>();
List<PmsPatientVo.PatientList> list = new ArrayList<>();
// PmsPatientDto.QueryPatient param = dto.getParam();
PmsPatientDto.QueryPatient param = dto.getParam();
// if (StrUtil.isNotEmpty(param.getSearchValue()) && param.getSearchValue().length() == 10) {
// //关键字不为空,且长度等于10,先查询院内his信息
// List<PmsPatientVo.PatientList> hisList = ltHisConnectionService.queryHisPatient(param.getSearchValue());
// if (CollUtil.isNotEmpty(hisList)) {
// list.addAll(hisList);
// }
if(StrUtil.isNotEmpty(param.getSearchValue())) {
//先查询院内his信息
List<PmsPatientVo.PatientList> hisList = ltHisConnectionService.queryHisPatient(param.getSearchValue());
if (CollUtil.isNotEmpty(hisList)) {
list.addAll(hisList);
}
DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.SLAVE.name());
}
// }
//获取用户的权限
@ -86,18 +91,18 @@ public class PmsController extends BaseController {
startPageOvertop(dto);
List<PmsPatientVo.PatientList> serverList = patientService.queryPatientList(dto.getParam(), dataScope, loginUser.getUserId(), loginUser.getUsername());
// if (CollUtil.isNotEmpty(serverList)) {
// list.addAll(serverList);
// }
if (CollUtil.isNotEmpty(serverList)) {
list.addAll(serverList);
}
// // 创建一个 TreeSet,通过 Comparator 根据 patientId 去重
// Set<PmsPatientVo.PatientList> uniqueSet = new TreeSet<>(
// Comparator.comparing(PmsPatientVo.PatientList::getPatientId)
// );
// uniqueSet.addAll(list);
// List<PmsPatientVo.PatientList> uniqueList = new ArrayList<>(uniqueSet);
// 创建一个 TreeSet,通过 Comparator 根据 patientId 去重
Set<PmsPatientVo.PatientList> uniqueSet = new TreeSet<>(
Comparator.comparing(PmsPatientVo.PatientList::getPatientId)
);
uniqueSet.addAll(list);
List<PmsPatientVo.PatientList> uniqueList = new ArrayList<>(uniqueSet);
return JsonResponse.ok(new PageInfo<>(serverList));
return JsonResponse.ok(new PageInfo<>(uniqueList));
}
@ApiOperation("通过身份证号查询患者信息,方便页面展示返回和列表一样的格式")

74
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/scheduled/SyncHospitalData.java

@ -1,5 +1,6 @@
package com.ccsens.client.controller.scheduled;
import com.ccsens.client.service.ILtHisConnectionService;
import com.ccsens.common.annotation.DataSource;
import com.ccsens.common.core.domain.entity.SysDept;
import com.ccsens.common.core.domain.entity.SysUser;
@ -22,44 +23,81 @@ public class SyncHospitalData {
@Resource
private DockService dockService;
@Resource
private ILtHisConnectionService ltHisConnectionService;
@DataSource(value = DataSourceType.SLAVE)
// @DataSource(value = DataSourceType.SLAVE)
// @Scheduled(cron = "0 */1 * * * ?")
public void syncHospitalData() {
dockService.syncHospitalData();
}
// public void syncHospitalData() {
// dockService.syncHospitalData();
// }
@DataSource(value = DataSourceType.SLAVE)
// @DataSource(value = DataSourceType.SLAVE)
// @Scheduled(cron = "0 */1 * * * ?")
// public void syncDeptData() {
// try {
// List<SysDept> sysDepts = dockService.syncUmsDeptSlave();
// syncDeptMaster(sysDepts);
// }catch (Exception e){
// log.error("部门信息同步失败",e);
// }
//
// }
// @DataSource(value = DataSourceType.MASTER)
// public void syncDeptMaster(List<SysDept> sysDepts) {
// dockService.syncUmsDeptMaster(sysDepts);
// }
// @DataSource(value = DataSourceType.SLAVE)
// @Scheduled(cron = "0 */1 * * * ?")
public void syncDeptData() {
// public void syncUserData() {
// try {
// List<SysUser> sysUsers = dockService.syncUmsUserSlave();
// syncUserMaster(sysUsers);
// }catch (Exception e){
// log.error("用户信息同步失败",e);
// }
// }
// @DataSource(value = DataSourceType.MASTER)
// public void syncUserMaster(List<SysUser> sysUser) {
// dockService.syncUmsUserMaster(sysUser);
// }
/**
* 柳铁自动更新部门和用户信息
*/
@DataSource(value = DataSourceType.SLAVE)
@Scheduled(cron = "0 */30 * * * ?")
public void syncDeptDataSlave() {
try {
List<SysDept> sysDepts = dockService.syncUmsDeptSlave();
List<SysDept> sysDepts = ltHisConnectionService.syncDeptDataSlave();
syncDeptMaster(sysDepts);
}catch (Exception e){
log.error("部门信息同步失败",e);
} catch (Exception e) {
log.error("部门信息同步失败", e);
}
}
@DataSource(value = DataSourceType.MASTER)
public void syncDeptMaster(List<SysDept> sysDepts) {
dockService.syncUmsDeptMaster(sysDepts);
ltHisConnectionService.syncDeptDataMaster(sysDepts);
}
@DataSource(value = DataSourceType.SLAVE)
// @Scheduled(cron = "0 */1 * * * ?")
public void syncUserData() {
@Scheduled(cron = "0 */10 * * * ?")
public void syncUserDataSlave() {
try {
List<SysUser> sysUsers = dockService.syncUmsUserSlave();
List<SysUser> sysUsers = ltHisConnectionService.syncUserDataSlave();
syncUserMaster(sysUsers);
}catch (Exception e){
log.error("用户信息同步失败",e);
} catch (Exception e) {
log.error("用户信息同步失败", e);
}
}
@DataSource(value = DataSourceType.MASTER)
public void syncUserMaster(List<SysUser> sysUser) {
dockService.syncUmsUserMaster(sysUser);
ltHisConnectionService.syncUserDataMaster(sysUser);
}
}

12
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/scheduled/SyncHospitalViwe.java

@ -24,42 +24,42 @@ public class SyncHospitalViwe {
@Resource
private DockService dockService;
@DataSource(value = DataSourceType.ORACLE)
// @DataSource(value = DataSourceType.ORACLE)
// @Scheduled(cron = "0 */10 * * * ?")
public void getDeptView() {
List<DockVo.DeptInfo> sysDepts = dockService.getDeptView();
syncDeptView(sysDepts);
}
@DataSource(value = DataSourceType.ORACLE)
// @DataSource(value = DataSourceType.ORACLE)
// @Scheduled(cron = "0 */10 * * * ?")
public void getEmplView() {
List<DockVo.EmplInfo> sysEmpls = dockService.getEmplView();
syncEmplView(sysEmpls);
}
@DataSource(value = DataSourceType.ORACLE)
// @DataSource(value = DataSourceType.ORACLE)
// @Scheduled(cron = "0 */10 * * * ?")
public void getPatientBasicView() {
List<DockVo.PatientBasicInfo> sysPatients = dockService.getPatientBasicView();
syncPatientBasicView(sysPatients);
}
@DataSource(value = DataSourceType.ORACLE)
// @DataSource(value = DataSourceType.ORACLE)
// @Scheduled(cron = "0 */10 * * * ?")
public void getPatientVisitView() {
List<DockVo.PatientVisitInfo> sysVisits = dockService.getPatientVisitView();
syncPatientVisitView(sysVisits);
}
@DataSource(value = DataSourceType.ORACLE)
// @DataSource(value = DataSourceType.ORACLE)
// @Scheduled(cron = "0 */10 * * * ?")
public void getDiagnosisView() {
List<DockVo.DiagnosisInfo> sysDiagnosis = dockService.getDiagnosisView();
syncDiagnosisView(sysDiagnosis);
}
@DataSource(value = DataSourceType.ORACLE)
// @DataSource(value = DataSourceType.ORACLE)
// @Scheduled(cron = "0 */10 * * * ?")
public void getMedicationView() {
List<DockVo.MedicationInfo> sysMedications = dockService.getMedicationView();

18
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/HisConnectionDao.java

@ -12,12 +12,18 @@ import java.util.Map;
*/
public interface HisConnectionDao {
@DataSource(DataSourceType.SLAVE)
List<Map<String, Object>> getGmxx(String cardNo);
// @DataSource(DataSourceType.LTSZXYYORACLE)
// List<Map<String, Object>> getGmxx(String cardNo);
//
// @DataSource(DataSourceType.LTSZXYYORACLE)
// List<Map<String, Object>> getBlxx(String cardNo);
@DataSource(DataSourceType.SLAVE)
List<Map<String, Object>> getBlxx(String cardNo);
@DataSource(DataSourceType.SLAVE)
@DataSource(DataSourceType.LTSZXYYORACLE)
List<Object> getBlxxAll();
@DataSource(DataSourceType.LTSZXYYORACLE)
List<Map<String, Object>> getBlxxByVisitNo(String visitNo);
@DataSource(DataSourceType.LTSZXYYORACLE)
List<Map<String, Object>> getGmxxByVisitNo(String visitNo);
}

13
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/ILtHisConnectionService.java

@ -1,5 +1,7 @@
package com.ccsens.client.service;
import com.ccsens.common.core.domain.entity.SysDept;
import com.ccsens.common.core.domain.entity.SysUser;
import com.ccsens.system.domain.vo.PmsPatientVo;
import org.apache.poi.ss.formula.functions.T;
@ -14,7 +16,16 @@ public interface ILtHisConnectionService {
PmsPatientVo.PatientList getPatientByCardNo(String cardNo);
Map<String, List<Map<String, Object>>> getPatientOtherMsgByCardNo(String cardNo, Long patientId);
Map<String, List<Map<String, Object>>> getPatientOtherMsgByCardNo(String visitNo, String cardNo, Long patientId);
List<PmsPatientVo.PatientList> queryHisPatient(String cardNo);
List<SysDept> syncDeptDataSlave();
void syncDeptDataMaster(List<SysDept> sysDepts);
List<SysUser> syncUserDataSlave();
void syncUserDataMaster(List<SysUser> sysUsers);
}

4
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IPmsPatientService.java

@ -2,7 +2,7 @@ package com.ccsens.client.service;
import com.ccsens.system.domain.dto.LdPatientDto;
import com.ccsens.system.domain.dto.PmsPatientDto;
import com.ccsens.system.domain.po.PmsPatient;
import com.ccsens.system.domain.po.*;
import com.ccsens.system.domain.vo.LdPatientVo;
import com.ccsens.system.domain.vo.PmsPatientVo;
@ -36,7 +36,7 @@ public interface IPmsPatientService {
PmsPatientVo.PatientInfo editPatient(PmsPatient pmsPatient);
Long editPatientOtherMsg(PmsPatientDto.EditOtherMsg param);
Long editPatientOtherMsgByHis(PmsPatientDto.EditOtherMsg param);
void editPatientOtherMsgByHis(PmsPatientBody pmsPatientBody, PmsPatientPersonal pmsPatientPersonal, PmsPatientDiagnosis PmsPatientDiagnosis, PmsPatientParentIllness pmsPatientParentIllness);
Integer delPatient(PmsPatientDto.GetPatientById param);
//
// Long insertPatientIllnessHistory(AmsPatientReportDto.EditPatientIllnessHistory param,Long patientId);

562
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/LtHisConnectionServiceImpl.java

@ -2,6 +2,8 @@ package com.ccsens.client.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@ -16,27 +18,28 @@ import com.ccsens.client.persist.dao.PmsPatientDao;
import com.ccsens.client.service.ILtHisConnectionService;
import com.ccsens.client.service.IPmsPatientService;
import com.ccsens.common.annotation.DataSource;
import com.ccsens.common.core.domain.entity.SysDept;
import com.ccsens.common.core.domain.entity.SysRole;
import com.ccsens.common.core.domain.entity.SysUser;
import com.ccsens.common.core.domain.model.LoginUser;
import com.ccsens.common.enums.DataSourceType;
import com.ccsens.common.utils.IDGenerator;
import com.ccsens.common.utils.SecurityUtils;
import com.ccsens.framework.datasource.DynamicDataSourceContextHolder;
import com.ccsens.system.domain.SysUserRole;
import com.ccsens.system.domain.dto.PmsPatientDto;
import com.ccsens.system.domain.po.PmsPatient;
import com.ccsens.system.domain.po.PmsPatientBody;
import com.ccsens.system.domain.po.PmsPatientBodyExample;
import com.ccsens.system.domain.po.PmsPatientExample;
import com.ccsens.system.domain.po.*;
import com.ccsens.system.domain.vo.PmsPatientVo;
import com.ccsens.system.persist.mapper.PmsPatientBodyMapper;
import com.ccsens.system.persist.mapper.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -59,6 +62,19 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
private PmsPatientDao patientDao;
@Resource
private PmsPatientBodyMapper patientBodyMapper;
@Resource
private SysDeptMapper sysDeptMapper;
@Resource
private SysUserMapper sysUserMapper;
@Resource
private SysUserRoleMapper userRoleMapper;
@Resource
private SysRoleMapper sysRoleMapper;
@Value("${hospitalId:}")
private Long hospitalId;
@Value("${generalPassword:}")
private String generalPassword;
/**
* 前端调用查询列表接口如果有数据则直接返回
@ -75,6 +91,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
//【RP1.1.4S054】查询患者档案信息
private static final String URL_SUFFIX_RP_1_1_4 = "/patient-service/api/v1/patient/archives/get?cardNo=";
//查询住院记录http://200.1.8.36:7801/roc/patient-service/api/v1/patient/getFinIprList
//【RP2.1.6S062】查询门诊患者挂号记录
private static final String URL_SUFFIX_RP_2_1_6 = "/patient-service/api/v1/register/patient/getFinOprRegList";
@ -85,15 +102,40 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
//【RE2.1.5S234】新 获取病案首页基本信息
private static final String URL_SUFFIX_RE_2_1_5 = "/patient-service/api/v1/patient/getFinOprRegList?inPatientNo=";
//【RC1.1.1S001】查询科室列表
private static final String URL_SUFFIX_RC_1_1_1 = "/curr-web/api/v1/common/dept/query";
//【RC1.1.3S003】查询人员列表
private static final String URL_SUFFIX_RC_1_1_3 = "/curr-web/api/v1/common/employee/query";
@Override
public List<PmsPatientVo.PatientList> queryHisPatient(String cardNo) {
LoginUser loginUser = null;
try {
loginUser = getLoginUser();
}catch (Exception e){
} catch (Exception e) {
}
try {
//先试用传入的值查询病例视图
String visitNo = cardNo;
List<Map<String, Object>> blxx = new ArrayList<>();
try {
blxx = hisConnectionDao.getBlxxByVisitNo(cardNo);
log.info("查询视图blxx成功:{}", blxx.get(0));
} catch (Exception e) {
log.error("查询视图blxx异常", e);
}
DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.SLAVE.name());
if (CollUtil.isNotEmpty(blxx)) {
Map<String, Object> item = blxx.get(0);
Object object = item.get("患者卡号");
if(ObjectUtil.isNotNull(object)){
cardNo = object.toString();
}
}
PmsPatientVo.PatientList patientByCardNo = getPatientByCardNo(cardNo);
if (ObjectUtil.isNotNull(patientByCardNo)) {
//检查当前患者信息是否在系统内已存在
@ -103,7 +145,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
List<PmsPatient> pmsPatients = patientDao.selectByExample(example);
if (CollUtil.isEmpty(pmsPatients)) {
pmsPatient = new PmsPatient();
}else {
} else {
pmsPatient = pmsPatients.get(0);
}
//查找到患者信息,先添加基本信息
@ -114,6 +156,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
pmsPatient.setNameFull(PinyinUtil.getPinyin(pmsPatient.getName(), ""));
pmsPatient.setNameInitial(PinyinUtil.getFirstLetter(pmsPatient.getName(), ""));
pmsPatient.setPatientNumber(cardNo);
pmsPatient.setMobile(patientByCardNo.getPhone());
PmsPatientVo.PatientInfo pmsPatientVo = patientService.editPatient(pmsPatient);
//保存id
@ -122,48 +165,53 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
try {
//根据就诊流水号查找当前患者是否有baby信息
PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample();
patientBodyExample.createCriteria().andOutpatientNoEqualTo(cardNo).andPatientIdEqualTo(patientByCardNo.getPatientId()).andDelFlagEqualTo((byte) 0);
patientBodyExample.createCriteria().andOutpatientNoEqualTo(visitNo).andPatientIdEqualTo(patientByCardNo.getPatientId()).andDelFlagEqualTo((byte) 0);
List<PmsPatientBody> pmsPatientBodies = patientBodyMapper.selectByExample(patientBodyExample);
if(CollUtil.isEmpty(pmsPatientBodies)){
Map<String, List<Map<String, Object>>> patientOtherMsgByCardNo = getPatientOtherMsgByCardNo(cardNo,patientByCardNo.getPatientId());
addOtherMsg(patientOtherMsgByCardNo, patientByCardNo);
if (CollUtil.isEmpty(pmsPatientBodies)) {
Map<String, List<Map<String, Object>>> patientOtherMsgByCardNo = getPatientOtherMsgByCardNo(visitNo, cardNo, patientByCardNo.getPatientId());
// log.info("查询其他信息成功:{}", patientOtherMsgByCardNo);
// addOtherMsg(patientOtherMsgByCardNo, patientByCardNo);
}
}catch (Exception e){
} catch (Exception e) {
log.error("获取患者其他信息失败", e);
}
List<PmsPatientVo.PatientList> list = new ArrayList<>();
list.add(patientByCardNo);
return list;
}else {
} else {
return null;
}
}catch (Exception e){
} catch (Exception e) {
log.error("查询患者失败", e);
return null;
}
}
public void addOtherMsg(Map<String, List<Map<String, Object>>> patientOtherMsgByCardNo, PmsPatientVo.PatientList patientByCardNo) {
if(CollUtil.isNotEmpty(patientOtherMsgByCardNo)){
//不为空则添加其他信息
patientOtherMsgByCardNo.forEach((key, valueList) -> {
if(CollUtil.isNotEmpty(valueList)){
valueList.forEach(value -> {
com.alibaba.fastjson2.JSONObject valueJson = com.alibaba.fastjson2.JSONObject.parseObject(JSONUtil.toJsonStr(value));
valueJson.put("patientId", patientByCardNo.getPatientId());
PmsPatientDto.EditOtherMsg param = new PmsPatientDto.EditOtherMsg();
param.setEditType(key);
param.setModel(valueJson);
patientService.editPatientOtherMsgByHis(param);
});
}
});
}
}
// public void addOtherMsg(Map<String, List<Map<String, Object>>> patientOtherMsgByCardNo, PmsPatientVo.PatientList patientByCardNo) {
// if (CollUtil.isNotEmpty(patientOtherMsgByCardNo)) {
// //不为空则添加其他信息
// patientOtherMsgByCardNo.forEach((key, valueList) -> {
// if (CollUtil.isNotEmpty(valueList)) {
// valueList.forEach(value -> {
// com.alibaba.fastjson2.JSONObject valueJson = com.alibaba.fastjson2.JSONObject.parseObject(JSONUtil.toJsonStr(value));
// valueJson.put("patientId", patientByCardNo.getPatientId());
// PmsPatientDto.EditOtherMsg param = new PmsPatientDto.EditOtherMsg();
// param.setEditType(key);
// param.setModel(valueJson);
// log.info("添加其他信息:{}--{}", key, value);
// patientService.editPatientOtherMsgByHis(param);
// });
// }
// });
// }
// }
@Override
public PmsPatientVo.PatientList getPatientByCardNo(String cardNo) {
PmsPatientVo.PatientList patientVo;
//调用"【RP1.1.4S054】查询患者档案信息"接口
String url = URL_PREFIX + URL_SUFFIX_RP_1_1_4 + cardNo;
@ -187,14 +235,14 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
log.warn("查询患者档案信息接口返回data为空");
return null;
}
// 取第一个患者信息
// 患者信息
patientVo = new PmsPatientVo.PatientList();
patientVo.setPatientName(data.getStr("patientName"));
String genderCode = data.getStr("genderCode");
//TODO 性别需要实际调用接口后确定
if ("1".equals(genderCode) || genderCode.contains("男")) {
patientVo.setSex((byte) 0);
} else if ("0".equals(genderCode) || genderCode.contains("女")) {
} else if ("0".equals(genderCode) || genderCode.contains("女") || "2".equals(genderCode)) {
patientVo.setSex((byte) 1);
}
patientVo.setBirthday(data.getStr("birthDate"));
@ -210,10 +258,10 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
patientVo.setIdCardEncrypt(data.getStr("idCardNumber"));
patientVo.setAboBloodType(data.getStr("bloodCode"));
//TODO 职业和婚姻状况待定
if(ObjectUtil.isNotNull(data.getStr("mari"))){
if (ObjectUtil.isNotNull(data.getStr("mari"))) {
patientVo.setMaritalStatus(Byte.valueOf(data.getStr("mari")));
}
if(ObjectUtil.isNotNull(data.getStr("profCode"))){
if (ObjectUtil.isNotNull(data.getStr("profCode"))) {
patientVo.setCareer(Byte.valueOf(data.getStr("profCode")));
}
log.info("处理后的patient信息: {}", patientVo);
@ -225,7 +273,13 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
}
@Override
public Map<String, List<Map<String, Object>>> getPatientOtherMsgByCardNo(String cardNo, Long patientId) {
public Map<String, List<Map<String, Object>>> getPatientOtherMsgByCardNo(String visitNo, String cardNo, Long patientId) {
PmsPatientBody pmsPatientBody = new PmsPatientBody();
PmsPatientPersonal pmsPatientPersonal = new PmsPatientPersonal();
PmsPatientDiagnosis PmsPatientDiagnosis = new PmsPatientDiagnosis();
PmsPatientParentIllness pmsPatientParentIllness = new PmsPatientParentIllness();
//1.查询所有需要的信息
Map<String, Object> params = new HashMap<>();
params.put("cardNo", cardNo);
@ -241,17 +295,17 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
//查视图过敏信息
List<Map<String, Object>> gmxx = new ArrayList<>();
try {
gmxx = hisConnectionDao.getGmxx(cardNo);
log.info("查询视图gmxx成功:{}", gmxx.get(0));
}catch (Exception e){
gmxx = hisConnectionDao.getGmxxByVisitNo(visitNo);
log.info("查询视图gmxx成功:{}", gmxx);
} catch (Exception e) {
log.error("查询视图gmxx异常", e);
}
//查视图病历信息
List<Map<String, Object>> blxx = new ArrayList<>();
try {
blxx = hisConnectionDao.getBlxx(cardNo);
log.info("查询视图blxx成功:{}", blxx.get(0));
}catch (Exception e){
blxx = hisConnectionDao.getBlxxByVisitNo(visitNo);
log.info("查询视图blxx成功:{}", blxx);
} catch (Exception e) {
log.error("查询视图blxx异常", e);
}
@ -260,34 +314,29 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
// 病史信息 - PmsPatientPersonal
List<Map<String, Object>> personalList = new ArrayList<>();
Map<String, Object> personal = new HashMap<>();
personal.put("patientId", patientId);
personal.put("visitNo", cardNo);
// personal.put("patientId", patientId);
// personal.put("visitNo", visitNo);
pmsPatientPersonal.setPatientId(patientId);
pmsPatientPersonal.setVisitNo(visitNo);
if (CollUtil.isNotEmpty(blxx)) {
Map<String, Object> item = blxx.get(0);
log.info("视图blxx信息: {}", item);
Map<String, Object> smokingMap = extractSmokingInfo((String) item.get("是否吸烟"));
Map<String, Object> drinkMap = extractDrinkInfo((String) item.get("是否饮酒"));
personal.putAll(smokingMap);
personal.putAll(drinkMap);
// personal.put("smokingHistory", item.get("是否吸烟"));
// personal.put("smokingYear", item.get("吸烟年限"));
// personal.put("smokingQuit", item.get("是否戒烟"));
// personal.put("smokingQuitYear", item.get("戒烟年限"));
// personal.put("drinkHistory", item.get("是否饮酒"));
// personal.put("drinkYear", item.get("饮酒年限"));
// personal.put("drinkQuit", item.get("是否戒酒"));
// personal.put("drinkQuitYear", item.get("戒酒年限"));
extractSmokingInfo((String) item.get("是否吸烟"),pmsPatientPersonal);
extractDrinkInfo((String) item.get("是否饮酒"),pmsPatientPersonal);
// personal.putAll(smokingMap);
// personal.putAll(drinkMap);
}
// 过敏信息 - 也放入PmsPatientPersonal
if (CollUtil.isNotEmpty(gmxx)) {
Map<String, Object> item = gmxx.get(0);
personal.put("allergyDrug", item.get("过敏信息"));
}
personalList.add(personal);
if(CollUtil.isNotEmpty(personalList)){
result.put("pmsPatientPersonal", personalList);
// personal.put("allergyDrug", item.get("过敏信息"));
pmsPatientPersonal.setAllergyDrug((String) item.get("过敏信息"));
}
// personalList.add(personal);
// if (CollUtil.isNotEmpty(personalList)) {
// result.put("pmsPatientPersonal", personalList);
// }
//TODO "诊断用药(多个)对应数据库现病史 PmsPatientParentIllness" 暂无
@ -295,51 +344,86 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
List<Map<String, Object>> bodyList = new ArrayList<>();
Map<String, Object> bodyInfo = new HashMap<>();
// 基本信息
bodyInfo.put("outpatientNo", cardNo);
bodyInfo.put("patientId", patientId);
if(ObjectUtil.isNotNull(zyData) && zyData != null){
bodyInfo.put("age", zyData.getStr("age"));
bodyInfo.put("department", zyData.getStr("deptName"));
bodyInfo.put("doctor", zyData.getStr("directorDocName"));
bodyInfo.put("admissionDate", zyData.getStr("inDate"));
bodyInfo.put("admissionCount", zyData.getStr("inTimes"));
bodyInfo.put("bedNumber", zyData.getStr("bedNo"));
bodyInfo.put("dischargeDate", zyData.getStr("outDate"));
bodyInfo.put("diagnosisType","2");
bodyInfo.put("isMainDiagnosis","1");
bodyInfo.put("diagnosisName", zyData.getStr("ryDiagnose"));
bodyInfo.put("diagnosisCode", zyData.getStr("ryDiagnoseCode"));
bodyInfo.put("diagnosisDate", zyData.getStr("inDate"));
// bodyInfo.put("outpatientNo", visitNo);
// bodyInfo.put("patientId", patientId);
pmsPatientBody.setOutpatientNo(visitNo);
pmsPatientBody.setPatientId(patientId);
if (ObjectUtil.isNotNull(zyData) && zyData != null) {
// bodyInfo.put("age", zyData.getStr("age"));
// bodyInfo.put("department", zyData.getStr("deptName"));
// bodyInfo.put("doctor", zyData.getStr("directorDocName"));
// bodyInfo.put("admissionDate", zyData.getStr("inDate"));
// bodyInfo.put("admissionCount", zyData.getStr("inTimes"));
// bodyInfo.put("bedNumber", zyData.getStr("bedNo"));
// bodyInfo.put("dischargeDate", zyData.getStr("outDate"));
// bodyInfo.put("diagnosisType", "2");
// bodyInfo.put("isMainDiagnosis", "1");
// bodyInfo.put("diagnosisName", zyData.getStr("ryDiagnose"));
// bodyInfo.put("diagnosisCode", zyData.getStr("ryDiagnoseCode"));
// bodyInfo.put("diagnosisDate", zyData.getStr("inDate"));
pmsPatientBody.setAge(zyData.getStr("age"));
pmsPatientBody.setDepartment(zyData.getStr("deptName"));
pmsPatientBody.setDoctor(zyData.getStr("directorDocName"));
pmsPatientBody.setAdmissionDate(zyData.getStr("inDate"));
pmsPatientBody.setAdmissionCount(zyData.getStr("inTimes"));
pmsPatientBody.setBedNumber(zyData.getStr("bedNo"));
pmsPatientBody.setDischargeDate(zyData.getStr("outDate"));
pmsPatientBody.setDiagnosisType("2");
pmsPatientBody.setIsMainDiagnosis("1");
pmsPatientBody.setDiagnosisName(zyData.getStr("ryDiagnose"));
pmsPatientBody.setDiagnosisCode(zyData.getStr("ryDiagnoseCode"));
pmsPatientBody.setDiagnosisDate(zyData.getStr("inDate"));
//如果住院信息不为空,查病案首页信息
String baUrl = URL_PREFIX + URL_SUFFIX_RE_2_1_5 + zyData.getStr("inPatientNo");
HttpResponse baResponse = getHttpResponse(baUrl);
JSONObject baData = getApiData(baResponse, "【RE2.1.5S234】新 获取病案首页基本信息");
if(ObjectUtil.isNotNull(baData) && baData != null){
bodyInfo.put("admissionMethod", baData.getStr("inWay"));
bodyInfo.put("dischargeMethod", baData.getStr("outType"));
if (ObjectUtil.isNotNull(baData) && baData != null) {
// bodyInfo.put("admissionMethod", baData.getStr("inWay"));
// bodyInfo.put("dischargeMethod", baData.getStr("outType"));
pmsPatientBody.setAdmissionMethod(baData.getStr("inWay"));
pmsPatientBody.setDischargeMethod(baData.getStr("outType"));
}
}else if(ObjectUtil.isNotNull(mzData) && mzData != null){
bodyInfo.put("age", mzData.getStr("age"));
bodyInfo.put("department", mzData.getStr("deptName"));
bodyInfo.put("doctor", mzData.getStr("docName"));
bodyInfo.put("admissionDate", mzData.getStr("receptDate"));
} else if (ObjectUtil.isNotNull(mzData) && mzData != null) {
// bodyInfo.put("age", mzData.getStr("age"));
// bodyInfo.put("department", mzData.getStr("deptName"));
// bodyInfo.put("doctor", mzData.getStr("docName"));
// bodyInfo.put("admissionDate", mzData.getStr("receptDate"));
pmsPatientBody.setAge(mzData.getStr("age"));
pmsPatientBody.setDepartment(mzData.getStr("deptName"));
pmsPatientBody.setDoctor(mzData.getStr("docName"));
pmsPatientBody.setAdmissionDate(mzData.getStr("receptDate"));
}
if (CollUtil.isNotEmpty(blxx)) {
Map<String, Object> item = blxx.get(0);
bodyInfo.put("height", item.get("身高"));
bodyInfo.put("weight", item.get("体重"));
bodyInfo.put("temperature", item.get("体温"));
//TODO 血压需要处理
bodyInfo.put("bloodPressureShrink", item.get("血压"));
bodyInfo.put("bloodPressureDiastole", item.get("血压"));
bodyInfo.put("pulse", item.get("脉搏"));
bodyInfo.put("creatinine", item.get("肌酐"));
}
bodyList.add(bodyInfo);
if(CollUtil.isNotEmpty(bodyList)){
result.put("pmsPatientBody", bodyList);
// bodyInfo.put("height", item.get("身高"));
// bodyInfo.put("weight", item.get("体重"));
// bodyInfo.put("temperature", item.get("体温"));
// //TODO 血压需要处理
// bodyInfo.put("bloodPressureShrink", item.get("血压"));
// bodyInfo.put("bloodPressureDiastole", item.get("血压"));
// bodyInfo.put("pulse", item.get("脉搏"));
// bodyInfo.put("creatinine", item.get("肌酐"));
pmsPatientBody.setHeight((String) item.get("身高"));
pmsPatientBody.setWeight((String) item.get("体重"));
pmsPatientBody.setTemperature((String) item.get("体温"));
pmsPatientBody.setPulse((String) item.get("脉搏"));
pmsPatientBody.setCreatinine((String) item.get("肌酐"));
if(ObjectUtil.isNotNull(item.get("血压"))){
String s = (String) item.get("血压");
String[] split = s.split("/");
if(split.length >= 2){
pmsPatientBody.setBloodPressureShrink(split[0]);
pmsPatientBody.setBloodPressureDiastole(split[1]);
}
}
}
// bodyList.add(bodyInfo);
// if (CollUtil.isNotEmpty(bodyList)) {
// log.info("pmsPatientBody信息: {}", bodyInfo);
// result.put("pmsPatientBody", bodyList);
// }
//TODO 暂无 tz T值
// oxygenSaturation 血氧饱和度
@ -349,11 +433,15 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
// hematocrit 凝血酶原时间
// dimer D-二聚体
log.info("pmsPatientBody信息: {}", pmsPatientBody);
log.info("pmsPatientPersonal信息: {}", pmsPatientPersonal);
log.info("pmsPatientDiagnosis信息: {}", PmsPatientDiagnosis);
log.info("pmsPatientParentIllness信息: {}", pmsPatientParentIllness);
patientService.editPatientOtherMsgByHis(pmsPatientBody, pmsPatientPersonal, PmsPatientDiagnosis, pmsPatientParentIllness);
return result;
}
private JSONObject getApiData(HttpResponse response, String errorString) {
JSONObject mzData = null;
if (response.isOk()) {
@ -367,7 +455,7 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
return null;
}
mzData = dataArray;
}catch (Exception e){
} catch (Exception e) {
log.error(errorString + "接口-请求失败: {}", response.getStatus());
}
} else {
@ -397,12 +485,15 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
.execute();
}
public static Map<String, Object> extractSmokingInfo(String text) {
Map<String, Object> result = new HashMap<>();
public static void extractSmokingInfo(String text,PmsPatientPersonal pmsPatientPersonal) {
// Map<String, Object> result = new HashMap<>();
if(StrUtil.isEmpty(text)){
return;
}
// 是否吸烟 - 先判断否定情况
int smokingHistory = (text.contains("否认吸烟史") || text.contains("无吸烟史")) ? 0 : 1;
result.put("smokingHistory", smokingHistory);
// result.put("smokingHistory", smokingHistory);
pmsPatientPersonal.setSmokingHistory((byte) smokingHistory);
// 只有有吸烟史时才提取其他信息
if (smokingHistory == 1) {
@ -411,15 +502,22 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
Matcher matcher1 = pattern1.matcher(text);
if (matcher1.find()) {
String group = matcher1.group(1);
if(StrUtil.isNotBlank(group)){
result.put("smokingYear", group);
if (StrUtil.isNotBlank(group)) {
// result.put("smokingYear", group);
try {
pmsPatientPersonal.setSmokingYear(Integer.parseInt(group));
}catch (Exception e){
log.error("吸烟年龄解析异常");
}
}
}
//是否戒烟
int smokingQuit = text.contains("未戒烟") ? 0 : 1;
result.put("smokingQuit", smokingQuit);
// result.put("smokingQuit", smokingQuit);
pmsPatientPersonal.setSmokingQuit((byte) smokingQuit);
if(smokingQuit == 1){
if (smokingQuit == 1) {
Pattern pattern2 = Pattern.compile("已?戒(?:烟|酒)?\\s*(\\d+)\\s*(月|年)\\s*(?:余)?");
Matcher matcher2 = pattern2.matcher(text);
if (matcher2.find()) {
@ -427,23 +525,32 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
String unit = matcher2.group(2);
if ("月".equals(unit)) {
result.put("smokingQuitYear", 1);
// result.put("smokingQuitYear", 1);
pmsPatientPersonal.setSmokingQuitYear(1);
} else {
result.put("smokingQuitYear", number);
// result.put("smokingQuitYear", number);
try {
pmsPatientPersonal.setSmokingQuitYear(Integer.parseInt(number));
}catch (Exception e){
log.error("戒烟年龄解析异常");
}
}
}
}
}
return result;
// return result;
}
public static Map<String, Object> extractDrinkInfo(String text) {
Map<String, Object> result = new HashMap<>();
public static void extractDrinkInfo(String text,PmsPatientPersonal pmsPatientPersonal) {
// Map<String, Object> result = new HashMap<>();
if(StrUtil.isEmpty(text)){
return;
}
// 是否吸烟 - 先判断否定情况
int drinkHistory = (text.contains("否认饮酒史") || text.contains("无饮酒史")) ? 0 : 1;
result.put("drinkHistory", drinkHistory);
// result.put("drinkHistory", drinkHistory);
pmsPatientPersonal.setDrinkHistory((byte) drinkHistory);
// 只有有吸烟史时才提取其他信息
if (drinkHistory == 1) {
@ -452,15 +559,21 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
Matcher matcher1 = pattern1.matcher(text);
if (matcher1.find()) {
String group = matcher1.group(1);
if(StrUtil.isNotBlank(group)){
result.put("drinkYear", group);
if (StrUtil.isNotBlank(group)) {
// result.put("drinkYear", group);
try {
pmsPatientPersonal.setDrinkYear(Integer.parseInt(group));
}catch (Exception e){
log.error("饮酒年龄解析异常");
}
}
}
//是否戒烟
int drinkQuit = text.contains("未戒酒") ? 0 : 1;
result.put("drinkQuit", drinkQuit);
// result.put("drinkQuit", drinkQuit);
pmsPatientPersonal.setDrinkQuit((byte) drinkQuit);
if(drinkQuit == 1){
if (drinkQuit == 1) {
Pattern pattern2 = Pattern.compile("已?戒(?:烟|酒)?\\s*(\\d+)\\s*(月|年)\\s*(?:余)?");
Matcher matcher2 = pattern2.matcher(text);
if (matcher2.find()) {
@ -468,15 +581,216 @@ public class LtHisConnectionServiceImpl implements ILtHisConnectionService {
String unit = matcher2.group(2);
if ("月".equals(unit)) {
result.put("drinkQuitYear", 1);
// result.put("drinkQuitYear", 1);
pmsPatientPersonal.setDrinkQuitYear(1);
} else {
result.put("drinkQuitYear", number);
// result.put("drinkQuitYear", number);
try {
pmsPatientPersonal.setDrinkQuitYear(Integer.parseInt(number));
}catch (Exception e){
log.error("饮酒年龄解析异常");
}
}
}
}
}
return result;
// return result;
}
@Override
public List<SysDept> syncDeptDataSlave() {
List<SysDept> returnDepts = new ArrayList<>();
//查找部门信息
JSONArray deptData = queryDept();
//循环处理部门信息
for (int i = 0; i < deptData.size(); i++) {
JSONObject dept = deptData.getJSONObject(i);
SysDept sysDept = new SysDept();
sysDept.setDeptCode(dept.getStr("deptCode"));
List<SysDept> sysDepts = sysDeptMapper.selectDeptList(sysDept);
if (CollUtil.isEmpty(sysDepts)) {
sysDept.setParentId(hospitalId);
sysDept.setAncestors("0," + hospitalId);
sysDept.setDeptName(dept.getStr("deptName"));
sysDept.setDeptCode(dept.getStr("deptCode"));
sysDeptMapper.insertDept(sysDept);
returnDepts.add(sysDept);
} else {
sysDept = sysDepts.get(0);
sysDept.setParentId(hospitalId);
sysDept.setAncestors("0," + hospitalId);
sysDept.setDeptName(dept.getStr("deptName"));
sysDept.setDeptCode(dept.getStr("deptCode"));
sysDeptMapper.updateDept(sysDept);
returnDepts.add(sysDept);
}
}
return returnDepts;
}
@Override
@DataSource(value = DataSourceType.MASTER)
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void syncDeptDataMaster(List<SysDept> sysDepts) {
log.info("同步Master部门数据--{}--{}", sysDepts.size(), sysDepts.get(0));
if (CollUtil.isNotEmpty(sysDepts)) {
sysDepts.forEach(sysDept -> {
//根据code查找系统的部门信息
SysDept dept = new SysDept();
dept.setDeptCode(sysDept.getDeptCode());
List<SysDept> depts = sysDeptMapper.selectDeptList(dept);
if (CollUtil.isEmpty(depts)) {
sysDeptMapper.insertDept(sysDept);
} else {
SysDept sysDept1 = depts.get(0);
sysDept.setDeptId(sysDept1.getDeptId());
sysDeptMapper.updateDept(sysDept);
}
});
}
}
@Override
public List<SysUser> syncUserDataSlave() {
List<SysUser> returnUsers = new ArrayList<>();
//查询用户信息
JSONArray userData = queryUser();
//柳铁暂不处理部门权限,所有用户都是医院下,也不处理角色权限,所有都是测评师
//查询测评师角色
SysRole role = sysRoleMapper.queryRoleByRoleKey("yy_cps");
for (int i = 0; i < userData.size(); i++) {
JSONObject user = userData.getJSONObject(i);
//根据code查找部门信息
//
// Map<String, Object> userMap = new HashMap<>();
// userMap.put("deptCode", "lnb");
// userMap.put("emplCode", "admin");
// userMap.put("emplName", "adminName");
//
//
// JSONObject user = JSONUtil.parseObj(userMap);
SysDept sysDept = new SysDept();
sysDept.setDeptCode(user.getStr("deptCode"));
List<SysDept> sysDepts = sysDeptMapper.selectDeptList(sysDept);
if (CollUtil.isEmpty(sysDepts)) {
continue;
} else {
sysDept = sysDepts.get(0);
}
SysUser sysUser = new SysUser();
sysUser.setEmplCode(user.getStr("emplCode"));
List<SysUser> sysUsers = sysUserMapper.selectUserList(sysUser);
if (CollUtil.isEmpty(sysUsers)) {
sysUser.setDeptId(sysDept.getDeptId());
sysUser.setUserName("u_" + user.getStr("emplCode"));
sysUser.setNickName(user.getStr("emplName"));
sysUser.setEmplCode(user.getStr("emplCode"));
sysUser.setPassword(SecurityUtils.encryptPassword(generalPassword));
//获取一年后的日期
sysUser.setValidDate(DateUtil.offset(new Date(), DateField.YEAR, 1));
sysUserMapper.insertUser(sysUser);
// 新增用户与角色管理
if (role != null) {
SysUserRole ur = new SysUserRole();
ur.setUserId(sysUser.getUserId());
ur.setRoleId(role.getRoleId());
userRoleMapper.batchUserRole(CollUtil.newArrayList(ur));
}
returnUsers.add(sysUser);
} else {
SysUser u = sysUsers.get(0);
u.setDeptId(sysDept.getDeptId());
u.setNickName(user.getStr("emplName"));
sysUserMapper.updateUser(u);
returnUsers.add(u);
}
}
return returnUsers;
}
@Override
@DataSource(value = DataSourceType.MASTER)
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void syncUserDataMaster(List<SysUser> sysUsers) {
log.info("同步Master用户数据--{}--{}", sysUsers.size(), sysUsers.get(0));
if (CollUtil.isNotEmpty(sysUsers)) {
for (SysUser sysUser : sysUsers) {
//根据code查找用户
SysUser user = new SysUser();
user.setEmplCode(sysUser.getEmplCode());
List<SysUser> users = sysUserMapper.selectUserList(user);
if (CollUtil.isEmpty(users)) {
sysUser.setDeptId(hospitalId);
sysUser.setPassword(SecurityUtils.encryptPassword(generalPassword));
log.info("master新增用户:{}", sysUser);
sysUserMapper.insertUser(sysUser);
} else {
sysUser.setUserId(users.get(0).getUserId());
log.info("master更新用户:{}", sysUser);
sysUserMapper.updateUser(sysUser);
}
}
}
}
private JSONArray queryUser() {
//调用接口查询用户数据
String url = URL_PREFIX + URL_SUFFIX_RC_1_1_3;
HttpResponse response = getHttpResponse(url);
String userBody;
if (response.isOk()) {
userBody = response.body();
} else {
log.error("【RP1.1.3】查询用户数据接口-请求失败: {}", response.getStatus());
return null;
}
try {
JSONObject json = JSONUtil.parseObj(userBody);
log.info("【RP1.1.3】查询用户数据接口-返回数据: {}", json);
JSONArray dataArray = json.getJSONArray("data");
if (CollUtil.isEmpty(dataArray)) {
log.warn("查询用户数据接口返回data为空");
return null;
}
return dataArray;
} catch (Exception e) {
log.error("【RP1.1.3】查询用户数据接口-解析数据失败: {}", e.getMessage());
return null;
}
}
private JSONArray queryDept() {
//调用接口查询部门数据
String url = URL_PREFIX + URL_SUFFIX_RC_1_1_1;
HttpResponse response = getHttpResponse(url);
String deptBody;
if (response.isOk()) {
deptBody = response.body();
} else {
log.error("【RP1.1.1】查询部门数据接口-请求失败: {}", response.getStatus());
return null;
}
try {
JSONObject json = JSONUtil.parseObj(deptBody);
log.info("【RP1.1.1】查询部门数据接口-返回数据: {}", json);
// 获取data数组(这里应该是JSONArray,不是JSONObject)
JSONArray dataArray = json.getJSONArray("data");
if (CollUtil.isEmpty(dataArray)) {
log.warn("查询部门数据接口返回data为空");
return null;
}
return dataArray;
} catch (Exception e) {
log.error("查询部门信息异常", e);
return null;
}
}
}

57
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/PmsPatientServiceImpl.java

@ -230,7 +230,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService {
List<Map<String, Object>> pmsPatientBodyReturn = new ArrayList<>();
pmsPatientBodyReturn.add(JSON.parseObject(JSON.toJSONString(body), Map.class));
patientOtherMsg.put("pmsPatientBody", pmsPatientBodyReturn);
if (visitNo != null) {
if(visitNo != null) {
//烟酒史
PmsPatientPersonalExample patientPersonalExample = new PmsPatientPersonalExample();
patientPersonalExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(pmsPatient.getId())
@ -421,6 +421,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService {
@Override
public Long editPatientOtherMsg(PmsPatientDto.EditOtherMsg param) {
log.info("编辑病人其他信息:{}", param);
JSONObject jsonObject = new JSONObject();
Object model = param.getModel();
// 处理model参数
@ -434,7 +435,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService {
// Map转JSONObject
jsonObject = (JSONObject) JSON.toJSON(model);
}
log.info("处理后的其他信息jsonObject:{}", jsonObject);
// JSONObject jsonObject = null;
// if (param.getModel() instanceof JSONArray) {
// JSONArray array = (JSONArray) param.getModel();
@ -587,8 +588,56 @@ public class PmsPatientServiceImpl implements IPmsPatientService {
@Override
@DataSource(DataSourceType.SLAVE)
public Long editPatientOtherMsgByHis(PmsPatientDto.EditOtherMsg param) {
return editPatientOtherMsg(param);
public void editPatientOtherMsgByHis(PmsPatientBody pmsPatientBody, PmsPatientPersonal pmsPatientPersonal, PmsPatientDiagnosis PmsPatientDiagnosis, PmsPatientParentIllness pmsPatientParentIllness) {
if(ObjectUtil.isNotNull(pmsPatientBody)){
//根据就诊号和患者id查询就诊信息是否存在
PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample();
patientBodyExample.createCriteria().andOutpatientNoEqualTo(pmsPatientBody.getOutpatientNo()).andPatientIdEqualTo(pmsPatientBody.getPatientId())
.andDelFlagEqualTo((byte) 0);
List<PmsPatientBody> pmsPatientBodies = pmsPatientBodyMapper.selectByExample(patientBodyExample);
if (CollUtil.isNotEmpty(pmsPatientBodies)) {
//存在则修改
log.info("修改就诊信息:{}", pmsPatientBody);
PmsPatientBody oldPatientBody = pmsPatientBodies.get(0);
pmsPatientBody.setId(oldPatientBody.getId());
pmsPatientBodyMapper.updateByPrimaryKeySelective(pmsPatientBody);
} else {
//不存在则添加
log.info("添加就诊信息:{}", pmsPatientBody);
pmsPatientBody.setId(IDGenerator.nextSnowflakeId());
pmsPatientBodyMapper.insertSelective(pmsPatientBody);
//首次添加就诊信息是,添加诊断和用药信息,后续同步不更新
if(ObjectUtil.isNotNull(PmsPatientDiagnosis)){
log.info("添加诊断信息:{}", PmsPatientDiagnosis);
PmsPatientDiagnosis.setId(IDGenerator.nextSnowflakeId());
pmsPatientDiagnosisMapper.insertSelective(PmsPatientDiagnosis);
}
if(ObjectUtil.isNotNull(pmsPatientParentIllness)){
log.info("添加用药信息:{}", pmsPatientParentIllness);
pmsPatientParentIllness.setId(IDGenerator.nextSnowflakeId());
pmsPatientParentIllnessMapper.insertSelective(pmsPatientParentIllness);
}
}
}
if(ObjectUtil.isNotNull(pmsPatientPersonal)){
//根据就诊号和患者id查询烟酒史
PmsPatientPersonalExample patientPersonalExample = new PmsPatientPersonalExample();
patientPersonalExample.createCriteria().andVisitNoEqualTo(pmsPatientPersonal.getVisitNo()).andPatientIdEqualTo(pmsPatientPersonal.getPatientId())
.andDelFlagEqualTo((byte) 0);
List<PmsPatientPersonal> pmsPatientPersonals = pmsPatientPersonalMapper.selectByExample(patientPersonalExample);
if (CollUtil.isNotEmpty(pmsPatientPersonals)) {
//存在则修改
log.info("修改烟酒史信息:{}", pmsPatientBody);
PmsPatientPersonal oldPatientPersonal = pmsPatientPersonals.get(0);
pmsPatientPersonal.setId(oldPatientPersonal.getId());
pmsPatientPersonalMapper.updateByPrimaryKeySelective(pmsPatientPersonal);
}else {
log.info("添加烟酒史等信息:{}", pmsPatientPersonal);
pmsPatientPersonal.setId(IDGenerator.nextSnowflakeId());
pmsPatientPersonalMapper.insertSelective(pmsPatientPersonal);
}
}
}
@Override

7
ruisi_java/ruisi-web-client/src/main/resources/application-dev.yml

@ -19,6 +19,13 @@ spring:
url: jdbc:mysql://127.0.0.1:3306/ruisi_cga_yf?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 123456
ltszxyyoracle:
# 从数据源开关/默认关闭
enabled: true
driverClassName: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@//200.1.8.115:1521/hisdb
username: interface_lnpg
password: interface_lnpg
# driverClassName: oracle.jdbc.driver.OracleDriver
# url: jdbc:oracle:thin:@200.1.8.115:1521:hisdb
# username: interface_lnpg

38
ruisi_java/ruisi-web-client/src/main/resources/application-prod.yml

@ -6,23 +6,23 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.0.128:3306/ruisi_cga?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://200.1.8.141:23306/ruisi_cga?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: Sxinf18aA
password: xian#2024!!!
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url: jdbc:mysql://172.28.145.18:23306/ruisi_cga_whszxyjhyy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
enabled: true
url: jdbc:mysql://200.1.8.141:23306/ruisi_cga_ltszxyy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: xian#2024!!!
oracle:
ltszxyyoracle:
# 从数据源开关/默认关闭
enabled: true
driverClassName: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@//192.168.1.5:1521/ORCL
username: USER_LNPGXT
password: Lnpgxt.2026
url: jdbc:oracle:thin:@//200.1.8.115:1521/hisdb
username: interface_lnpg
password: interface_lnpg
# 初始连接数
initialSize: 5
# 最小连接池数量
@ -69,13 +69,13 @@ spring:
# redis 配置
redis:
# 地址
host: localhost
host: 172.17.0.1
# 端口,默认为6379
port: 6379
# 数据库索引
database: 1
# 密码
password: 123456
password: "redis111^#"
# 连接超时时间
timeout: 10s
lettuce:
@ -88,20 +88,6 @@ spring:
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# 核心:SpringBoot全局UTF-8编码配置
server:
# 配置Tomcat容器UTF-8编码(关键,解决URI中文解码)
tomcat:
uri-encoding: UTF-8 # 强制Tomcat对URI进行UTF-8解码
relaxed-path-chars: [ '%', '#', '&', '=', '|', ',', ';', '\\', ' ', '中' ] # 允许路径包含中文/特殊符号
# 全局请求/响应编码
servlet:
encoding:
enabled: true # 开启编码自动配置
charset: UTF-8 # 编码格式
force: true # 强制所有请求/响应使用UTF-8(覆盖容器默认编码)
force-request: true # 强制请求编码为UTF-8
force-response: true # 强制响应编码为UTF-8
app:
# 是否开启调式模式
@ -138,6 +124,8 @@ informed:
#clientVersion: v1.8.2.0
clientVersion: v1.8.3.0
# 医院id,不同医院部署的时候需要修改
hospitalId: 106
hospitalId: 176
generalPassword: cga123#
redirectPath: http://200.1.8.141/cga/v2/client/#/sickList

6
ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/HisConnectionDao.xml

@ -10,4 +10,10 @@
<select id="getBlxxAll" resultType="java.lang.Object">
select * from view_lnpg_blxx
</select>
<select id="getBlxxByVisitNo" resultType="java.util.Map">
select * from view_lnpg_blxx where 患者流水号 = #{visitNo}
</select>
<select id="getGmxxByVisitNo" resultType="java.util.Map">
select * from view_lnpg_gmxx where 患者流水号 = #{visitNo}
</select>
</mapper>

185
web_admin/adminapi/index.html

File diff suppressed because one or more lines are too long

BIN
web_admin/adminapi/index.html.gz

Binary file not shown.

2
web_client/src/views/evaluation/index.vue

@ -376,7 +376,7 @@ export default {
const { code, msg, data } = res;
if (code === 200) {
this.dictList = data;
this.version = "1982749726432432128";
this.version = "1982749703053381632";
}
},
//

2
web_client/vue.config.js

@ -38,7 +38,7 @@ module.exports = {
// target: "https://www.ylinno.com/cga/v2/api/client/",
target: "http://113.45.159.249:59001/cga/v2/api/client/",
// target: "http://127.0.0.1:19331",
// target: "http://192.168.1.136:19331",
// target: "http://127.0.0.1:19331",
changeOrigin: true,
pathRewrite: {
["^" + settings.proxyUrl]: "",

Loading…
Cancel
Save