commit
b8a2ae896d
1365 changed files with 218151 additions and 0 deletions
@ -0,0 +1,101 @@ |
|||
# ============================= |
|||
# 通用忽略规则 |
|||
# ============================= |
|||
|
|||
# 依赖目录 |
|||
node_modules/ |
|||
vendor/ |
|||
|
|||
# 构建产物 |
|||
dist/ |
|||
build/ |
|||
target/ |
|||
out/ |
|||
*.class |
|||
|
|||
# 环境变量(敏感配置,不上传) |
|||
.env |
|||
.env.local |
|||
.env.*.local |
|||
*.env |
|||
|
|||
# 日志文件 |
|||
logs/ |
|||
*.log |
|||
npm-debug.log* |
|||
yarn-debug.log* |
|||
yarn-error.log* |
|||
|
|||
# 运行时数据 |
|||
pids/ |
|||
*.pid |
|||
*.seed |
|||
*.pid.lock |
|||
|
|||
# ============================= |
|||
# 前端(frontend/) |
|||
# ============================= |
|||
frontend/node_modules/ |
|||
frontend/dist/ |
|||
frontend/.vite/ |
|||
frontend/vite.config.js.timestamp-* |
|||
|
|||
# ============================= |
|||
# 后端(backend/) |
|||
# ============================= |
|||
backend/target/ |
|||
backend/*.class |
|||
backend/.classpath |
|||
backend/.project |
|||
backend/.settings/ |
|||
backend/logs/ |
|||
backend/.svn/ |
|||
|
|||
# ============================= |
|||
# AI/QA 模块(qa/) |
|||
# ============================= |
|||
qa/__pycache__/ |
|||
qa/*.pyc |
|||
qa/*.pyo |
|||
qa/.pytest_cache/ |
|||
qa/venv/ |
|||
qa/.venv/ |
|||
# 大文件(PDF等) |
|||
qa/*.pdf |
|||
qa/*.docx |
|||
|
|||
# ============================= |
|||
# SFU 服务器(sfu-server/) |
|||
# ============================= |
|||
sfu-server/node_modules/ |
|||
sfu-server/.svn/ |
|||
|
|||
# ============================= |
|||
# SVN 残留(如项目原来用SVN管理) |
|||
# ============================= |
|||
.svn/ |
|||
.github/java-upgrade/ |
|||
|
|||
# ============================= |
|||
# IDE / 编辑器 |
|||
# ============================= |
|||
.idea/ |
|||
.vscode/ |
|||
*.suo |
|||
*.ntvs* |
|||
*.njsproj |
|||
*.sln |
|||
*.sw? |
|||
.DS_Store |
|||
Thumbs.db |
|||
|
|||
# ============================= |
|||
# 系统文件 |
|||
# ============================= |
|||
*.tmp |
|||
*.bak |
|||
*.bak[0-9]* |
|||
*.bak2 |
|||
*.bak3 |
|||
*.bak4 |
|||
*.bak5 |
|||
@ -0,0 +1,69 @@ |
|||
# 远程超声诊断平台 - Monorepo |
|||
|
|||
## 项目简介 |
|||
|
|||
本仓库为远程超声诊断平台的统一代码仓库,包含前端、后端、AI质控模块以及专网实时通信中间件。 |
|||
采用 Monorepo 结构管理,方便统一版本控制,支持针对不同医院/客户进行定制化开发。 |
|||
|
|||
--- |
|||
|
|||
## 目录结构 |
|||
|
|||
``` |
|||
monorepo/ |
|||
├── frontend/ # 前端(Vue 3 + Vite)- 远程超声Web端 |
|||
├── backend/ # 后端(Java Spring Boot)- 业务逻辑与数据库服务 |
|||
├── qa/ # AI质控模块(Python)- 超声报告质量控制 |
|||
└── sfu-server/ # 专网中间件(Node.js + mediasoup)- 实时音视频SFU服务 |
|||
``` |
|||
|
|||
--- |
|||
|
|||
## 各模块说明 |
|||
|
|||
### 🖥️ frontend(前端) |
|||
- 技术栈:Vue 3、Vite、Element Plus |
|||
- 功能:远程超声申请、会诊、报告管理、实时视频通话 |
|||
- 启动:`cd frontend && npm install && npm run dev` |
|||
|
|||
### ☕ backend(后端) |
|||
- 技术栈:Java、Spring Boot、Maven |
|||
- 功能:用户管理、医院管理、超声申请流程、数据存储 |
|||
- 启动:`cd backend && mvn spring-boot:run` |
|||
|
|||
### 🤖 qa(AI质控) |
|||
- 技术栈:Python、FastAPI |
|||
- 功能:超声报告AI质量控制与评分 |
|||
- 启动:`cd qa && pip install -r requirements.txt && python admin_app.py` |
|||
|
|||
### 📡 sfu-server(专网中间件) |
|||
- 技术栈:Node.js、mediasoup |
|||
- 功能:专网环境下的实时音视频SFU服务器 |
|||
- 启动:`cd sfu-server && npm install && npm start` |
|||
|
|||
--- |
|||
|
|||
## 分支策略 |
|||
|
|||
| 分支 | 说明 | |
|||
|------|------| |
|||
| `main` | 生产环境稳定版本 | |
|||
| `develop` | 日常开发集成分支 | |
|||
| `feature/xxx` | 功能开发分支,从 develop 切出 | |
|||
| `hotfix/xxx` | 紧急修复分支,从 main 切出 | |
|||
|
|||
--- |
|||
|
|||
## 开发流程 |
|||
|
|||
1. 从 `develop` 创建功能分支:`git checkout -b feature/your-feature develop` |
|||
2. 开发完成后提交 PR/MR 合并到 `develop` |
|||
3. 测试通过后合并到 `main` 并打 Tag 发布 |
|||
|
|||
--- |
|||
|
|||
## 注意事项 |
|||
|
|||
- `.env.local`、`.env.*.local` 等敏感配置文件**不提交**到仓库 |
|||
- 请将环境变量参考 `.env.example`(如有)进行本地配置 |
|||
- 各模块的 `node_modules/`、`dist/`、`target/` 目录均已忽略 |
|||
@ -0,0 +1,575 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.mapper.Wrapper; |
|||
import com.imurs.controller.ApplyBModeController; |
|||
import com.imurs.dto.SpecialistSubmitDto; |
|||
import com.imurs.entity.ApplyBMode; |
|||
import com.imurs.entity.ApplyBModeImg; |
|||
import com.imurs.entity.ApplyBModeSpecialist; |
|||
import com.imurs.entity.Patient; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyBModeImgService; |
|||
import com.imurs.service.ApplyBModeService; |
|||
import com.imurs.service.ApplyBModeSpecialistService; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.PatientService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.service.impl.ApplyBModeServiceImpl; |
|||
import com.imurs.service.impl.BmodeMachineModelServiceImpl; |
|||
import com.imurs.util.DateUtils; |
|||
import com.imurs.util.page.Pagetion; |
|||
import java.sql.Timestamp; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@Controller |
|||
@RestController |
|||
@RequestMapping({"bmode"}) |
|||
public class ApplyBModeController { |
|||
@Autowired |
|||
ApplyBModeService applyBModeService; |
|||
|
|||
@Autowired |
|||
ApplyBModeServiceImpl applyBModeServiceImpl; |
|||
|
|||
@Autowired |
|||
PatientService patientService; |
|||
|
|||
@Autowired |
|||
ApplyBModeImgService applyBModeImgService; |
|||
|
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
|
|||
@Autowired |
|||
ApplyBModeSpecialistService applyBModeSpecialistService; |
|||
|
|||
@Autowired |
|||
UserService userService; |
|||
|
|||
@Autowired |
|||
BmodeMachineModelServiceImpl bmodeMachineModelServiceImpl; |
|||
|
|||
@Transactional |
|||
@RequestMapping({"insertBmodeImg"}) |
|||
public Map<String, Object> insertBmodeImg(@RequestBody List<ApplyBModeImg> abmiList) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
try { |
|||
if (!abmiList.isEmpty()) { |
|||
boolean result = this.applyBModeImgService.insertBatch(abmiList); |
|||
map.put("msg", result ? "1" : "2"); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@Transactional |
|||
@RequestMapping({"insertBmode"}) |
|||
public Map<String, Object> insertBmode(@RequestBody List<ApplyBMode> abmList) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
EntityWrapper<Patient> wrapper = new EntityWrapper(); |
|||
EntityWrapper<Patient> wrapper2 = new EntityWrapper(); |
|||
String ptEsrdNumber = ""; |
|||
try { |
|||
if (!abmList.isEmpty() && abmList.get(0) != null) { |
|||
Date date = new Date(); |
|||
Wrapper<ApplyBMode> bModeWrapper = (new EntityWrapper()).eq("category_hospital_id", ((ApplyBMode)abmList.get(0)).getCategoryHospitalId()).and().ge("group_date", DateUtils.formatDateTime(DateUtils.getDateStart(date))).and().le("group_date", DateUtils.formatDateTime(DateUtils.getDateEnd(date))); |
|||
Integer size = Integer.valueOf(this.applyBModeService.selectCount(bModeWrapper)); |
|||
Integer abmNo = Integer.valueOf(size.intValue() + 1); |
|||
ApplyBMode abm = abmList.get(0); |
|||
abm.setBtype(DateUtils.format(date, "yyyyMMdd") + "0" + abmNo); |
|||
// abm.setGroupDate(new Timestamp(date.getTime()));
|
|||
boolean result = this.applyBModeService.insert(abmList.get(0)); |
|||
if (result == true) { |
|||
map.put("id", ((ApplyBMode)abmList.get(0)).getId()); |
|||
map.put("msg", "1"); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode)abmList.get(0)).getHisEsrdNumber())) { |
|||
wrapper.eq("his_esrd_number", ((ApplyBMode)abmList.get(0)).getHisEsrdNumber()); |
|||
wrapper2.eq("his_esrd_number", ((ApplyBMode)abmList.get(0)).getHisEsrdNumber()); |
|||
} else { |
|||
wrapper.eq("out_patien", ((ApplyBMode)abmList.get(0)).getOutPatien()); |
|||
wrapper2.eq("out_patien", ((ApplyBMode)abmList.get(0)).getOutPatien()); |
|||
} |
|||
wrapper.eq("hospital_id", ((ApplyBMode)abmList.get(0)).getCategoryHospitalId()); |
|||
Patient patient2 = (Patient)this.patientService.selectOne((Wrapper)wrapper); |
|||
wrapper2.eq("hospital_id", ((ApplyBMode)abmList.get(0)).getGroupHospitalId()); |
|||
Patient patient3 = (Patient)this.patientService.selectOne((Wrapper)wrapper2); |
|||
if (patient2 == null || patient3 == null) { |
|||
Patient patient = new Patient(); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode)abmList.get(0)).getPtCard())) |
|||
patient.setCard(((ApplyBMode)abmList.get(0)).getPtCard()); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode)abmList.get(0)).getSex())) |
|||
patient.setSex(((ApplyBMode)abmList.get(0)).getSex()); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode)abmList.get(0)).getPatientName())) |
|||
patient.setPatientName(((ApplyBMode)abmList.get(0)).getPatientName()); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode)abmList.get(0)).getPtCity())) |
|||
patient.setFamily(((ApplyBMode)abmList.get(0)).getPtCity()); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode)abmList.get(0)).getPtPhone())) |
|||
patient.setPhone(((ApplyBMode)abmList.get(0)).getPtPhone()); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode)abmList.get(0)).getHisEsrdNumber())) |
|||
patient.setHisEsrdNumber(((ApplyBMode)abmList.get(0)).getHisEsrdNumber()); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode)abmList.get(0)).getOutPatien())) |
|||
patient.setOutPatien(((ApplyBMode)abmList.get(0)).getOutPatien()); |
|||
if (patient2 == null) { |
|||
patient.setHospitalId(((ApplyBMode)abmList.get(0)).getCategoryHospitalId()); |
|||
result = this.patientService.insert(patient); |
|||
if (result == true) { |
|||
ptEsrdNumber = "yd03" + patient.getId(); |
|||
patient.setEsrdNumber(ptEsrdNumber); |
|||
this.patientService.updateById(patient); |
|||
} |
|||
} |
|||
if (patient3 == null) { |
|||
patient.setHospitalId(((ApplyBMode)abmList.get(0)).getGroupHospitalId()); |
|||
result = this.patientService.insert(patient); |
|||
if (result == true) { |
|||
ptEsrdNumber = StringUtils.isNotEmpty(ptEsrdNumber) ? ptEsrdNumber : ("yd03" + patient.getId()); |
|||
patient.setEsrdNumber(ptEsrdNumber); |
|||
this.patientService.updateById(patient); |
|||
} |
|||
} |
|||
} else { |
|||
ptEsrdNumber = patient2.getEsrdNumber(); |
|||
} |
|||
Long id = ((ApplyBMode)abmList.get(0)).getId(); |
|||
((ApplyBMode)abmList.get(0)).setEsrdNumber(ptEsrdNumber); |
|||
this.applyBModeService.updateById(abmList.get(0)); |
|||
ApplyBMode applyBMode = abmList.get(0); |
|||
List<ApplyBModeImg> ImgList = applyBMode.getAbmList(); |
|||
if (!ImgList.isEmpty()) { |
|||
for (int i = 0; i < ImgList.size(); i++) |
|||
((ApplyBModeImg)ImgList.get(i)).setbId(id); |
|||
this.applyBModeImgService.insertBatch(ImgList); |
|||
} |
|||
} else { |
|||
map.put("msg", "2"); |
|||
} |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({"updateBmode"}) |
|||
public Map<String, Object> updateBmode(@RequestBody List<ApplyBMode> acList) { |
|||
ApplyBMode applyBMode = acList.get(0); |
|||
Map<String, Object> map = new HashMap<>(8); |
|||
boolean result = false; |
|||
try { |
|||
if (applyBMode != null) |
|||
result = this.applyBModeService.updateBmodeById(applyBMode); |
|||
map.put("msg", result ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({"updateBmodeImg"}) |
|||
public Map<String, Object> updateBmodeImg(@RequestBody List<ApplyBMode> acList) { |
|||
ApplyBMode applyBMode = acList.get(0); |
|||
Map<String, Object> map = new HashMap<>(); |
|||
try { |
|||
EntityWrapper<ApplyBModeImg> wrapper = new EntityWrapper(); |
|||
wrapper.eq("b_id", applyBMode.getId()); |
|||
List<ApplyBModeImg> idList = this.applyBModeImgService.selectList((Wrapper)wrapper); |
|||
List<ApplyBModeImg> abmList = applyBMode.getAbmList(); |
|||
if (!idList.isEmpty()) { |
|||
if (!abmList.isEmpty()) { |
|||
for (ApplyBModeImg applyBModeImg : idList) { |
|||
if (applyBModeImg.getType().intValue() != 32) |
|||
this.applyBModeImgService.deleteById(applyBModeImg.getId()); |
|||
} |
|||
for (int i = 0; i < abmList.size(); i++) { |
|||
ApplyBModeImg applyBModeImg = abmList.get(i); |
|||
applyBModeImg.setbId(applyBMode.getId()); |
|||
this.applyBModeImgService.insert(applyBModeImg); |
|||
} |
|||
} else { |
|||
for (ApplyBModeImg applyBModeImg : idList) { |
|||
if (applyBModeImg.getType().intValue() != 32) |
|||
this.applyBModeImgService.deleteById(applyBModeImg.getId()); |
|||
} |
|||
} |
|||
} else if (!abmList.isEmpty()) { |
|||
for (int i = 0; i < abmList.size(); i++) { |
|||
ApplyBModeImg applyBModeImg = abmList.get(i); |
|||
applyBModeImg.setbId(applyBMode.getId()); |
|||
this.applyBModeImgService.insert(applyBModeImg); |
|||
} |
|||
} |
|||
boolean result = this.applyBModeService.updateById(applyBMode); |
|||
map.put("msg", (result == true) ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@Transactional |
|||
@RequestMapping({"deleteBmodeById"}) |
|||
public Map<String, Object> deleteBmodeById(Long id) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
try { |
|||
boolean result = this.applyBModeService.deleteById(id); |
|||
if (result == true) { |
|||
map.put("b_id", id); |
|||
this.applyBModeImgService.deleteByMap(map); |
|||
map.clear(); |
|||
map.put("msg", "1"); |
|||
} else { |
|||
map.put("msg", "2"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({"selectBmodeById"}) |
|||
public Map<String, Object> selectBmodeById(Long id) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
String account = ""; |
|||
String phone = ""; |
|||
ApplyBMode applyBMode = new ApplyBMode(); |
|||
List<ApplyBModeImg> abmList = new ArrayList<>(); |
|||
List<ApplyBModeSpecialist> abmSp = new ArrayList<>(); |
|||
EntityWrapper<ApplyBModeImg> wrapper = new EntityWrapper(); |
|||
EntityWrapper<ApplyBModeSpecialist> wrapper2 = new EntityWrapper(); |
|||
try { |
|||
applyBMode = (ApplyBMode)this.applyBModeService.selectById(id); |
|||
if (applyBMode != null) { |
|||
map.put("patientType", applyBMode.getPatientType()); |
|||
User user = (User)this.userService.selectById(applyBMode.getDocId()); |
|||
if (user != null) |
|||
account = user.getPhone(); |
|||
wrapper2.eq("b_id", id); |
|||
abmSp = this.applyBModeSpecialistService.selectList((Wrapper)wrapper2); |
|||
map.put("b_id", id); |
|||
wrapper.eq("b_id", id); |
|||
abmList = this.applyBModeImgService.selectList((Wrapper)wrapper); |
|||
if (!abmSp.isEmpty() && abmSp.get(0) != null) { |
|||
applyBMode.setSpecialist(((ApplyBModeSpecialist)abmSp.get(0)).getSpeName()); |
|||
applyBMode.setSpecialistId(((ApplyBModeSpecialist)abmSp.get(0)).getSpeId()); |
|||
Long speId = ((ApplyBModeSpecialist)abmSp.get(0)).getSpeId(); |
|||
//医生删了 那user 就为null 2025 0211
|
|||
User selectById = (User)this.userService.selectById(speId); |
|||
if(selectById!=null) |
|||
phone = selectById.getPhone(); |
|||
} |
|||
} |
|||
map.put("abmSp", abmSp); |
|||
map.put("applyBMode", applyBMode); |
|||
map.put("abmList", abmList); |
|||
map.put("contactPhone", account); |
|||
map.put("phone", phone); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({"selectBmodePage"}) |
|||
public Map<String, Object> selectBmodePage(String categoryHospitalId, String groupHospitalId, String startTime, String endTime, String patientName, Integer pageNo, Integer pageSize, Integer type, String part, Long docId, Integer cureType, String diagnosisType, String status, String isRemote) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
map.put("categoryHospitalId", categoryHospitalId); |
|||
map.put("groupHospitalId", groupHospitalId); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("patientName", patientName); |
|||
map.put("type", type); |
|||
map.put("part", part); |
|||
map.put("docId", docId); |
|||
map.put("isRemote", isRemote); |
|||
map.put("diagnosisType", diagnosisType); |
|||
map.put("cureType", Integer.valueOf((cureType == null) ? 1 : cureType.intValue())); |
|||
map.put("status", status); |
|||
pageNo = Integer.valueOf((pageNo == null) ? 1 : pageNo.intValue()); |
|||
pageSize = Integer.valueOf((pageSize == null) ? 10 : pageSize.intValue()); |
|||
try { |
|||
Pagetion<ApplyBMode> pagetion = this.applyBModeService.selectBmodePage(map, pageNo, pageSize); |
|||
map.clear(); |
|||
if (pagetion != null) |
|||
for (int i = 0; i < pagetion.getList().size(); i++) { |
|||
EntityWrapper<ApplyBModeSpecialist> wrapper = new EntityWrapper(); |
|||
wrapper.eq("b_id", ((ApplyBMode)pagetion.getList().get(i)).getId()).ne("state", "80"); |
|||
List<ApplyBModeSpecialist> abmSp = this.applyBModeSpecialistService.selectList((Wrapper)wrapper); |
|||
if (!abmSp.isEmpty()) |
|||
((ApplyBMode)pagetion.getList().get(i)).setAbmSp(abmSp); |
|||
} |
|||
map.put("pagetion", pagetion); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} finally { |
|||
map.remove("categoryHospitalId"); |
|||
map.remove("groupHospitalId"); |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("patientName"); |
|||
map.remove("type"); |
|||
map.remove("part"); |
|||
map.remove("docId"); |
|||
map.remove("cureType"); |
|||
map.remove("status"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({"insertBModeSpecialist"}) |
|||
public Map<String, Object> insertBModeSpecialist(@RequestBody List<ApplyBModeSpecialist> acList) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
boolean insert = false; |
|||
try { |
|||
Long bId = ((ApplyBModeSpecialist)acList.get(0)).getbId(); |
|||
EntityWrapper<ApplyBMode> bModeWrapper = new EntityWrapper(); |
|||
bModeWrapper.eq("id", bId); |
|||
ApplyBMode bMode = (ApplyBMode)this.applyBModeService.selectOne((Wrapper)bModeWrapper); |
|||
for (ApplyBModeSpecialist applyBModeSpecialist : acList) { |
|||
EntityWrapper<ApplyBModeSpecialist> wrapper = new EntityWrapper(); |
|||
if (applyBModeSpecialist.getbId() != null && applyBModeSpecialist.getSpeId() != null) { |
|||
wrapper.eq("b_id", applyBModeSpecialist.getbId()) |
|||
.eq("spe_id", applyBModeSpecialist.getSpeId()); |
|||
ApplyBModeSpecialist queryApply = (ApplyBModeSpecialist)this.applyBModeSpecialistService.selectOne((Wrapper)wrapper); |
|||
if (queryApply != null) { |
|||
applyBModeSpecialist.setId(queryApply.getId()); |
|||
applyBModeSpecialist.setGroupDate(bMode.getGroupDate()); |
|||
insert = this.applyBModeSpecialistService.updateById(applyBModeSpecialist); |
|||
} else { |
|||
applyBModeSpecialist.setGroupDate(bMode.getGroupDate()); |
|||
insert = this.applyBModeSpecialistService.insert(applyBModeSpecialist); |
|||
} |
|||
} |
|||
if (!insert) |
|||
break; |
|||
} |
|||
map.put("msg", insert ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({"updateConSpecialist"}) |
|||
public Map<String, Object> updateConSpecialist(ApplyBModeSpecialist abmSp) { |
|||
ApplyBMode bmode = (ApplyBMode)this.applyBModeService.selectById(abmSp.getbId()); |
|||
Map<String, Object> map = new HashMap<>(); |
|||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|||
Date date = new Date(); |
|||
EntityWrapper<ApplyBModeSpecialist> wrapper = new EntityWrapper(); |
|||
String status = ""; |
|||
try { |
|||
if (abmSp != null) { |
|||
abmSp.setUpdateTime(dateFormat.parse(dateFormat.format(date))); |
|||
wrapper.eq("spe_id", abmSp.getSpeId()).eq("b_id", abmSp.getbId()); |
|||
boolean result = this.applyBModeSpecialistService.update(abmSp, (Wrapper)wrapper); |
|||
if (result == true) { |
|||
if ("1".equals(bmode.getConsultationWay())) { |
|||
status = abmSp.getState() + ""; |
|||
} else { |
|||
map.put("b_id", abmSp.getbId()); |
|||
List<ApplyBModeSpecialist> accList = this.applyBModeSpecialistService.selectByMap(map); |
|||
if (!accList.isEmpty()) { |
|||
Map<Integer, Long> collect = (Map<Integer, Long>)accList.stream().collect(Collectors.groupingBy(ApplyBModeSpecialist::getState, Collectors.counting())); |
|||
int sum30 = (collect.get(Integer.valueOf(30)) != null) ? ((Long)collect.get(Integer.valueOf(30))).intValue() : 0; |
|||
int sum40 = (collect.get(Integer.valueOf(40)) != null) ? ((Long)collect.get(Integer.valueOf(40))).intValue() : 0; |
|||
int sum80 = (collect.get(Integer.valueOf(80)) != null) ? ((Long)collect.get(Integer.valueOf(80))).intValue() : 0; |
|||
if (sum40 != 0 && sum30 == 0 && sum80 == 0) { |
|||
status = "40"; |
|||
} else if (sum80 != 0 && sum40 == 0 && sum30 == 0) { |
|||
status = "20"; |
|||
} else { |
|||
status = "30"; |
|||
} |
|||
} |
|||
} |
|||
if (StringUtils.isNotEmpty(status)) { |
|||
ApplyBMode ab = new ApplyBMode(); |
|||
ab.setStatus(status); |
|||
ab.setId(abmSp.getbId()); |
|||
ab.setDismissReason(abmSp.getDismissReason()); |
|||
this.applyBModeService.updateById(ab); |
|||
} |
|||
map.put("msg", "1"); |
|||
} else { |
|||
map.put("msg", "2"); |
|||
} |
|||
} else { |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({"selectBmodeSpePage"}) |
|||
public Map<String, Object> selectBmodeSpePage(Integer pageNo, Integer pageSize, String patientName, String startTime, String endTime, String specialistId, Integer cureType, String diagnosisType, Integer part, Integer type, String status) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
pageNo = Integer.valueOf((pageNo == null) ? 1 : pageNo.intValue()); |
|||
pageSize = Integer.valueOf((pageSize == null) ? 10 : pageSize.intValue()); |
|||
map.put("patientName", patientName); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("specialistId", specialistId); |
|||
map.put("cureType", Integer.valueOf((cureType == null) ? 1 : cureType.intValue())); |
|||
map.put("diagnosisType", diagnosisType); |
|||
map.put("part", part); |
|||
map.put("type", type); |
|||
map.put("status", status); |
|||
try { |
|||
Pagetion<Map<String, Object>> pagetion = this.applyBModeService.selectBmodeSpePage(map, pageNo, pageSize); |
|||
if (pagetion != null) |
|||
for (int i = 0; i < pagetion.getList().size(); i++) { |
|||
EntityWrapper<ApplyBModeSpecialist> wrapper = new EntityWrapper(); |
|||
wrapper.eq("b_id", ((Map)pagetion.getList().get(i)).get("id")); |
|||
List<ApplyBModeSpecialist> applyBModeSpecialists = this.applyBModeSpecialistService.selectList((Wrapper)wrapper); |
|||
pagetion.getList().get(i).put("abmSp", applyBModeSpecialists); |
|||
} |
|||
map.put("pagetion", pagetion); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} finally { |
|||
map.remove("patientName"); |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("specialistId"); |
|||
map.remove("cureType"); |
|||
map.remove("part"); |
|||
map.remove("type"); |
|||
map.remove("status"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({"selectMachineModel"}) |
|||
public Map<String, Object> selectMachineModel() { |
|||
Map<String, Object> map = this.bmodeMachineModelServiceImpl.selectMachineModel(); |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({"DataStatistics"}) |
|||
public Map<String, Object> DataStatistics() { |
|||
Map<String, Object> dataStatistics = this.applyBModeServiceImpl.DataStatistics(); |
|||
return dataStatistics; |
|||
} |
|||
|
|||
@RequestMapping({"categoryHospitalStatistics"}) |
|||
public Map<String, Object> categoryHospitalStatistics(String id, String startTime, String endTime) { |
|||
Map<String, Object> map = this.applyBModeService.categoryHospitalStatistics(id, startTime, endTime); |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({"manageHospitalDataStatistics"}) |
|||
public Map<String, Object> dataStatisticsForHospital(String startTime, String endTime) { |
|||
Map<String, Object> map = this.applyBModeService.dataStatisticsForHospital(startTime, endTime); |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({"queuing"}) |
|||
public Map<String, Object> getQueuing(Long id) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
EntityWrapper<ApplyBMode> wrapper = new EntityWrapper(); |
|||
int people = 0; |
|||
int waitTime = 0; |
|||
int active = 1; |
|||
try { |
|||
wrapper.eq("status", "40").eq("active", Integer.valueOf(3)); |
|||
wrapper.orderBy("active", false); |
|||
List<ApplyBMode> applyBModes = this.applyBModeService.selectList((Wrapper)wrapper); |
|||
if (!applyBModes.isEmpty()) |
|||
for (int i = 0; i < applyBModes.size(); i++) { |
|||
ApplyBMode bMode = applyBModes.get(i); |
|||
if (bMode.getId().equals(id)) { |
|||
people = i; |
|||
waitTime = i * 15; |
|||
active = bMode.getActive().intValue(); |
|||
break; |
|||
} |
|||
} |
|||
map.put("msg", "1"); |
|||
map.put("people", Integer.valueOf(people)); |
|||
map.put("waitTime", Integer.valueOf(waitTime)); |
|||
map.put("active", Integer.valueOf(active)); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@Transactional(rollbackFor = {Exception.class}) |
|||
@RequestMapping({"updateSpecialistBySubmit"}) |
|||
public Map<String, Object> updateSpecialistBySubmit(@RequestBody List<SpecialistSubmitDto> submitDtos) { |
|||
Map<String, Object> map = new HashMap<>(4); |
|||
SpecialistSubmitDto submitDto = submitDtos.get(0); |
|||
EntityWrapper<ApplyBModeSpecialist> speWrapper = new EntityWrapper(); |
|||
speWrapper.eq("spe_id", submitDto.getContactsId()); |
|||
speWrapper.eq("b_id", submitDto.getbId()); |
|||
try { |
|||
Long bId = null; |
|||
String type = null; |
|||
int successCount = 0; |
|||
ApplyBModeSpecialist bModeSpecialist = (ApplyBModeSpecialist)this.applyBModeSpecialistService.selectOne((Wrapper)speWrapper); |
|||
if (bModeSpecialist != null) { |
|||
bId = bModeSpecialist.getbId(); |
|||
type = bModeSpecialist.getDiagnosisType(); |
|||
bModeSpecialist.setSpeId(submitDto.getUserId()); |
|||
bModeSpecialist.setSpeName(submitDto.getUserName()); |
|||
bModeSpecialist.setState(Integer.valueOf(70)); |
|||
boolean updateResult = this.applyBModeSpecialistService.updateById(bModeSpecialist); |
|||
if (updateResult) |
|||
successCount++; |
|||
} |
|||
if (submitDtos.size() > 1) |
|||
for (int i = 1; i < submitDtos.size(); i++) { |
|||
ApplyBModeSpecialist addSpecialist = new ApplyBModeSpecialist(); |
|||
addSpecialist.setSpeId(((SpecialistSubmitDto)submitDtos.get(i)).getUserId()); |
|||
addSpecialist.setSpeName(((SpecialistSubmitDto)submitDtos.get(i)).getUserName()); |
|||
addSpecialist.setState(Integer.valueOf(70)); |
|||
if (bId != null && type != null) { |
|||
addSpecialist.setbId(bId); |
|||
addSpecialist.setDiagnosisType(type); |
|||
} |
|||
boolean addResult = this.applyBModeSpecialistService.insert(addSpecialist); |
|||
if (addResult) |
|||
successCount++; |
|||
} |
|||
if (successCount == submitDtos.size()) |
|||
map.put("msg", "1"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
Manifest-Version: 1.0 |
|||
Class-Path: |
|||
|
|||
@ -0,0 +1,74 @@ |
|||
import os |
|||
import re |
|||
|
|||
entity_dir = r"d:/Projects/洛川康复中医院/imurs/src/main/java/com/imurs/entity" |
|||
|
|||
# Header |
|||
print("| Table Name | Entity Class | Description |") |
|||
print("| :--- | :--- | :--- |") |
|||
|
|||
files = sorted([f for f in os.listdir(entity_dir) if f.endswith(".java")]) |
|||
|
|||
for f in files: |
|||
path = os.path.join(entity_dir, f) |
|||
content = "" |
|||
try: |
|||
with open(path, 'r', encoding='utf-8') as file: |
|||
content = file.read() |
|||
except UnicodeDecodeError: |
|||
try: |
|||
with open(path, 'r', encoding='gbk') as file: |
|||
content = file.read() |
|||
except: |
|||
pass |
|||
|
|||
if not content: |
|||
continue |
|||
|
|||
# Extract Table Name |
|||
table_match = re.search(r'@TableName\s*\(\s*(?:value\s*=\s*)?"([^"]+)"\s*\)', content) |
|||
if not table_match: |
|||
table_match = re.search(r"@TableName\s*\(\s*(?:value\s*=\s*)?'([^']+)'\s*\)", content) |
|||
|
|||
table_name = table_match.group(1) if table_match else "" |
|||
|
|||
# Extract Class Name |
|||
class_match = re.search(r'public\s+class\s+(\w+)', content) |
|||
class_name = class_match.group(1) if class_match else f.replace(".java", "") |
|||
|
|||
# Extract Description |
|||
description = "" |
|||
if class_match: |
|||
start_index = class_match.start() |
|||
# Search backwards from class definition |
|||
preceding = content[:start_index] |
|||
# Find all javadoc blocks |
|||
# We want the one closest to the class def, but typically it is the last one in 'preceding' |
|||
# unless there are other methods/fields above (unlikely for entity start) |
|||
comments = list(re.finditer(r'/\*\*(.*?)\*/', preceding, re.DOTALL)) |
|||
if comments: |
|||
# Use the last one |
|||
last_comment = comments[-1] |
|||
raw_comment = last_comment.group(1) |
|||
|
|||
# Clean comment |
|||
lines = raw_comment.split('\n') |
|||
desc_lines = [] |
|||
for line in lines: |
|||
line = line.strip() |
|||
# Remove comment markers * |
|||
line = re.sub(r'^\*+', '', line).strip() |
|||
|
|||
if not line: |
|||
continue |
|||
if line.startswith("@"): |
|||
continue |
|||
desc_lines.append(line) |
|||
|
|||
description = " ".join(desc_lines) |
|||
|
|||
# Escape pipes |
|||
description = description.replace("|", "\\|") |
|||
|
|||
if table_name: |
|||
print(f"| `{table_name}` | `{class_name}` | {description} |") |
|||
@ -0,0 +1,8 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<module version="4"> |
|||
<component name="FacetManager"> |
|||
<facet type="Spring" name="Spring"> |
|||
<configuration /> |
|||
</facet> |
|||
</component> |
|||
</module> |
|||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,529 @@ |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<groupId>com.imurs</groupId> |
|||
<artifactId>lunqin</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
<packaging>jar</packaging> |
|||
|
|||
<name>imurs</name> |
|||
<description>Demo project for Spring Boot</description> |
|||
<parent> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-parent</artifactId> |
|||
<!-- bumped to a patched release addressing Spring4Shell (CVE-2022-22965) --> |
|||
<version>2.6.6</version> |
|||
</parent> |
|||
|
|||
<!-- <properties>--> |
|||
<!-- <elasticsearch.version>2.4.0</elasticsearch.version>--> |
|||
<!-- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>--> |
|||
<!-- </properties>--> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-cache</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.alibaba</groupId> |
|||
<artifactId>easyexcel</artifactId> |
|||
<version>1.1.2-beta5</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.projectlombok</groupId> |
|||
<artifactId>lombok</artifactId> |
|||
<version>1.18.30</version> |
|||
<optional>true</optional> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.elasticsearch</groupId> |
|||
<artifactId>elasticsearch</artifactId> |
|||
<!-- upgraded to 7.17.16 which includes fixes for multiple CVEs including the high severity 2023-31418 --> |
|||
<version>7.17.16</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-data-elasticsearch</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.elasticsearch.client</groupId> |
|||
<artifactId>elasticsearch-rest-high-level-client</artifactId> |
|||
<!-- align with elasticsearch 7.17.16 upgrade --> |
|||
<version>7.17.16</version> |
|||
</dependency> |
|||
<!-- <dependency> |
|||
<groupId>org.elasticsearch.client</groupId> |
|||
<artifactId>elasticsearch-rest-client</artifactId> |
|||
<version>5.6.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.elasticsearch.client</groupId> |
|||
<artifactId>elasticsearch-rest-high-level-client</artifactId> |
|||
<version>5.6.0</version> |
|||
</dependency> --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-web</artifactId> |
|||
<!-- explicit version aligned with parent 2.6.6 --> |
|||
<version>2.6.6</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>javax.servlet</groupId> |
|||
<artifactId>javax.servlet-api</artifactId> |
|||
<version>3.1.0</version> |
|||
<scope>provided</scope> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.apache.tomcat</groupId> |
|||
<artifactId>tomcat-servlet-api</artifactId> |
|||
<version>8.0.36</version> |
|||
<scope>provided</scope> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.mybatis.spring.boot</groupId> |
|||
<artifactId>mybatis-spring-boot-starter</artifactId> |
|||
<version>2.1.1</version> |
|||
<exclusions> |
|||
<exclusion> |
|||
<artifactId>mybatis-spring</artifactId> |
|||
<groupId>org.mybatis</groupId> |
|||
</exclusion> |
|||
<exclusion> |
|||
<artifactId>mybatis</artifactId> |
|||
<groupId>org.mybatis</groupId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>mysql</groupId> |
|||
<artifactId>mysql-connector-java</artifactId> |
|||
<!-- 8.1.x does not exist on Maven Central, use latest 8.0.x stable --> |
|||
<version>8.0.33</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>io.agora</groupId> |
|||
<artifactId>agora-rest-client-core</artifactId> |
|||
<version>0.1.3-BETA</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>io.agora</groupId> |
|||
<artifactId>authentication</artifactId> |
|||
<version>2.1.2</version> |
|||
</dependency> |
|||
<!-- druid阿里巴巴数据库连接池 --> |
|||
<dependency> |
|||
<groupId>com.alibaba</groupId> |
|||
<artifactId>druid</artifactId> |
|||
<version>1.0.29</version> |
|||
</dependency> |
|||
<!-- MP 核心库:源码使用 2.x 包路径(com.baomidou.mybatisplus.annotations/mapper/service),降级到 2.3 以匹配 --> |
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus</artifactId> |
|||
<version>2.3</version> |
|||
<exclusions> |
|||
<exclusion> |
|||
<groupId>log4j</groupId> |
|||
<artifactId>log4j</artifactId> |
|||
</exclusion> |
|||
<exclusion> |
|||
<groupId>org.slf4j</groupId> |
|||
<artifactId>slf4j-log4j12</artifactId> |
|||
</exclusion> |
|||
<exclusion> |
|||
<groupId>commons-logging</groupId> |
|||
<artifactId>commons-logging</artifactId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
|
|||
<!-- JUnit test dependency --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-test</artifactId> |
|||
</dependency> |
|||
|
|||
<!-- fastjson阿里巴巴jSON处理器 --> |
|||
<dependency> |
|||
<groupId>com.alibaba</groupId> |
|||
<artifactId>fastjson</artifactId> |
|||
<version>1.2.83</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.jsoup</groupId> |
|||
<artifactId>jsoup</artifactId> |
|||
<version>1.16.1</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.apache.shiro</groupId> |
|||
<artifactId>shiro-spring</artifactId> |
|||
<!-- Shiro 2.x is not released on Maven Central; use latest 1.x stable --> |
|||
<version>1.13.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.apache.shiro</groupId> |
|||
<artifactId>shiro-ehcache</artifactId> |
|||
<version>1.13.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.apache.commons</groupId> |
|||
<artifactId>commons-lang3</artifactId> |
|||
<version>3.1</version> |
|||
</dependency> |
|||
|
|||
<!-- 提供监控插件。 有spring-boot actuator的jar包 --> |
|||
<dependency> |
|||
<groupId>de.codecentric</groupId> |
|||
<artifactId>spring-boot-admin-starter-client</artifactId> |
|||
<version>2.2.4</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>commons-lang</groupId> |
|||
<artifactId>commons-lang</artifactId> |
|||
<version>2.4</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>commons-beanutils</groupId> |
|||
<artifactId>commons-beanutils</artifactId> |
|||
<version>1.11.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.apache.commons</groupId> |
|||
<artifactId>commons-collections4</artifactId> |
|||
<version>4.4</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>commons-logging</groupId> |
|||
<artifactId>commons-logging</artifactId> |
|||
<version>1.2</version> |
|||
</dependency> |
|||
<!-- devtools依赖 修改代码后即时重启启动 --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-devtools</artifactId> |
|||
<optional>true</optional> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.aliyun.oss</groupId> |
|||
<artifactId>aliyun-sdk-oss</artifactId> |
|||
<version>2.8.2</version> |
|||
<exclusions> |
|||
<exclusion> |
|||
<artifactId>commons-lang</artifactId> |
|||
<groupId>commons-lang</groupId> |
|||
</exclusion> |
|||
<exclusion> |
|||
<artifactId>commons-logging</artifactId> |
|||
<groupId>commons-logging</groupId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>aliyun-java-sdk-core</artifactId> |
|||
<version>3.3.1</version> |
|||
</dependency> |
|||
|
|||
<!-- mybatisplus-spring-boot-starter 2.x 未发布到 Maven Central,已删除;mybatis-plus:2.3 核心库已足够 --> |
|||
<dependency> |
|||
<groupId>com.thoughtworks.xstream</groupId> |
|||
<artifactId>xstream</artifactId> |
|||
<!-- 1.4.25 does not exist on Maven Central; use latest 1.4.x stable --> |
|||
<version>1.4.20</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>net.sourceforge.jexcelapi</groupId> |
|||
<artifactId>jxl</artifactId> |
|||
<version>2.6.12</version> |
|||
<exclusions> |
|||
<!-- 排除 Log4j 1.x --> |
|||
<exclusion> |
|||
<groupId>log4j</groupId> |
|||
<artifactId>log4j</artifactId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.xiaoleilu</groupId> |
|||
<artifactId>hutool-all</artifactId> |
|||
<version>3.2.3</version> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi --> |
|||
<dependency> |
|||
<groupId>org.apache.poi</groupId> |
|||
<artifactId>poi</artifactId> |
|||
<version>3.17</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.alibaba</groupId> |
|||
<artifactId>easyexcel</artifactId> |
|||
<version>2.2.11</version> |
|||
<exclusions> |
|||
<exclusion> |
|||
<groupId>org.apache.poi</groupId> |
|||
<artifactId>poi</artifactId> |
|||
</exclusion> |
|||
<exclusion> |
|||
<groupId>org.apache.poi</groupId> |
|||
<artifactId>poi-ooxml</artifactId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.dom4j</groupId> |
|||
<artifactId>dom4j</artifactId> |
|||
<version>2.1.4</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.apache.poi</groupId> |
|||
<artifactId>poi-ooxml</artifactId> |
|||
<version>3.17</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.json</groupId> |
|||
<artifactId>json</artifactId> |
|||
<version>20230227</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>net.coobird</groupId> |
|||
<artifactId>thumbnailator</artifactId> |
|||
<version>0.4.8</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>jaxen</groupId> |
|||
<artifactId>jaxen</artifactId> |
|||
<!-- <version>1.1.6</version> --> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.jsoup</groupId> |
|||
<artifactId>jsoup</artifactId> |
|||
<version>1.16.1</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.apache.pdfbox</groupId> |
|||
<artifactId>pdfbox</artifactId> |
|||
<version>1.8.13</version> |
|||
<exclusions> |
|||
<exclusion> |
|||
<artifactId>commons-logging</artifactId> |
|||
<groupId>commons-logging</groupId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>cn.licoy</groupId> |
|||
<artifactId>encrypt-body-spring-boot-starter</artifactId> |
|||
<version>1.0.2.RELEASE</version> |
|||
</dependency> |
|||
<!-- 引入了如下的依赖,用于RSA的加密,解密 --> |
|||
<dependency> |
|||
<groupId>org.bouncycastle</groupId> |
|||
<artifactId>bcprov-ext-jdk15on</artifactId> |
|||
<version>1.59</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.github.ulisesbocchio</groupId> |
|||
<artifactId>jasypt-spring-boot-starter</artifactId> |
|||
<version>2.1.2</version> |
|||
</dependency> |
|||
<!-- AoP切面记录操作日志 --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-aop</artifactId> |
|||
</dependency> |
|||
<!-- 记录浏览器操作类型 --> |
|||
<dependency> |
|||
<groupId>nl.bitwalker</groupId> |
|||
<artifactId>UserAgentUtils</artifactId> |
|||
<version>1.2.4</version> |
|||
</dependency> |
|||
<!-- 阿里云直播录音 用到的 --> |
|||
<!-- <dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-websocket</artifactId> |
|||
<version>2.0.4.RELEASE</version> |
|||
</dependency> --> |
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>aliyun-java-sdk-live</artifactId> |
|||
<version>2.3.0</version> |
|||
</dependency> |
|||
|
|||
|
|||
<!-- screw核心 生成数据库文档--> |
|||
<dependency> |
|||
<groupId>cn.smallbun.screw</groupId> |
|||
<artifactId>screw-core</artifactId> |
|||
<version>1.0.3</version> |
|||
<exclusions> |
|||
<exclusion> |
|||
<artifactId>fastjson</artifactId> |
|||
<groupId>com.alibaba</groupId> |
|||
</exclusion> |
|||
<exclusion> |
|||
<artifactId>commons-lang</artifactId> |
|||
<groupId>commons-lang</groupId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
|
|||
<!--数据库连接池,在使用screw生成数据库文档时使用--> |
|||
<dependency> |
|||
<groupId>com.zaxxer</groupId> |
|||
<artifactId>HikariCP</artifactId> |
|||
<version>3.4.5</version> |
|||
</dependency> |
|||
|
|||
<!--生成接口文档--> |
|||
<dependency> |
|||
<groupId>io.github.yedaxia</groupId> |
|||
<artifactId>japidocs</artifactId> |
|||
<version>1.4.3</version> |
|||
<exclusions> |
|||
<exclusion> |
|||
<artifactId>fastjson</artifactId> |
|||
<groupId>com.alibaba</groupId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
|
|||
<!-- websocket dependency --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-websocket</artifactId> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.google.guava</groupId> |
|||
<artifactId>guava</artifactId> |
|||
<version>28.1-jre</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.google.code.gson</groupId> |
|||
<artifactId>gson</artifactId> |
|||
<version>2.8.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>javax.websocket</groupId> |
|||
<artifactId>javax.websocket-api</artifactId> |
|||
<version>1.1</version> |
|||
<scope>provided</scope> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/com.google.guava/failureaccess --> |
|||
<dependency> |
|||
<groupId>com.google.guava</groupId> |
|||
<artifactId>failureaccess</artifactId> |
|||
<version>1.0.1</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.security</groupId> |
|||
<artifactId>spring-security-crypto</artifactId> |
|||
<version>5.3.6.RELEASE</version> |
|||
</dependency> |
|||
|
|||
<!--Gson 转Json工具--> |
|||
<dependency> |
|||
<groupId>com.google.code.gson</groupId> |
|||
<artifactId>gson</artifactId> |
|||
<version>2.10</version> |
|||
</dependency> |
|||
<!--阿里云ocr识别--> |
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>alibabacloud-ocr_api20210707</artifactId> |
|||
<version>2.0.3</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>ocr_api20210707</artifactId> |
|||
<version>2.0.3</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>tea-openapi</artifactId> |
|||
<version>0.3.2</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>tea-console</artifactId> |
|||
<version>0.0.1</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>tea-util</artifactId> |
|||
<version>0.2.21</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>darabonba-stream</artifactId> |
|||
<version>0.0.1</version> |
|||
</dependency> |
|||
|
|||
|
|||
</dependencies> |
|||
<build> |
|||
<defaultGoal>compile</defaultGoal> |
|||
<plugins> |
|||
<!-- 要使生成的jar可运行,需要加入此插件 --> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>org.mybatis.generator</groupId> |
|||
<artifactId>mybatis-generator-maven-plugin</artifactId> |
|||
<version>1.3.5</version> |
|||
<configuration> |
|||
<!-- 允许移动生成的文件 --> |
|||
<verbose>true</verbose> |
|||
<!-- 是否覆盖 --> |
|||
<overwrite>true</overwrite> |
|||
<!-- 自动生成的配置 --> |
|||
<configurationFile>${basedir}/src/main/resources/mybatis-generator.xml</configurationFile> |
|||
</configuration> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-compiler-plugin</artifactId> |
|||
<version>3.3</version> |
|||
<configuration> |
|||
<!-- 指定source和target的版本 --> |
|||
<source>1.8</source> |
|||
<target>1.8</target> |
|||
</configuration> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-war-plugin</artifactId> |
|||
<version>3.3.2</version> |
|||
<configuration> |
|||
<failOnMissingWebXml>false</failOnMissingWebXml> |
|||
</configuration> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
<configuration> |
|||
<fork>true</fork> |
|||
<classifier>exec</classifier> |
|||
</configuration> |
|||
</plugin> |
|||
</plugins> |
|||
<finalName>imurs</finalName> |
|||
</build> |
|||
</project> |
|||
@ -0,0 +1,18 @@ |
|||
import sys |
|||
|
|||
path = r'd:/Projects/洛川康复中医院/imurs/src/main/java/com/imurs/controller/ApplyBModeController.java' |
|||
|
|||
try: |
|||
with open(path, 'r', encoding='utf-8') as f: |
|||
content = f.read() |
|||
|
|||
# Remove spaces: { " -> {" and " } -> "} |
|||
new_content = content.replace('{ "', '{"').replace('" }', '"}') |
|||
|
|||
with open(path, 'w', encoding='utf-8') as f: |
|||
f.write(new_content) |
|||
|
|||
print("Successfully removed spaces from RequestMapping annotations.") |
|||
except Exception as e: |
|||
print(f"Error: {e}") |
|||
sys.exit(1) |
|||
@ -0,0 +1,85 @@ |
|||
|
|||
|
|||
package com.imurs; |
|||
|
|||
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; |
|||
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; |
|||
|
|||
import org.jasypt.encryption.StringEncryptor; |
|||
/** |
|||
*运行代码 |
|||
*/ |
|||
import org.mybatis.spring.annotation.MapperScan; |
|||
import org.springframework.boot.CommandLineRunner; |
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
import org.springframework.boot.builder.SpringApplicationBuilder; |
|||
import org.springframework.boot.web.servlet.ServletComponentScan; |
|||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
|||
import org.springframework.cache.annotation.EnableCaching; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.scheduling.annotation.EnableScheduling; |
|||
import org.springframework.transaction.annotation.EnableTransactionManagement; |
|||
|
|||
import com.imurs.util.MsgCode; |
|||
|
|||
|
|||
/** |
|||
* springboot口 |
|||
* |
|||
*/ |
|||
// 扫描指定包下面的dao接口
|
|||
@MapperScan({"com.imurs.shiro","com.imurs.dao"}) |
|||
@ServletComponentScan |
|||
@SpringBootApplication |
|||
@EnableScheduling |
|||
@EnableTransactionManagement |
|||
@EnableCaching(proxyTargetClass = true) // 开启缓存功能
|
|||
public class Application extends SpringBootServletInitializer implements CommandLineRunner { |
|||
|
|||
|
|||
// 入口
|
|||
public static void main(String[] args) { |
|||
SpringApplication.run(Application.class, args); |
|||
System.setProperty("es.set.netty.runtime.available.processors", "false"); |
|||
} |
|||
|
|||
// Java EE应用服务器配置,
|
|||
// 如果要使用tomcat来加载jsp的话就必须继承SpringBootServletInitializer类并且重写其中configure方法
|
|||
@Override |
|||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
|||
return application.sources(Application.class); |
|||
} |
|||
|
|||
// springboot运行后此方法首先被调用
|
|||
// 实现CommandLineRunner抽象类中的run方法
|
|||
@Override |
|||
public void run(String... args) throws Exception { |
|||
System.out.println("springboot启动完成!"); |
|||
System.out.println(" _____ ______ __ __ _____ \r\n" + |
|||
" / ____| |___ / \\ \\ / / | __ \\ \r\n" + |
|||
" | | __ / / \\ \\_/ / | | | |\r\n" + |
|||
" | | |_ | / / \\ / | | | |\r\n" + |
|||
" | |__| | / /__ | | | |__| |\r\n" + |
|||
" \\_____| /_____| |_| |_____/ \r\n" + |
|||
" \r\n" + |
|||
" "); |
|||
} |
|||
/** |
|||
* 配置StringEncryptor |
|||
*/ |
|||
@Bean("jasyptStringEncryptor") |
|||
public StringEncryptor stringEncryptor() { |
|||
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); |
|||
SimpleStringPBEConfig config = new SimpleStringPBEConfig(); |
|||
config.setPassword(MsgCode.MYSQL_PUBLICKEY_BD_TEST); |
|||
config.setAlgorithm("PBEWithMD5AndDES"); |
|||
config.setKeyObtentionIterations("1000"); |
|||
config.setPoolSize("1"); |
|||
config.setProviderName("SunJCE"); |
|||
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); |
|||
config.setStringOutputType("base64"); |
|||
encryptor.setConfig(config); |
|||
return encryptor; |
|||
} |
|||
} |
|||
@ -0,0 +1,223 @@ |
|||
package com.imurs.api; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.dto.AgoraLoginUserDTO; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.UserService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.util.StreamUtils; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.io.IOException; |
|||
import java.net.HttpURLConnection; |
|||
import java.net.URL; |
|||
import java.nio.charset.Charset; |
|||
import java.text.ParsePosition; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Base64; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author wdh |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("agoraApi") |
|||
public class AgoreApiController { |
|||
@Autowired |
|||
UserService userService; |
|||
|
|||
/** |
|||
* 客户 ID |
|||
*/ |
|||
final String customerKey = "b85a527055eb4b82b06f34d95edcf21c"; |
|||
/** |
|||
* 客户密钥 |
|||
*/ |
|||
final String customerSecret = "0cc3f5806c6445e69ee233098c7aa78a"; |
|||
|
|||
/** |
|||
* 拼接客户 ID 和客户密钥并使用 base64 编码 |
|||
*/ |
|||
String plainCredentials = customerKey + ":" + customerSecret; |
|||
String base64Credentials = new String(Base64.getEncoder().encode(plainCredentials.getBytes())); |
|||
/** |
|||
* 创建 authorization header |
|||
*/ |
|||
String authorizationHeader = "Basic " + base64Credentials; |
|||
|
|||
@RequestMapping("getChannel") |
|||
public Map<String, Object> test(String appId) throws IOException { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
//建立URL连接对象
|
|||
String httpUrl = "https://api.agora.io/dev/v1/channel/" + appId; |
|||
URL url = new URL(httpUrl); |
|||
//创建连接
|
|||
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); |
|||
//设置请求的方式(需要是大写的)
|
|||
conn.setRequestMethod("GET"); |
|||
//设置请求头
|
|||
conn.setRequestProperty("Content-Type","application/json"); |
|||
conn.setRequestProperty("Connection", "Keep-Alive"); |
|||
conn.setRequestProperty("Authorization", authorizationHeader); |
|||
|
|||
//post请求不能使用缓存
|
|||
conn.setUseCaches(false); |
|||
//设置需要输出
|
|||
conn.setDoOutput(true); |
|||
//设置超时
|
|||
conn.setConnectTimeout(5000); |
|||
//写入参数.
|
|||
//conn.getOutputStream().write(dataJson.getBytes());
|
|||
|
|||
//发送请求到服务器
|
|||
conn.connect(); |
|||
//获取远程响应的内容并返回
|
|||
String response = StreamUtils.copyToString(conn.getInputStream(), Charset.forName("utf-8")); |
|||
com.alibaba.fastjson.JSONObject data = JSON.parseObject(response); |
|||
//关闭连接
|
|||
conn.disconnect(); |
|||
map.put("response",data); |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* @param appId appId |
|||
* @param cname 频道名 |
|||
* @return 踢出该频道的用户 |
|||
*/ |
|||
@RequestMapping("leftChannel") |
|||
public Map<String, Object> leftChannel(String appId, String cname) { |
|||
Map<String, Object> map = new HashMap<>(8); |
|||
// 封禁为加入频道封禁
|
|||
String[] privileges = new String[1]; |
|||
privileges[0] = "join_channel"; |
|||
JSONObject dataJson = new JSONObject(); |
|||
dataJson.put("appid",appId); |
|||
dataJson.put("cname",cname); |
|||
dataJson.put("time",0); |
|||
dataJson.put("privileges",privileges); |
|||
try { |
|||
//建立URL连接对象
|
|||
String httpUrl = "https://api.agora.io/dev/v1/kicking-rule"; |
|||
URL url = new URL(httpUrl); |
|||
//创建连接
|
|||
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); |
|||
//设置请求的方式(需要是大写的)
|
|||
conn.setRequestMethod("POST"); |
|||
//设置请求头
|
|||
conn.setRequestProperty("Content-Type","application/json"); |
|||
conn.setRequestProperty("Connection", "Keep-Alive"); |
|||
conn.setRequestProperty("Authorization", authorizationHeader); |
|||
|
|||
//post请求不能使用缓存
|
|||
conn.setUseCaches(false); |
|||
//设置需要输出
|
|||
conn.setDoOutput(true); |
|||
//设置超时
|
|||
conn.setConnectTimeout(5000); |
|||
//写入参数.
|
|||
conn.getOutputStream().write(dataJson.toString().getBytes()); |
|||
|
|||
//发送请求到服务器
|
|||
conn.connect(); |
|||
//获取远程响应的内容并返回
|
|||
String response = StreamUtils.copyToString(conn.getInputStream(), Charset.forName("utf-8")); |
|||
com.alibaba.fastjson.JSONObject data = JSON.parseObject(response); |
|||
//关闭连接
|
|||
conn.disconnect(); |
|||
map.put("response",data); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping("byTime") |
|||
public Map<String, Object> byTime() throws IOException { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
long startTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")) |
|||
.parse("2020-01-30 20:00:00", new ParsePosition(0)).getTime() / 1000; |
|||
long endTime= (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")) |
|||
.parse("2021-02-10 20:00:00", new ParsePosition(0)).getTime() / 1000; |
|||
String appid = "dbe6c79f3c8045b4abbf8429838189db"; |
|||
String metric = "userCount"; |
|||
//建立URL连接对象
|
|||
String httpUrl = "https://api.agora.io/beta/live/experience/by_time?start_ts=" + startTime |
|||
+"&end_ts=" + endTime + "&appid=" + appid + "&metric=" + metric; |
|||
URL url = new URL(httpUrl); |
|||
//创建连接
|
|||
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); |
|||
//设置请求的方式(需要是大写的)
|
|||
conn.setRequestMethod("GET"); |
|||
//设置请求头
|
|||
conn.setRequestProperty("Content-Type","application/json"); |
|||
conn.setRequestProperty("Connection", "Keep-Alive"); |
|||
conn.setRequestProperty("Authorization", authorizationHeader); |
|||
|
|||
//post请求不能使用缓存
|
|||
conn.setUseCaches(false); |
|||
//设置需要输出
|
|||
conn.setDoOutput(true); |
|||
//设置超时
|
|||
conn.setConnectTimeout(5000); |
|||
//写入参数.
|
|||
//conn.getOutputStream().write(dataJson.getBytes());
|
|||
|
|||
//发送请求到服务器
|
|||
conn.connect(); |
|||
//获取远程响应的内容并返回
|
|||
String response = StreamUtils.copyToString(conn.getInputStream(), Charset.forName("utf-8")); |
|||
com.alibaba.fastjson.JSONObject data = JSON.parseObject(response); |
|||
//关闭连接
|
|||
conn.disconnect(); |
|||
map.put("data",data); |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping("getHospitalNameByPhone") |
|||
public Map<String, Object> getHospitalNameByPhone(String phone) { |
|||
Map<String, Object> map = new HashMap<>(8); |
|||
try { |
|||
User user = userService.selectUserByPhone(phone); |
|||
if (user != null) { |
|||
map.put("name",user.getHospitalName()); |
|||
map.put("msg","1"); |
|||
} else { |
|||
map.put("msg","2"); |
|||
} |
|||
} catch (Exception e) { |
|||
map.put("msg","4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* @param userDTO 用户名 密码 权限id |
|||
* @return 监控平台的登录验证 |
|||
*/ |
|||
@RequestMapping("login") |
|||
public Map<String, Object> login(@RequestBody AgoraLoginUserDTO userDTO) { |
|||
Map<String, Object> map = new HashMap<>(8); |
|||
try { |
|||
User user = userService.selectOne(new EntityWrapper<User>() |
|||
.eq("phone", userDTO.getUsername()) |
|||
.eq("password", userDTO.getPassword()) |
|||
.eq("rid", userDTO.getRid())); |
|||
if (user != null) { |
|||
map.put("status","200"); |
|||
} else { |
|||
map.put("status","404"); |
|||
} |
|||
} catch (Exception e) { |
|||
map.put("status","4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
package com.imurs.api; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.jasypt.util.text.BasicTextEncryptor; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.MD5; |
|||
import com.imurs.util.MsgCode; |
|||
|
|||
|
|||
@RestController |
|||
@RequestMapping("api") |
|||
public class ApiController { |
|||
|
|||
@Autowired |
|||
UserService userService; |
|||
|
|||
|
|||
/** |
|||
* 查询医生详情 |
|||
* sign= MD5(MD5(uid +timestamp)+ secretKey) |
|||
*/ |
|||
@RequestMapping(value = "selectDoctorByPhone",method=RequestMethod.POST) |
|||
public Map<String, Object> selectDoctorByPhone(String phone,String timestamp,String sign) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
if(StringUtils.isNotEmpty(phone)&& StringUtils.isNotEmpty(timestamp) && StringUtils.isNotEmpty(sign)){ |
|||
//加密判断
|
|||
String signServer=MD5.GetMD5Code(MD5.GetMD5Code(phone +timestamp)+ "X8O2b79XiZFVQOX5X049Sw=="); |
|||
if(signServer.equals(sign)){ |
|||
User user = userService.selectUserByPhone(phone); |
|||
if(user!=null){ |
|||
BasicTextEncryptor textEncryptor = new BasicTextEncryptor(); |
|||
textEncryptor.setPassword(MsgCode.API); |
|||
map.put("user",textEncryptor.encrypt(JSON.toJSONString(user))); |
|||
|
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
}else{ |
|||
map.put("msg", "1004"); |
|||
} |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,65 @@ |
|||
package com.imurs.config; |
|||
|
|||
import org.springframework.stereotype.Component; |
|||
import javax.servlet.*; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.IOException; |
|||
import java.util.Arrays; |
|||
import java.util.HashSet; |
|||
import java.util.Set; |
|||
|
|||
@Component |
|||
public class CorsFilter implements Filter { |
|||
|
|||
@Override |
|||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) |
|||
throws IOException, ServletException { |
|||
// 解决跨域问题
|
|||
HttpServletResponse res1 = (HttpServletResponse) res; |
|||
HttpServletRequest req1 = (HttpServletRequest) req; |
|||
res1.setContentType("html;charset=UTF-8"); |
|||
// request.setCharacterEncoding("UTF-8");
|
|||
res1.setCharacterEncoding("UTF-8"); |
|||
// ((HttpServletResponse)
|
|||
// response).setHeader("Access-Control-Allow-Origin", "*");
|
|||
// ((HttpServletResponse)
|
|||
// response).setHeader("Access-Control-Allow-Methods", "POST, GET,
|
|||
// OPTIONS, DELETE");
|
|||
// ((HttpServletResponse) response).setHeader("Access-Control-Max-Age",
|
|||
// "3600");
|
|||
// ((HttpServletResponse)
|
|||
// response).setHeader("Access-Control-Allow-Headers","x-requested-with,content-type");
|
|||
String[] allowdomain = { "http://192.168.1.111:8020", "http://192.168.1.120:8080", "http://192.168.1.3", |
|||
"http://127.0.0.1:1002", "http://localhost:8080", "http://localhost:5050" }; |
|||
Set<String> allowOrigins = new HashSet<String>(Arrays.asList(allowdomain)); |
|||
String origionHeader = req1.getHeader("origin"); |
|||
// System.out.println("origin" + req1.getHeader("origin"));
|
|||
|
|||
if (origionHeader != null && allowOrigins.contains(origionHeader)) { |
|||
//// 指定允许其他域名访问
|
|||
res1.setHeader("Access-Control-Allow-Origin", origionHeader); |
|||
} else { |
|||
res1.setHeader("Access-Control-Allow-Origin", "*"); |
|||
} |
|||
res1.setHeader("Content-type", "text/html;charset=UTF-8"); |
|||
// 响应类型
|
|||
res1.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
|||
res1.setHeader("Access-Control-Max-Age", "3600"); |
|||
// 响应头设置
|
|||
res1.setHeader("Access-Control-Allow-Headers", |
|||
"Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With,userId,token,Authorization"); |
|||
res1.setHeader("Access-Control-Allow-Credentials", "true"); |
|||
res1.setHeader("XDomainRequestAllowed", "1"); |
|||
|
|||
// System.out.println("*********************************过滤器被使用**************************");
|
|||
chain.doFilter(req, res); |
|||
} |
|||
|
|||
public void init(FilterConfig filterConfig) { |
|||
} |
|||
|
|||
@Override |
|||
public void destroy() { |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
package com.imurs.config; |
|||
|
|||
import org.apache.http.HttpHost; |
|||
import org.elasticsearch.client.RestClient; |
|||
import org.elasticsearch.client.RestHighLevelClient; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
|
|||
/** |
|||
* @author laier |
|||
* @date 2022-12-12 14:21 |
|||
*/ |
|||
|
|||
@Configuration |
|||
@ConditionalOnProperty(name = "es.enabled", havingValue = "true") |
|||
public class ElasticSearchConfig { |
|||
|
|||
@Value("${es.url}") |
|||
private String url; |
|||
|
|||
@Value("${es.port}") |
|||
private Integer port; |
|||
|
|||
public static String index="es_lunqin"; |
|||
|
|||
@Bean |
|||
public RestHighLevelClient client(){ |
|||
RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost(url, port))); |
|||
return client; |
|||
} |
|||
} |
|||
@ -0,0 +1,105 @@ |
|||
package com.imurs.config; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.ISqlInjector; |
|||
import com.baomidou.mybatisplus.mapper.LogicSqlInjector; |
|||
import org.apache.ibatis.logging.stdout.StdOutImpl; |
|||
import org.apache.ibatis.mapping.DatabaseIdProvider; |
|||
import org.apache.ibatis.plugin.Interceptor; |
|||
//import org.apache.log4j.Logger;
|
|||
import org.mybatis.spring.boot.autoconfigure.MybatisProperties; |
|||
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.core.io.DefaultResourceLoader; |
|||
import org.springframework.core.io.ResourceLoader; |
|||
import org.springframework.util.ObjectUtils; |
|||
import org.springframework.util.StringUtils; |
|||
|
|||
import com.baomidou.mybatisplus.MybatisConfiguration; |
|||
import com.baomidou.mybatisplus.MybatisXMLLanguageDriver; |
|||
import com.baomidou.mybatisplus.entity.GlobalConfiguration; |
|||
import com.baomidou.mybatisplus.enums.DBType; |
|||
import com.baomidou.mybatisplus.plugins.PaginationInterceptor; |
|||
import com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean; |
|||
|
|||
@Configuration |
|||
public class MybatisPlusConfig { |
|||
@Autowired |
|||
private DataSource dataSource; |
|||
|
|||
@Autowired |
|||
private MybatisProperties properties; |
|||
|
|||
@Autowired |
|||
private ResourceLoader resourceLoader = new DefaultResourceLoader(); |
|||
|
|||
@Autowired(required = false) |
|||
private Interceptor[] interceptors; |
|||
|
|||
@Autowired(required = false) |
|||
private DatabaseIdProvider databaseIdProvider; |
|||
|
|||
// @Autowired
|
|||
// private MyMetaObjectHandler myMetaObjectHandler;
|
|||
|
|||
/** |
|||
* mybatis-plus分页插件 |
|||
*/ |
|||
@Bean |
|||
public PaginationInterceptor paginationInterceptor() { |
|||
PaginationInterceptor page = new PaginationInterceptor(); |
|||
page.setDialectType("mysql"); |
|||
// Logger.getLogger(getClass()).info("PaginationInterceptor注入成功!!");
|
|||
return page; |
|||
} |
|||
|
|||
/** |
|||
* 这里全部使用mybatis-autoconfigure 已经自动加载的资源。不手动指定 配置文件和mybatis-boot的配置文件同步 |
|||
* |
|||
* @return |
|||
*/ |
|||
@Bean |
|||
public MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean() { |
|||
MybatisSqlSessionFactoryBean mybatisPlus = new MybatisSqlSessionFactoryBean(); |
|||
mybatisPlus.setDataSource(dataSource); |
|||
mybatisPlus.setVfs(SpringBootVFS.class); |
|||
if (StringUtils.hasText(this.properties.getConfigLocation())) { |
|||
mybatisPlus.setConfigLocation(this.resourceLoader.getResource(this.properties.getConfigLocation())); |
|||
} |
|||
mybatisPlus.setConfiguration(properties.getConfiguration()); |
|||
if (!ObjectUtils.isEmpty(this.interceptors)) { |
|||
mybatisPlus.setPlugins(this.interceptors); |
|||
} |
|||
// MP 全局配置,更多内容进入类看注释
|
|||
GlobalConfiguration globalConfig = new GlobalConfiguration(); |
|||
// 配置公共字段自动填写
|
|||
// globalConfig.setMetaObjectHandler(myMetaObjectHandler);
|
|||
globalConfig.setDbType(DBType.MYSQL.name()); |
|||
// ID 策略 AUTO->`0`("数据库ID自增") INPUT->`1`(用户输入ID")
|
|||
// ID_WORKER->`2`("全局唯一ID") UUID->`3`("全局唯一ID")
|
|||
globalConfig.setIdType(3); |
|||
mybatisPlus.setGlobalConfig(globalConfig); |
|||
MybatisConfiguration mc = new MybatisConfiguration(); |
|||
//配置sql日志打印
|
|||
mc.setLogImpl(StdOutImpl.class); |
|||
mc.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class); |
|||
mybatisPlus.setConfiguration(mc); |
|||
if (this.databaseIdProvider != null) { |
|||
mybatisPlus.setDatabaseIdProvider(this.databaseIdProvider); |
|||
} |
|||
if (StringUtils.hasLength(this.properties.getTypeAliasesPackage())) { |
|||
mybatisPlus.setTypeAliasesPackage(this.properties.getTypeAliasesPackage()); |
|||
} |
|||
if (StringUtils.hasLength(this.properties.getTypeHandlersPackage())) { |
|||
mybatisPlus.setTypeHandlersPackage(this.properties.getTypeHandlersPackage()); |
|||
} |
|||
if (!ObjectUtils.isEmpty(this.properties.resolveMapperLocations())) { |
|||
mybatisPlus.setMapperLocations(this.properties.resolveMapperLocations()); |
|||
} |
|||
return mybatisPlus; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
package com.imurs.constant; |
|||
|
|||
/** |
|||
* @author wang |
|||
* @date 2021年08月17日 15:51 |
|||
* 超声病例的会诊状态 |
|||
*/ |
|||
public class ModelActiveConstant { |
|||
/** |
|||
* 超声病例正在进行 |
|||
*/ |
|||
public final static int ACTIVE_DOING = 3; |
|||
/** |
|||
* 超声病例待审核报告 |
|||
*/ |
|||
public final static int ACTIVE_CHECKING = 2; |
|||
/** |
|||
* 超声病例未开始会诊 |
|||
*/ |
|||
public final static int ACTIVE_NOT_BEGIN = 1; |
|||
/** |
|||
* 超声病例已结束 |
|||
*/ |
|||
public final static int ACTIVE_FINISH = 0; |
|||
|
|||
private ModelActiveConstant() {} |
|||
} |
|||
@ -0,0 +1,157 @@ |
|||
/* |
|||
package com.imurs.controller; |
|||
|
|||
import java.io.File; |
|||
import java.io.FileInputStream; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.net.URL; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Timer; |
|||
import java.util.TimerTask; |
|||
import java.util.UUID; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.scheduling.annotation.Async; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.AgoraRecord; |
|||
import com.imurs.oss.AliyunOSSClientUtil; |
|||
import com.imurs.service.AgoraRecordService; |
|||
|
|||
|
|||
import io.agora.recording.RecordingSDK; |
|||
import io.agora.recording.test.RecordingSample; |
|||
|
|||
@RestController |
|||
@RequestMapping("agora") |
|||
public class AgoraController { |
|||
private static String isSucess = null; |
|||
@Autowired |
|||
AgoraRecordService agoraRecordService; |
|||
|
|||
@RequestMapping("Record") |
|||
public String AgnoraRecord(String esrdNumber,String id ){ |
|||
|
|||
String[] s= {"--appId", "7bbabfd2f5a84a6591fc7b863e2c901e","--uid","0","--channel","1000","--appliteDir","/usr/Agorao/Agorao_Linux_FULL/bin","--isAudioOnly","1","--isVideoOnly","0","--isMixingEnabled","1","--mixedVideoAudio","0","--recordFileRootDir","/usr/recording_output","--idle","10"}; |
|||
s[5] = id; |
|||
*/ |
|||
/* RecordingSDK RecordingSdk = new RecordingSDK(); |
|||
RecordingSample ars = new RecordingSample(RecordingSdk); |
|||
String dir= ars.createChannel(s); |
|||
ars.unRegister(); |
|||
//
|
|||
System.out.println("zp AgoraController dir..."+dir);//file directory
|
|||
File des = new File(dir); |
|||
File[] sub =des.listFiles(); |
|||
for(File file:sub) { |
|||
if(file.isFile()&&file.getName().endsWith(".aac")) { |
|||
System.out.println("now exiting .aac...!"+dir+file.getName()); |
|||
String s2=excle(dir+file.getName()); |
|||
AgoraRecord arec =new AgoraRecord(); |
|||
arec.setEsrdNumber(esrdNumber); |
|||
arec.setRegDir(s2+".acc");//加文件目录
|
|||
boolean isSave=agoraRecordService.insert(arec); |
|||
System.out.println("s2"+s2+"保存是否成功"+isSave); |
|||
} |
|||
}*//*
|
|||
|
|||
excuteAsync(s,esrdNumber); |
|||
return "isok"; |
|||
} |
|||
//需要异步处理的业务方法
|
|||
@Async |
|||
public String excuteAsync(String[] param,String esrdNumber){ |
|||
// do something;
|
|||
// final String isSucess="";
|
|||
Timer timer = new Timer();// 实例化Timer类
|
|||
timer.schedule(new TimerTask() { |
|||
public void run() { |
|||
//System.out.println("退出");
|
|||
isSucess=parseAgiao(param,esrdNumber); |
|||
this.cancel(); |
|||
} |
|||
}, 1000);// 这里百毫秒
|
|||
return isSucess; |
|||
|
|||
} |
|||
|
|||
public String parseAgiao(String[] parms,String esrdNumber ){ |
|||
RecordingSDK RecordingSdk = new RecordingSDK(); |
|||
RecordingSample ars = new RecordingSample(RecordingSdk); |
|||
String dir= ars.createChannel(parms); |
|||
ars.unRegister(); |
|||
//
|
|||
// System.out.println("zp AgoraController dir..."+dir);//file directory
|
|||
boolean isSave=false; |
|||
File des = new File(dir); |
|||
File[] sub =des.listFiles(); |
|||
if(sub.length<0){ |
|||
return "无录音文件"; |
|||
} |
|||
for(File file:sub) { |
|||
if(file.isFile()&&file.getName().endsWith(".aac")) { |
|||
// System.out.println("now exiting .aac...!"+dir+file.getName());
|
|||
String s2=excle(dir+file.getName()); |
|||
AgoraRecord arec =new AgoraRecord(); |
|||
arec.setEsrdNumber(esrdNumber); |
|||
arec.setRegDir(s2+".aac");//加文件目录
|
|||
isSave=agoraRecordService.insert(arec); |
|||
// System.out.println("s2"+s2+"保存是否成功"+isSave);
|
|||
} |
|||
} |
|||
return isSave==true?"保存成功":"保存失败"; |
|||
} |
|||
public String excle(String fileName) { |
|||
AliyunOSSClientUtil.FOLDER = "gansu/record/"; |
|||
AliyunOSSClientUtil ossClient = new AliyunOSSClientUtil();// oss上传工具类
|
|||
// 文件名称
|
|||
String img =fileName; |
|||
String fileName1=null; |
|||
try { |
|||
// 将图片转换输入流
|
|||
InputStream is = new FileInputStream(img); |
|||
fileName1 =String.valueOf(UUID.randomUUID());//String.valueOf(UUID.randomUUID());
|
|||
//System.out.println(fileName1);
|
|||
// 获取图片后缀名
|
|||
URL url = ossClient.uploadObject3OSS(is,fileName1+".aac"); |
|||
//System.out.println("url的网址"+url);
|
|||
is.close(); |
|||
// 删除本地文件
|
|||
*/ |
|||
/*File files = new File(img); |
|||
if (files.exists()) { |
|||
System.gc(); |
|||
files.delete(); |
|||
}*//*
|
|||
|
|||
//将数据文件保存到数据库里去,按病案号。日期201804011205 到分。id 做主健,可以一个病案号插入多个文件。
|
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
return "error"; |
|||
} |
|||
return "gansu/record/"+fileName1; |
|||
} |
|||
//录音文件查询
|
|||
@RequestMapping("selectAgoraById") |
|||
public Map<String,Object> selectAgoraById(String id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<AgoraRecord> wrapper = new EntityWrapper<AgoraRecord>(); |
|||
List<AgoraRecord> RecordFileList=new ArrayList<AgoraRecord>(); |
|||
try { |
|||
wrapper.eq("esrd_number", id); |
|||
RecordFileList=agoraRecordService.selectList(wrapper); |
|||
map.put("recordlist", RecordFileList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
*/ |
|||
@ -0,0 +1,433 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.net.URL; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import javax.net.ssl.HostnameVerifier; |
|||
import javax.net.ssl.HttpsURLConnection; |
|||
import javax.net.ssl.SSLContext; |
|||
import javax.net.ssl.SSLSession; |
|||
import javax.net.ssl.TrustManager; |
|||
|
|||
import com.imurs.entity.LayoutConfig; |
|||
import org.json.JSONObject; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.google.gson.JsonArray; |
|||
import com.imurs.sound.ConnUtil; |
|||
|
|||
/** |
|||
* 云端录制 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("Agora") |
|||
public class AgoraRecordController { |
|||
@RequestMapping(method = RequestMethod.POST,value="/StartRecord") |
|||
public Map<String,Object> StartRecord(@RequestBody List<LayoutConfig> LayoutConfigList) throws Exception{ |
|||
LayoutConfig layoutConfig = LayoutConfigList.get(0); |
|||
String appid = layoutConfig.getAppid(); |
|||
Integer streamTypes = layoutConfig.getStreamTypes(); |
|||
String cname = layoutConfig.getCname(); |
|||
Integer channelType = layoutConfig.getChannelType(); |
|||
String rdirectory = layoutConfig.getRdirectory(); |
|||
String sdirectory = layoutConfig.getSdirectory(); |
|||
Integer twidth = layoutConfig.getTwidth(); |
|||
JSONObject recordingFileConfig = new JSONObject(); |
|||
org.json.JSONArray avFileType = new org.json.JSONArray(); |
|||
avFileType.put("hls"); |
|||
avFileType.put("mp4"); |
|||
recordingFileConfig.put("avFileType",avFileType); |
|||
//System.out.println(twidth+"!!!");
|
|||
Integer theight = layoutConfig.getTheight(); |
|||
Integer fps = layoutConfig.getFps(); |
|||
Integer bitrate = layoutConfig.getBitrate(); |
|||
Integer mixedVideoLayout = layoutConfig.getMixedVideoLayout(); |
|||
|
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
JSONObject nullObj = new JSONObject(); |
|||
//合流模式下录制
|
|||
String reasourceId = reasourceId(cname,appid); |
|||
//System.out.println("查询到的id值"+reasourceId);
|
|||
String durl = "https://api.sd-rtn.com/v1/apps/"+appid+"/cloud_recording/resourceid/"+reasourceId+"/mode/mix/start"; |
|||
//测试超声//测试超声59109db67051428f96346260bda5654b
|
|||
//正式超声7bbabfd2f5a84a6591fc7b863e2c901e
|
|||
//System.out.println("请求网站"+durl);
|
|||
SSLContext sslcontext = SSLContext.getInstance("SSL","SunJSSE"); |
|||
sslcontext.init(null, new TrustManager[]{new com.imurs.parameter.MyX509TrustManager()}, new java.security.SecureRandom()); |
|||
URL url = new URL(durl);///inoneagent/bloodoxygen
|
|||
HostnameVerifier ignoreHostnameVerifier = new HostnameVerifier() { |
|||
public boolean verify(String s, SSLSession sslsession) { |
|||
|
|||
return true; |
|||
} |
|||
}; |
|||
HttpsURLConnection.setDefaultHostnameVerifier(ignoreHostnameVerifier); |
|||
HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory()); |
|||
JSONObject clientRequest = new JSONObject(); |
|||
JSONObject recordingConfig = new JSONObject(); |
|||
recordingConfig.put("channelType", channelType);//0,通信模式,1,直播模式
|
|||
//recordingConfig.put("maxIdleTime", 6);//频道内最长6秒
|
|||
//recordingConfig.put("streamTypes", streamTypes);//0,仅录制音频,1,仅录制视频,2,同时录制音视频
|
|||
JSONObject transcodingConfig = new JSONObject(); |
|||
// transcodingConfig.put("width", width);//宽度
|
|||
// transcodingConfig.put("height", height);//高度
|
|||
transcodingConfig.put("width", twidth);//宽度
|
|||
transcodingConfig.put("height", theight);//高度
|
|||
transcodingConfig.put("fps", fps);//帧率
|
|||
transcodingConfig.put("bitrate", bitrate);//码率
|
|||
|
|||
//2020.10.28修改xfh
|
|||
transcodingConfig.put("mixedVideoLayout",mixedVideoLayout);//0、1、2 为预设的合流布局,3 为自定义合流布局
|
|||
//System.out.println(transcodingConfig+"~~~~~~~~~~~~~~~");
|
|||
org.json.JSONArray config = new org.json.JSONArray(); |
|||
for (int i=1;i<LayoutConfigList.size();i++){ |
|||
LayoutConfig layout= LayoutConfigList.get(i); |
|||
JSONObject layoutinConfig = new JSONObject(); |
|||
layoutinConfig.put("x_axis", layout.getX_axis()); |
|||
layoutinConfig.put("y_axis", layout.getY_axis()); |
|||
layoutinConfig.put("width", layout.getWidth()); |
|||
layoutinConfig.put("height", layout.getHeight()); |
|||
layoutinConfig.put("uid", layout.getUid()); |
|||
layoutinConfig.put("render_mode", layout.getRender_mode()); |
|||
config.put(layoutinConfig); |
|||
} |
|||
|
|||
transcodingConfig.put("layoutConfig",config); |
|||
clientRequest.put("recordingFileConfig",recordingFileConfig); |
|||
recordingConfig.put("transcodingConfig", transcodingConfig); |
|||
|
|||
//阿里云存储设置
|
|||
JSONObject storageConfig = new JSONObject(); |
|||
storageConfig.put("vendor", 2);//阿里云
|
|||
storageConfig.put("region", 6);//深圳
|
|||
|
|||
storageConfig.put("bucket", "ydlqcs"); |
|||
storageConfig.put("accessKey", "LTAImVN6wtEJLfH1"); |
|||
storageConfig.put("secretKey", "lO7FsV3pxSaP6lcd8KP9SsfBIeFhPw"); |
|||
//
|
|||
|
|||
JSONArray fileNamep = new JSONArray(); |
|||
// JSONObject fileNamep = new JSONObject()
|
|||
fileNamep.add(rdirectory);//注意查看文档格式,将在录制文件名前加上前缀 "directory1/directory2/"
|
|||
fileNamep.add(sdirectory); |
|||
storageConfig.put("fileNamePrefix", fileNamep);//?
|
|||
//System.out.println(storageConfig+"***********************");
|
|||
String storageConfigStr = storageConfig.toString().replaceAll("\\\"(?=\\[|})|\\\\(?=\\\")", ""); |
|||
//System.out.println(storageConfigStr+"&&&&&&&&&&&&&&&&&&&&");
|
|||
storageConfig = new JSONObject(storageConfigStr); |
|||
LayoutConfig layoutConfig1 = LayoutConfigList.get(1); |
|||
String uid= layoutConfig1.getUid(); |
|||
//System.out.println("用户名"+uid+"");
|
|||
// String token=Toeknid(cname,appid,uid);
|
|||
JSONObject params = new JSONObject(); |
|||
//JSONObject clientRequest = new JSONObject();
|
|||
clientRequest.put("recordingConfig", recordingConfig); |
|||
clientRequest.put("storageConfig", storageConfig); |
|||
//clientRequest.put("token",token);
|
|||
params.put("cname",cname);//待录制的频道名
|
|||
params.put("uid","16555");//不能与频道内的用户保持一致
|
|||
params.put("clientRequest",clientRequest); |
|||
|
|||
// params.put("clientRequest",storageConfig);
|
|||
// System.out.println("请求参数"+params);
|
|||
String result =""; |
|||
try{ |
|||
|
|||
HttpsURLConnection conn= (HttpsURLConnection) url.openConnection(); |
|||
conn.setConnectTimeout(5000); |
|||
conn.setRequestMethod("POST"); |
|||
conn.setRequestProperty("Content-Type", "application/json;charset=utf-8"); |
|||
conn.addRequestProperty("Authorization", "Basic M2Q5NzY0NzYyNTEwNGNmODg0YjAyM2Q0MWU1NzYzNDQ6MzFjZGFhNWU4Njk0NDJlYzg0YWZmMGI0NTM1NGE5NTA="); |
|||
conn.setDoOutput(true); |
|||
conn.getOutputStream().write(params.toString().getBytes()); |
|||
conn.getOutputStream().close(); |
|||
|
|||
result = ConnUtil.getResponseString(conn); |
|||
}catch (Exception e){ |
|||
String s= e.toString(); |
|||
// System.out.println(e.getMessage());
|
|||
// System.out.println(e);
|
|||
map.put("error", s); |
|||
return map; |
|||
} |
|||
//com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(result);
|
|||
//获取成功录制后得SID
|
|||
JSONObject jsonObject = new JSONObject(result); |
|||
String bsid = jsonObject.getString("sid"); |
|||
|
|||
map.put("sid", bsid); |
|||
map.put("resourceid", reasourceId); |
|||
// System.out.println("sid 的值"+map);
|
|||
return map; |
|||
|
|||
} |
|||
//结束录制
|
|||
@RequestMapping(method = RequestMethod.POST,value="/StopRecord") |
|||
public Map<String,Object> StopRecord(String appid,String cname,String resourceid,String sid,String uid ) throws Exception{ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
SSLContext sslcontext = SSLContext.getInstance("SSL","SunJSSE"); |
|||
sslcontext.init(null, new TrustManager[]{new com.imurs.parameter.MyX509TrustManager()}, new java.security.SecureRandom()); |
|||
String STOPURL = "https://api.sd-rtn.com/v1/apps/"+appid+"/cloud_recording/resourceid/"+resourceid+"/sid/"+sid+"/mode/mix/stop"; |
|||
URL url = new URL(STOPURL);///inoneagent/bloodoxygen
|
|||
// System.out.println("结束网址"+url);
|
|||
HostnameVerifier ignoreHostnameVerifier = new HostnameVerifier() { |
|||
public boolean verify(String s, SSLSession sslsession) { |
|||
// System.out.println("WARNING: Hostname is not matched for cert.");
|
|||
return true; |
|||
} |
|||
}; |
|||
HttpsURLConnection.setDefaultHostnameVerifier(ignoreHostnameVerifier); |
|||
HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory()); |
|||
JSONObject params = new JSONObject(); |
|||
JSONObject clientRequest = new JSONObject(); |
|||
clientRequest.put("async_stop",true); |
|||
params.put("cname",cname);//待录制的频道名
|
|||
params.put("uid","16555"); |
|||
params.put("clientRequest",clientRequest); |
|||
//params.put("clientRequest",storageConfig);
|
|||
// System.out.println("打印参数"+params);
|
|||
HttpsURLConnection conn= (HttpsURLConnection) url.openConnection(); |
|||
conn.setConnectTimeout(5000); |
|||
conn.setRequestMethod("POST"); |
|||
conn.setRequestProperty("Content-Type", "application/json;charset=utf-8"); |
|||
conn.addRequestProperty("Authorization", "Basic M2Q5NzY0NzYyNTEwNGNmODg0YjAyM2Q0MWU1NzYzNDQ6MzFjZGFhNWU4Njk0NDJlYzg0YWZmMGI0NTM1NGE5NTA="); |
|||
conn.setDoOutput(true); |
|||
conn.getOutputStream().write(params.toString().getBytes()); |
|||
conn.getOutputStream().close(); |
|||
String result = ""; |
|||
try{ |
|||
result = ConnUtil.getResponseString(conn); |
|||
// map.put("error", result);
|
|||
}catch (Exception e){ |
|||
String s= e.toString(); |
|||
|
|||
// e.printStackTrace();
|
|||
//System.out.println(s);
|
|||
map.put("error", s); |
|||
return map ; |
|||
} |
|||
|
|||
//System.out.println("收到的结果"+result);
|
|||
//获取存储文件列表名字。
|
|||
JSONObject jsonObject = new JSONObject(result); |
|||
// String bsid = jsonObject.getString("serverResponse");
|
|||
JSONObject sr= (JSONObject) jsonObject.get("serverResponse"); |
|||
org.json.JSONArray fileList = sr.getJSONArray("fileList"); |
|||
|
|||
/* |
|||
* for (int i = 0; i < fileList.length(); i++) { JSONObject fileObj = |
|||
* fileList.getJSONObject(i); fileNameList.add(fileObj.getString("fileName"));; |
|||
* } |
|||
*/ |
|||
JSONObject fileObj = fileList.getJSONObject(0); |
|||
String flie= fileObj.getString("fileName"); |
|||
//pfile.p
|
|||
//System.out.println("文件列表"+flie);
|
|||
map.put("recordfile", flie); |
|||
return map; |
|||
|
|||
} |
|||
//query请求,不需要等待15秒就可以返回文件
|
|||
@RequestMapping(method = RequestMethod.POST,value="/QueryRecord") |
|||
public Map<String,Object> QueryRecord(String appid,String resourceid,String sid ) throws Exception{ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
SSLContext sslcontext = SSLContext.getInstance("SSL","SunJSSE"); |
|||
sslcontext.init(null, new TrustManager[]{new com.imurs.parameter.MyX509TrustManager()}, new java.security.SecureRandom()); |
|||
String STOPURL = "https://api.sd-rtn.com/v1/apps/"+appid+"/cloud_recording/resourceid/"+resourceid+"/sid/"+sid+"/mode/mix/query"; |
|||
URL url = new URL(STOPURL);///inoneagent/bloodoxygen
|
|||
// System.out.println("结束网址"+url+"网址结束了");
|
|||
HostnameVerifier ignoreHostnameVerifier = new HostnameVerifier() { |
|||
public boolean verify(String s, SSLSession sslsession) { |
|||
System.out.println("WARNING: Hostname is not matched for cert."); |
|||
return true; |
|||
} |
|||
}; |
|||
HttpsURLConnection.setDefaultHostnameVerifier(ignoreHostnameVerifier); |
|||
HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory()); |
|||
JSONObject params = new JSONObject(); |
|||
JSONObject clientRequest = new JSONObject(); |
|||
//params.put("cname","1000");//待录制的频道名
|
|||
//params.put("uid","98765");
|
|||
// params.put("clientRequest",clientRequest);
|
|||
// params.put("clientRequest",storageConfig);
|
|||
System.out.println(params); |
|||
HttpsURLConnection conn= (HttpsURLConnection) url.openConnection(); |
|||
conn.setConnectTimeout(5000); |
|||
conn.setRequestMethod("GET"); |
|||
conn.setRequestProperty("Content-Type", "application/json;charset=utf-8"); |
|||
conn.addRequestProperty("Authorization", "Basic M2Q5NzY0NzYyNTEwNGNmODg0YjAyM2Q0MWU1NzYzNDQ6MzFjZGFhNWU4Njk0NDJlYzg0YWZmMGI0NTM1NGE5NTA="); |
|||
conn.setDoOutput(true); |
|||
//conn.getOutputStream().write(params.toString().getBytes());
|
|||
conn.getOutputStream().close(); |
|||
String result = ConnUtil.getResponseString(conn); |
|||
System.out.println(result); |
|||
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(result); |
|||
JSONObject sr= (JSONObject) jsonObject.get("serverResponse"); |
|||
String flie= sr.getString("fileList"); |
|||
map.put("recordfile", flie); |
|||
return map; |
|||
|
|||
} |
|||
//获取请求ID
|
|||
private String reasourceId(String cname,String appid) throws Exception, Exception{ |
|||
String RIDURL = "https://api.sd-rtn.com/v1/apps/"+appid+"/cloud_recording/acquire"; |
|||
SSLContext sslcontext = SSLContext.getInstance("SSL","SunJSSE"); |
|||
sslcontext.init(null, new TrustManager[]{new com.imurs.parameter.MyX509TrustManager()}, new java.security.SecureRandom()); |
|||
URL url = new URL(RIDURL); |
|||
HostnameVerifier ignoreHostnameVerifier = new HostnameVerifier() { |
|||
public boolean verify(String s, SSLSession sslsession) { |
|||
return true; |
|||
} |
|||
}; |
|||
HttpsURLConnection.setDefaultHostnameVerifier(ignoreHostnameVerifier); |
|||
HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory()); |
|||
JSONObject params = new JSONObject(); |
|||
//待录制的频道名
|
|||
JSONObject clientRequestObj = new JSONObject(); |
|||
clientRequestObj.put("resourceExpiredHour",24); |
|||
clientRequestObj.put("scene",0); |
|||
params.put("cname",cname); |
|||
params.put("uid","16555"); |
|||
params.put("clientRequest",clientRequestObj); |
|||
//System.out.println("参数呃呃呃id"+params);
|
|||
HttpsURLConnection conn= (HttpsURLConnection) url.openConnection(); |
|||
conn.setConnectTimeout(5000); |
|||
conn.setRequestMethod("POST"); |
|||
conn.setRequestProperty("Content-Type", "application/json;charset=utf-8"); |
|||
//basic 后面的值是通过客户ID 和证书 通过BASE64认证生成的
|
|||
conn.addRequestProperty("Authorization", "Basic M2Q5NzY0NzYyNTEwNGNmODg0YjAyM2Q0MWU1NzYzNDQ6MzFjZGFhNWU4Njk0NDJlYzg0YWZmMGI0NTM1NGE5NTA="); |
|||
conn.setDoOutput(true); |
|||
conn.getOutputStream().write(params.toString().getBytes()); |
|||
conn.getOutputStream().close(); |
|||
String result =""; |
|||
try{ |
|||
result = ConnUtil.getResponseString(conn); |
|||
}catch (Exception e){ |
|||
return "获取reasourceId失败"; |
|||
} |
|||
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(result); |
|||
return jsonObject.get("resourceId").toString(); |
|||
} |
|||
|
|||
@PostMapping("/startPageRecord") |
|||
public Map<String, Object> startPageRecord(@RequestBody List<LayoutConfig> LayoutConfigList) throws Exception{ |
|||
LayoutConfig layoutConfig = LayoutConfigList.get(0); |
|||
String appid = layoutConfig.getAppid(); |
|||
String cname = layoutConfig.getCname(); |
|||
String rdirectory = layoutConfig.getRdirectory(); |
|||
String sdirectory = layoutConfig.getSdirectory(); |
|||
Integer twidth = layoutConfig.getTwidth(); |
|||
Integer theight = layoutConfig.getTheight(); |
|||
String url = layoutConfig.getUrl(); |
|||
|
|||
Map<String,Object> map = new HashMap<>(8); |
|||
JSONObject clientRequestObj = new JSONObject(); |
|||
clientRequestObj.put("resourceExpiredHour",24); |
|||
clientRequestObj.put("scene",1); |
|||
|
|||
String resourceId = reasourceId(cname,appid); |
|||
|
|||
String pageUrl = "https://api.sd-rtn.com/v1/apps/" + appid + "/cloud_recording/resourceid/" + resourceId + "/mode/web/start"; |
|||
SSLContext sslcontext = SSLContext.getInstance("SSL","SunJSSE"); |
|||
sslcontext.init(null, new TrustManager[]{new com.imurs.parameter.MyX509TrustManager()}, new java.security.SecureRandom()); |
|||
URL postUrl = new URL(pageUrl); |
|||
HostnameVerifier ignoreHostnameVerifier = new HostnameVerifier() { |
|||
public boolean verify(String s, SSLSession sslsession) { |
|||
return true; |
|||
} |
|||
}; |
|||
HttpsURLConnection.setDefaultHostnameVerifier(ignoreHostnameVerifier); |
|||
HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory()); |
|||
|
|||
JSONObject serviceParam = new JSONObject(); |
|||
JSONObject extensionServicesObj = new JSONObject(); |
|||
org.json.JSONArray extensionServices = new org.json.JSONArray(); |
|||
JSONObject extensionServiceConfig = new JSONObject(); |
|||
|
|||
serviceParam.put("url",url); |
|||
serviceParam.put("audioProfile",0); |
|||
serviceParam.put("videoWidth",twidth); |
|||
serviceParam.put("videoHeight",theight); |
|||
serviceParam.put("maxRecordingHour",72); |
|||
|
|||
extensionServicesObj.put("serviceName","web_recorder_service"); |
|||
extensionServicesObj.put("errorHandlePolicy","error_abort"); |
|||
extensionServicesObj.put("serviceParam",serviceParam); |
|||
|
|||
extensionServices.put(extensionServicesObj); |
|||
|
|||
extensionServiceConfig.put("errorHandlePolicy","error_abort"); |
|||
extensionServiceConfig.put("extensionServices",extensionServices); |
|||
|
|||
JSONObject recordingFileConfig = new JSONObject(); |
|||
org.json.JSONArray avFileType = new org.json.JSONArray(); |
|||
avFileType.put("hls"); |
|||
avFileType.put("mp4"); |
|||
recordingFileConfig.put("avFileType",avFileType); |
|||
|
|||
JSONObject storageConfig = new JSONObject(); |
|||
org.json.JSONArray fileNamePrefix = new org.json.JSONArray(); |
|||
fileNamePrefix.put(rdirectory); |
|||
fileNamePrefix.put(sdirectory); |
|||
storageConfig.put("vendor",2); |
|||
storageConfig.put("region",6); |
|||
storageConfig.put("bucket","ydlqcs"); |
|||
storageConfig.put("accessKey","LTAImVN6wtEJLfH1"); |
|||
storageConfig.put("secretKey","lO7FsV3pxSaP6lcd8KP9SsfBIeFhPw"); |
|||
storageConfig.put("fileNamePrefix",fileNamePrefix); |
|||
|
|||
JSONObject clientRequest = new JSONObject(); |
|||
//clientRequest.put("token","");
|
|||
clientRequest.put("extensionServiceConfig",extensionServiceConfig); |
|||
clientRequest.put("recordingFileConfig",recordingFileConfig); |
|||
clientRequest.put("storageConfig",storageConfig); |
|||
|
|||
JSONObject params = new JSONObject(); |
|||
params.put("cname",cname); |
|||
params.put("uid","16555"); |
|||
params.put("clientRequest",clientRequest); |
|||
System.out.println("======格式======>" + params); |
|||
|
|||
HttpsURLConnection conn= (HttpsURLConnection) postUrl.openConnection(); |
|||
conn.setConnectTimeout(5000); |
|||
conn.setRequestMethod("POST"); |
|||
conn.setRequestProperty("Content-Type", "application/json;charset=utf-8"); |
|||
conn.addRequestProperty("Authorization", "Basic M2Q5NzY0NzYyNTEwNGNmODg0YjAyM2Q0MWU1NzYzNDQ6MzFjZGFhNWU4Njk0NDJlYzg0YWZmMGI0NTM1NGE5NTA="); |
|||
conn.setDoOutput(true); |
|||
conn.getOutputStream().write(params.toString().getBytes()); |
|||
conn.getOutputStream().close(); |
|||
String result =""; |
|||
try{ |
|||
result = ConnUtil.getResponseString(conn); |
|||
}catch (Exception e){ |
|||
String s= e.toString(); |
|||
map.put("error", s); |
|||
return map; |
|||
} |
|||
//获取成功录制后得SID
|
|||
JSONObject jsonObject = new JSONObject(result); |
|||
System.out.println(jsonObject); |
|||
String bsid = jsonObject.getString("sid"); |
|||
map.put("sid", bsid); |
|||
map.put("resourceid", resourceId); |
|||
return map; |
|||
} |
|||
/* |
|||
* private String Toeknid(String cname,String appid,String uid) throws |
|||
* Exception, Exception{ String appCertificate |
|||
* ="c2809b8ba09e431e84097d60b4406e0a"; int tokenExpirationInSeconds = 3600; int |
|||
* privilegeExpirationInSeconds = 3600; RtcTokenBuilder2 token = new |
|||
* RtcTokenBuilder2(); String result = token.buildTokenWithUserAccount(appid, |
|||
* appCertificate, cname, uid, Role.ROLE_PUBLISHER, tokenExpirationInSeconds, |
|||
* privilegeExpirationInSeconds); System.out.printf("Token with uid: %s\n", |
|||
* result); return uid; |
|||
* |
|||
* } |
|||
*/ |
|||
|
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import com.imurs.entity.AiQcVocabulary; |
|||
import com.imurs.service.AiQcVocabularyService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* AI 质控词库管理接口 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/ai/vocab") |
|||
public class AiQcController { |
|||
|
|||
@Autowired |
|||
private AiQcVocabularyService aiQcVocabularyService; |
|||
|
|||
/** |
|||
* 专家提交纠错建议 |
|||
*/ |
|||
@PostMapping("/suggest") |
|||
public Map<String, Object> suggestVocab(@RequestBody AiQcVocabulary vocab) { |
|||
Map<String, Object> res = new HashMap<>(); |
|||
try { |
|||
// 设置初始状态为待审核
|
|||
vocab.setStatus("draft"); |
|||
vocab.setFrequency(1); |
|||
if (vocab.getVocabType() == null) |
|||
vocab.setVocabType("L3"); |
|||
|
|||
boolean success = aiQcVocabularyService.insert(vocab); |
|||
if (success) { |
|||
res.put("msg", 1); |
|||
res.put("data", "提交成功,感谢您的反馈!"); |
|||
} else { |
|||
res.put("msg", 0); |
|||
res.put("data", "提交失败"); |
|||
} |
|||
} catch (Exception e) { |
|||
res.put("msg", 0); |
|||
res.put("data", "服务器错误: " + e.getMessage()); |
|||
} |
|||
return res; |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.io.InputStream; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import com.imurs.ocr.Sample; |
|||
|
|||
@RestController |
|||
@RequestMapping(value="aocr") |
|||
public class Aliocr { |
|||
@RequestMapping(value = "/aliocr") |
|||
public String saveImage(MultipartFile filelSavePath) throws Exception { |
|||
InputStream is =filelSavePath.getInputStream(); |
|||
String s =Sample.aliocr(is); |
|||
return s; |
|||
} |
|||
@RequestMapping(value = "/bocr") |
|||
public Map<String, String> bImage(MultipartFile filelSavePath) throws Exception { |
|||
InputStream is =filelSavePath.getInputStream(); |
|||
Map<String, String> s =Sample.BaiduOcrRecognition("1"); |
|||
return s; |
|||
} |
|||
} |
|||
@ -0,0 +1,757 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.mapper.Wrapper; |
|||
import com.imurs.controller.ApplyBModeController; |
|||
import com.imurs.dto.SpecialistSubmitDto; |
|||
import com.imurs.entity.ApplyBMode; |
|||
import com.imurs.entity.ApplyBModeImg; |
|||
import com.imurs.entity.ApplyBModeSpecialist; |
|||
import com.imurs.entity.Patient; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyBModeImgService; |
|||
import com.imurs.service.ApplyBModeService; |
|||
import com.imurs.service.ApplyBModeSpecialistService; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.BModeReportService; |
|||
import com.imurs.service.PatientService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.service.impl.ApplyBModeServiceImpl; |
|||
import com.imurs.service.impl.BmodeMachineModelServiceImpl; |
|||
import com.imurs.util.DateUtils; |
|||
import com.imurs.util.page.Pagetion; |
|||
|
|||
import io.netty.util.internal.StringUtil; |
|||
|
|||
import java.sql.Timestamp; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import javax.servlet.http.HttpSession; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@Controller |
|||
@RestController |
|||
@RequestMapping({ "bmode" }) |
|||
public class ApplyBModeController { |
|||
@Autowired |
|||
ApplyBModeService applyBModeService; |
|||
|
|||
@Autowired |
|||
ApplyBModeServiceImpl applyBModeServiceImpl; |
|||
|
|||
@Autowired |
|||
PatientService patientService; |
|||
|
|||
@Autowired |
|||
ApplyBModeImgService applyBModeImgService; |
|||
|
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
|
|||
@Autowired |
|||
ApplyBModeSpecialistService applyBModeSpecialistService; |
|||
|
|||
@Autowired |
|||
UserService userService; |
|||
|
|||
@Autowired |
|||
BmodeMachineModelServiceImpl bmodeMachineModelServiceImpl; |
|||
@Autowired |
|||
BModeReportService bModeReportService; |
|||
|
|||
@Transactional |
|||
@RequestMapping({ "insertBmodeImg" }) |
|||
public Map<String, Object> insertBmodeImg(@RequestBody List<ApplyBModeImg> abmiList) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
try { |
|||
if (!abmiList.isEmpty()) { |
|||
boolean result = this.applyBModeImgService.insertBatch(abmiList); |
|||
map.put("msg", result ? "1" : "2"); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@Transactional |
|||
@RequestMapping({ "insertBmodeold" }) |
|||
public Map<String, Object> insertBmodeold(@RequestBody List<ApplyBMode> abmList) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
EntityWrapper<Patient> wrapper = new EntityWrapper(); |
|||
EntityWrapper<Patient> wrapper2 = new EntityWrapper(); |
|||
String ptEsrdNumber = ""; |
|||
try { |
|||
if (!abmList.isEmpty() && abmList.get(0) != null) { |
|||
Date date = new Date(); |
|||
Wrapper<ApplyBMode> bModeWrapper = (new EntityWrapper()) |
|||
.eq("category_hospital_id", ((ApplyBMode) abmList.get(0)).getCategoryHospitalId()).and() |
|||
.ge("group_date", DateUtils.formatDateTime(DateUtils.getDateStart(date))).and() |
|||
.le("group_date", DateUtils.formatDateTime(DateUtils.getDateEnd(date))); |
|||
Integer size = Integer.valueOf(this.applyBModeService.selectCount(bModeWrapper)); |
|||
Integer abmNo = Integer.valueOf(size.intValue() + 1); |
|||
ApplyBMode abm = abmList.get(0); |
|||
abm.setBtype(DateUtils.format(date, "yyyyMMdd") + "0" + abmNo); |
|||
// abm.setGroupDate(new Timestamp(date.getTime()));
|
|||
boolean result = this.applyBModeService.insert(abmList.get(0)); |
|||
if (result == true) { |
|||
map.put("id", ((ApplyBMode) abmList.get(0)).getId()); |
|||
map.put("msg", "1"); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode) abmList.get(0)).getHisEsrdNumber())) { |
|||
wrapper.eq("his_esrd_number", ((ApplyBMode) abmList.get(0)).getHisEsrdNumber()); |
|||
wrapper2.eq("his_esrd_number", ((ApplyBMode) abmList.get(0)).getHisEsrdNumber()); |
|||
} else { |
|||
wrapper.eq("out_patien", ((ApplyBMode) abmList.get(0)).getOutPatien()); |
|||
wrapper2.eq("out_patien", ((ApplyBMode) abmList.get(0)).getOutPatien()); |
|||
} |
|||
wrapper.eq("hospital_id", ((ApplyBMode) abmList.get(0)).getCategoryHospitalId()); |
|||
Patient patient2 = (Patient) this.patientService.selectOne((Wrapper) wrapper); |
|||
wrapper2.eq("hospital_id", ((ApplyBMode) abmList.get(0)).getGroupHospitalId()); |
|||
Patient patient3 = (Patient) this.patientService.selectOne((Wrapper) wrapper2); |
|||
if (patient2 == null || patient3 == null) { |
|||
Patient patient = new Patient(); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode) abmList.get(0)).getPtCard())) |
|||
patient.setCard(((ApplyBMode) abmList.get(0)).getPtCard()); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode) abmList.get(0)).getSex())) |
|||
patient.setSex(((ApplyBMode) abmList.get(0)).getSex()); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode) abmList.get(0)).getPatientName())) |
|||
patient.setPatientName(((ApplyBMode) abmList.get(0)).getPatientName()); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode) abmList.get(0)).getPtCity())) |
|||
patient.setFamily(((ApplyBMode) abmList.get(0)).getPtCity()); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode) abmList.get(0)).getPtPhone())) |
|||
patient.setPhone(((ApplyBMode) abmList.get(0)).getPtPhone()); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode) abmList.get(0)).getHisEsrdNumber())) |
|||
patient.setHisEsrdNumber(((ApplyBMode) abmList.get(0)).getHisEsrdNumber()); |
|||
if (StringUtils.isNotEmpty(((ApplyBMode) abmList.get(0)).getOutPatien())) |
|||
patient.setOutPatien(((ApplyBMode) abmList.get(0)).getOutPatien()); |
|||
if (patient2 == null) { |
|||
patient.setHospitalId(((ApplyBMode) abmList.get(0)).getCategoryHospitalId()); |
|||
result = this.patientService.insert(patient); |
|||
if (result == true) { |
|||
ptEsrdNumber = "yd03" + patient.getId(); |
|||
patient.setEsrdNumber(ptEsrdNumber); |
|||
this.patientService.updateById(patient); |
|||
} |
|||
} |
|||
if (patient3 == null) { |
|||
patient.setHospitalId(((ApplyBMode) abmList.get(0)).getGroupHospitalId()); |
|||
result = this.patientService.insert(patient); |
|||
if (result == true) { |
|||
ptEsrdNumber = StringUtils.isNotEmpty(ptEsrdNumber) ? ptEsrdNumber : ("yd03" + patient.getId()); |
|||
patient.setEsrdNumber(ptEsrdNumber); |
|||
this.patientService.updateById(patient); |
|||
} |
|||
} |
|||
} else { |
|||
ptEsrdNumber = patient2.getEsrdNumber(); |
|||
} |
|||
Long id = ((ApplyBMode) abmList.get(0)).getId(); |
|||
((ApplyBMode) abmList.get(0)).setEsrdNumber(ptEsrdNumber); |
|||
this.applyBModeService.updateById(abmList.get(0)); |
|||
ApplyBMode applyBMode = abmList.get(0); |
|||
List<ApplyBModeImg> ImgList = applyBMode.getAbmList(); |
|||
if (!ImgList.isEmpty()) { |
|||
for (int i = 0; i < ImgList.size(); i++) |
|||
((ApplyBModeImg) ImgList.get(i)).setbId(id); |
|||
this.applyBModeImgService.insertBatch(ImgList); |
|||
} |
|||
} else { |
|||
map.put("msg", "2"); |
|||
} |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
@RequestMapping({ "insertBmode" }) |
|||
public Map<String, Object> insertBmode(@RequestBody List<ApplyBMode> abmList) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
|
|||
try { |
|||
if (abmList == null || abmList.isEmpty() || abmList.get(0) == null) { |
|||
map.put("msg", "3"); |
|||
return map; |
|||
} |
|||
|
|||
Date date = new Date(); |
|||
Wrapper<ApplyBMode> bModeWrapper = (new EntityWrapper()) |
|||
.eq("category_hospital_id", ((ApplyBMode) abmList.get(0)).getCategoryHospitalId()).and() |
|||
.ge("group_date", DateUtils.formatDateTime(DateUtils.getDateStart(date))).and() |
|||
.le("group_date", DateUtils.formatDateTime(DateUtils.getDateEnd(date))); |
|||
Integer size = Integer.valueOf(this.applyBModeService.selectCount(bModeWrapper)); |
|||
Integer abmNo = Integer.valueOf(size.intValue() + 1); |
|||
ApplyBMode abm = abmList.get(0); |
|||
// New ID Generation Logic: Hex(CRC32(4)) + yyyyMMddHHmmss + Seq(2)
|
|||
String categoryHospitalId = abm.getCategoryHospitalId(); |
|||
java.util.zip.CRC32 crc32 = new java.util.zip.CRC32(); |
|||
crc32.update(categoryHospitalId.getBytes()); |
|||
String hexCrc = Long.toHexString(crc32.getValue()).toUpperCase(); |
|||
// Ensure CRC is exactly 4 characters
|
|||
if (hexCrc.length() > 4) { |
|||
hexCrc = hexCrc.substring(0, 4); |
|||
} else { |
|||
hexCrc = String.format("%-4s", hexCrc).replace(' ', '0'); |
|||
} |
|||
|
|||
String dateStr = DateUtils.format(date, "yyyyMMddHHmmss"); |
|||
String sequence = String.format("%02d", abmNo % 100); // 2-digit sequence
|
|||
|
|||
String eid = hexCrc + dateStr + sequence; |
|||
abm.setEsrdNumber(eid); |
|||
// 如果医生填了就用医生的,如果没填就用系统生成的
|
|||
if (StringUtils.isEmpty(abm.getBtype())) { |
|||
abm.setBtype(eid); // 只有在前端没传值(为空)的时候,才把系统生成的号给它
|
|||
} |
|||
boolean result = this.applyBModeService.insert(abmList.get(0)); |
|||
if (!result) { |
|||
throw new RuntimeException("主表插入失败"); // 触发回滚
|
|||
} |
|||
|
|||
map.put("id", ((ApplyBMode) abmList.get(0)).getId()); |
|||
|
|||
Long id = ((ApplyBMode) abmList.get(0)).getId(); |
|||
|
|||
this.applyBModeService.updateById(abmList.get(0)); |
|||
ApplyBMode applyBMode = abmList.get(0); |
|||
List<ApplyBModeImg> ImgList = applyBMode.getAbmList(); |
|||
if (!ImgList.isEmpty()) { |
|||
for (int i = 0; i < ImgList.size(); i++) { |
|||
((ApplyBModeImg) ImgList.get(i)).setbId(id); |
|||
// ImgList.forEach(img -> img.setbId(abm.getId()));
|
|||
|
|||
} |
|||
boolean iresult = this.applyBModeImgService.insertBatch(ImgList); |
|||
if (!iresult) { |
|||
throw new RuntimeException("图像表插入失败"); // 触发回滚
|
|||
} |
|||
|
|||
} |
|||
map.put("msg", "1"); |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({ "updateBmode" }) |
|||
public Map<String, Object> updateBmode(@RequestBody List<ApplyBMode> acList) { |
|||
ApplyBMode applyBMode = acList.get(0); |
|||
Map<String, Object> map = new HashMap<>(8); |
|||
boolean result = false; |
|||
try { |
|||
if (applyBMode != null) |
|||
result = this.applyBModeService.updateBmodeById(applyBMode); |
|||
map.put("msg", result ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({ "updateBmodeImg" }) |
|||
public Map<String, Object> updateBmodeImg(@RequestBody List<ApplyBMode> acList) { |
|||
ApplyBMode applyBMode = acList.get(0); |
|||
Map<String, Object> map = new HashMap<>(); |
|||
try { |
|||
EntityWrapper<ApplyBModeImg> wrapper = new EntityWrapper(); |
|||
wrapper.eq("b_id", applyBMode.getId()); |
|||
List<ApplyBModeImg> idList = this.applyBModeImgService.selectList((Wrapper) wrapper); |
|||
List<ApplyBModeImg> abmList = applyBMode.getAbmList(); |
|||
if (!idList.isEmpty()) { |
|||
if (!abmList.isEmpty()) { |
|||
for (ApplyBModeImg applyBModeImg : idList) { |
|||
if (applyBModeImg.getType().intValue() != 32) |
|||
this.applyBModeImgService.deleteById(applyBModeImg.getId()); |
|||
} |
|||
for (int i = 0; i < abmList.size(); i++) { |
|||
ApplyBModeImg applyBModeImg = abmList.get(i); |
|||
applyBModeImg.setbId(applyBMode.getId()); |
|||
this.applyBModeImgService.insert(applyBModeImg); |
|||
} |
|||
} else { |
|||
for (ApplyBModeImg applyBModeImg : idList) { |
|||
if (applyBModeImg.getType().intValue() != 32) |
|||
this.applyBModeImgService.deleteById(applyBModeImg.getId()); |
|||
} |
|||
} |
|||
} else if (!abmList.isEmpty()) { |
|||
for (int i = 0; i < abmList.size(); i++) { |
|||
ApplyBModeImg applyBModeImg = abmList.get(i); |
|||
applyBModeImg.setbId(applyBMode.getId()); |
|||
this.applyBModeImgService.insert(applyBModeImg); |
|||
} |
|||
} |
|||
boolean result = this.applyBModeService.updateById(applyBMode); |
|||
map.put("msg", (result == true) ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@Transactional |
|||
@RequestMapping({ "deleteBmodeById" }) |
|||
public Map<String, Object> deleteBmodeById(Long id) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
try { |
|||
boolean result = this.applyBModeService.deleteById(id); |
|||
if (result == true) { |
|||
map.put("b_id", id); |
|||
this.applyBModeImgService.deleteByMap(map); |
|||
bModeReportService.deleteByMap(map); |
|||
applyBModeSpecialistService.deleteByMap(map); |
|||
map.clear(); |
|||
map.put("msg", "1"); |
|||
} else { |
|||
map.put("msg", "2"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({ "selectBmodeByIdnew" }) |
|||
public Map<String, Object> selectBmodeByIdnew(Long id, HttpSession session) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
String account = ""; |
|||
String phone = ""; |
|||
ApplyBMode applyBMode = new ApplyBMode(); |
|||
List<ApplyBModeImg> abmList = new ArrayList<>(); |
|||
List<ApplyBModeSpecialist> abmSp = new ArrayList<>(); |
|||
EntityWrapper<ApplyBModeImg> wrapper = new EntityWrapper(); |
|||
EntityWrapper<ApplyBModeSpecialist> wrapper2 = new EntityWrapper(); |
|||
try { |
|||
applyBMode = (ApplyBMode) this.applyBModeService.selectById(id); |
|||
if (applyBMode != null) { |
|||
map.put("patientType", applyBMode.getPatientType()); |
|||
User user = (User) this.userService.selectById(applyBMode.getDocId()); |
|||
if (user != null) |
|||
account = user.getPhone(); |
|||
wrapper2.eq("b_id", id); |
|||
abmSp = this.applyBModeSpecialistService.selectList((Wrapper) wrapper2); |
|||
map.put("b_id", id); |
|||
wrapper.eq("b_id", id); |
|||
abmList = this.applyBModeImgService.selectList((Wrapper) wrapper); |
|||
if (!abmSp.isEmpty() && abmSp.get(0) != null) { |
|||
applyBMode.setSpecialist(((ApplyBModeSpecialist) abmSp.get(0)).getSpeName()); |
|||
applyBMode.setSpecialistId(((ApplyBModeSpecialist) abmSp.get(0)).getSpeId()); |
|||
Long speId = ((ApplyBModeSpecialist) abmSp.get(0)).getSpeId(); |
|||
// 医生删了 那user 就为null 2025 0211
|
|||
User selectById = (User) this.userService.selectById(speId); |
|||
if (selectById != null) |
|||
phone = selectById.getPhone(); |
|||
} |
|||
} |
|||
map.put("abmSp", abmSp); |
|||
map.put("applyBMode", applyBMode); |
|||
map.put("abmList", abmList); |
|||
map.put("contactPhone", account); |
|||
map.put("phone", phone); |
|||
// 锁定的机制,查询的时候 保存,而且只有状态status为40的
|
|||
String status = applyBMode.getStatus(); |
|||
if (status.equals("40")) { |
|||
System.out.println("状态为" + status); |
|||
String name = (String) session.getAttribute("name"); |
|||
// System.out.println("用户"+usr);
|
|||
EntityWrapper<User> wrapperu = new EntityWrapper(); |
|||
User u = userService.selectOne(wrapperu); |
|||
long rid = u.getRid(); |
|||
if (rid == 6) {// 如果是专家操作,就保存对应的操作者医生名字。
|
|||
ApplyBMode applyBMode2 = new ApplyBMode(); |
|||
applyBMode2.setLoginDoc(name); |
|||
// System.out.println("数据为"+applyBMode2.getLoginDoc());
|
|||
EntityWrapper<ApplyBMode> wrapper4 = new EntityWrapper(); |
|||
wrapper4.eq("id", id); |
|||
if (applyBMode2.getLoginDoc() != null) { |
|||
boolean issucess = applyBModeService.update(applyBMode2, wrapper4); |
|||
} |
|||
|
|||
} |
|||
// System.out.println("更新是否成功"+issucess);
|
|||
|
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({ "selectBmodeById" }) |
|||
public Map<String, Object> selectBmodeById(Long id) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
String account = ""; |
|||
String phone = ""; |
|||
ApplyBMode applyBMode = new ApplyBMode(); |
|||
List<ApplyBModeImg> abmList = new ArrayList<>(); |
|||
List<ApplyBModeSpecialist> abmSp = new ArrayList<>(); |
|||
EntityWrapper<ApplyBModeImg> wrapper = new EntityWrapper(); |
|||
EntityWrapper<ApplyBModeSpecialist> wrapper2 = new EntityWrapper(); |
|||
try { |
|||
applyBMode = (ApplyBMode) this.applyBModeService.selectById(id); |
|||
if (applyBMode != null) { |
|||
map.put("patientType", applyBMode.getPatientType()); |
|||
User user = (User) this.userService.selectById(applyBMode.getDocId()); |
|||
if (user != null) |
|||
account = user.getPhone(); |
|||
wrapper2.eq("b_id", id); |
|||
abmSp = this.applyBModeSpecialistService.selectList((Wrapper) wrapper2); |
|||
map.put("b_id", id); |
|||
wrapper.eq("b_id", id); |
|||
abmList = this.applyBModeImgService.selectList((Wrapper) wrapper); |
|||
if (!abmSp.isEmpty() && abmSp.get(0) != null) { |
|||
applyBMode.setSpecialist(((ApplyBModeSpecialist) abmSp.get(0)).getSpeName()); |
|||
applyBMode.setSpecialistId(((ApplyBModeSpecialist) abmSp.get(0)).getSpeId()); |
|||
Long speId = ((ApplyBModeSpecialist) abmSp.get(0)).getSpeId(); |
|||
User selectById = (User) this.userService.selectById(speId); |
|||
if (selectById != null) |
|||
phone = selectById.getPhone(); |
|||
|
|||
// phone = selectById.getPhone();
|
|||
} |
|||
} |
|||
map.put("abmSp", abmSp); |
|||
map.put("applyBMode", applyBMode); |
|||
map.put("abmList", abmList); |
|||
map.put("contactPhone", account); |
|||
map.put("phone", phone); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({ "selectBmodePage" }) |
|||
public Map<String, Object> selectBmodePage(String categoryHospitalId, String groupHospitalId, |
|||
String startTime, String endTime, |
|||
String patientName, Integer pageNo, Integer pageSize, |
|||
String conditions, Integer type, String part, Long docId, Integer cureType, |
|||
String diagnosisType, String status, String isRemote, |
|||
String groupAlias, Long active) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
map.put("categoryHospitalId", categoryHospitalId); |
|||
map.put("groupHospitalId", groupHospitalId); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("patientName", patientName); |
|||
map.put("type", type); |
|||
map.put("part", part); |
|||
map.put("docId", docId); |
|||
map.put("isRemote", isRemote); |
|||
map.put("diagnosisType", diagnosisType); |
|||
map.put("cureType", Integer.valueOf((cureType == null) ? 1 : cureType.intValue())); |
|||
map.put("status", status); |
|||
map.put("groupAlias", groupAlias); |
|||
map.put("active", active); |
|||
if (!StringUtil.isNullOrEmpty(conditions)) { |
|||
map.put("conditions", Arrays.asList(conditions.split(","))); |
|||
} |
|||
|
|||
pageNo = Integer.valueOf((pageNo == null) ? 1 : pageNo.intValue()); |
|||
pageSize = Integer.valueOf((pageSize == null) ? 10 : pageSize.intValue()); |
|||
try { |
|||
Pagetion<ApplyBMode> pagetion = this.applyBModeService.selectBmodePage(map, pageNo, pageSize); |
|||
map.clear(); |
|||
if (pagetion != null) |
|||
for (int i = 0; i < pagetion.getList().size(); i++) { |
|||
EntityWrapper<ApplyBModeSpecialist> wrapper = new EntityWrapper(); |
|||
wrapper.eq("b_id", ((ApplyBMode) pagetion.getList().get(i)).getId()).ne("state", "80"); |
|||
List<ApplyBModeSpecialist> abmSp = this.applyBModeSpecialistService.selectList((Wrapper) wrapper); |
|||
if (!abmSp.isEmpty()) |
|||
((ApplyBMode) pagetion.getList().get(i)).setAbmSp(abmSp); |
|||
} |
|||
map.put("pagetion", pagetion); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} finally { |
|||
map.remove("categoryHospitalId"); |
|||
map.remove("groupHospitalId"); |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("patientName"); |
|||
map.remove("type"); |
|||
map.remove("part"); |
|||
map.remove("docId"); |
|||
map.remove("cureType"); |
|||
map.remove("status"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({ "insertBModeSpecialist" }) |
|||
public Map<String, Object> insertBModeSpecialist(@RequestBody List<ApplyBModeSpecialist> acList) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
boolean insert = false; |
|||
try { |
|||
Long bId = ((ApplyBModeSpecialist) acList.get(0)).getbId(); |
|||
EntityWrapper<ApplyBMode> bModeWrapper = new EntityWrapper(); |
|||
bModeWrapper.eq("id", bId); |
|||
ApplyBMode bMode = (ApplyBMode) this.applyBModeService.selectOne((Wrapper) bModeWrapper); |
|||
for (ApplyBModeSpecialist applyBModeSpecialist : acList) { |
|||
EntityWrapper<ApplyBModeSpecialist> wrapper = new EntityWrapper(); |
|||
if (applyBModeSpecialist.getbId() != null && applyBModeSpecialist.getSpeId() != null) { |
|||
wrapper.eq("b_id", applyBModeSpecialist.getbId()) |
|||
.eq("spe_id", applyBModeSpecialist.getSpeId()); |
|||
ApplyBModeSpecialist queryApply = (ApplyBModeSpecialist) this.applyBModeSpecialistService |
|||
.selectOne((Wrapper) wrapper); |
|||
if (queryApply != null) { |
|||
applyBModeSpecialist.setId(queryApply.getId()); |
|||
applyBModeSpecialist.setGroupDate(bMode.getGroupDate()); |
|||
insert = this.applyBModeSpecialistService.updateById(applyBModeSpecialist); |
|||
} else { |
|||
applyBModeSpecialist.setGroupDate(bMode.getGroupDate()); |
|||
insert = this.applyBModeSpecialistService.insert(applyBModeSpecialist); |
|||
} |
|||
} |
|||
if (!insert) |
|||
break; |
|||
} |
|||
map.put("msg", insert ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({ "updateConSpecialist" }) |
|||
public Map<String, Object> updateConSpecialist(ApplyBModeSpecialist abmSp) { |
|||
ApplyBMode bmode = (ApplyBMode) this.applyBModeService.selectById(abmSp.getbId()); |
|||
Map<String, Object> map = new HashMap<>(); |
|||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|||
Date date = new Date(); |
|||
EntityWrapper<ApplyBModeSpecialist> wrapper = new EntityWrapper(); |
|||
String status = ""; |
|||
try { |
|||
if (abmSp != null) { |
|||
abmSp.setUpdateTime(dateFormat.parse(dateFormat.format(date))); |
|||
wrapper.eq("spe_id", abmSp.getSpeId()).eq("b_id", abmSp.getbId()); |
|||
boolean result = this.applyBModeSpecialistService.update(abmSp, (Wrapper) wrapper); |
|||
if (result == true) { |
|||
if ("1".equals(bmode.getConsultationWay())) { |
|||
status = abmSp.getState() + ""; |
|||
} else { |
|||
map.put("b_id", abmSp.getbId()); |
|||
List<ApplyBModeSpecialist> accList = this.applyBModeSpecialistService.selectByMap(map); |
|||
if (!accList.isEmpty()) { |
|||
Map<Integer, Long> collect = (Map<Integer, Long>) accList.stream() |
|||
.collect(Collectors.groupingBy(ApplyBModeSpecialist::getState, Collectors.counting())); |
|||
int sum30 = (collect.get(Integer.valueOf(30)) != null) |
|||
? ((Long) collect.get(Integer.valueOf(30))).intValue() |
|||
: 0; |
|||
int sum40 = (collect.get(Integer.valueOf(40)) != null) |
|||
? ((Long) collect.get(Integer.valueOf(40))).intValue() |
|||
: 0; |
|||
int sum80 = (collect.get(Integer.valueOf(80)) != null) |
|||
? ((Long) collect.get(Integer.valueOf(80))).intValue() |
|||
: 0; |
|||
if (sum40 != 0 && sum30 == 0 && sum80 == 0) { |
|||
status = "40"; |
|||
} else if (sum80 != 0 && sum40 == 0 && sum30 == 0) { |
|||
status = "20"; |
|||
} else { |
|||
status = "30"; |
|||
} |
|||
} |
|||
} |
|||
if (StringUtils.isNotEmpty(status)) { |
|||
ApplyBMode ab = new ApplyBMode(); |
|||
ab.setStatus(status); |
|||
ab.setId(abmSp.getbId()); |
|||
ab.setDismissReason(abmSp.getDismissReason()); |
|||
this.applyBModeService.updateById(ab); |
|||
} |
|||
map.put("msg", "1"); |
|||
} else { |
|||
map.put("msg", "2"); |
|||
} |
|||
} else { |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({ "selectBmodeSpePage" }) |
|||
public Map<String, Object> selectBmodeSpePage(Integer pageNo, String categoryHospitalId, String conditions, |
|||
Integer pageSize, String patientName, String startTime, String endTime, String specialistId, Integer cureType, |
|||
String diagnosisType, Integer part, Integer type, String status) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
pageNo = Integer.valueOf((pageNo == null) ? 1 : pageNo.intValue()); |
|||
pageSize = Integer.valueOf((pageSize == null) ? 10 : pageSize.intValue()); |
|||
map.put("patientName", patientName); |
|||
map.put("categoryHospitalId", categoryHospitalId); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("specialistId", specialistId); |
|||
map.put("cureType", Integer.valueOf((cureType == null) ? 1 : cureType.intValue())); |
|||
map.put("diagnosisType", diagnosisType); |
|||
map.put("part", part); |
|||
map.put("type", type); |
|||
map.put("status", status); |
|||
map.put("conditions", conditions); |
|||
try { |
|||
Pagetion<Map<String, Object>> pagetion = this.applyBModeService.selectBmodeSpePage(map, pageNo, pageSize); |
|||
if (pagetion != null) |
|||
for (int i = 0; i < pagetion.getList().size(); i++) { |
|||
EntityWrapper<ApplyBModeSpecialist> wrapper = new EntityWrapper(); |
|||
wrapper.eq("b_id", ((Map) pagetion.getList().get(i)).get("id")); |
|||
List<ApplyBModeSpecialist> applyBModeSpecialists = this.applyBModeSpecialistService |
|||
.selectList((Wrapper) wrapper); |
|||
pagetion.getList().get(i).put("abmSp", applyBModeSpecialists); |
|||
} |
|||
map.put("pagetion", pagetion); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} finally { |
|||
map.remove("patientName"); |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("specialistId"); |
|||
map.remove("cureType"); |
|||
map.remove("part"); |
|||
map.remove("type"); |
|||
map.remove("status"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({ "selectMachineModel" }) |
|||
public Map<String, Object> selectMachineModel() { |
|||
Map<String, Object> map = this.bmodeMachineModelServiceImpl.selectMachineModel(); |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({ "DataStatistics" }) |
|||
public Map<String, Object> DataStatistics() { |
|||
Map<String, Object> dataStatistics = this.applyBModeServiceImpl.DataStatistics(); |
|||
return dataStatistics; |
|||
} |
|||
|
|||
@RequestMapping({ "categoryHospitalStatistics" }) |
|||
public Map<String, Object> categoryHospitalStatistics(String id, String startTime, String endTime) { |
|||
Map<String, Object> map = this.applyBModeService.categoryHospitalStatistics(id, startTime, endTime); |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({ "manageHospitalDataStatistics" }) |
|||
public Map<String, Object> dataStatisticsForHospital(String startTime, String endTime) { |
|||
Map<String, Object> map = this.applyBModeService.dataStatisticsForHospital(startTime, endTime); |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping({ "queuing" }) |
|||
public Map<String, Object> getQueuing(Long id) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
EntityWrapper<ApplyBMode> wrapper = new EntityWrapper(); |
|||
int people = 0; |
|||
int waitTime = 0; |
|||
int active = 1; |
|||
try { |
|||
wrapper.eq("status", "40").eq("active", Integer.valueOf(3)); |
|||
wrapper.orderBy("active", false); |
|||
List<ApplyBMode> applyBModes = this.applyBModeService.selectList((Wrapper) wrapper); |
|||
if (!applyBModes.isEmpty()) |
|||
for (int i = 0; i < applyBModes.size(); i++) { |
|||
ApplyBMode bMode = applyBModes.get(i); |
|||
if (bMode.getId().equals(id)) { |
|||
people = i; |
|||
waitTime = i * 15; |
|||
active = bMode.getActive().intValue(); |
|||
break; |
|||
} |
|||
} |
|||
map.put("msg", "1"); |
|||
map.put("people", Integer.valueOf(people)); |
|||
map.put("waitTime", Integer.valueOf(waitTime)); |
|||
map.put("active", Integer.valueOf(active)); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@Transactional(rollbackFor = { Exception.class }) |
|||
@RequestMapping({ "updateSpecialistBySubmit" }) |
|||
public Map<String, Object> updateSpecialistBySubmit(@RequestBody List<SpecialistSubmitDto> submitDtos) { |
|||
Map<String, Object> map = new HashMap<>(4); |
|||
SpecialistSubmitDto submitDto = submitDtos.get(0); |
|||
EntityWrapper<ApplyBModeSpecialist> speWrapper = new EntityWrapper(); |
|||
speWrapper.eq("spe_id", submitDto.getContactsId()); |
|||
speWrapper.eq("b_id", submitDto.getbId()); |
|||
try { |
|||
Long bId = null; |
|||
String type = null; |
|||
int successCount = 0; |
|||
ApplyBModeSpecialist bModeSpecialist = (ApplyBModeSpecialist) this.applyBModeSpecialistService |
|||
.selectOne((Wrapper) speWrapper); |
|||
if (bModeSpecialist != null) { |
|||
bId = bModeSpecialist.getbId(); |
|||
type = bModeSpecialist.getDiagnosisType(); |
|||
bModeSpecialist.setSpeId(submitDto.getUserId()); |
|||
bModeSpecialist.setSpeName(submitDto.getUserName()); |
|||
bModeSpecialist.setState(Integer.valueOf(70)); |
|||
boolean updateResult = this.applyBModeSpecialistService.updateById(bModeSpecialist); |
|||
if (updateResult) |
|||
successCount++; |
|||
} |
|||
if (submitDtos.size() > 1) |
|||
for (int i = 1; i < submitDtos.size(); i++) { |
|||
ApplyBModeSpecialist addSpecialist = new ApplyBModeSpecialist(); |
|||
addSpecialist.setSpeId(((SpecialistSubmitDto) submitDtos.get(i)).getUserId()); |
|||
addSpecialist.setSpeName(((SpecialistSubmitDto) submitDtos.get(i)).getUserName()); |
|||
addSpecialist.setState(Integer.valueOf(70)); |
|||
if (bId != null && type != null) { |
|||
addSpecialist.setbId(bId); |
|||
addSpecialist.setDiagnosisType(type); |
|||
} |
|||
boolean addResult = this.applyBModeSpecialistService.insert(addSpecialist); |
|||
if (addResult) |
|||
successCount++; |
|||
} |
|||
if (successCount == submitDtos.size()) |
|||
map.put("msg", "1"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,68 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.controller.ApplyBModeImageController; |
|||
import com.imurs.entity.ApplyBModeImg; |
|||
import com.imurs.service.ApplyBModeImgService; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequestMapping({"modeImage"}) |
|||
public class ApplyBModeImageController { |
|||
Logger logger = LoggerFactory.getLogger(ApplyBModeImageController.class); |
|||
|
|||
@Autowired |
|||
ApplyBModeImgService applyBModeImgService; |
|||
|
|||
@PostMapping({"insertBModeImage"}) |
|||
public Map<String, Object> insertBModeImage(@RequestBody ApplyBModeImg applyBModeImg) { |
|||
Map<String, Object> resultMap = new HashMap<>(8); |
|||
try { |
|||
this.applyBModeImgService.insert(applyBModeImg); |
|||
resultMap.put("msg", "1"); |
|||
resultMap.put("applyBModeImg", applyBModeImg); |
|||
} catch (Exception e) { |
|||
//this.logger.error(", e);
|
|||
resultMap.put("msg", "4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
@RequestMapping({"deleteBmodeById"}) |
|||
public Map<String, Object> deleteBmodeById(Long imageId) { |
|||
Map<String, Object> resultMap = new HashMap<>(8); |
|||
try { |
|||
this.applyBModeImgService.deleteById(imageId); |
|||
resultMap.put("msg", "1"); |
|||
} catch (Exception e) { |
|||
//this.logger.error(", e);
|
|||
resultMap.put("msg", "4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
@GetMapping({"selectBModeImageByBId"}) |
|||
public Map<String, Object> selectBModeImageByBId(Long bId) { |
|||
Map<String, Object> resultMap = new HashMap<>(8); |
|||
try { |
|||
List<ApplyBModeImg> bModeImgs = this.applyBModeImgService.selectList((new EntityWrapper()) |
|||
.eq("b_id", bId)); |
|||
resultMap.put("bModeImgs", bModeImgs); |
|||
resultMap.put("msg", "1"); |
|||
} catch (Exception e) { |
|||
//this.logger.error(", e);
|
|||
resultMap.put("msg", "4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
} |
|||
@ -0,0 +1,477 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.ApplyCase; |
|||
import com.imurs.entity.ApplyCaseImg; |
|||
import com.imurs.entity.Patient; |
|||
import com.imurs.service.ApplyCaseImgService; |
|||
import com.imurs.service.ApplyCaseService; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.PatientService; |
|||
import com.imurs.util.page.Pagetion; |
|||
|
|||
/** |
|||
* |
|||
* @author Server |
|||
* 就诊表 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("case") |
|||
public class ApplyCaseController { |
|||
|
|||
@Autowired |
|||
ApplyCaseService applyCaseService; |
|||
@Autowired |
|||
ApplyCaseImgService applyCaseImgService; |
|||
@Autowired |
|||
PatientService patientService; |
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
|
|||
/** |
|||
* 批量新增 |
|||
* @param acList |
|||
* @return |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("insertCase") |
|||
public Map<String,Object> insertCase(@RequestBody List<ApplyCase> acList){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<Patient> wrapper=new EntityWrapper<Patient>(); |
|||
EntityWrapper<Patient> wrapper2=new EntityWrapper<Patient>(); |
|||
String ptEsrdNumber=""; |
|||
try { |
|||
if(!acList.isEmpty() && acList.get(0)!=null){ |
|||
//双向转诊数据
|
|||
boolean result=applyCaseService.insert(acList.get(0)); |
|||
if(result==true){ |
|||
map.put("msg", "1"); |
|||
//第一次新增时患者表新增
|
|||
if(acList.get(0).getHisEsrdNumber()!=null){ |
|||
wrapper.eq("his_esrd_number", acList.get(0).getHisEsrdNumber()); |
|||
wrapper2.eq("his_esrd_number", acList.get(0).getHisEsrdNumber()); |
|||
}else{ |
|||
wrapper.eq("out_patien", acList.get(0).getOutPatien()); |
|||
wrapper2.eq("out_patien", acList.get(0).getOutPatien()); |
|||
} |
|||
wrapper.eq("hospital_id", acList.get(0).getHospitalId());; |
|||
Patient patient2=patientService.selectOne(wrapper); |
|||
|
|||
wrapper2.eq("hospital_id", acList.get(0).getPlanHospitalId()); |
|||
Patient patient3=patientService.selectOne(wrapper); |
|||
|
|||
|
|||
if(patient2==null || patient3==null){ |
|||
Patient patient=new Patient(); |
|||
if(StringUtils.isNotEmpty(acList.get(0).getPtSex())){ |
|||
patient.setSex(acList.get(0).getPtSex()); |
|||
} |
|||
if(StringUtils.isNotEmpty(acList.get(0).getPtCard())){ |
|||
patient.setCard(acList.get(0).getPtCard()); |
|||
//patient.setBirthDate(acList.get(0).getPtCard().substring(6, 14));
|
|||
} |
|||
if(StringUtils.isNotEmpty(acList.get(0).getPtName())){ |
|||
patient.setPatientName(acList.get(0).getPtName()); |
|||
} |
|||
if(StringUtils.isNotEmpty(acList.get(0).getPtCity())){ |
|||
patient.setFamily(acList.get(0).getPtCity()); |
|||
} |
|||
if(StringUtils.isNotEmpty(acList.get(0).getPtPhone())){ |
|||
patient.setPhone(acList.get(0).getPtPhone()); |
|||
} |
|||
if(StringUtils.isNotEmpty(acList.get(0).getHisEsrdNumber())){ |
|||
patient.setHisEsrdNumber(acList.get(0).getHisEsrdNumber()); |
|||
} |
|||
if(StringUtils.isNotEmpty(acList.get(0).getOutPatien())){ |
|||
patient.setOutPatien(acList.get(0).getOutPatien()); |
|||
} |
|||
|
|||
if(patient2==null){ |
|||
patient.setHospitalId(acList.get(0).getHospitalId()); |
|||
result=patientService.insert(patient); |
|||
if(result==true){ |
|||
//yd:公司简称 01:远程会诊新增 02:双休转诊新增
|
|||
ptEsrdNumber="yd02"+patient.getId(); |
|||
patient.setEsrdNumber(ptEsrdNumber); |
|||
patientService.updateById(patient); |
|||
} |
|||
|
|||
} |
|||
if(patient3==null){ |
|||
patient.setHospitalId(acList.get(0).getPlanHospitalId()); |
|||
result=patientService.insert(patient); |
|||
if(result==true){ |
|||
ptEsrdNumber=StringUtils.isNotEmpty(ptEsrdNumber)?ptEsrdNumber:"yd02"+patient.getId(); |
|||
patient.setEsrdNumber(ptEsrdNumber); |
|||
patientService.updateById(patient); |
|||
} |
|||
} |
|||
}else{ |
|||
ptEsrdNumber=patient2.getEsrdNumber(); |
|||
} |
|||
|
|||
Long id=acList.get(0).getId(); |
|||
acList.get(0).setEsrdNumber(ptEsrdNumber); |
|||
applyCaseService.updateById(acList.get(0)); |
|||
|
|||
if(!acList.get(0).getAciList().isEmpty()){ |
|||
for (int i = 0; i < acList.get(0).getAciList().size(); i++) { |
|||
acList.get(0).getAciList().get(i).setCaseId(id); |
|||
} |
|||
applyCaseImgService.insertBatch(acList.get(0).getAciList()); |
|||
} |
|||
}else{ |
|||
map.put("msg", "2"); |
|||
} |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 批量修改 |
|||
* @param acList |
|||
* @return |
|||
*/ |
|||
@RequestMapping("updateCase") |
|||
public Map<String,Object> updateCase(ApplyCase applyCase){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=applyCaseService.updateById(applyCase); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 发送HIS 系统数据 |
|||
* @param acList |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
/*@RequestMapping("SendHisdate") |
|||
public String SendHisdate(String id) throws Exception{ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
//msg==1 表示那个确定按钮提交了,
|
|||
if(!msg.equals("1")||!statu.equals("4")){ |
|||
// throw new Exception("双向转诊数据保存失败,或已经是已就诊或已住院状态无法发送信息给HIS");
|
|||
return "不是已接受状态或"; |
|||
} |
|||
//查询患者基本数据
|
|||
map.put("id", id); |
|||
|
|||
Map<String,Object> patientmap = applyCaseService.selectPatientById(map); |
|||
if(patientmap==null){ |
|||
return "数据库无此人信息"; |
|||
} |
|||
//取出数据保存在ID还是 数据表里暂时是限定statu=4
|
|||
String uniid =patientmap.get("id")+"";//唯一主健值
|
|||
String pt_name = patientmap.get("pt_name")+"";//姓名
|
|||
String pt_sex = patientmap.get("pt_sex")+"";//性别
|
|||
if(pt_sex.equals("男")){ |
|||
pt_sex="M"; |
|||
}else{ |
|||
pt_sex="F"; |
|||
} |
|||
String pt_card = patientmap.get("pt_card")+"";//身份证 不能为NULL值,由于前端已经做判断,所以不做判断
|
|||
String pt_city = patientmap.get("pt_city")+"";//家庭地址
|
|||
String pt_phone = patientmap.get("pt_phone")+"";//家庭电话
|
|||
String prote_type = patientmap.get("protect_type")+"";//医保类型
|
|||
//System.out.println(prote_type);
|
|||
String protect_type=""; |
|||
switch(prote_type){ |
|||
case "1": |
|||
protect_type="省医保"; |
|||
break; |
|||
case "2": |
|||
protect_type="市职工医保"; |
|||
break; |
|||
case "3": |
|||
protect_type="市居民医保"; |
|||
break; |
|||
case "4": |
|||
protect_type="新农合"; |
|||
break; |
|||
case "5": |
|||
protect_type="自费"; |
|||
break; |
|||
case "6": |
|||
protect_type="异地医保"; |
|||
break; |
|||
default: |
|||
protect_type="其他"; |
|||
break; |
|||
} |
|||
String hospital_name = patientmap.get("hospital_name")+"";//医院名字
|
|||
String plan_time = patientmap.get("plan_time")+"";//预约时间
|
|||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
|||
Date tim=simpleDateFormat.parse(plan_time); |
|||
String date =new SimpleDateFormat("yyyyMMdd").format(tim); |
|||
// System.out.println(date);
|
|||
String soap = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + |
|||
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:car=\"http://cardtest.com/\">\n" + |
|||
" <soapenv:Body>\n" + |
|||
" <car:DoInterconnectSave>\n" + |
|||
" <car:xml><![CDATA["+ |
|||
"<?xml version=\"1.0\" encoding=\"utf-8\"?><Request>"+ |
|||
"<IDCardNo>"+pt_name+"^"+pt_sex+"^"+pt_card+"^"+pt_city+"^"+pt_phone+"^"+protect_type+"^"+hospital_name+"^"+date+"^"+uniid+ |
|||
"</IDCardNo></Request>]]> </car:xml>\n"+ |
|||
" </car:DoInterconnectSave>\n" + |
|||
" </soapenv:Body>\n" + |
|||
"</soapenv:Envelope>"; |
|||
//地址
|
|||
String urlString = "http://220.168.26.57:1001/Service.asmx";//57
|
|||
// System.out.println(soap);
|
|||
//String urlString="";
|
|||
//方法
|
|||
String soapActionString = "http://cardtest.com/DoInterconnectSave"; |
|||
URL url = new URL(urlString); |
|||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection(); |
|||
|
|||
byte[] buf = soap.getBytes(); |
|||
// System.out.println(soap);
|
|||
//设置一些头参数
|
|||
httpConn.setRequestProperty("Content-Length", String.valueOf(buf.length)); |
|||
httpConn.setRequestProperty("Content-Type", "text/xml; charset=utf-8"); |
|||
httpConn.setRequestProperty("soapActionString", soapActionString); |
|||
httpConn.setRequestMethod("POST"); |
|||
//输入参数和输出结果
|
|||
|
|||
|
|||
OutputStream out=null; |
|||
try{ |
|||
httpConn.setConnectTimeout(30000); |
|||
httpConn.setReadTimeout(30000); |
|||
httpConn.setDoOutput(true); |
|||
httpConn.setDoInput(true); |
|||
out = httpConn.getOutputStream(); |
|||
out.write(buf); |
|||
out.close(); |
|||
}catch (Exception e){ |
|||
//System.out.println("连接不成功");
|
|||
DualReferral_His.sendErrorNotice("15602395710", pt_name+pt_card+"建立连接,不成功,数据未发送成功"); |
|||
} |
|||
|
|||
// int responseCode = httpConn.getResponseCode();
|
|||
|
|||
if(responseCode!=200){ |
|||
//说明网络异常需要重新请求
|
|||
//throw new Exception("msg");
|
|||
|
|||
return "4004";//网络异常,再次请求发送
|
|||
} |
|||
// new DualReferral_His();
|
|||
byte[] datas = DualReferral_His.readInputStream(httpConn.getInputStream()); |
|||
String result = new String(datas); |
|||
// System.out.println("result:" + result);
|
|||
//new DualReferral_His();
|
|||
//接受返回的数据并解析出
|
|||
String result2= DualReferral_His.strToHtml(result); |
|||
// System.out.println("解析后的结果"+result2);
|
|||
String[] ss= parxml2(result2); |
|||
System.out.println("ErrorMSg"+ss[0]+"Errorcode"+ss[1]); |
|||
if(ss[1].equals("1")){ |
|||
//信息保存失败,将患者ID。错误信息发送出去
|
|||
// sendNotice("15602395710",ss[0],ss[1]);
|
|||
DualReferral_His.sendErrorNotice("15602395710", pt_name+pt_card+ss[0]); |
|||
} |
|||
return ""; |
|||
} |
|||
|
|||
//解析XML格式
|
|||
public static String[] parxml2(String xml) throws JDOMException, IOException, DocumentException{ |
|||
String reg = "<\\?xml\\s+version=\"1.0\"\\s+encoding=\"(.*?)\"\\?>"; |
|||
String result = xml.replaceAll(reg,""); |
|||
SAXReader reader = new SAXReader(); |
|||
Document document = reader.read(new ByteArrayInputStream(result.getBytes())); |
|||
String[] paresu =new String[2]; |
|||
Element out = |
|||
document.getRootElement().element("Body").element("DoInterconnectSaveResponse").element("DoInterconnectSaveResult").element("Response"); |
|||
//取2个数据.element("ErrorMsg")
|
|||
Element out2 = out.element("ErrorMsg"); |
|||
Element out3 = out.element("ResultCode"); |
|||
paresu[0]=out2.getText(); |
|||
paresu[1]=out3.getText(); |
|||
System.out.println("return 解析ErrorMsg:"+out2.getText()); |
|||
System.out.println("return 解析ResultCode:"+out3.getText()); |
|||
return paresu; |
|||
|
|||
|
|||
|
|||
}*/ |
|||
|
|||
/** |
|||
* 删除 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("deleteCaseById") |
|||
public Map<String,Object> deleteCaseById(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=applyCaseService.deleteById(id); |
|||
if(result==true){ |
|||
map.put("case_id", id); |
|||
applyCaseImgService.deleteByMap(map); |
|||
map.clear(); |
|||
map.put("msg", "1"); |
|||
}else{ |
|||
map.put("msg", "2"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查询 |
|||
*/ |
|||
@RequestMapping("selectCaseById") |
|||
public Map<String,Object> selectCaseById(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
ApplyCase applyCase=new ApplyCase(); |
|||
List<ApplyCaseImg> imgList=new ArrayList<ApplyCaseImg>(); |
|||
try { |
|||
applyCase=applyCaseService.selectCaseById(id); |
|||
if(applyCase!=null){ |
|||
map.put("case_id", id); |
|||
imgList=applyCaseImgService.selectByMap(map); |
|||
} |
|||
map.put("applyCase", applyCase); |
|||
map.put("imgList", imgList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("case_id"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 管理医院转诊列表 |
|||
* 基层转出,管理转出 |
|||
*/ |
|||
@RequestMapping("selectCasePage") |
|||
public Map<String,Object> selectCasePage(String planHospitalId,String type,String ptName, |
|||
String startTime,String endTime,Integer pageNo,Integer pageSize,String hospitalId,Long applyUserId, |
|||
Long docUserId,Integer state){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
map.put("planHospitalId", planHospitalId); |
|||
map.put("type", type); |
|||
map.put("ptName", ptName); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("hospitalId", hospitalId); |
|||
map.put("applyUserId", applyUserId); |
|||
map.put("docUserId", docUserId); |
|||
map.put("state", state); |
|||
pageNo=pageNo==null?1:pageNo; |
|||
pageSize=pageSize==null?10:pageSize; |
|||
try { |
|||
Pagetion<ApplyCase> list=applyCaseService.selectCasePage(map, pageNo, pageSize); |
|||
map.put("list", list); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("planHospitalId"); |
|||
map.remove("type"); |
|||
map.remove("ptName"); |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("hospitalId"); |
|||
map.remove("applyUserId"); |
|||
map.remove("docUserId"); |
|||
map.remove("state"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 管理医院转诊列表 |
|||
* 管理转入 |
|||
*/ |
|||
@RequestMapping("selectAdminCasePage") |
|||
public Map<String,Object> selectAdminCasePage(String planHospitalId,String type,String ptName, |
|||
String startTime,String endTime,Integer pageNo,Integer pageSize,String hospitalId, |
|||
Long applyUserId,Long docUserId,Integer state,String ptCard,String hisId,String esrdNumber){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
map.put("planHospitalId", planHospitalId); |
|||
map.put("type", type); |
|||
map.put("ptName", ptName); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("hospitalId", hospitalId); |
|||
map.put("applyUserId", applyUserId); |
|||
map.put("docUserId", docUserId); |
|||
map.put("state", state); |
|||
map.put("hisId", hisId); |
|||
map.put("ptCard", ptCard); |
|||
map.put("esrdNumber", esrdNumber); |
|||
pageNo=pageNo==null?1:pageNo; |
|||
pageSize=pageSize==null?10:pageSize; |
|||
try { |
|||
Pagetion<ApplyCase> list=applyCaseService.selectAdminCasePage(map, pageNo, pageSize); |
|||
map.put("list", list); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("planHospitalId"); |
|||
map.remove("type"); |
|||
map.remove("ptName"); |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("hospitalId"); |
|||
map.remove("applyUserId"); |
|||
map.remove("docUserId"); |
|||
map.remove("state"); |
|||
map.remove("hisId"); |
|||
map.remove("ptCard"); |
|||
map.remove("esrdNumber"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 根据身份证号码查看患者信息 |
|||
* ORDER BY FIELD(c.statu,1,2,3,4,5,6,7,8,9),c.plan_time DESC |
|||
*/ |
|||
@RequestMapping("selectCaseByCard") |
|||
public Map<String,Object> selectCaseByCard(String card){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
List<ApplyCase> acList=new ArrayList<ApplyCase>(); |
|||
EntityWrapper<ApplyCase> wrapper=new EntityWrapper<ApplyCase>(); |
|||
wrapper.eq("pt_card", card).orderBy("plan_time",false); |
|||
try { |
|||
acList=applyCaseService.selectList(wrapper); |
|||
map.put("acList", acList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,703 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.ApplyConsulationSpecialist; |
|||
import com.imurs.entity.ApplyConsultation; |
|||
import com.imurs.entity.ApplyConsultationImg; |
|||
import com.imurs.entity.ApplyPathologyFile; |
|||
import com.imurs.entity.Patient; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyConsulationSpecialistService; |
|||
import com.imurs.service.ApplyConsultationImgService; |
|||
import com.imurs.service.ApplyConsultationService; |
|||
import com.imurs.service.ApplyLisService; |
|||
import com.imurs.service.ApplyPathologyFileService; |
|||
import com.imurs.service.ApplyPathologyImgService; |
|||
import com.imurs.service.ApplyPathologyService; |
|||
import com.imurs.service.PatientService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
import com.imurs.util.page.Pagetion; |
|||
|
|||
@RestController |
|||
@RequestMapping(value = "con") |
|||
public class ApplyConsultationController { |
|||
|
|||
@Autowired |
|||
ApplyConsultationService applyConsultationService; |
|||
@Autowired |
|||
ApplyConsultationImgService applyConsultationImgService; |
|||
@Autowired |
|||
PatientService patientService; |
|||
@Autowired |
|||
UserService userService; |
|||
@Autowired |
|||
ApplyConsulationSpecialistService applyConsulationSpecialistService; |
|||
@Autowired |
|||
ApplyPathologyFileService applyPathologyFileService; |
|||
@Autowired |
|||
ApplyLisService applyLisService; |
|||
@Autowired |
|||
ApplyPathologyService applyPathologyService; |
|||
@Autowired |
|||
ApplyPathologyImgService applyPathologyImgService; |
|||
|
|||
|
|||
/** |
|||
* 批量新增 |
|||
* |
|||
* @param acList |
|||
* @return |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("insertConsultation") |
|||
public Map<String, Object> insertConsultation(@RequestBody List<ApplyConsultation> acList) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<Patient> wrapper=new EntityWrapper<Patient>(); |
|||
EntityWrapper<Patient> wrapper2=new EntityWrapper<Patient>(); |
|||
String ptEsrdNumber=""; |
|||
try { |
|||
if (!acList.isEmpty() && acList.get(0) != null) { |
|||
// 双向转诊数据
|
|||
boolean result = applyConsultationService.insert(acList.get(0)); |
|||
if (result == true) { |
|||
//9.8新增
|
|||
map.put("id",acList.get(0).getId()); |
|||
map.put("msg", "1"); |
|||
|
|||
//第一次新增时患者表新增
|
|||
if(acList.get(0).getHisEsrdNumber()!=null){ |
|||
wrapper.eq("his_esrd_number", acList.get(0).getHisEsrdNumber()); |
|||
wrapper2.eq("his_esrd_number", acList.get(0).getHisEsrdNumber()); |
|||
}else{ |
|||
wrapper.eq("out_patien", acList.get(0).getOutPatien()); |
|||
wrapper2.eq("out_patien", acList.get(0).getOutPatien()); |
|||
} |
|||
|
|||
wrapper.eq("hospital_id", acList.get(0).getCategoryHospitalId()); |
|||
Patient patient2=patientService.selectOne(wrapper); |
|||
|
|||
wrapper2.eq("hospital_id", acList.get(0).getGroupHospitalId()); |
|||
Patient patient3=patientService.selectOne(wrapper); |
|||
|
|||
if(patient2==null || patient3==null){ |
|||
Patient patient=new Patient(); |
|||
if(StringUtils.isNotEmpty(acList.get(0).getSex())){ |
|||
patient.setSex(acList.get(0).getSex()); |
|||
} |
|||
if(StringUtils.isNotEmpty(acList.get(0).getPtCard())){ |
|||
patient.setCard(acList.get(0).getPtCard()); |
|||
} |
|||
if(StringUtils.isNotEmpty(acList.get(0).getPatientName())){ |
|||
patient.setPatientName(acList.get(0).getPatientName()); |
|||
} |
|||
if(StringUtils.isNotEmpty(acList.get(0).getPtCity())){ |
|||
patient.setFamily(acList.get(0).getPtCity()); |
|||
} |
|||
if(StringUtils.isNotEmpty(acList.get(0).getPtPhone())){ |
|||
patient.setPhone(acList.get(0).getPtPhone()); |
|||
} |
|||
if(StringUtils.isNotEmpty(acList.get(0).getHisEsrdNumber())){ |
|||
patient.setHisEsrdNumber(acList.get(0).getHisEsrdNumber()); |
|||
} |
|||
if(StringUtils.isNotEmpty(acList.get(0).getOutPatien())){ |
|||
patient.setOutPatien(acList.get(0).getOutPatien()); |
|||
} |
|||
|
|||
if(patient2==null){ |
|||
patient.setHospitalId(acList.get(0).getCategoryHospitalId()); |
|||
result=patientService.insert(patient); |
|||
if(result==true){ |
|||
//yd:公司简称 01:远程会诊新增 02:双休转诊新增
|
|||
ptEsrdNumber="yd01"+patient.getId(); |
|||
patient.setEsrdNumber(ptEsrdNumber); |
|||
patientService.updateById(patient); |
|||
} |
|||
} |
|||
if(patient3==null){ |
|||
patient.setHospitalId(acList.get(0).getGroupHospitalId()); |
|||
result=patientService.insert(patient); |
|||
if(result==true){ |
|||
ptEsrdNumber=StringUtils.isNotEmpty(ptEsrdNumber)?ptEsrdNumber:"yd01"+patient.getId(); |
|||
patient.setEsrdNumber(ptEsrdNumber); |
|||
patientService.updateById(patient); |
|||
} |
|||
} |
|||
}else{ |
|||
ptEsrdNumber=patient2.getEsrdNumber(); |
|||
} |
|||
|
|||
//修改会诊数据
|
|||
Long id = acList.get(0).getId(); |
|||
acList.get(0).setEsrdNumber(ptEsrdNumber); |
|||
applyConsultationService.updateById(acList.get(0)); |
|||
|
|||
if (!acList.get(0).getAciList().isEmpty()) { |
|||
for (int i = 0; i < acList.get(0).getAciList().size(); i++) { |
|||
acList.get(0).getAciList().get(i).setConId(id); |
|||
} |
|||
applyConsultationImgService.insertBatch(acList.get(0).getAciList()); |
|||
} |
|||
} else { |
|||
map.put("msg", "2"); |
|||
} |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 专家医院远程会诊 |
|||
*/ |
|||
@RequestMapping("selectConsultationSpe") |
|||
public Map<String, Object> selectConsultationSpe(Integer pageNo, Integer pageSize, String patientName,String part, |
|||
String startTime, String endTime, String categoryHospitalId, Integer type,String ptCard,String hisId,String conditions, |
|||
String specialistId, String diagnosisType) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
pageNo = pageNo == null ? 1 : pageNo; |
|||
pageSize = pageSize == null ? 10 : pageSize; |
|||
map.put("patientName", patientName); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("categoryHospitalId", categoryHospitalId); |
|||
map.put("type", type); |
|||
map.put("diagnosisType", diagnosisType); |
|||
map.put("ptCard", ptCard); |
|||
map.put("hisId", hisId); |
|||
map.put("part", part); |
|||
map.put("specialistId",specialistId); |
|||
map.put("conditions",conditions); |
|||
try { |
|||
Pagetion<ApplyConsultation> pagetion = applyConsultationService.selectConsultationSpe(map, pageNo, pageSize); |
|||
map.put("pagetion", pagetion); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 管理医院远程会诊 |
|||
*/ |
|||
@RequestMapping("selectConByCategory") |
|||
public Map<String, Object> selectConByCategory(Integer pageNo, Integer pageSize, String patientName,String part, |
|||
String startTime, String endTime, String categoryHospitalId, Integer type, String docId,String ptCard,String hisId, |
|||
String specialistId, String diagnosisType,String conditions,String groupHospitalId,String esrdNumber) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
pageNo = pageNo == null ? 1 : pageNo; |
|||
pageSize = pageSize == null ? 10 : pageSize; |
|||
map.put("patientName", patientName); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("categoryHospitalId", categoryHospitalId); |
|||
map.put("type", type); |
|||
map.put("docId", docId); |
|||
map.put("specialistId", specialistId); |
|||
map.put("diagnosisType", diagnosisType); |
|||
map.put("ptCard", ptCard); |
|||
map.put("hisId", hisId); |
|||
map.put("part", part); |
|||
map.put("conditions", conditions); |
|||
map.put("groupHospitalId", groupHospitalId); |
|||
map.put("esrdNumber", esrdNumber); |
|||
try { |
|||
Pagetion<ApplyConsultation> pagetion = applyConsultationService.selectConByCategory(map, pageNo, pageSize); |
|||
map.clear(); |
|||
if(pagetion!=null){ |
|||
List<ApplyConsulationSpecialist> acssList=new ArrayList<ApplyConsulationSpecialist>(); |
|||
|
|||
for (int i = 0; i < pagetion.getList().size(); i++) { |
|||
EntityWrapper<ApplyConsulationSpecialist> wrapper=new EntityWrapper<ApplyConsulationSpecialist>(); |
|||
//查看分配专家
|
|||
wrapper.eq("con_id", pagetion.getList().get(i).getId()).ne("state","80"); |
|||
acssList=applyConsulationSpecialistService.selectList(wrapper); |
|||
if(!acssList.isEmpty()){ |
|||
pagetion.getList().get(i).setAcsList(acssList); |
|||
} |
|||
} |
|||
} |
|||
map.put("pagetion", pagetion); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/* |
|||
*//**
|
|||
* 基层医院远程会诊 |
|||
*//*
|
|||
@RequestMapping("selectConByPage") |
|||
public Map<String, Object> selectConByPage(Integer pageNo, Integer pageSize, String patientName, String startTime, |
|||
String endTime, Integer type, String diagnosisType, String categoryHospitalId, Long docId,String conditions,String groupHospitalId) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyConsultation> wrapper = new EntityWrapper<ApplyConsultation>(); |
|||
FrontPage<ApplyConsultation> page = new FrontPage<ApplyConsultation>(); |
|||
page.setPage(pageNo == null ? 1 : pageNo); |
|||
page.setRows(pageSize == null ? 10 : pageSize); |
|||
|
|||
if (docId != null) { |
|||
wrapper.eq("doc_id", docId); |
|||
} |
|||
if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) { |
|||
wrapper.between("group_date", startTime, endTime); |
|||
} |
|||
if (StringUtils.isNotEmpty(patientName)) { |
|||
wrapper.like("patient_name", patientName); |
|||
} |
|||
if (StringUtils.isNotEmpty(diagnosisType)) { |
|||
wrapper.eq("diagnosis_type", diagnosisType); |
|||
} |
|||
if (StringUtils.isNotEmpty(categoryHospitalId)) { |
|||
wrapper.eq("category_hospital_id", categoryHospitalId); |
|||
} |
|||
if (StringUtils.isNotEmpty(groupHospitalId)) { |
|||
wrapper.eq("group_hospital_id", groupHospitalId); |
|||
} |
|||
if (StringUtils.isNotEmpty(conditions)) { |
|||
wrapper.eq("conditions", conditions); |
|||
} |
|||
// 状态 1:待分配专家 2:已分配专家 3:已结束
|
|||
if (type != null && type == 1) { |
|||
wrapper.ne("status", "70"); |
|||
wrapper.orderBy("status,group_date", true); |
|||
} else if (type != null && type == 3) { |
|||
wrapper.eq("status", "70"); |
|||
wrapper.orderBy("group_date", false); |
|||
} |
|||
try { |
|||
Page<ApplyConsultation> list = applyConsultationService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if (list != null) { |
|||
CustomPage<ApplyConsultation> customPage = new CustomPage<ApplyConsultation>(list); |
|||
|
|||
List<ApplyConsulationSpecialist> acssList=new ArrayList<ApplyConsulationSpecialist>(); |
|||
for (int i = 0; i < customPage.getRows().size(); i++) { |
|||
EntityWrapper<ApplyConsulationSpecialist> wrapper2=new EntityWrapper<ApplyConsulationSpecialist>(); |
|||
//查看分配专家
|
|||
wrapper2.eq("con_id", customPage.getRows().get(i).getId()).ne("state","80"); |
|||
acssList=applyConsulationSpecialistService.selectList(wrapper2); |
|||
if(!acssList.isEmpty()){ |
|||
customPage.getRows().get(i).setAcsList(acssList); |
|||
} |
|||
} |
|||
map.put("customPage", customPage); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
}*/ |
|||
|
|||
//从写
|
|||
/** 9.7重写此方法 |
|||
* 基层医院远程会诊 |
|||
*/ |
|||
@RequestMapping("selectConByPage") |
|||
public Map<String, Object> selectConByPage(Integer pageNo, Integer pageSize, String patientName, String startTime, |
|||
String endTime, Integer type, String diagnosisType, String categoryHospitalId, |
|||
Long docId, String conditions, String groupHospitalId) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
pageNo = pageNo == null ? 1 : pageNo; |
|||
pageSize = pageSize == null ? 10 : pageSize; |
|||
map.put("patientName",patientName); |
|||
map.put("startTime",startTime); |
|||
map.put("endTime",endTime); |
|||
map.put("type",type); |
|||
map.put("diagnosisType",diagnosisType); |
|||
map.put("categoryHospitalId",categoryHospitalId); |
|||
map.put("docId",docId); |
|||
map.put("conditions",conditions); |
|||
map.put("groupHospitalId",groupHospitalId); |
|||
try { |
|||
CustomPage<ApplyConsultation> customPage = applyConsultationService.selectConByPage(map,pageNo,pageSize); |
|||
map.clear(); |
|||
if (customPage != null) { |
|||
for (int i = 0; i < customPage.getRows().size(); i++) { |
|||
EntityWrapper<ApplyConsulationSpecialist> wrapper=new EntityWrapper<ApplyConsulationSpecialist>(); |
|||
//查看分配专家
|
|||
wrapper.eq("con_id", customPage.getRows().get(i).getId()).ne("state","80"); |
|||
List<ApplyConsulationSpecialist> acssList = applyConsulationSpecialistService.selectList(wrapper); |
|||
if(!acssList.isEmpty()){ |
|||
customPage.getRows().get(i).setAcsList(acssList); |
|||
} |
|||
} |
|||
map.put("customPage", customPage); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 会诊查看详情 |
|||
* |
|||
* @param |
|||
* @return |
|||
*/ |
|||
@RequestMapping("selectConsultationById") |
|||
public Map<String, Object> selectConsultationById(Long id,Integer status,Long speId) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
List<ApplyConsultationImg> imgList=new ArrayList<ApplyConsultationImg>(); |
|||
String docPhone=""; |
|||
String contactPhone=""; |
|||
StringBuffer sctPhone=new StringBuffer(); |
|||
StringBuffer sctName=new StringBuffer(); |
|||
StringBuffer sctState=new StringBuffer(); |
|||
List<ApplyPathologyFile> apfList=new ArrayList<ApplyPathologyFile>(); |
|||
try { |
|||
ApplyConsultation applyConsultation = applyConsultationService.selectById(id); |
|||
if (applyConsultation != null) { |
|||
|
|||
User user=new User(); |
|||
if(applyConsultation.getDocId()!=null){ |
|||
user=userService.selectById(applyConsultation.getDocId()); |
|||
if(user!=null){ |
|||
docPhone=user.getPhone(); |
|||
contactPhone=user.getContactPhone(); |
|||
} |
|||
} |
|||
|
|||
//管理医院显示专家状态
|
|||
EntityWrapper<ApplyConsulationSpecialist> wrapper2 = new EntityWrapper<ApplyConsulationSpecialist>(); |
|||
wrapper2.eq("con_id", applyConsultation.getId()).ne("state", "80"); |
|||
List<ApplyConsulationSpecialist> accsList=applyConsulationSpecialistService.selectList(wrapper2); |
|||
for (int i = 0; i < accsList.size(); i++) { |
|||
user=userService.selectById(accsList.get(i).getSpeId()); |
|||
if(user!=null){ |
|||
//专家显示自己当前的状态
|
|||
if(speId!=null && accsList.get(i).getSpeId().equals(speId)){ |
|||
applyConsultation.setStatus(String.valueOf(accsList.get(i).getState())); |
|||
} |
|||
sctPhone=sctPhone.append(user.getPhone()+","); |
|||
sctName=sctName.append(user.getUserName()+","); |
|||
sctState=sctState.append(accsList.get(i).getState()+","); |
|||
} |
|||
} |
|||
//专家现在本人自己状态
|
|||
if(speId!=null){ |
|||
EntityWrapper<ApplyConsulationSpecialist> wrapper3 = new EntityWrapper<ApplyConsulationSpecialist>(); |
|||
wrapper3.eq("con_id", applyConsultation.getId()).eq("spe_id", speId); |
|||
ApplyConsulationSpecialist accs=applyConsulationSpecialistService.selectOne(wrapper3); |
|||
if(accs!=null){ |
|||
applyConsultation.setStatus(String.valueOf(accs.getState())); |
|||
} |
|||
} |
|||
map.clear(); |
|||
map.put("con_id", id); |
|||
imgList = applyConsultationImgService.selectByMap(map); |
|||
apfList=applyPathologyFileService.selectByMap(map); |
|||
} |
|||
map.put("apfList", apfList); |
|||
map.put("applyConsultation", applyConsultation); |
|||
map.put("imgList", imgList); |
|||
map.put("docPhone", docPhone);//医生账号
|
|||
map.put("contactPhone", contactPhone);//医生联系电话
|
|||
map.put("sctPhone", sctPhone.length()>0?sctPhone.substring(0,sctPhone.length() - 1):"");//专家账号
|
|||
map.put("sctName", sctName.length()>0?sctName.substring(0,sctName.length() - 1):"");//专家姓名
|
|||
map.put("sctState",sctState.length()>0?sctState.substring(0,sctState.length() - 1):"");//专家姓名
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 会诊图意见 |
|||
* @param |
|||
* @return |
|||
*/ |
|||
@RequestMapping("updateConImgOpinion") |
|||
public Map<String, Object> updateConImgOpinion(ApplyConsultationImg applyConsultationImg) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyConsultationImg> wrapper = new EntityWrapper<ApplyConsultationImg>(); |
|||
try { |
|||
wrapper.eq("type", applyConsultationImg.getType()); |
|||
wrapper.eq("con_id", applyConsultationImg.getConId()); |
|||
boolean result = applyConsultationImgService.update(applyConsultationImg, wrapper); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 修改会诊信息 |
|||
* |
|||
* @param |
|||
* @return |
|||
*/ |
|||
@RequestMapping("updateConsultation") |
|||
public Map<String, Object> updateConsultation(ApplyConsultation applyConsultation) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = applyConsultationService.updateById(applyConsultation); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 分配专家 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("insertConSpecialist") |
|||
public Map<String, Object> insertConSpecialist(@RequestBody List<ApplyConsulationSpecialist> accList) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
List<ApplyConsulationSpecialist> aspList=new ArrayList<ApplyConsulationSpecialist>(); |
|||
EntityWrapper<ApplyConsulationSpecialist> wrapper=new EntityWrapper<ApplyConsulationSpecialist>(); |
|||
Integer speNumber=1; |
|||
try { |
|||
if(!accList.isEmpty() && accList.get(0).getConId()!=null){ |
|||
if(accList.get(0).getSpeNumber()!=null){ |
|||
//获取分配专家的个数
|
|||
wrapper.eq("con_id", accList.get(0).getConId()).ne("state", "80"); |
|||
aspList=applyConsulationSpecialistService.selectList(wrapper); |
|||
if(aspList.size()>0){ |
|||
speNumber=2; |
|||
} |
|||
} |
|||
|
|||
boolean result = applyConsulationSpecialistService.insertBatch(accList); |
|||
if(result){ |
|||
|
|||
ApplyConsultation con=new ApplyConsultation(); |
|||
con.setGroupDate(accList.get(0).getConTime()); |
|||
con.setId(accList.get(0).getConId()); |
|||
|
|||
if(speNumber==2){ |
|||
map.put("con_id", accList.get(0).getConId()); |
|||
aspList=applyConsulationSpecialistService.selectByMap(map); |
|||
for (int i = 0; i < aspList.size(); i++) { |
|||
aspList.get(i).setSpeNumber(2); |
|||
applyConsulationSpecialistService.updateById(aspList.get(i)); |
|||
} |
|||
//修改总状态
|
|||
con.setStatus("30"); |
|||
applyConsultationService.updateById(con); |
|||
}else{ |
|||
//修改会诊时间
|
|||
applyConsultationService.updateById(con); |
|||
} |
|||
map.put("msg","1"); |
|||
}else{ |
|||
map.put("msg","2"); |
|||
} |
|||
}else{ |
|||
map.put("msg","3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 专家修改状态 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("updateConSpecialist") |
|||
public Map<String, Object> updateConSpecialist(ApplyConsulationSpecialist acss) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|||
Date date=new Date(); |
|||
EntityWrapper<ApplyConsulationSpecialist> wrapper=new EntityWrapper<ApplyConsulationSpecialist>(); |
|||
String status = ""; |
|||
try { |
|||
if(acss!=null){ |
|||
acss.setUpdateTime(dateFormat.parse(dateFormat.format(date))); |
|||
wrapper.eq("spe_id", acss.getSpeId()).eq("con_id", acss.getConId()); |
|||
//.eq("spe_name",acss.getSpeName()).eq("contact_phone",acss.getContactPhone());
|
|||
boolean result = applyConsulationSpecialistService.update(acss, wrapper); |
|||
if(result == true){ |
|||
map.put("con_id", acss.getConId()); |
|||
List<ApplyConsulationSpecialist> accList=applyConsulationSpecialistService.selectByMap(map); |
|||
if(!accList.isEmpty()){ |
|||
int speNumber=accList.get(0).getSpeNumber(); |
|||
// 分组
|
|||
Map<Integer, Long> collect=accList.stream().collect(Collectors.groupingBy(ApplyConsulationSpecialist::getState,Collectors.counting())); |
|||
int sum30=collect.get(30)!=null?collect.get(30).intValue():0; |
|||
int sum40=collect.get(40)!=null?collect.get(40).intValue():0; |
|||
int sum80=collect.get(80)!=null?collect.get(80).intValue():0; |
|||
// 状态20 30 40 50 60 70 待分配专家、待专家接收、已接收、本医院撤销、上级医院撤销 、已结束
|
|||
// 状态 30 40 50 60 70 80待专家接收、已接收、本医院撤销、上级医院撤销 、已结束 拒接
|
|||
|
|||
//全部同意则总状态改为
|
|||
if(speNumber==1){ |
|||
if(sum40!=0){ |
|||
status="40"; |
|||
}else if(sum30!=0){ |
|||
status="30"; |
|||
}else if(sum80!=0 && sum40==0 && sum30==0){ |
|||
status="20"; |
|||
} |
|||
}else if(speNumber==2){ |
|||
if(sum40!=0 && sum40==2){ |
|||
status="40"; |
|||
}else if(sum40<2 && sum30!=0){ |
|||
status="30"; |
|||
}else if(sum40<2 && sum30==0 && sum80!=0){ |
|||
status="20"; |
|||
} |
|||
} |
|||
} |
|||
if(StringUtils.isNotEmpty(status)){ |
|||
ApplyConsultation ac=new ApplyConsultation(); |
|||
ac.setStatus(status); |
|||
ac.setId(acss.getConId()); |
|||
applyConsultationService.updateById(ac); |
|||
} |
|||
map.put("msg","1"); |
|||
} else{ |
|||
map.put("msg","2"); |
|||
} |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 专家修改状态 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("updateConSpecialistInfo") |
|||
public Map<String, Object> updateConSpecialistInfo(ApplyConsulationSpecialist acss) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|||
Date date=new Date(); |
|||
EntityWrapper<ApplyConsulationSpecialist> wrapper=new EntityWrapper<ApplyConsulationSpecialist>(); |
|||
try { |
|||
if(acss!=null){ |
|||
acss.setUpdateTime(dateFormat.parse(dateFormat.format(date))); |
|||
wrapper.eq("con_id", acss.getConId()); |
|||
boolean result = applyConsulationSpecialistService.update(acss, wrapper); |
|||
if(result == true){ |
|||
map.put("msg","1"); |
|||
} else{ |
|||
map.put("msg","2"); |
|||
} |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 删除 |
|||
*/ |
|||
@Transactional//事务回滚
|
|||
@RequestMapping("deleteConsultation") |
|||
public Map<String, Object> deleteConsultation(Long id,String code) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
ApplyConsultation con=applyConsultationService.selectById(id); |
|||
if(con!=null){ |
|||
code=con.getCode(); |
|||
boolean result = applyConsultationService.deleteById(id); |
|||
if(result == true){ |
|||
map.put("con_id", id); |
|||
applyConsultationImgService.deleteByMap(map); |
|||
applyConsulationSpecialistService.deleteByMap(map); |
|||
applyPathologyFileService.deleteByMap(map); |
|||
map.clear(); |
|||
map.put("code", code); |
|||
applyLisService.deleteByMap(map); |
|||
applyPathologyService.deleteByMap(map); |
|||
applyPathologyImgService.deleteByMap(map); |
|||
} |
|||
map.put("msg", result==true?"1":"2"); |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 根据身份证号码查看患者信息 |
|||
*/ |
|||
@RequestMapping("selectConsultationByCard") |
|||
public Map<String, Object> selectConsultationByCard(String card) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
List<ApplyConsultation> acList=new ArrayList<ApplyConsultation>(); |
|||
EntityWrapper<ApplyConsultation> wrapper=new EntityWrapper<ApplyConsultation>(); |
|||
wrapper.eq("pt_card", card).orderBy("group_date", false); |
|||
try { |
|||
acList=applyConsultationService.selectList(wrapper); |
|||
map.put("acList",acList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,193 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.sql.Date; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Calendar; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.ApplyDoctorPromote; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyDoctorPromoteService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
import com.imurs.util.page.Pagetion; |
|||
|
|||
/** |
|||
* 医生进修申请控制器 |
|||
* |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value = "promote") |
|||
public class ApplyDoctorPromoteController { |
|||
|
|||
@Autowired |
|||
ApplyDoctorPromoteService applyDoctorPromoteService; |
|||
|
|||
@Autowired |
|||
UserService userService; |
|||
/** |
|||
* 新增医生进修申请 |
|||
*/ |
|||
@RequestMapping(value = "insertPromote") |
|||
public Map<String, Object> insertPromote(ApplyDoctorPromote applyDoctorPromote) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<User> wrapper=new EntityWrapper<User>(); |
|||
|
|||
try { |
|||
if(applyDoctorPromote.getAccount()!=null){ |
|||
wrapper.eq("phone", applyDoctorPromote.getAccount()); |
|||
User user = userService.selectOne(wrapper); |
|||
if(user!=null){ |
|||
applyDoctorPromote.setDocId(user.getId()); |
|||
}else{ |
|||
map.put("msg", "6");//账号不存在account
|
|||
return map; |
|||
} |
|||
} |
|||
boolean result = applyDoctorPromoteService.insert(applyDoctorPromote); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
map.remove("account"); |
|||
return map; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 修改医生进修申请 |
|||
*/ |
|||
@RequestMapping(value = "updatePromote") |
|||
public Map<String, Object> updatePromote(ApplyDoctorPromote applyDoctorPromote) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = applyDoctorPromoteService.updateById(applyDoctorPromote); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 删除医生进修申请 |
|||
*/ |
|||
@RequestMapping(value = "deletePromote") |
|||
public Map<String, Object> deletePromote(Long id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = applyDoctorPromoteService.deleteById(id); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 查看医生进修申请详情 |
|||
*/ |
|||
@RequestMapping(value = "selectPromoteById") |
|||
public Map<String, Object> selectPromoteById(Long id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
ApplyDoctorPromote promote = applyDoctorPromoteService.selectById(id); |
|||
map.put("promote", promote); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 医生进修列表分页 |
|||
*/ |
|||
@RequestMapping(value = "selectPromotePage") |
|||
public Map<String, Object> selectPromotePage(String applyStartTime,String applyEndTime,String isSuper,String hospitalId , |
|||
String hospitalName,String docId,Integer pageNo,Integer pageSize) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyDoctorPromote> wrapper=new EntityWrapper<ApplyDoctorPromote>(); |
|||
FrontPage<ApplyDoctorPromote> page=new FrontPage<ApplyDoctorPromote>(); |
|||
page.setPage(pageNo==null?1:pageNo); |
|||
page.setRows(pageSize==null?6:pageSize); |
|||
|
|||
if(StringUtils.isNotEmpty(applyStartTime)){ |
|||
wrapper.ge("apply_start_time", applyStartTime); |
|||
} |
|||
if(StringUtils.isNotEmpty(applyEndTime)){ |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd"); |
|||
Calendar cal = Calendar.getInstance(); |
|||
cal.setTime(Date.valueOf(applyEndTime)); |
|||
cal.add(Calendar.DATE,1);//增加一天
|
|||
wrapper.lt("apply_start_time",dateFormat.format(cal.getTime())); |
|||
} |
|||
if(StringUtils.isNotEmpty(hospitalId)){ |
|||
wrapper.eq("hospital_id", hospitalId); |
|||
} |
|||
if(StringUtils.isNotEmpty(isSuper)){//上级医院/基层医院、基层医生看全部状态
|
|||
wrapper.ne("status", "A").ne("status", "J"); |
|||
} |
|||
wrapper.orderBy("status", true); |
|||
try { |
|||
Page<ApplyDoctorPromote> pageList=applyDoctorPromoteService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if(pageList!=null){ |
|||
CustomPage<ApplyDoctorPromote> customPage=new CustomPage<ApplyDoctorPromote>(pageList); |
|||
map.put("customPage", customPage); |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 管理医院进修列表分页 |
|||
*/ |
|||
@RequestMapping(value = "selectAdminPromote") |
|||
public Map<String, Object> selectAdminPromote(String applyStartTime,String applyEndTime,String isSuper,String hospitalId , |
|||
Integer pageNo,Integer pageSize) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
pageNo=pageNo==null?1:pageNo; |
|||
pageSize=pageSize==null?12:pageSize; |
|||
map.put("applyStartTime", applyStartTime); |
|||
map.put("applyEndTime", applyEndTime); |
|||
map.put("isSuper", isSuper); |
|||
map.put("hospitalId", hospitalId); |
|||
try { |
|||
Pagetion<ApplyDoctorPromote> pageList=applyDoctorPromoteService.selectAdminPromote(map,pageNo,pageSize); |
|||
map.put("customPage", pageList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("applyStartTime"); |
|||
map.remove("applyEndTime"); |
|||
map.remove("isSuper"); |
|||
map.remove("hospitalId"); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,420 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.ApplyEcg; |
|||
import com.imurs.entity.ApplyEcgSpecialist; |
|||
import com.imurs.entity.ApplyEcgImg; |
|||
import com.imurs.entity.ApplyInformation; |
|||
import com.imurs.entity.Patient; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyEcgImgService; |
|||
import com.imurs.service.ApplyEcgService; |
|||
import com.imurs.service.ApplyEcgSpecialistService; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.PatientService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.page.Pagetion; |
|||
|
|||
@RestController |
|||
@RequestMapping("ecg") |
|||
public class ApplyEcgController { |
|||
|
|||
@Autowired |
|||
ApplyEcgService applyEcgService; |
|||
|
|||
@Autowired |
|||
ApplyEcgImgService applyEcgImgService; |
|||
|
|||
@Autowired |
|||
PatientService patientService; |
|||
|
|||
@Autowired |
|||
ApplyEcgSpecialistService applyEcgSpecialistService; |
|||
|
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
|
|||
@Autowired |
|||
UserService userService; |
|||
|
|||
|
|||
/** |
|||
* 批量新增心电图片 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("insertEcgImg") |
|||
public Map<String,Object> insertEcgImg(@RequestBody List<ApplyEcgImg> ecgImgList){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
boolean result=false; |
|||
try { |
|||
if(!ecgImgList.isEmpty() && ecgImgList.get(0)!=null){ |
|||
for (int i = 0; i < ecgImgList.size(); i++) { |
|||
result=applyEcgImgService.insert(ecgImgList.get(i)); |
|||
} |
|||
map.put("msg", result==true?"1":"2"); |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("inserEcg") |
|||
public Map<String, Object> inserEcg(@RequestBody List<ApplyEcg> ecgList) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<Patient> wrapper = new EntityWrapper<Patient>(); |
|||
EntityWrapper<Patient> wrapper2 = new EntityWrapper<Patient>(); |
|||
String ptEsrdNumber = ""; |
|||
try { |
|||
if (!ecgList.isEmpty() && ecgList.get(0) != null) { |
|||
// 双向转诊数据
|
|||
boolean result = applyEcgService.insert(ecgList.get(0)); |
|||
if (result == true) { |
|||
map.put("msg", "1"); |
|||
|
|||
if(StringUtils.isNotEmpty(ecgList.get(0).getHisEsrdNumber())){ |
|||
wrapper.eq("his_esrd_number", ecgList.get(0).getHisEsrdNumber()); |
|||
wrapper2.eq("his_esrd_number", ecgList.get(0).getHisEsrdNumber()); |
|||
}else{ |
|||
wrapper.eq("out_patien", ecgList.get(0).getOutPatien()); |
|||
wrapper2.eq("out_patien", ecgList.get(0).getOutPatien()); |
|||
} |
|||
// 第一次新增时患者表新增
|
|||
wrapper.eq("hospital_id",ecgList.get(0).getCategoryHospitalId()); |
|||
Patient patient2 = patientService.selectOne(wrapper); |
|||
|
|||
wrapper2.eq("hospital_id",ecgList.get(0).getGroupHospitalId()); |
|||
Patient patient3 = patientService.selectOne(wrapper); |
|||
|
|||
if (patient2 == null || patient3 == null) { |
|||
Patient patient = new Patient(); |
|||
if(StringUtils.isNotEmpty(ecgList.get(0).getSex())){ |
|||
patient.setSex(ecgList.get(0).getSex()); |
|||
} |
|||
if(StringUtils.isNotEmpty(ecgList.get(0).getPatientName())){ |
|||
patient.setPatientName(ecgList.get(0).getPatientName()); |
|||
} |
|||
if(StringUtils.isNotEmpty(ecgList.get(0).getHisEsrdNumber())){ |
|||
patient.setHisEsrdNumber(ecgList.get(0).getHisEsrdNumber()); |
|||
} |
|||
if(StringUtils.isNotEmpty(ecgList.get(0).getOutPatien())){ |
|||
patient.setOutPatien(ecgList.get(0).getOutPatien()); |
|||
} |
|||
if (patient2 == null) { |
|||
patient.setHospitalId(ecgList.get(0).getCategoryHospitalId()); |
|||
result = patientService.insert(patient); |
|||
if (result == true) { |
|||
//yd:公司简称 01:远程会诊新增 02:双休转诊新增 03:B超 04:心电
|
|||
ptEsrdNumber = "yd04" + patient.getId(); |
|||
patient.setEsrdNumber(ptEsrdNumber); |
|||
patientService.updateById(patient); |
|||
} |
|||
} |
|||
if (patient3 == null) { |
|||
patient.setHospitalId(ecgList.get(0).getGroupHospitalId()); |
|||
result = patientService.insert(patient); |
|||
if (result == true) { |
|||
ptEsrdNumber = StringUtils.isNotEmpty(ptEsrdNumber) ? ptEsrdNumber |
|||
: "yd04" + patient.getId(); |
|||
patient.setEsrdNumber(ptEsrdNumber); |
|||
patientService.updateById(patient); |
|||
} |
|||
} |
|||
} else { |
|||
ptEsrdNumber = patient2.getEsrdNumber(); |
|||
} |
|||
|
|||
// 修改会诊数据
|
|||
Long id = ecgList.get(0).getId(); |
|||
ecgList.get(0).setEsrdNumber(ptEsrdNumber); |
|||
applyEcgService.updateById(ecgList.get(0)); |
|||
|
|||
if (!ecgList.get(0).getEcgImgList().isEmpty()) { |
|||
for (int i = 0; i < ecgList.get(0).getEcgImgList().size(); i++) { |
|||
ecgList.get(0).getEcgImgList().get(i).seteId(id); |
|||
} |
|||
applyEcgImgService.insertBatch(ecgList.get(0).getEcgImgList()); |
|||
} |
|||
} else { |
|||
map.put("msg", "2"); |
|||
} |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@RequestMapping("updateEcg") |
|||
public Map<String,Object> updateEcg(ApplyEcg applyEcg){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=applyEcgService.updateById(applyEcg); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("deleteEcgById") |
|||
public Map<String,Object> deleteEcgById(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=applyEcgService.deleteById(id); |
|||
if(result==true){ |
|||
map.put("e_id", id); |
|||
applyEcgImgService.deleteByMap(map); |
|||
map.clear(); |
|||
map.put("msg", "1"); |
|||
}else{ |
|||
map.put("msg", "2"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查询 |
|||
*/ |
|||
@RequestMapping("selectEcgById") |
|||
public Map<String,Object> selectEcgById(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
ApplyEcg applyEcg=new ApplyEcg(); |
|||
String contactPhone=""; |
|||
List<ApplyEcgImg> ecgImgList=new ArrayList<ApplyEcgImg>(); |
|||
EntityWrapper<ApplyInformation> wrapper=new EntityWrapper<ApplyInformation>(); |
|||
EntityWrapper<ApplyEcgSpecialist> wrapper2=new EntityWrapper<ApplyEcgSpecialist>(); |
|||
try { |
|||
applyEcg=applyEcgService.selectById(id); |
|||
if(applyEcg!=null){ |
|||
User user=userService.selectById(applyEcg.getDocId()); |
|||
if(user!=null){ |
|||
contactPhone=user.getContactPhone(); |
|||
} |
|||
//查看分配专家
|
|||
wrapper2.eq("e_id",id).ne("state","80"); |
|||
ApplyEcgSpecialist ecgSp=applyEcgSpecialistService.selectOne(wrapper2); |
|||
if(ecgSp!=null){ |
|||
applyEcg.setSpecialist(ecgSp.getSpeName()); |
|||
applyEcg.setSpecialistId(ecgSp.getSpeId()); |
|||
} |
|||
|
|||
//查看医院名字
|
|||
wrapper.eq("id", applyEcg.getCategoryHospitalId()).or().eq("id", applyEcg.getGroupHospitalId()); |
|||
List<ApplyInformation> aifList=applyInformationService.selectList(wrapper); |
|||
if(!aifList.isEmpty()){ |
|||
for (int i = 0; i < aifList.size(); i++) { |
|||
if(aifList.get(i).getId().equals(applyEcg.getCategoryHospitalId())){ |
|||
applyEcg.setCategoryHospital(aifList.get(i).getHospitalName()); |
|||
} |
|||
if(aifList.get(i).getId().equals(applyEcg.getGroupHospitalId())){ |
|||
applyEcg.setGroupHospital(aifList.get(i).getHospitalName()); |
|||
} |
|||
} |
|||
} |
|||
map.put("e_id", id); |
|||
ecgImgList=applyEcgImgService.selectByMap(map); |
|||
} |
|||
map.put("applyEcg", applyEcg); |
|||
map.put("ecgImgList", ecgImgList); |
|||
map.put("contactPhone", contactPhone); |
|||
} catch (Exception e ) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 分配专家 |
|||
*/ |
|||
@RequestMapping("insertEcgSpecialist") |
|||
public Map<String, Object> insertEcgSpecialist(ApplyEcgSpecialist ecgSp) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = applyEcgSpecialistService.insert(ecgSp); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 专家修改状态 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("updateEcgSpecialist") |
|||
public Map<String, Object> updateEcgSpecialist(ApplyEcgSpecialist ecgSp) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|||
Date date=new Date(); |
|||
EntityWrapper<ApplyEcgSpecialist> wrapper=new EntityWrapper<ApplyEcgSpecialist>(); |
|||
String status = ""; |
|||
try { |
|||
if(ecgSp!=null){ |
|||
ecgSp.setUpdateTime(dateFormat.parse(dateFormat.format(date))); |
|||
wrapper.eq("spe_id", ecgSp.getSpeId()).eq("e_id", ecgSp.geteId()); |
|||
boolean result = applyEcgSpecialistService.update(ecgSp, wrapper); |
|||
if(result == true){ |
|||
map.put("e_id", ecgSp.geteId()); |
|||
List<ApplyEcgSpecialist> accList=applyEcgSpecialistService.selectByMap(map); |
|||
if(!accList.isEmpty()){ |
|||
// 分组
|
|||
Map<Integer, Long> collect=accList.stream().collect(Collectors.groupingBy(ApplyEcgSpecialist::getState,Collectors.counting())); |
|||
int sum30=collect.get(30)!=null?collect.get(30).intValue():0; |
|||
int sum40=collect.get(40)!=null?collect.get(40).intValue():0; |
|||
int sum80=collect.get(80)!=null?collect.get(80).intValue():0; |
|||
// 状态20 30 40 50 60 70 待分配专家、待专家接收、已接收、本医院撤销、上级医院撤销 、已结束
|
|||
// 状态 30 40 50 60 70 80待专家接收、已接收、本医院撤销、上级医院撤销 、已结束 拒接
|
|||
|
|||
//全部同意则总状态改为
|
|||
if(sum40!=0){ |
|||
status="40"; |
|||
}else if(sum30!=0){ |
|||
status="30"; |
|||
}else if(sum80!=0 && sum40==0 && sum30==0){ |
|||
status="20"; |
|||
} |
|||
} |
|||
if(StringUtils.isNotEmpty(status)){ |
|||
ApplyEcg ab=new ApplyEcg(); |
|||
ab.setStatus(status); |
|||
ab.setId(ecgSp.geteId()); |
|||
applyEcgService.updateById(ab); |
|||
} |
|||
map.put("msg","1"); |
|||
}else{ |
|||
map.put("msg","2"); |
|||
} |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 管理/申请专家医院心电列表 |
|||
*/ |
|||
@RequestMapping("selectEcgPage") |
|||
public Map<String,Object> selectEcgPage(String categoryHospitalId,String groupHospitalId,String startTime, |
|||
String endTime,String patientName,Integer pageNo,Integer pageSize,Integer type,String part,Long docId){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
map.put("categoryHospitalId", categoryHospitalId); |
|||
map.put("groupHospitalId", groupHospitalId); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("patientName", patientName); |
|||
map.put("type", type); |
|||
map.put("part", part); |
|||
map.put("docId", docId); |
|||
pageNo=pageNo==null?1:pageNo; |
|||
pageSize=pageSize==null?10:pageSize; |
|||
try { |
|||
Pagetion<ApplyEcg> pagetion = applyEcgService.selectEcgPage(map, pageNo, pageSize); |
|||
map.clear(); |
|||
if(pagetion!=null){ |
|||
ApplyEcgSpecialist ecgSp=new ApplyEcgSpecialist(); |
|||
for (int i = 0; i < pagetion.getList().size(); i++) { |
|||
EntityWrapper<ApplyEcgSpecialist> wrapper=new EntityWrapper<ApplyEcgSpecialist>(); |
|||
//查看分配专家
|
|||
wrapper.eq("e_id", pagetion.getList().get(i).getId()).ne("state","80"); |
|||
ecgSp=applyEcgSpecialistService.selectOne(wrapper); |
|||
if(ecgSp!=null){ |
|||
pagetion.getList().get(i).setSpecialist(ecgSp.getSpeName()); |
|||
pagetion.getList().get(i).setSpecialistId(ecgSp.getSpeId()); |
|||
} |
|||
} |
|||
} |
|||
map.put("pagetion", pagetion); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("categoryHospitalId"); |
|||
map.remove("groupHospitalId"); |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("patientName"); |
|||
map.remove("type"); |
|||
map.remove("part"); |
|||
map.remove("docId"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 专家心电 |
|||
*/ |
|||
@RequestMapping("selectEcgSpePage") |
|||
public Map<String, Object> selectEcgSpePage(Integer pageNo, Integer pageSize, String patientName, |
|||
String startTime, String endTime, String specialistId,Integer part,Integer type) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
pageNo = pageNo == null ? 1 : pageNo; |
|||
pageSize = pageSize == null ? 10 : pageSize; |
|||
map.put("patientName", patientName); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("specialistId",specialistId); |
|||
map.put("part",part); |
|||
map.put("type",type); |
|||
try { |
|||
Pagetion<ApplyEcg> pagetion = applyEcgService.selectEcgSpePage(map, pageNo, pageSize); |
|||
map.put("pagetion", pagetion); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("patientName"); |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("specialistId"); |
|||
map.remove("part"); |
|||
map.remove("type"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,376 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.ApplyInformation; |
|||
import com.imurs.entity.ApplyInformationImg; |
|||
import com.imurs.entity.DoctorArrange; |
|||
import com.imurs.entity.TotalInformation; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyInformationImgService; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.DoctorArrangeService; |
|||
import com.imurs.service.TotalInformationService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.MD5; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
import com.imurs.util.page.Pagetion; |
|||
|
|||
import javax.print.DocFlavor; |
|||
|
|||
/** |
|||
* 基层医院申请表 |
|||
* |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value = "infor") |
|||
public class ApplyInforMationController { |
|||
|
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
@Autowired |
|||
ApplyInformationImgService applyInformationImgService; |
|||
@Autowired |
|||
DoctorArrangeService doctorArrangeService; |
|||
@Autowired |
|||
UserService userService; |
|||
@Autowired |
|||
TotalInformationService totalInformationService; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 查询指定角色的医院 |
|||
*/ |
|||
/** |
|||
* 查询管理医院的名称 |
|||
*/ |
|||
@RequestMapping(value = "selectInforByRid") |
|||
public Map<String, Object> selectInforByRid(String rid) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
if(StringUtils.isNotEmpty(rid)){ |
|||
map.put("rid", rid); |
|||
map.put("state", "1"); |
|||
List<ApplyInformation> inforList = applyInformationService.selectByMap(map); |
|||
map.put("inforList", inforList); |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 查询管理医院的名称 |
|||
*/ |
|||
@RequestMapping(value = "selectInforName") |
|||
public Map<String, Object> selectInforName() { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyInformation> wrapper=new EntityWrapper<ApplyInformation>(); |
|||
wrapper.setSqlSelect("id as id,hospital_name as hospitalName").where("rid=1"); |
|||
try { |
|||
ApplyInformation applyInformation = applyInformationService.selectOne(wrapper); |
|||
map.put("applyInformation",applyInformation); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新增基层医院申请信息 |
|||
*/ |
|||
@RequestMapping(value = "insertInfor") |
|||
public Map<String, Object> insertInfor(ApplyInformation applyInformation) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
|||
Date date=new Date(); |
|||
try { |
|||
String uuid=MD5.GetMD5Code(dateFormat.format(date)); |
|||
// 医院id按照时间日期生成
|
|||
applyInformation.setId(uuid); |
|||
applyInformation.setAccount(applyInformation.getId()); |
|||
boolean result = applyInformationService.insert(applyInformation); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 修改基层医院申请信息/审核医院为通过 |
|||
*/ |
|||
@RequestMapping(value = "updateInfor") |
|||
public Map<String, Object> updateInfor(ApplyInformation applyInformation) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyInformation> wrapper = new EntityWrapper<ApplyInformation>(); |
|||
EntityWrapper<TotalInformation> totalWrapper = new EntityWrapper<TotalInformation>(); |
|||
|
|||
try { |
|||
if(applyInformation!=null && StringUtils.isNotEmpty(applyInformation.getId())){ |
|||
wrapper.eq("id", applyInformation.getId()); |
|||
boolean result = applyInformationService.update(applyInformation, wrapper); |
|||
if(result == true && applyInformation.getState()!=null |
|||
&& applyInformation.getState()==1){//修改医院状态为审核通过
|
|||
totalWrapper.eq("hospital_id", applyInformation.getId()); |
|||
TotalInformation totalIfo = totalInformationService.selectOne(totalWrapper); |
|||
if(totalIfo==null){ |
|||
TotalInformation totalInformation = new TotalInformation(); |
|||
totalInformation.setHospitalId(applyInformation.getId());//医院id
|
|||
totalInformation.setType(applyInformation.getRid().intValue());//医院注册类型
|
|||
totalInformationService.insert(totalInformation); |
|||
} |
|||
} |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 批量修改医院数据 |
|||
*/ |
|||
@RequestMapping(value = "updateInforBatch") |
|||
public Map<String, Object> updateUserBatch(@RequestBody List<ApplyInformation> ApplyInformation) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
try { |
|||
boolean result = applyInformationService.updateBatchByIds(ApplyInformation); |
|||
map.put("msg", result ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 修改基层医院数据和图片信息 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping(value="updateInforImg") |
|||
public Map<String, Object> updateInforImg(ApplyInformation applyInformation,String imgUrls,String imgType) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyInformation> wrapper = new EntityWrapper<ApplyInformation>(); |
|||
try { |
|||
if(applyInformation!=null && StringUtils.isNotEmpty(applyInformation.getId())){ |
|||
String id=applyInformation.getId(); |
|||
wrapper.eq("id", id); |
|||
boolean result = applyInformationService.update(applyInformation, wrapper); |
|||
//修改图片
|
|||
if(result==true){ |
|||
if(StringUtils.isNotEmpty(imgUrls) && StringUtils.isNotEmpty(imgType)){ |
|||
String[] strImg=imgUrls.split(","); |
|||
String[] strType=imgType.split(","); |
|||
map.put("hospital_id",id); |
|||
List<ApplyInformationImg> imgList=applyInformationImgService.selectByMap(map); |
|||
if(!imgList.isEmpty()){ |
|||
applyInformationImgService.deleteByMap(map); |
|||
} |
|||
for (int i = 0; i < strType.length; i++) { |
|||
ApplyInformationImg apImg=new ApplyInformationImg(); |
|||
apImg.setHospitalId(id); |
|||
apImg.setImgUrl(strImg[i]); |
|||
apImg.setImgType(Integer.valueOf(strType[i])); |
|||
applyInformationImgService.insert(apImg); |
|||
} |
|||
} |
|||
map.remove("hospital_id"); |
|||
map.put("msg", "1"); |
|||
}else{ |
|||
map.put("msg", "2"); |
|||
} |
|||
}else{ |
|||
map.put("msg","3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 删除基层医院申请信息 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping(value = "deleteInfor") |
|||
public Map<String, Object> deleteInfor(String id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("id", id); |
|||
try { |
|||
boolean result = applyInformationService.deleteByMap(map); |
|||
map.clear(); |
|||
if(result == true){ |
|||
map.put("hospital_id", id); |
|||
applyInformationImgService.deleteByMap(map); |
|||
map.put("msg","1"); |
|||
}else{ |
|||
map.put("msg", "2"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查询单条基层医院申请信息 |
|||
*/ |
|||
@RequestMapping(value = "findAifmById") |
|||
public Map<String, Object> findAifmById(String id,String rid) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
Map<String, Object> map1 = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyInformationImg> wrapper=new EntityWrapper<ApplyInformationImg>(); |
|||
try { |
|||
ApplyInformation applyInformation = applyInformationService.selectById(id); |
|||
if (applyInformation != null) { |
|||
// 医院图片
|
|||
wrapper.eq("hospital_id", id); |
|||
if(rid!=null){ |
|||
wrapper.ne("img_type","1").ne("img_type","2"); |
|||
} |
|||
List<ApplyInformationImg> imgList = applyInformationImgService.selectList(wrapper); |
|||
map.put("imgList", imgList); |
|||
map.put("information", applyInformation); |
|||
//查出管理员信息
|
|||
if(applyInformation.getPrincipalId()!=null){ |
|||
User user=userService.selectById(applyInformation.getPrincipalId()); |
|||
map.put("user", user); |
|||
} |
|||
if(!StringUtils.isEmpty(rid)){ |
|||
map1.put("hospitalId", id); |
|||
List<DoctorArrange> doctorArrangeList = doctorArrangeService.homeShowArrange(map1); |
|||
//List<DoctorArrange> doctorArrangeList = doctorArrangeService.selectArrangeByRhId(id);
|
|||
map.put("doctorArrangeList", doctorArrangeList); |
|||
} |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 医院信息分页显示(申请信息管理) |
|||
*/ |
|||
@RequestMapping(value = "findAifmPage") |
|||
public Map<String, Object> findAifmPage(Integer pageSize, Integer pageNo, Integer state, Long hospitalId, |
|||
String hospitalName) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyInformation> wrapper = new EntityWrapper<ApplyInformation>(); |
|||
FrontPage<ApplyInformation> page = new FrontPage<ApplyInformation>(); |
|||
page.setPage(pageNo == null ? 1 : pageNo); |
|||
page.setRows(pageSize == null ? 10 : pageSize); |
|||
if (StringUtils.isNotEmpty(hospitalName)) { |
|||
wrapper.like("hospital_name", hospitalName); |
|||
} |
|||
try { |
|||
wrapper.eq("state", state).eq("hospital_id", hospitalId).orderBy("create_time", false); |
|||
Page<ApplyInformation> pageList = applyInformationService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if (pageList != null) { |
|||
CustomPage<ApplyInformation> customPage = new CustomPage<ApplyInformation>(pageList); |
|||
map.put("customPage", customPage); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 医院信息分页显示(合作医院信息) |
|||
*/ |
|||
@RequestMapping(value = "findAifmAdminPage") |
|||
public Map<String, Object> findAifmAdminPage(Integer pageSize, Integer pageNo, Integer state, Long hospitalId, |
|||
String hospitalName) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
pageNo=pageNo == null ? 1 : pageNo; |
|||
pageSize=pageSize == null ? 10 : pageSize; |
|||
map.put("hospitalName", hospitalName); |
|||
try { |
|||
Pagetion<ApplyInformation> pageList = applyInformationService.findAifmAdminPage(map, pageNo, pageSize); |
|||
map.put("pageList", pageList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("hospitalName"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 分组查出所有医院名称 |
|||
*/ |
|||
@RequestMapping(value = "findAifmGroup") |
|||
public Map<String, Object> findAifmGroup(Integer state, String rid,String hospitalName) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyInformation> wrapper = new EntityWrapper<ApplyInformation>(); |
|||
wrapper.setSqlSelect("hospital_name as hospitalName,id as id,rid as rid,allocate_doctor as allocateDoctor "); |
|||
if (state == null) { |
|||
wrapper.eq("state", "1"); |
|||
}else if(state==4){ |
|||
if (StringUtils.isNotEmpty(rid)) { |
|||
wrapper.eq("rid",rid); |
|||
}else{ |
|||
wrapper.ne("rid", "1").ne("rid","9"); |
|||
if(StringUtils.isNotEmpty(hospitalName)){ |
|||
wrapper.eq("hospital_name", hospitalName); |
|||
} |
|||
wrapper.orderBy("if(id='68729a2d87075bd616f7339940227f46',0,1),if(id='97561c8ecc660a36a3cdad29abd4ae3f',0,1)," |
|||
+ "if(id='07cdf216c7a7eb0e1dd5d7fc568d9285',0,1),if(id='4f74e5c6659354e6eca2d4658bf57777',0,1)"); |
|||
} |
|||
} |
|||
try { |
|||
List<ApplyInformation> list = applyInformationService.selectList(wrapper); |
|||
map.put("list", list); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,628 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.ApplyConsultation; |
|||
import com.imurs.entity.ApplyConsultationImg; |
|||
import com.imurs.entity.ApplyEcg; |
|||
import com.imurs.entity.ApplyEcgImg; |
|||
import com.imurs.entity.ApplyInformation; |
|||
import com.imurs.entity.ApplyLis; |
|||
import com.imurs.entity.ApplyPathology; |
|||
import com.imurs.entity.ApplyPathologyFile; |
|||
import com.imurs.entity.ApplyPathologyImg; |
|||
import com.imurs.entity.ApplySpecialist; |
|||
import com.imurs.entity.Patient; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.parameter.ApplyParameter; |
|||
import com.imurs.service.ApplyConsultationImgService; |
|||
import com.imurs.service.ApplyConsultationService; |
|||
import com.imurs.service.ApplyEcgImgService; |
|||
import com.imurs.service.ApplyEcgService; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.ApplyLisService; |
|||
import com.imurs.service.ApplyPathologyFileService; |
|||
import com.imurs.service.ApplyPathologyImgService; |
|||
import com.imurs.service.ApplyPathologyService; |
|||
import com.imurs.service.ApplySpecialistService; |
|||
import com.imurs.service.PatientService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.MD5; |
|||
|
|||
import net.sf.json.JSONObject; |
|||
|
|||
@RestController |
|||
@RequestMapping("apply") |
|||
public class ApplyParameterController { |
|||
|
|||
@Autowired |
|||
ApplyConsultationService applyConsultationService; |
|||
@Autowired |
|||
ApplyConsultationImgService applyConsultationImgService; |
|||
@Autowired |
|||
ApplyLisService applyLisService; |
|||
@Autowired |
|||
ApplyPathologyService applyPathologyService; |
|||
@Autowired |
|||
ApplyPathologyImgService applyPathologyImgService; |
|||
@Autowired |
|||
ApplyEcgService applyEcgService; |
|||
@Autowired |
|||
ApplyEcgImgService applyEcgImgService; |
|||
@Autowired |
|||
PatientService patientService; |
|||
@Autowired |
|||
ApplySpecialistService applySpecialistService; |
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
@Autowired |
|||
UserService userService; |
|||
@Autowired |
|||
ApplyPathologyFileService applyPathologyFileService; |
|||
|
|||
/** |
|||
* 批量新增 |
|||
* |
|||
* @param apList |
|||
* @return |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("insertApply") |
|||
public Map<String, Object> insertApply(@RequestBody List<ApplyParameter> parameterList) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<Patient> wrapper = new EntityWrapper<Patient>(); |
|||
EntityWrapper<Patient> wrapper2 = new EntityWrapper<Patient>(); |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
|||
Date date=new Date(); |
|||
String code=MD5.GetMD5Code(dateFormat.format(date)); |
|||
String ptEsrdNumber = ""; |
|||
boolean result = false; |
|||
Long id = null; |
|||
Patient patient2 = new Patient(); |
|||
Patient patient3 = new Patient(); |
|||
for(int i = 0; i<parameterList.size();i++) { |
|||
String string = parameterList.get(i).toString(); |
|||
} |
|||
|
|||
try { |
|||
if (!parameterList.isEmpty() && parameterList.get(0) != null) { |
|||
//患者
|
|||
if (StringUtils.isNotEmpty(parameterList.get(0).getHisEsrdNumber())) { |
|||
wrapper.eq("his_esrd_number", parameterList.get(0).getHisEsrdNumber()); |
|||
wrapper2.eq("his_esrd_number", parameterList.get(0).getHisEsrdNumber()); |
|||
} else { |
|||
wrapper.eq("out_patien", parameterList.get(0).getOutPatien()); |
|||
wrapper2.eq("out_patien", parameterList.get(0).getOutPatien()); |
|||
} |
|||
// 第一次新增时患者表新增
|
|||
wrapper.eq("hospital_id", parameterList.get(0).getCategoryHospitalId()); |
|||
patient2 = patientService.selectOne(wrapper); |
|||
|
|||
wrapper2.eq("hospital_id", parameterList.get(0).getGroupHospitalId()); |
|||
patient3 = patientService.selectOne(wrapper); |
|||
if (patient2 == null || patient3 == null) { |
|||
if (patient2 == null) { |
|||
parameterList.get(0).getPatient().setHospitalId(parameterList.get(0).getCategoryHospitalId()); |
|||
result = patientService.insert(parameterList.get(0).getPatient()); |
|||
if (result == true) { |
|||
ptEsrdNumber = "yd10" + parameterList.get(0).getPatient().getId(); |
|||
parameterList.get(0).getPatient().setEsrdNumber(ptEsrdNumber); |
|||
patientService.updateById(parameterList.get(0).getPatient()); |
|||
} |
|||
} |
|||
if (patient3 == null) { |
|||
parameterList.get(0).getPatient().setHospitalId(parameterList.get(0).getGroupHospitalId()); |
|||
result = patientService.insert(parameterList.get(0).getPatient()); |
|||
if (result == true) { |
|||
ptEsrdNumber = StringUtils.isNotEmpty(ptEsrdNumber) ? ptEsrdNumber |
|||
: "yd10" + parameterList.get(0).getPatient().getId(); |
|||
parameterList.get(0).getPatient().setEsrdNumber(ptEsrdNumber); |
|||
patientService.updateById(parameterList.get(0).getPatient()); |
|||
} |
|||
} |
|||
}else{ |
|||
ptEsrdNumber=patient2.getEsrdNumber(); |
|||
} |
|||
// 远程会诊/his
|
|||
System.out.println(parameterList.get(0).getApplyConsultation().toString()); |
|||
if (parameterList.get(0).getApplyConsultation() != null) { |
|||
parameterList.get(0).getApplyConsultation().get(0).setEsrdNumber(ptEsrdNumber); |
|||
parameterList.get(0).getApplyConsultation().get(0).setCode(code); |
|||
result = applyConsultationService.insert(parameterList.get(0).getApplyConsultation().get(0)); |
|||
if(result==true && !parameterList.get(0).getApplyConsultation().get(0).getAciList().isEmpty()){ |
|||
id = parameterList.get(0).getApplyConsultation().get(0).getId(); |
|||
for (int i = 0; i < parameterList.get(0).getApplyConsultation().get(0).getAciList().size(); i++) { |
|||
parameterList.get(0).getApplyConsultation().get(0).getAciList().get(i).setConId(id); |
|||
} |
|||
applyConsultationImgService.insertBatch(parameterList.get(0).getApplyConsultation().get(0).getAciList()); |
|||
|
|||
} |
|||
} |
|||
// lis
|
|||
if (parameterList.get(0).getApplyLis() != null) { |
|||
parameterList.get(0).getApplyLis().setEsrdNumber(ptEsrdNumber); |
|||
parameterList.get(0).getApplyLis().setCode(code); |
|||
result = applyLisService.insert(parameterList.get(0).getApplyLis()); |
|||
} |
|||
// 影像
|
|||
if (!parameterList.get(0).getApList().isEmpty()) { |
|||
for (int i = 0; i < parameterList.get(0).getApList().size(); i++) { |
|||
parameterList.get(0).getApList().get(i).setEsrdNumber(ptEsrdNumber); |
|||
parameterList.get(0).getApList().get(i).setCode(code); |
|||
result = applyPathologyService.insert(parameterList.get(0).getApList().get(i)); |
|||
if (result == true && !parameterList.get(0).getApList().get(i).getAphImgList().isEmpty()) { |
|||
id = parameterList.get(0).getApList().get(i).getId(); |
|||
for (int j = 0; j < parameterList.get(0).getApList().get(i).getAphImgList().size(); j++) { |
|||
parameterList.get(0).getApList().get(i).getAphImgList().get(j).setCode(code); |
|||
parameterList.get(0).getApList().get(i).getAphImgList().get(j).setpId(id); |
|||
} |
|||
applyPathologyImgService.insertBatch(parameterList.get(0).getApList().get(i).getAphImgList()); |
|||
} |
|||
} |
|||
} |
|||
// 心电
|
|||
if (!parameterList.get(0).getEcgList().isEmpty()) { |
|||
parameterList.get(0).getEcgList().get(0).setEsrdNumber(ptEsrdNumber); |
|||
parameterList.get(0).getEcgList().get(0).setCode(code); |
|||
result = applyEcgService.insert(parameterList.get(0).getEcgList().get(0)); |
|||
if (result == true && parameterList.get(0).getEcgList().get(0).getEcgImgList() != null) |
|||
id = parameterList.get(0).getEcgList().get(0).getId(); |
|||
for (int i = 0; i < parameterList.get(0).getEcgList().get(0).getEcgImgList().size(); i++) { |
|||
parameterList.get(0).getEcgList().get(0).getEcgImgList().get(i).seteId(id); |
|||
} |
|||
List<ApplyEcgImg> ecgImgList = parameterList.get(0).getEcgList().get(0).getEcgImgList(); |
|||
if (ecgImgList != null) { |
|||
result =applyEcgImgService.insertBatch(ecgImgList); |
|||
} |
|||
} |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
|
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
@RequestMapping("selectApply") |
|||
public Map<String, Object> selectApply() { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
List<ApplyConsultationImg> aciList=new ArrayList<ApplyConsultationImg>(); |
|||
ApplyConsultationImg aci=new ApplyConsultationImg(); |
|||
aci.setConId(1L); |
|||
aci.setImgUrl("ur///////"); |
|||
aciList.add(aci); |
|||
List<ApplyConsultation> acList=new ArrayList<ApplyConsultation>(); |
|||
ApplyConsultation ac=new ApplyConsultation(); |
|||
ac.setAge(22); |
|||
ac.setAciList(aciList); |
|||
acList.add(ac); |
|||
|
|||
|
|||
|
|||
List<ApplyEcgImg> ecgImgList=new ArrayList<ApplyEcgImg>(); |
|||
ApplyEcgImg ecgImg=new ApplyEcgImg(); |
|||
ecgImg.seteId(1L); |
|||
ecgImg.setImgUrl("11111"); |
|||
ecgImgList.add(ecgImg); |
|||
|
|||
List<ApplyEcg> ecgList=new ArrayList<ApplyEcg>(); |
|||
ApplyEcg ae=new ApplyEcg(); |
|||
ae.setAge(22); |
|||
ae.setEcgImgList(ecgImgList); |
|||
ecgList.add(ae); |
|||
|
|||
List<ApplyPathologyImg> apImgList=new ArrayList<ApplyPathologyImg>(); |
|||
ApplyPathologyImg img=new ApplyPathologyImg(); |
|||
img.setId(32L); |
|||
apImgList.add(img); |
|||
|
|||
ApplyPathology ap=new ApplyPathology(); |
|||
ap.setAge(233); |
|||
ap.setAphImgList(apImgList); |
|||
List<ApplyPathology> apList=new ArrayList<ApplyPathology>(); |
|||
apList.add(ap); |
|||
|
|||
|
|||
ApplyParameter applyParameter=new ApplyParameter(acList, new ApplyLis(), apList, |
|||
ecgList, new Patient(),"1", "2", "3", "4"); |
|||
try { |
|||
JSONObject json = JSONObject.fromObject(applyParameter);//将java对象转换为json对象
|
|||
//String str = json.toString();//将json对象转换为字符串
|
|||
//map.put("apply",str);
|
|||
map.put("applyParameter",applyParameter); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 分配专家 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("insertApplySpecialist") |
|||
public Map<String, Object> insertApplySpecialist(@RequestBody List<ApplySpecialist> asList) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
List<ApplySpecialist> aspList=new ArrayList<ApplySpecialist>(); |
|||
EntityWrapper<ApplySpecialist> wrapper=new EntityWrapper<ApplySpecialist>(); |
|||
Integer speNumber=1; |
|||
EntityWrapper<ApplyConsultation> wrapper1=new EntityWrapper<ApplyConsultation>(); |
|||
EntityWrapper<ApplyLis> wrapper2=new EntityWrapper<ApplyLis>(); |
|||
EntityWrapper<ApplyEcg> wrapper3=new EntityWrapper<ApplyEcg>(); |
|||
ApplyConsultation con=new ApplyConsultation(); |
|||
ApplyLis lis=new ApplyLis(); |
|||
ApplyEcg ecg=new ApplyEcg(); |
|||
ApplyPathology pathology=new ApplyPathology(); |
|||
List<ApplyPathology> apList=new ArrayList<ApplyPathology>(); |
|||
String code=""; |
|||
try { |
|||
if(!asList.isEmpty() && StringUtils.isNotEmpty(asList.get(0).getCode())){ |
|||
code=asList.get(0).getCode(); |
|||
if(asList.get(0).getSpeNumber()!=null){ |
|||
//获取分配专家的个数
|
|||
wrapper.eq("code",code).ne("state", "80"); |
|||
aspList=applySpecialistService.selectList(wrapper); |
|||
if(aspList.size()>0){ |
|||
speNumber=2; |
|||
} |
|||
} |
|||
boolean result = applySpecialistService.insertBatch(asList); |
|||
if(result == true){ |
|||
if(speNumber==2){ |
|||
map.put("code", code); |
|||
aspList=applySpecialistService.selectByMap(map); |
|||
for (int i = 0; i < aspList.size(); i++) { |
|||
aspList.get(i).setSpeNumber(2); |
|||
applySpecialistService.updateById(aspList.get(i)); |
|||
} |
|||
//修改总状态
|
|||
wrapper1.eq("code",code); |
|||
wrapper2.eq("code",code); |
|||
wrapper3.eq("code",code); |
|||
con.setStatus("30"); |
|||
lis.setStatus("30"); |
|||
ecg.setStatus("30"); |
|||
|
|||
applyConsultationService.update(con, wrapper1); |
|||
applyLisService.update(lis, wrapper2); |
|||
applyEcgService.update(ecg, wrapper3); |
|||
apList=applyPathologyService.selectByMap(map); |
|||
for (int i = 0; i < apList.size(); i++) { |
|||
pathology.setId(apList.get(i).getId()); |
|||
pathology.setStatus("30"); |
|||
applyPathologyService.updateById(pathology); |
|||
} |
|||
|
|||
} |
|||
map.put("msg","1"); |
|||
}else{ |
|||
map.put("msg","2"); |
|||
} |
|||
}else{ |
|||
map.put("msg","3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 专家修改状态 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("updateSpecialist") |
|||
public Map<String, Object> updateSpecialist(ApplySpecialist as) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|||
Date date=new Date(); |
|||
EntityWrapper<ApplySpecialist> wrapper=new EntityWrapper<ApplySpecialist>(); |
|||
String status = ""; |
|||
EntityWrapper<ApplyConsultation> wrapper1=new EntityWrapper<ApplyConsultation>(); |
|||
EntityWrapper<ApplyLis> wrapper2=new EntityWrapper<ApplyLis>(); |
|||
EntityWrapper<ApplyEcg> wrapper3=new EntityWrapper<ApplyEcg>(); |
|||
ApplyConsultation con=new ApplyConsultation(); |
|||
ApplyLis lis=new ApplyLis(); |
|||
ApplyEcg ecg=new ApplyEcg(); |
|||
ApplyPathology pathology=new ApplyPathology(); |
|||
List<ApplyPathology> apList=new ArrayList<ApplyPathology>(); |
|||
String code=""; |
|||
try { |
|||
if(as!=null && StringUtils.isNotEmpty(as.getCode())){ |
|||
code=as.getCode(); |
|||
as.setUpdateTime(dateFormat.parse(dateFormat.format(date))); |
|||
wrapper.eq("spe_id", as.getSpeId()).eq("code", code); |
|||
boolean result = applySpecialistService.update(as, wrapper); |
|||
if(result == true){ |
|||
map.put("code", code); |
|||
List<ApplySpecialist> accList=applySpecialistService.selectByMap(map); |
|||
if(!accList.isEmpty()){ |
|||
int speNumber=accList.get(0).getSpeNumber(); |
|||
// 分组
|
|||
Map<Integer, Long> collect=accList.stream().collect(Collectors.groupingBy(ApplySpecialist::getState,Collectors.counting())); |
|||
int sum30=collect.get(30)!=null?collect.get(30).intValue():0; |
|||
int sum40=collect.get(40)!=null?collect.get(40).intValue():0; |
|||
int sum80=collect.get(80)!=null?collect.get(80).intValue():0; |
|||
// 状态20 30 40 50 60 70 待分配专家、待专家接收、已接收、本医院撤销、上级医院撤销 、已结束
|
|||
// 状态 30 40 50 60 70 80待专家接收、已接收、本医院撤销、上级医院撤销 、已结束 拒接
|
|||
|
|||
//全部同意则总状态改为
|
|||
if(speNumber==1){ |
|||
if(sum40!=0){ |
|||
status="40"; |
|||
}else if(sum30!=0){ |
|||
status="30"; |
|||
}else if(sum80!=0 && sum40==0 && sum30==0){ |
|||
status="20"; |
|||
} |
|||
}else if(speNumber==2){ |
|||
if(sum40!=0 && sum40==2){ |
|||
status="40"; |
|||
}else if(sum40<2 && sum30!=0){ |
|||
status="30"; |
|||
}else if(sum40<2 && sum30==0 && sum80!=0){ |
|||
status="20"; |
|||
} |
|||
} |
|||
} |
|||
if(StringUtils.isNotEmpty(status)){ |
|||
//修改总状态
|
|||
wrapper1.eq("code",code); |
|||
wrapper2.eq("code",code); |
|||
wrapper3.eq("code",code); |
|||
con.setStatus(status); |
|||
lis.setStatus(status); |
|||
ecg.setStatus(status); |
|||
pathology.setStatus(status); |
|||
applyConsultationService.update(con, wrapper1); |
|||
applyLisService.update(lis, wrapper2); |
|||
applyEcgService.update(ecg, wrapper3); |
|||
|
|||
apList=applyPathologyService.selectByMap(map); |
|||
for (int i = 0; i < apList.size(); i++) { |
|||
pathology.setId(apList.get(i).getId()); |
|||
pathology.setStatus(status); |
|||
applyPathologyService.updateById(pathology); |
|||
} |
|||
} |
|||
map.put("msg","1"); |
|||
}else{ |
|||
map.put("msg","2"); |
|||
} |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 会诊查看详情 |
|||
*/ |
|||
@RequestMapping("selectConsultationByCode") |
|||
public Map<String, Object> selectConsultationByCode(Long id,Integer status,Long speId) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
String docPhone=""; |
|||
String contactPhone=""; |
|||
StringBuffer sctPhone=new StringBuffer(); |
|||
StringBuffer sctName=new StringBuffer(); |
|||
StringBuffer sctState=new StringBuffer(); |
|||
ApplyInformation applyInformation=new ApplyInformation(); |
|||
try { |
|||
if(id!=null){ |
|||
ApplyConsultation applyConsultation = applyConsultationService.selectById(id); |
|||
if (applyConsultation != null) { |
|||
applyInformation = applyInformationService |
|||
.selectById(applyConsultation.getCategoryHospitalId());// 所属医院
|
|||
applyConsultation.setCategoryHospital(applyInformation.getHospitalName()); |
|||
applyInformation = applyInformationService |
|||
.selectById(applyConsultation.getGroupHospitalId());// 会诊医院
|
|||
applyConsultation.setGroupHospital(applyInformation.getHospitalName()); |
|||
|
|||
User user=new User(); |
|||
if(applyConsultation.getDocId()!=null){ |
|||
user=userService.selectById(applyConsultation.getDocId()); |
|||
if(user!=null){ |
|||
docPhone=user.getPhone(); |
|||
contactPhone=user.getContactPhone(); |
|||
} |
|||
} |
|||
|
|||
//管理医院显示专家状态
|
|||
EntityWrapper<ApplySpecialist> wrapper2 = new EntityWrapper<ApplySpecialist>(); |
|||
wrapper2.eq("code", applyConsultation.getCode()).ne("state", "80"); |
|||
List<ApplySpecialist> accsList=applySpecialistService.selectList(wrapper2); |
|||
for (int i = 0; i < accsList.size(); i++) { |
|||
user=userService.selectById(accsList.get(i).getSpeId()); |
|||
if(user!=null){ |
|||
//专家显示自己当前的状态
|
|||
if(speId!=null && accsList.get(i).getSpeId().equals(speId)){ |
|||
applyConsultation.setStatus(String.valueOf(accsList.get(i).getState())); |
|||
} |
|||
sctPhone=sctPhone.append(user.getPhone()+","); |
|||
sctName=sctName.append(user.getUserName()+","); |
|||
sctState=sctState.append(accsList.get(i).getState()+","); |
|||
} |
|||
} |
|||
//专家现在本人自己状态
|
|||
if(speId!=null){ |
|||
EntityWrapper<ApplySpecialist> wrapper3 = new EntityWrapper<ApplySpecialist>(); |
|||
wrapper3.eq("code", applyConsultation.getCode()).eq("spe_id", speId); |
|||
ApplySpecialist accs=applySpecialistService.selectOne(wrapper3); |
|||
if(accs!=null){ |
|||
applyConsultation.setStatus(String.valueOf(accs.getState())); |
|||
} |
|||
} |
|||
} |
|||
map.put("applyConsultation", applyConsultation); |
|||
map.put("docPhone", docPhone);//医生账号
|
|||
map.put("contactPhone", contactPhone);//医生联系电话
|
|||
map.put("sctPhone", sctPhone.length()>0?sctPhone.substring(0,sctPhone.length() - 1):"");//专家账号
|
|||
map.put("sctName", sctName.length()>0?sctName.substring(0,sctName.length() - 1):"");//专家姓名
|
|||
map.put("sctState",sctState.length()>0?sctState.substring(0,sctState.length() - 1):"");//专家姓名
|
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 心电查看详情 |
|||
*/ |
|||
@RequestMapping("selectEcgByCode") |
|||
public Map<String, Object> selectEcgByCode(String code) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyEcg> ecgWrapper = new EntityWrapper<ApplyEcg>(); |
|||
List<ApplyEcgImg> imgList=new ArrayList<ApplyEcgImg>(); |
|||
try { |
|||
if(StringUtils.isNotEmpty(code)){ |
|||
ecgWrapper.eq("code", code); |
|||
ApplyEcg applyEcg = applyEcgService.selectOne(ecgWrapper); |
|||
if (applyEcg != null) { |
|||
map.put("e_id", applyEcg.getId()); |
|||
imgList = applyEcgImgService.selectByMap(map); |
|||
} |
|||
map.put("imgList", imgList); |
|||
map.put("applyEcg", applyEcg); |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* lis查看详情 |
|||
*/ |
|||
@RequestMapping("selectLisByCode") |
|||
public Map<String, Object> selectLisByCode(String code) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyLis> lisWrapper = new EntityWrapper<ApplyLis>(); |
|||
try { |
|||
if(StringUtils.isNotEmpty(code)){ |
|||
lisWrapper.eq("code", code); |
|||
ApplyLis applyLis = applyLisService.selectOne(lisWrapper); |
|||
map.put("applyLis", applyLis); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 影像查看详情 |
|||
*/ |
|||
@RequestMapping("selectPathologyByCode") |
|||
public Map<String, Object> selectPathologyByCode(String code) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
List<ApplyPathology> apList = new ArrayList<ApplyPathology>(); |
|||
List<ApplyPathologyImg> imgList=new ArrayList<ApplyPathologyImg>(); |
|||
//ApplyInformation applyInformation=new ApplyInformation();
|
|||
try { |
|||
if(StringUtils.isNotEmpty(code)){ |
|||
map.put("code", code); |
|||
apList = applyPathologyService.selectByMap(map); |
|||
if (!apList.isEmpty()) { |
|||
for (int i = 0; i < apList.size(); i++) { |
|||
map.clear(); |
|||
map.put("p_id", apList.get(i).getId()); |
|||
imgList = applyPathologyImgService.selectByMap(map); |
|||
apList.get(i).setAphImgList(imgList); |
|||
|
|||
} |
|||
|
|||
} |
|||
map.put("apList", apList); |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 上传影像文件 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("insertPathologyFile") |
|||
public Map<String, Object> insertPathologyFile(@RequestBody List<ApplyPathologyFile> apfList) { |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
boolean result=false; |
|||
try { |
|||
if(apfList.isEmpty()){ |
|||
map.put("msg", "3"); |
|||
}else{ |
|||
for (int i = 0; i < apfList.size(); i++) { |
|||
result=applyPathologyFileService.insert(apfList.get(i)); |
|||
} |
|||
map.put("msg", result==true?"1":"2"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 删除影像文件 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("deletePathologyFile") |
|||
public Map<String, Object> deletePathologyFile(Long id) { |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
boolean result=false; |
|||
try { |
|||
if(id==null){ |
|||
map.put("msg", "3"); |
|||
}else{ |
|||
result=applyPathologyFileService.deleteById(id); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,419 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.ApplyPathology; |
|||
import com.imurs.entity.ApplyPathologySpecialist; |
|||
import com.imurs.entity.ApplyInformation; |
|||
import com.imurs.entity.ApplyPathologyImg; |
|||
import com.imurs.entity.Patient; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.ApplyPathologyImgService; |
|||
import com.imurs.service.ApplyPathologyService; |
|||
import com.imurs.service.ApplyPathologySpecialistService; |
|||
import com.imurs.service.PatientService; |
|||
import com.imurs.util.page.Pagetion; |
|||
|
|||
/** |
|||
* 影像控制器 |
|||
* |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value = "icon") |
|||
public class ApplyPathologyContrller { |
|||
|
|||
@Autowired |
|||
ApplyPathologyService applyPathologyService; |
|||
|
|||
@Autowired |
|||
ApplyPathologyImgService applyPathologyImgService; |
|||
|
|||
@Autowired |
|||
ApplyPathologySpecialistService applyPathologySpecialistService; |
|||
|
|||
@Autowired |
|||
PatientService patientService; |
|||
|
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
|
|||
|
|||
/** |
|||
* 批量新增影像图片 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("insertAphImg") |
|||
public Map<String,Object> insertAphImg(@RequestBody List<ApplyPathologyImg> apImgList){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
boolean result=false; |
|||
try { |
|||
if(!apImgList.isEmpty() && apImgList.get(0)!=null){ |
|||
for (int i = 0; i < apImgList.size(); i++) { |
|||
result=applyPathologyImgService.insert(apImgList.get(i)); |
|||
} |
|||
map.put("msg", result==true?"1":"2"); |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 批量新增影像 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("insertAph") |
|||
public Map<String,Object> insertAph(@RequestBody List<ApplyPathology> aphList){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<Patient> wrapper=new EntityWrapper<Patient>(); |
|||
EntityWrapper<Patient> wrapper2=new EntityWrapper<Patient>(); |
|||
String ptEsrdNumber=""; |
|||
try { |
|||
if(!aphList.isEmpty() && aphList.get(0)!=null){ |
|||
//双向转诊数据
|
|||
boolean result=applyPathologyService.insert(aphList.get(0)); |
|||
if(result==true){ |
|||
map.put("msg", "1"); |
|||
|
|||
//第一次新增时患者表新增
|
|||
if(StringUtils.isNotEmpty(aphList.get(0).getHisEsrdNumber())){ |
|||
wrapper.eq("his_esrd_number", aphList.get(0).getHisEsrdNumber()); |
|||
wrapper2.eq("his_esrd_number", aphList.get(0).getHisEsrdNumber()); |
|||
}else{ |
|||
wrapper.eq("out_patien", aphList.get(0).getOutPatien()); |
|||
wrapper2.eq("out_patien", aphList.get(0).getOutPatien()); |
|||
} |
|||
|
|||
wrapper.eq("hospital_id", aphList.get(0).getCategoryHospitalId());; |
|||
Patient patient2=patientService.selectOne(wrapper); |
|||
|
|||
wrapper2.eq("hospital_id", aphList.get(0).getGroupHospitalId()); |
|||
Patient patient3=patientService.selectOne(wrapper); |
|||
|
|||
if(patient2==null || patient3==null){ |
|||
Patient patient=new Patient(); |
|||
if(StringUtils.isNotEmpty(aphList.get(0).getPtCard())){ |
|||
patient.setCard(aphList.get(0).getPtCard()); |
|||
//patient.setBirthDate(aphList.get(0).getPtCard().substring(6, 14));
|
|||
} |
|||
if(StringUtils.isNotEmpty(aphList.get(0).getSex())){ |
|||
patient.setSex(aphList.get(0).getSex()); |
|||
} |
|||
if(StringUtils.isNotEmpty(aphList.get(0).getPatientName())){ |
|||
patient.setPatientName(aphList.get(0).getPatientName()); |
|||
} |
|||
if(StringUtils.isNotEmpty(aphList.get(0).getHisEsrdNumber())){ |
|||
patient.setHisEsrdNumber(aphList.get(0).getHisEsrdNumber()); |
|||
} |
|||
if(StringUtils.isNotEmpty(aphList.get(0).getOutPatien())){ |
|||
patient.setOutPatien(aphList.get(0).getOutPatien()); |
|||
} |
|||
if(patient2==null){ |
|||
patient.setHospitalId(aphList.get(0).getCategoryHospitalId()); |
|||
result=patientService.insert(patient); |
|||
if(result==true){ |
|||
//yd:公司简称 01:远程会诊新增 02:双休转诊新增 03:B超/病理 04 心电 05影像
|
|||
ptEsrdNumber="yd05"+patient.getId(); |
|||
patient.setEsrdNumber(ptEsrdNumber); |
|||
patientService.updateById(patient); |
|||
} |
|||
|
|||
} |
|||
if(patient3==null){ |
|||
patient.setHospitalId(aphList.get(0).getGroupHospitalId()); |
|||
result=patientService.insert(patient); |
|||
if(result==true){ |
|||
ptEsrdNumber=StringUtils.isNotEmpty(ptEsrdNumber)?ptEsrdNumber:"yd05"+patient.getId(); |
|||
patient.setEsrdNumber(ptEsrdNumber); |
|||
patientService.updateById(patient); |
|||
} |
|||
} |
|||
}else{ |
|||
ptEsrdNumber=patient2.getEsrdNumber(); |
|||
} |
|||
|
|||
Long id=aphList.get(0).getId(); |
|||
aphList.get(0).setEsrdNumber(ptEsrdNumber); |
|||
applyPathologyService.updateById(aphList.get(0)); |
|||
|
|||
if(!aphList.get(0).getAphImgList().isEmpty()){ |
|||
for (int i = 0; i < aphList.get(0).getAphImgList().size(); i++) { |
|||
aphList.get(0).getAphImgList().get(i).setpId(id); |
|||
} |
|||
applyPathologyImgService.insertBatch(aphList.get(0).getAphImgList()); |
|||
} |
|||
}else{ |
|||
map.put("msg", "2"); |
|||
} |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@RequestMapping("updateAph") |
|||
public Map<String,Object> updateAph(ApplyPathology applyPathology){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=applyPathologyService.updateById(applyPathology); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("deleteAphById") |
|||
public Map<String,Object> deleteAphById(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=applyPathologyService.deleteById(id); |
|||
if(result==true){ |
|||
map.put("p_id", id); |
|||
applyPathologyImgService.deleteByMap(map); |
|||
map.clear(); |
|||
map.put("msg", "1"); |
|||
}else{ |
|||
map.put("msg", "2"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查询 |
|||
*/ |
|||
@RequestMapping("selectAphById") |
|||
public Map<String,Object> selectAphById(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
ApplyPathology applyPathology=new ApplyPathology(); |
|||
List<ApplyPathologyImg> aphImgList=new ArrayList<ApplyPathologyImg>(); |
|||
EntityWrapper<ApplyInformation> wrapper=new EntityWrapper<ApplyInformation>(); |
|||
EntityWrapper<ApplyPathologySpecialist> wrapper2=new EntityWrapper<ApplyPathologySpecialist>(); |
|||
try { |
|||
applyPathology=applyPathologyService.selectById(id); |
|||
if(applyPathology!=null){ |
|||
//查看分配专家
|
|||
wrapper2.eq("p_id",id).ne("state","80"); |
|||
ApplyPathologySpecialist aphSp=applyPathologySpecialistService.selectOne(wrapper2); |
|||
if(aphSp!=null){ |
|||
applyPathology.setSpecialist(aphSp.getSpeName()); |
|||
applyPathology.setSpecialistId(aphSp.getSpeId()); |
|||
} |
|||
|
|||
//查看医院名字
|
|||
wrapper.eq("id", applyPathology.getCategoryHospitalId()).or().eq("id", applyPathology.getGroupHospitalId()); |
|||
List<ApplyInformation> aifList=applyInformationService.selectList(wrapper); |
|||
if(!aifList.isEmpty()){ |
|||
for (int i = 0; i < aifList.size(); i++) { |
|||
if(aifList.get(i).getId().equals(applyPathology.getCategoryHospitalId())){ |
|||
applyPathology.setCategoryHospital(aifList.get(i).getHospitalName()); |
|||
} |
|||
if(aifList.get(i).getId().equals(applyPathology.getGroupHospitalId())){ |
|||
applyPathology.setGroupHospital(aifList.get(i).getHospitalName()); |
|||
} |
|||
} |
|||
} |
|||
map.put("p_id", id); |
|||
aphImgList=applyPathologyImgService.selectByMap(map); |
|||
} |
|||
map.put("applyPathology", applyPathology); |
|||
map.put("aphImgList", aphImgList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 管理医院影像列表 |
|||
*/ |
|||
@RequestMapping("selectAphPage") |
|||
public Map<String,Object> selectAphPage(String categoryHospitalId,String groupHospitalId,String startTime, |
|||
String endTime,String patientName,Integer pageNo,Integer pageSize,Integer type,String part,Long docId,Integer cureType,String diagnosisType){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
map.put("categoryHospitalId", categoryHospitalId); |
|||
map.put("groupHospitalId", groupHospitalId); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("patientName", patientName); |
|||
map.put("type", type); |
|||
map.put("part", part); |
|||
map.put("docId", docId); |
|||
pageNo=pageNo==null?1:pageNo; |
|||
pageSize=pageSize==null?10:pageSize; |
|||
try { |
|||
Pagetion<ApplyPathology> pagetion = applyPathologyService.selectAphPage(map, pageNo, pageSize); |
|||
map.clear(); |
|||
if(pagetion!=null){ |
|||
ApplyPathologySpecialist aphSp=new ApplyPathologySpecialist(); |
|||
for (int i = 0; i < pagetion.getList().size(); i++) { |
|||
EntityWrapper<ApplyPathologySpecialist> wrapper=new EntityWrapper<ApplyPathologySpecialist>(); |
|||
//查看分配专家
|
|||
wrapper.eq("p_id", pagetion.getList().get(i).getId()).ne("state","80"); |
|||
aphSp=applyPathologySpecialistService.selectOne(wrapper); |
|||
if(aphSp!=null){ |
|||
pagetion.getList().get(i).setSpecialist(aphSp.getSpeName()); |
|||
pagetion.getList().get(i).setSpecialistId(aphSp.getSpeId()); |
|||
} |
|||
} |
|||
} |
|||
map.put("pagetion", pagetion); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("categoryHospitalId"); |
|||
map.remove("groupHospitalId"); |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("patientName"); |
|||
map.remove("type"); |
|||
map.remove("part"); |
|||
map.remove("docId"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 分配专家 |
|||
*/ |
|||
@RequestMapping("insertAphSpecialist") |
|||
public Map<String, Object> insertAphSpecialist(ApplyPathologySpecialist aphSp) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = applyPathologySpecialistService.insert(aphSp); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 专家修改状态 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("updateAphSpecialist") |
|||
public Map<String, Object> updateAphSpecialist(ApplyPathologySpecialist aphSp) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|||
Date date=new Date(); |
|||
EntityWrapper<ApplyPathologySpecialist> wrapper=new EntityWrapper<ApplyPathologySpecialist>(); |
|||
String status = ""; |
|||
try { |
|||
if(aphSp!=null){ |
|||
aphSp.setUpdateTime(dateFormat.parse(dateFormat.format(date))); |
|||
wrapper.eq("spe_id", aphSp.getSpeId()).eq("p_id", aphSp.getpId()); |
|||
boolean result = applyPathologySpecialistService.update(aphSp, wrapper); |
|||
if(result == true){ |
|||
map.put("p_id", aphSp.getpId()); |
|||
List<ApplyPathologySpecialist> accList=applyPathologySpecialistService.selectByMap(map); |
|||
if(!accList.isEmpty()){ |
|||
// 分组
|
|||
Map<Integer, Long> collect=accList.stream().collect(Collectors.groupingBy(ApplyPathologySpecialist::getState,Collectors.counting())); |
|||
int sum30=collect.get(30)!=null?collect.get(30).intValue():0; |
|||
int sum40=collect.get(40)!=null?collect.get(40).intValue():0; |
|||
int sum80=collect.get(80)!=null?collect.get(80).intValue():0; |
|||
// 状态20 30 40 50 60 70 待分配专家、待专家接收、已接收、本医院撤销、上级医院撤销 、已结束
|
|||
// 状态 30 40 50 60 70 80待专家接收、已接收、本医院撤销、上级医院撤销 、已结束 拒接
|
|||
|
|||
//全部同意则总状态改为
|
|||
if(sum40!=0){ |
|||
status="40"; |
|||
}else if(sum30!=0){ |
|||
status="30"; |
|||
}else if(sum80!=0 && sum40==0 && sum30==0){ |
|||
status="20"; |
|||
} |
|||
} |
|||
if(StringUtils.isNotEmpty(status)){ |
|||
ApplyPathology ap=new ApplyPathology(); |
|||
ap.setStatus(status); |
|||
ap.setId(aphSp.getpId()); |
|||
applyPathologyService.updateById(ap); |
|||
} |
|||
map.put("msg","1"); |
|||
}else{ |
|||
map.put("msg","2"); |
|||
} |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 专家影像 |
|||
*/ |
|||
@RequestMapping("selectAphSpePage") |
|||
public Map<String, Object> selectAphSpePage(Integer pageNo, Integer pageSize, String patientName, |
|||
String startTime, String endTime, String specialistId,Integer part,Integer type) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
pageNo = pageNo == null ? 1 : pageNo; |
|||
pageSize = pageSize == null ? 10 : pageSize; |
|||
map.put("patientName", patientName); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("specialistId",specialistId); |
|||
map.put("part",part); |
|||
map.put("type",type); |
|||
try { |
|||
Pagetion<ApplyPathology> pagetion = applyPathologyService.selectAphSpePage(map, pageNo, pageSize); |
|||
map.put("pagetion", pagetion); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("patientName"); |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("specialistId"); |
|||
map.remove("part"); |
|||
map.remove("type"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,281 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import com.imurs.entity.ApplyBModeImg; |
|||
import com.imurs.entity.BModeHistory; |
|||
import com.imurs.entity.BModeReport; |
|||
import com.imurs.service.ApplyBModeImgService; |
|||
import com.imurs.service.BModeHistoryService; |
|||
import com.imurs.service.BModeReportService; |
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.util.CollectionUtils; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.*; |
|||
|
|||
/** |
|||
* @author laier |
|||
* @date 2022-12-05 10:01 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("report") |
|||
public class BModeReportController { |
|||
Logger logger = LoggerFactory.getLogger(BModeReportController.class); |
|||
|
|||
@Autowired |
|||
BModeReportService bModeReportService; |
|||
@Autowired |
|||
ApplyBModeImgService applyBModeImgService; |
|||
@Autowired |
|||
BModeHistoryService bModeHistoryService; |
|||
/** |
|||
* 基层批量新增超声报告,并修改病例状态为待审核报告 |
|||
* @param modeReports |
|||
* @return |
|||
*/ |
|||
@PostMapping("insertModeReportList") |
|||
public Map<String, Object> insertModeReportList(@RequestBody List<BModeReport> modeReports) { |
|||
Map<String, Object> resultMap = new HashMap<>(8); |
|||
try { |
|||
if (!CollectionUtils.isEmpty(modeReports)) { |
|||
// 同一个病例的报告,bId一致
|
|||
Long bId = modeReports.get(0).getbId(); |
|||
List<BModeReport> resultReports = bModeReportService.insertModeReportList(bId,modeReports); |
|||
if (resultReports == null) { |
|||
resultMap.put("msg","2"); |
|||
} |
|||
resultMap.put("msg","1"); |
|||
resultMap.put("resultReports",resultReports); |
|||
} else { |
|||
resultMap.put("msg","2"); |
|||
} |
|||
} catch (Exception e) { |
|||
logger.error("基层批量新增超声报告异常:",e); |
|||
resultMap.put("msg","4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
// /**
|
|||
// * 专家提交报告,省略审核流程,提交即为完成报告,修改状态,增加签名等
|
|||
// * @param modeReports 报告列表
|
|||
// * @return resultMap
|
|||
// */
|
|||
// @RequestMapping("insertReportBySpecialist")
|
|||
// public Map<String, Object> insertReportBySpecialist(@RequestBody List<BModeReport> modeReports) {
|
|||
// Map<String, Object> resultMap = new HashMap<>(8);
|
|||
// if (!CollectionUtils.isEmpty(modeReports)) {
|
|||
// try {
|
|||
// // 同一个病例的报告,bId一致
|
|||
// Long bId = modeReports.get(0).getbId();
|
|||
// Long speId = modeReports.get(0).getSpeId();
|
|||
// // 新增报告
|
|||
// List<BModeReport> resultReports = bModeReportService.insertModeReportList(bId,modeReports);
|
|||
// // 修改报告状态、病例状态、新增专家签名
|
|||
// resultReports = bModeReportService.finishModeReport(bId,speId,resultReports);
|
|||
// if (resultReports == null) {
|
|||
// resultMap.put("msg","2");
|
|||
// }
|
|||
// resultMap.put("msg","1");
|
|||
// resultMap.put("resultReports",resultReports);
|
|||
// } catch (Exception e) {
|
|||
// logger.error("专家批量新增超声报告异常:",e);
|
|||
// resultMap.put("msg","4");
|
|||
// }
|
|||
// } else {
|
|||
// resultMap.put("msg","2");
|
|||
// }
|
|||
// return resultMap;
|
|||
// }
|
|||
|
|||
/** |
|||
* 根据bId查询报告列表 |
|||
* @param bId 报告所属病例id |
|||
* @return |
|||
*/ |
|||
@GetMapping("selectModeReportListByBId") |
|||
public Map<String, Object> selectModeReportList(Long bId) { |
|||
Map<String, Object> resultMap = new HashMap<>(8); |
|||
try { |
|||
List<BModeReport> modeReportList = bModeReportService.selectModeReportListByBId(bId); |
|||
resultMap.put("msg","1"); |
|||
resultMap.put("modeReportList",modeReportList); |
|||
} catch (Exception e) { |
|||
logger.error("查询超声报告异常:",e); |
|||
resultMap.put("msg","4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
/** |
|||
* 根据报告id查询报告详情 |
|||
* @param reportId 报告id |
|||
* @return |
|||
*/ |
|||
@GetMapping("selectModeReportByReportId") |
|||
public Map<String, Object> selectModeReportByReportId(Long reportId) { |
|||
Map<String, Object> resultMap = new HashMap<>(8); |
|||
List<ApplyBModeImg> bModeImgList = new ArrayList<>(); |
|||
try { |
|||
BModeReport modeReport = bModeReportService.selectModeReportByReportId(reportId); |
|||
if (!StringUtils.isEmpty(modeReport.getImageIds())) { |
|||
String[] split = modeReport.getImageIds().split(","); |
|||
bModeImgList = applyBModeImgService.selectBatchIds(Arrays.asList(split)); |
|||
} |
|||
resultMap.put("msg","1"); |
|||
resultMap.put("modeReport",modeReport); |
|||
resultMap.put("bModeImgList",bModeImgList); |
|||
} catch (Exception e) { |
|||
logger.error("查询报告详情异常:",e); |
|||
resultMap.put("msg","4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
/** |
|||
* 根据id删除超声报告 |
|||
* @param reportId 报告id |
|||
* @return |
|||
*/ |
|||
@RequestMapping("deleteReportById") |
|||
public Map<String, Object> deleteReportById(Long reportId) { |
|||
Map<String, Object> resultMap = new HashMap<>(8); |
|||
try { |
|||
bModeReportService.deleteById(reportId); |
|||
resultMap.put("msg","1"); |
|||
} catch (Exception e) { |
|||
logger.error("删除超声报告异常:",e); |
|||
resultMap.put("msg","4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
/** |
|||
* 基层医生修改超声报告 |
|||
* @param modeReport |
|||
* @return |
|||
*/ |
|||
@PostMapping("updateModeReportByReportId") |
|||
public Map<String, Object> updateModeReportByReportId(@RequestBody BModeReport modeReport) { |
|||
Map<String, Object> resultMap = new HashMap<>(8); |
|||
try { |
|||
// 图片id由list转string
|
|||
if (!CollectionUtils.isEmpty(modeReport.getImageIdList())) { |
|||
String imageIds = StringUtils.join(modeReport.getImageIdList(), ","); |
|||
modeReport.setImageIds(imageIds); |
|||
} |
|||
bModeReportService.updateById(modeReport); |
|||
resultMap.put("msg","1"); |
|||
} catch (Exception e) { |
|||
logger.error("基层医生修改超声报告异常:",e); |
|||
resultMap.put("msg","4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
/** |
|||
* 专家审核报告,判断该病例所有病例是否审核完毕,是则改变病例状态,会诊状态以及专家表状态。 |
|||
* @param modeReport |
|||
* @return |
|||
*/ |
|||
@PostMapping("checkReportBySpecialist") |
|||
public Map<String, Object> checkRepostBySpecialist(@RequestBody BModeReport modeReport) { |
|||
Map<String, Object> resultMap = new HashMap<>(8); |
|||
try { |
|||
bModeReportService.checkReportAndChangeModelState(modeReport); |
|||
resultMap.put("msg","1"); |
|||
} catch (Exception e) { |
|||
logger.error("专家审核报告异常",e); |
|||
resultMap.put("msg","4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
//主表存储当前最新记录。
|
|||
//历史表存储所有历史记录,每次更新都会生成一条新历史记录
|
|||
//
|
|||
@RequestMapping(value="UpdateAndSaveHisBmodeReport") |
|||
// @PostMapping("UpdateAndSaveHisBmodeReport")
|
|||
public Map<String, Object> UpdateAndSaveBmodeReport(BModeReport modeReport) { |
|||
Map<String, Object> resultMap = new HashMap<>(8); |
|||
try { |
|||
//第一步存历史记录 一个是病例id 一个是表主键ID ,那修改的时候,是应该按主键id的 病例ID 有可能是多张报告,不清楚是不是
|
|||
//多张一起修改的,所以我默认它是一张张修改保存的
|
|||
BModeReport oldBmodeRe=bModeReportService.selectModeReportByReportId(modeReport.getId()); |
|||
//查到这个数据以后 把这份数据存进去
|
|||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss"); |
|||
Date updateTime = dateFormat.parse(dateFormat.format(new Date())); |
|||
BModeHistory bH =new BModeHistory(); |
|||
bH.setbId(oldBmodeRe.getbId()); |
|||
bH.setbHint(oldBmodeRe.getbHint()); |
|||
bH.setbSee(oldBmodeRe.getbSee()); |
|||
//bH.setCriticalValue(oldBmodeRe.getCriticalValue());
|
|||
bH.setUpdateTime(oldBmodeRe.getUpdateTime()); |
|||
bH.setReportId(oldBmodeRe.getId()); |
|||
bH.setExaminePart(oldBmodeRe.getExaminePart()); |
|||
bH.setSpeId(oldBmodeRe.getSpeId()); |
|||
bH.setNature(oldBmodeRe.getNature()); |
|||
//System.out.println("报告医生"+oldBmodeRe.getUpdateDoc()+modeReport.getId());
|
|||
bH.setUpdateDoc(oldBmodeRe.getUpdateDoc()); |
|||
bH.setUpdateTime(oldBmodeRe.getUpdateTime()); |
|||
//System.out.println("报告时间"+oldBmodeRe.getUpdateTime()+modeReport.getId());
|
|||
//System.out.println("参数"+updateDoc+"---"+oldBmodeRe.getUpdateTime());
|
|||
bH.setGroupDate(oldBmodeRe.getGroupDate()); |
|||
bH.setInitial(oldBmodeRe.getInitial()==null?"":oldBmodeRe.getInitial()); |
|||
bH.setOpinion(oldBmodeRe.getOpinion()==null?"":oldBmodeRe.getOpinion()); |
|||
|
|||
bH.setImageIds(oldBmodeRe.getImageIds()==null?"":oldBmodeRe.getImageIds()); |
|||
/* |
|||
* if (!CollectionUtils.isEmpty(oldBmodeRe.getImageIds())) { String[] split = |
|||
* modeReport.getImageIds().split(","); |
|||
* |
|||
* String imageIds = StringUtils.join(oldBmodeRe.getImageIdList(), ","); |
|||
* System.out.println("图片字符串"+imageIds); bH.setImageIds(imageIds); } |
|||
*/ |
|||
|
|||
boolean issucess=bModeHistoryService.insert(bH); |
|||
if(!issucess) { |
|||
resultMap.put("msg","插入历史数据不成功"); |
|||
|
|||
} |
|||
//
|
|||
//根据id 把修改的记录存到主表去,
|
|||
if (!CollectionUtils.isEmpty(modeReport.getImageIdList())) { |
|||
String imageIds = StringUtils.join(modeReport.getImageIdList(), ","); |
|||
modeReport.setImageIds(imageIds); |
|||
} |
|||
modeReport.setUpdateTime(updateTime); |
|||
bModeReportService.updateById(modeReport); |
|||
resultMap.put("msg","1"); |
|||
} catch (Exception e) { |
|||
logger.error("更新报告异常",e); |
|||
resultMap.put("msg","4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
//根据报告id查询历史记录,
|
|||
|
|||
@PostMapping("selectModeHisReportListByBId") |
|||
public Map<String, Object> selectModeHisReportListByBId(Long bId,Long reportId) { |
|||
Map<String, Object> resultMap = new HashMap<>(8); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
// System.out.println(reportId+"查询所有"+bId);
|
|||
map.put("bId",bId); |
|||
map.put("reportId",reportId); |
|||
try { |
|||
List<BModeHistory> modeReportList = bModeHistoryService.selectBmodeHis(map); |
|||
/* |
|||
* for(BModeHistory b:modeReportList) { System.out.println("查看列表数据"+b); } |
|||
*/ |
|||
resultMap.put("msg","1"); |
|||
resultMap.put("modeReportList",modeReportList); |
|||
} catch (Exception e) { |
|||
logger.error("查询超声报告异常:",e); |
|||
e.printStackTrace(); |
|||
resultMap.put("msg","4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
} |
|||
@ -0,0 +1,82 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.alibaba.druid.support.json.JSONUtils; |
|||
import com.imurs.entity.ApplyInformation; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.MsgCode; |
|||
import com.imurs.util.note.ChuangLanSmsUtil; |
|||
|
|||
import net.sf.json.JSONObject; |
|||
|
|||
|
|||
/** |
|||
* 预约超声短信提示 |
|||
* |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/BmodeSendMsg") |
|||
public class BmodeSendMsgController { |
|||
|
|||
@Autowired |
|||
UserService userService; |
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
|
|||
@RequestMapping("/sendMsgYy") |
|||
public Map<String, Object> sendMsg(String hostName,String docName,Integer docId) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
User user = userService.selectById(docId); |
|||
String contactPhone = user.getContactPhone(); |
|||
map.put("phone", contactPhone); |
|||
map.put("msg",hostName+docName+"医生,您好!你方预约的远程超声检查即将开始,请尽快登陆系统"); |
|||
//调用创蓝接口发送短信
|
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
//Json格式化返回信息
|
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
|
|||
@RequestMapping("/sendMsg") |
|||
public Map<String, Object> sendMsg(String hostName,String docName,String patientName,Integer docId) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
User user = userService.selectById(docId); |
|||
String contactPhone = user.getContactPhone(); |
|||
map.put("phone", contactPhone); |
|||
map.put("msg","尊敬的"+docName+"医生,"+hostName+patientName+"患者预约的远程超声已经上线,请您及时登陆。"); |
|||
//调用创蓝接口发送短信
|
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
|
|||
//Json格式化返回信息
|
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,124 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
import com.imurs.entity.*; |
|||
import com.imurs.service.*; |
|||
import org.apache.poi.hssf.record.OldFormulaRecord; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.parameter.Bchao; |
|||
import com.imurs.parameter.Bchildren; |
|||
import com.imurs.parameter.Bmenu; |
|||
import com.imurs.parameter.Children; |
|||
import com.imurs.parameter.Items; |
|||
|
|||
@RestController |
|||
@RequestMapping(value = "Bscan") |
|||
public class BrightnessmodeController { |
|||
@Autowired |
|||
BmodelFrisService bmodelFrisService; |
|||
@Autowired |
|||
BmodelService bmodelService; |
|||
@Autowired |
|||
BmodelSecondService bmodelSecondService; |
|||
@Autowired |
|||
BdiagnosisService bDiagnosisService; |
|||
@Autowired |
|||
BdiagnosisNextService bDiagnosisNextService; |
|||
/** |
|||
* 查询所有B超模板数据 |
|||
*/ |
|||
@RequestMapping(value = "selectInforByRid") |
|||
public Map<String, Object> selectInforByRid(String rid) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
EntityWrapper<Bmodel> wrapper=new EntityWrapper<Bmodel>(); |
|||
//EntityWrapper<BmodelFris> wrapper1=new EntityWrapper<BmodelFris>();
|
|||
//EntityWrapper<BmodelSecondWithBLOBs> wrapper2=new EntityWrapper<BmodelSecondWithBLOBs>();
|
|||
List<Bmodel> bmodel=bmodelService.selectList(wrapper.orderBy("first_id",true)); |
|||
// System.out.println("长度"+bmodel.size()+bmodel.toString());
|
|||
//三次单独的查询,将每级的菜单数据分别保存出来
|
|||
List<Bchao> tree = new ArrayList<Bchao>(); |
|||
//
|
|||
for(Bmodel bm:bmodel){ |
|||
// m.put(bm.getId(), bm);
|
|||
//根据这个循环 查出对应ID的二级目录
|
|||
// wrapper1.eq("bf_id", bm.getId());
|
|||
// System.out.println("一级子菜单的ID"+bm.getId());
|
|||
//List<BmodelFris> bmodelFris=bmodelFrisService.selectList(wrapper1);
|
|||
List<BmodelFris> bmodelFris=bmodelFrisService.selectBmodelFris(bm.getId()); |
|||
Bchao bc =new Bchao(); |
|||
// System.out.println("查询到二级子菜单的内容"+bmodelFris.toString());
|
|||
List<Bchildren> li= new ArrayList<Bchildren>(); |
|||
bc.setName(bm.getFirstText()); |
|||
bc.setId(bm.getId()); |
|||
//二级菜单的数据保存
|
|||
for(BmodelFris bf:bmodelFris){ |
|||
Bchildren bd = new Bchildren(); |
|||
bd.setId(bf.getSecondId());//下一级的ID
|
|||
bd.setThird_text(bf.getSecondText());//二级目录的文本
|
|||
li.add(bd); |
|||
|
|||
} |
|||
bc.setBchildren(li); |
|||
tree.add(bc); |
|||
} |
|||
//将三级菜单录进去
|
|||
|
|||
for(Bchao bc:tree){ |
|||
|
|||
List<Bchildren> list =bc.getBchildren(); |
|||
//System.out.println("list的尺寸"+list.size());
|
|||
for(Bchildren b:list){ |
|||
//查询到第三级数据
|
|||
List<Bchildren> chilList = bmodelSecondService.selectbmodelSecond(b.getId()); |
|||
b.setListbchildren(chilList); |
|||
} |
|||
|
|||
} |
|||
map.put("MENU", tree); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
@RequestMapping(value = "selectdiagnosisByRid") |
|||
public Map<String, Object> selectdiagnosisByRid(String rid) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<Bdiagnosis> wrapper=new EntityWrapper<Bdiagnosis>(); |
|||
EntityWrapper<BdiagnosisNext> wrapper2=new EntityWrapper<BdiagnosisNext>(); |
|||
List<Bdiagnosis> Bdiagnosislist= bDiagnosisService.selectList(wrapper.orderBy("id",true)); |
|||
List<Items> tree = new ArrayList<Items>(); |
|||
|
|||
for(Bdiagnosis bd:Bdiagnosislist){ |
|||
List<BdiagnosisNext> bdnlist =bDiagnosisNextService.selectDiagnosisList(bd.getId()); |
|||
Items bc =new Items(); |
|||
bc.setIcon(bd.getId()+""); |
|||
bc.setName(bd.getName()); |
|||
//System.out.println("打印出来的ID"+bd.getId());
|
|||
//System.out.println(bdnlist.toString());
|
|||
List<Children> li= new ArrayList<Children>(); |
|||
for(BdiagnosisNext bg:bdnlist){ |
|||
Children cd =new Children(); |
|||
cd.setName(bg.getName()); |
|||
cd.setPath(bg.getId()+""); |
|||
li.add(cd); |
|||
} |
|||
bc.setChildren(li); |
|||
tree.add(bc); |
|||
} |
|||
|
|||
map.put("tree", tree); |
|||
return map; |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,179 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.CaseTemplate; |
|||
import com.imurs.service.CaseTemplateService; |
|||
import io.github.yedaxia.apidocs.ApiDoc; |
|||
import org.apache.ibatis.jdbc.Null; |
|||
import org.apache.ibatis.scripting.xmltags.ForEachSqlNode; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@RestController |
|||
@RequestMapping(value = "casetemp") |
|||
public class CaseTemplateController { |
|||
|
|||
@Autowired |
|||
CaseTemplateService caseTemplateService; |
|||
|
|||
/** |
|||
* @ |
|||
* @Author xfh |
|||
* @Date 2020/12/14 16:01 |
|||
* @Param |
|||
* @Return |
|||
* @Exception |
|||
* |
|||
*/ |
|||
@RequestMapping(value = "selectCaseTemplateAll") |
|||
public Map<String,Object> SelectCaseTemplateAll(String name){ |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
EntityWrapper<CaseTemplate> wrapper = new EntityWrapper<>(); |
|||
wrapper.eq("level","1"); |
|||
if(name!=null){ |
|||
wrapper.like("name", "%" + name + "%"); |
|||
} |
|||
List<CaseTemplate> caseTemplates = caseTemplateService.selectList(wrapper); |
|||
if(!caseTemplates.isEmpty()){ |
|||
for (CaseTemplate caseTemplate : caseTemplates) { |
|||
EntityWrapper<CaseTemplate> wrapper1 = new EntityWrapper<>(); |
|||
wrapper1.eq("parent_id",caseTemplate.getId()); |
|||
List<CaseTemplate> caseTemplates1 = caseTemplateService.selectList(wrapper1); |
|||
caseTemplate.setCaseTemplateList(caseTemplates1); |
|||
if(!caseTemplates1.isEmpty()){ |
|||
for (CaseTemplate casetemplate:caseTemplates1) { |
|||
EntityWrapper<CaseTemplate> wrapper2 = new EntityWrapper<>(); |
|||
wrapper2.eq("parent_id",casetemplate.getId()); |
|||
List<CaseTemplate> caseTemplates2 = caseTemplateService.selectList(wrapper2); |
|||
casetemplate.setCaseTemplateList(caseTemplates2); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
map.put("caseTemplates",caseTemplates); |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* @ |
|||
* @Author xfh |
|||
* @Date 2020/12/14 16:02 |
|||
* @Param |
|||
* @Return |
|||
* @Exception |
|||
* |
|||
*/ |
|||
@RequestMapping(value = "updateCaseTemplate") |
|||
public Map<String,Object> UpdateCaseTemplateAll(@RequestBody CaseTemplate caseTemplate){ |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
|
|||
try { |
|||
if(caseTemplate!=null){ |
|||
boolean result = caseTemplateService.updateById(caseTemplate); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} |
|||
} catch (Exception e) { |
|||
map.put("error",e.getMessage()); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping(value = "saveCaseTemplate") |
|||
public Map<String,Object> saveCaseTemplate(@RequestBody CaseTemplate caseTemplate){ |
|||
|
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
try { |
|||
if(caseTemplate!=null){ |
|||
boolean result = caseTemplateService.insert(caseTemplate); |
|||
map.put("id",caseTemplate.getId()); |
|||
map.put("msg",result==true?"1":"2"); |
|||
} |
|||
} catch (Exception e) { |
|||
map.put("error",e.getMessage()); |
|||
map.put("msg","4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping(value = "deleteCaseTemplateById") |
|||
public Map<String,Object> deleteCaseTemplateById(Long id){ |
|||
|
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
try { |
|||
if(id!=null){ |
|||
boolean result = caseTemplateService.deleteById(id); |
|||
map.put("msg",result==true?"1":"2"); |
|||
} |
|||
} catch (Exception e) { |
|||
map.put("error",e.getMessage()); |
|||
map.put("msg","4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping(value = "deleteCaseTemplate") |
|||
public Map<String,Object> deleteCaseTemplate(@RequestBody CaseTemplate caseTemplate){ |
|||
|
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
try { |
|||
if(caseTemplate!=null){ |
|||
boolean result = caseTemplateService.deleteById(caseTemplate); |
|||
map.put("msg",result==true?"1":"2"); |
|||
} |
|||
} catch (Exception e) { |
|||
map.put("error",e.getMessage()); |
|||
map.put("msg","4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping(value = "selectCaseTemplateByName") |
|||
public Map<String,Object> deleteCaseTemplate(@RequestParam String name){ |
|||
|
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
try { |
|||
if(name!=null){ |
|||
EntityWrapper<CaseTemplate> wrapper = new EntityWrapper<>(); |
|||
List<CaseTemplate> caseTemplateList = caseTemplateService.selectList(wrapper.like("name", "%" + name + "%")); |
|||
map.put("caseTemplateList",caseTemplateList); |
|||
} |
|||
} catch (Exception e) { |
|||
map.put("error",e.getMessage()); |
|||
map.put("msg","4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping(value = "MySelectCaseTemplateAll") |
|||
public Map<String,Object> MySelectCaseTemplateAll(){ |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
List<CaseTemplate> caseTemplates1 = caseTemplateService.selectList(new EntityWrapper<>()); |
|||
List<CaseTemplate> collect = caseTemplates1.stream() |
|||
.filter(item -> item.getParentId() == 0) |
|||
.map(item->{ |
|||
item.setCaseTemplateList(getChildrens(item,caseTemplates1)); |
|||
return item; |
|||
}).collect(Collectors.toList()); |
|||
map.put("collect",collect); |
|||
return map; |
|||
} |
|||
public List<CaseTemplate> getChildrens(CaseTemplate caseTemplate,List<CaseTemplate> caseTemplateList){ |
|||
|
|||
List<CaseTemplate> childrens = caseTemplateList.stream().filter(item -> { |
|||
return item.getParentId() == caseTemplate.getId(); |
|||
}).map(menu -> { |
|||
menu.setCaseTemplateList(getChildrens(menu, caseTemplateList)); |
|||
return menu; |
|||
}).collect(Collectors.toList()); |
|||
return childrens; |
|||
} |
|||
} |
|||
@ -0,0 +1,227 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.sql.Date; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Calendar; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.ClinicalGuidelines; |
|||
import com.imurs.entity.TotalClinicalGuidelines; |
|||
import com.imurs.service.ClinicalGuidelinesService; |
|||
import com.imurs.service.TotalClinicalGuidelinesService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
|
|||
@RestController |
|||
@RequestMapping(value="cgs") |
|||
public class ClinicalGuidelinesController { |
|||
|
|||
@Autowired |
|||
ClinicalGuidelinesService clinicalGuidelinesService; |
|||
|
|||
@Autowired |
|||
TotalClinicalGuidelinesService totalClinicalGuidelinesService; |
|||
|
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@RequestMapping("insertCg") |
|||
public Map<String,Object> insertCg(ClinicalGuidelines clinicalGuidelines){ |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = clinicalGuidelinesService.insert(clinicalGuidelines); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@RequestMapping("updateCg") |
|||
public Map<String,Object> updateCg(ClinicalGuidelines clinicalGuidelines){ |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = clinicalGuidelinesService.updateById(clinicalGuidelines); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
*/ |
|||
@RequestMapping("deleteCg") |
|||
public Map<String,Object> deleteCg(Long id){ |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = clinicalGuidelinesService.deleteById(id); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 查看详情 |
|||
*/ |
|||
@RequestMapping("selectCgById") |
|||
public Map<String,Object> selectCgById(Long id){ |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
ClinicalGuidelines cg = clinicalGuidelinesService.selectById(id); |
|||
map.put("cg", cg); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 分页显示 |
|||
*/ |
|||
@RequestMapping(value="selectGsPage") |
|||
public Map<String,Object> selectGsPage(String hospitalId,Integer pageNo,Integer pageSize,String startTime,String endTime,String cgName,String rid){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<ClinicalGuidelines> wrapper=new EntityWrapper<ClinicalGuidelines>(); |
|||
FrontPage<ClinicalGuidelines> page=new FrontPage<ClinicalGuidelines>(); |
|||
|
|||
EntityWrapper<TotalClinicalGuidelines> wrapper2=new EntityWrapper<TotalClinicalGuidelines>(); |
|||
List<TotalClinicalGuidelines> totalList=new ArrayList<TotalClinicalGuidelines>(); |
|||
page.setRows(pageSize==null?10:pageSize); |
|||
page.setPage(pageNo==null?1:pageNo); |
|||
|
|||
wrapper2.isNotNull("hospital_id").isNotNull("clinical_id"); |
|||
if(StringUtils.isNotEmpty(hospitalId)){ |
|||
wrapper2.eq("hospital_id", hospitalId); |
|||
} |
|||
if(StringUtils.isNotEmpty(startTime)){ |
|||
wrapper.ge("upload_date", startTime); |
|||
wrapper2.ge("create_time", startTime); |
|||
} |
|||
if(StringUtils.isNotEmpty(endTime)){ |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd"); |
|||
Calendar cal = Calendar.getInstance(); |
|||
cal.setTime(Date.valueOf(endTime)); |
|||
cal.add(Calendar.DATE,1);//增加一天
|
|||
wrapper.lt("upload_date",dateFormat.format(cal.getTime())); |
|||
wrapper2.lt("create_time",dateFormat.format(cal.getTime())); |
|||
} |
|||
|
|||
if(StringUtils.isNotEmpty(cgName)){ |
|||
wrapper.like("cg_name", cgName); |
|||
} |
|||
wrapper.orderBy("upload_date", false); |
|||
try { |
|||
Page<ClinicalGuidelines> pageList=clinicalGuidelinesService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if(pageList!=null){ |
|||
CustomPage<ClinicalGuidelines> customPage=new CustomPage<ClinicalGuidelines>(pageList); |
|||
totalList=totalClinicalGuidelinesService.selectList(wrapper2); |
|||
if(totalList.isEmpty()){ |
|||
for (int i = 0; i < customPage.getRows().size(); i++) { |
|||
customPage.getRows().get(i).setPviews(0); |
|||
} |
|||
}else{ |
|||
Map<Long, Long> result=totalList.stream().collect(Collectors.groupingBy(TotalClinicalGuidelines::getClinicalId,Collectors.counting())); |
|||
for (int i = 0; i < customPage.getRows().size(); i++) { |
|||
if(result!=null && result.get(customPage.getRows().get(i).getId())!=null){ |
|||
customPage.getRows().get(i).setPviews(result.get(customPage.getRows().get(i).getId()).intValue()); |
|||
}else{ |
|||
customPage.getRows().get(i).setPviews(0); |
|||
} |
|||
} |
|||
} |
|||
map.put("customPage", customPage); |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查看诊疗指南添加查看记录次数 |
|||
*/ |
|||
@RequestMapping("insetTotCgByDocId") |
|||
public Map<String,Object> insetTotCgByDocId(TotalClinicalGuidelines totalClinicalGuidelines){ |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<TotalClinicalGuidelines> wrapper=new EntityWrapper<TotalClinicalGuidelines>(); |
|||
try { |
|||
wrapper.eq("clinical_id", totalClinicalGuidelines.getClinicalId()); |
|||
wrapper.eq("doc_id", totalClinicalGuidelines.getDocId()); |
|||
TotalClinicalGuidelines totCg = totalClinicalGuidelinesService.selectOne(wrapper); |
|||
if(totCg==null){ |
|||
Boolean result = totalClinicalGuidelinesService.insert(totalClinicalGuidelines); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} |
|||
map.put("msg", "5"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 诊疗指南分页显示列表 |
|||
@RequestMapping("selectGsPage") |
|||
public Map<String,Object> selectGsPage(String startTime,String endTime,String cgName,String docId, |
|||
Integer pageNo ,Integer pageSize){ |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
pageNo=pageNo==null?1:pageNo; |
|||
pageSize=pageSize==null?10:pageSize; |
|||
try { |
|||
if(StringUtils.isNotEmpty(startTime)){ |
|||
map.put("startTime", startTime); |
|||
} |
|||
if(StringUtils.isNotEmpty(endTime)){ |
|||
map.put("endTime",endTime); |
|||
} |
|||
if(StringUtils.isNotEmpty(docId)){ |
|||
map.put("docId",docId); |
|||
} |
|||
|
|||
if(StringUtils.isNotEmpty(cgName)){ |
|||
map.put("cgName", cgName); |
|||
} |
|||
Pagetion<ClinicalGuidelines> totalCgList = clinicalGuidelinesService.selectCgsOrByDocIdPage(map, pageNo, pageSize); |
|||
map.put("totalCgList", totalCgList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally{ |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("docId"); |
|||
map.remove("cgName"); |
|||
} |
|||
return map; |
|||
}**/ |
|||
} |
|||
@ -0,0 +1,84 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.serializer.JSONSerializer; |
|||
import com.imurs.sound.ConnUtil; |
|||
import com.imurs.util.MD5; |
|||
import org.json.JSONObject; |
|||
import org.springframework.util.StreamUtils; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.ResponseBody; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.io.BufferedReader; |
|||
import java.io.InputStream; |
|||
import java.io.InputStreamReader; |
|||
import java.net.HttpURLConnection; |
|||
import java.net.URL; |
|||
import java.nio.charset.Charset; |
|||
import java.util.Base64; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author wdh |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("cloud") |
|||
public class CloudImageController { |
|||
|
|||
/** |
|||
* 调用易联云影像的接口返回报告数据 |
|||
* @param hospitalName 医院名称 |
|||
* @param identificationNumber 病人身份证号码 |
|||
* @param beginDate 开始时间 |
|||
* @param endDate 结束时间 |
|||
* @return |
|||
*/ |
|||
@RequestMapping("getreport") |
|||
public Map<String, Object> getReport(String hospitalName,String identificationNumber, |
|||
String beginDate,String endDate) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
String key = "test"; |
|||
String sign = MD5.GetMD5Code(MD5.GetMD5Code(hospitalName + identificationNumber + |
|||
beginDate + endDate) + key); |
|||
try { |
|||
JSONObject jsonObject = new JSONObject(); |
|||
jsonObject.put("HospitalName",hospitalName); |
|||
jsonObject.put("IdentificationNumber",identificationNumber); |
|||
jsonObject.put("BeginDate",beginDate); |
|||
jsonObject.put("EndDate",endDate); |
|||
jsonObject.put("Key",key); |
|||
jsonObject.put("Sign",sign); |
|||
|
|||
//建立URL连接对象
|
|||
URL url = new URL("http://cloud.elincloud.cn:8013/YDService/GetReport"); |
|||
//创建连接
|
|||
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); |
|||
//设置请求的方式(需要是大写的)
|
|||
conn.setRequestMethod("POST"); |
|||
//设置需要输出
|
|||
conn.setDoOutput(true); |
|||
//设置超时
|
|||
conn.setConnectTimeout(5000); |
|||
//写入参数.
|
|||
conn.getOutputStream().write(jsonObject.toString().getBytes()); |
|||
//发送请求到服务器
|
|||
conn.connect(); |
|||
//获取远程响应的内容.
|
|||
String responseContent = StreamUtils.copyToString(conn.getInputStream(), Charset.forName("utf-8")); |
|||
com.alibaba.fastjson.JSONObject response = JSON.parseObject(responseContent); |
|||
conn.disconnect(); |
|||
map.put("response",response); |
|||
}catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg",4); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,323 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.sql.Date; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Calendar; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.ApplyBMode; |
|||
import com.imurs.entity.ApplyCase; |
|||
import com.imurs.entity.ApplyConsultation; |
|||
import com.imurs.entity.ApplyInformation; |
|||
import com.imurs.parameter.DataSummarization; |
|||
import com.imurs.service.ApplyBModeService; |
|||
import com.imurs.service.ApplyCaseService; |
|||
import com.imurs.service.ApplyConsultationService; |
|||
import com.imurs.service.ApplyInformationService; |
|||
|
|||
/** |
|||
* 数据汇总 |
|||
* @author D140 |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("data") |
|||
public class DataSummarizationController { |
|||
|
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
@Autowired |
|||
ApplyCaseService applyCaseService; |
|||
@Autowired |
|||
ApplyConsultationService applyConsultationService; |
|||
@Autowired |
|||
ApplyBModeService applyBModeService; |
|||
|
|||
|
|||
/** |
|||
* 基层医院远程会诊汇总表 |
|||
*/ |
|||
@RequestMapping("/basicHospitalData") |
|||
public Map<String,Object> basicHospitalData(String id,String startTime,String endTime){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<ApplyInformation> wrapper=new EntityWrapper<>(); |
|||
EntityWrapper<ApplyCase> caseAWrapper=new EntityWrapper<ApplyCase>(); |
|||
EntityWrapper<ApplyCase> caseBWrapper=new EntityWrapper<ApplyCase>(); |
|||
EntityWrapper<ApplyConsultation> conWrapper=new EntityWrapper<ApplyConsultation>(); |
|||
DataSummarization dataSum=new DataSummarization(); |
|||
try { |
|||
if(org.apache.commons.lang.StringUtils.isNotEmpty(id)){ |
|||
//医院
|
|||
wrapper.setSqlSelect("hospital_name as hospitalName,setup_time as setupTime,id").where("").eq("id", id); |
|||
ApplyInformation infor=applyInformationService.selectOne(wrapper); |
|||
dataSum.setId(id); |
|||
dataSum.setHospitalName(infor.getHospitalName()); |
|||
dataSum.setSetupTime(infor.getSetupTime()); |
|||
|
|||
//双向转诊 4:已接收,5:已就诊,6:已住院,7:未就诊
|
|||
//hospital_id:向上 plan_hospital_id:向下 plan_time
|
|||
if (StringUtils.isNotEmpty(startTime)) { |
|||
caseAWrapper.ge("plan_time",startTime); |
|||
caseBWrapper.ge("plan_time",startTime); |
|||
conWrapper.ge("group_date",startTime); |
|||
} |
|||
if (StringUtils.isNotEmpty(endTime)) { |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd"); |
|||
Calendar cal = Calendar.getInstance(); |
|||
cal.setTime(Date.valueOf(endTime)); |
|||
cal.add(Calendar.DATE,1);//增加一天
|
|||
caseAWrapper.lt("plan_time",dateFormat.format(cal.getTime())); |
|||
caseBWrapper.lt("plan_time",dateFormat.format(cal.getTime())); |
|||
conWrapper.lt("group_date",dateFormat.format(cal.getTime())); |
|||
} |
|||
caseAWrapper.in("statu", "4,5,6,7").eq("hospital_id", id); |
|||
int typeA=applyCaseService.selectCount(caseAWrapper); |
|||
dataSum.setTypeA(typeA); |
|||
|
|||
caseBWrapper.in("statu", "4,5,6,7").eq("plan_hospital_id", id); |
|||
int typeB=applyCaseService.selectCount(caseBWrapper); |
|||
dataSum.setTypeB(typeB); |
|||
|
|||
//视频会诊 status:70
|
|||
//LX SP category_hospital_id
|
|||
conWrapper.eq("status", "70").eq("category_hospital_id",id); |
|||
List<ApplyConsultation> conList=applyConsultationService.selectList(conWrapper); |
|||
if(!conList.isEmpty()){ |
|||
Map<String, Long> result=conList.stream().collect(Collectors.groupingBy(ApplyConsultation::getDiagnosisType,Collectors.counting())); |
|||
dataSum.setCountyLX(result.get("LX")!=null?result.get("LX").intValue():0); |
|||
dataSum.setCountySP(result.get("SP")!=null?result.get("SP").intValue():0); |
|||
} |
|||
map.clear(); |
|||
map.put("dataSum", dataSum); |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 白银市人民医院远程会诊汇总表 |
|||
*/ |
|||
@RequestMapping("/cityHospitalData") |
|||
public Map<String,Object> cityHospitalData(String id,String startTime,String endTime){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<ApplyInformation> wrapper=new EntityWrapper<>(); |
|||
EntityWrapper<ApplyConsultation> conWrapper=new EntityWrapper<ApplyConsultation>(); |
|||
EntityWrapper<ApplyBMode> modeWrapper=new EntityWrapper<ApplyBMode>(); |
|||
//EntityWrapper<ApplyEcg> ecgWrapper=new EntityWrapper<ApplyEcg>();
|
|||
//EntityWrapper<ApplyPathology> pathologyWrapper=new EntityWrapper<ApplyPathology>();
|
|||
DataSummarization dataSum=new DataSummarization(); |
|||
try { |
|||
if(org.apache.commons.lang.StringUtils.isNotEmpty(id)){ |
|||
//医院
|
|||
wrapper.setSqlSelect("hospital_name as hospitalName,setup_time as setupTime,id").where("").eq("id", id); |
|||
ApplyInformation infor=applyInformationService.selectOne(wrapper); |
|||
dataSum.setId(id); |
|||
dataSum.setHospitalName(infor.getHospitalName()); |
|||
dataSum.setSetupTime(infor.getSetupTime()); |
|||
|
|||
//视频会诊 status:70 LX SP group_hospital_id
|
|||
//双向转诊 4:已接收,5:已就诊,6:已住院,7:未就诊
|
|||
//hospital_id:向上 plan_hospital_id:向下 plan_time
|
|||
if (StringUtils.isNotEmpty(startTime)) { |
|||
conWrapper.ge("group_date",startTime); |
|||
modeWrapper.ge("group_date", startTime); |
|||
} |
|||
if (StringUtils.isNotEmpty(endTime)) { |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd"); |
|||
Calendar cal = Calendar.getInstance(); |
|||
cal.setTime(Date.valueOf(endTime)); |
|||
cal.add(Calendar.DATE,1);//增加一天
|
|||
conWrapper.lt("group_date",dateFormat.format(cal.getTime())); |
|||
modeWrapper.lt("group_date",dateFormat.format(cal.getTime())); |
|||
} |
|||
conWrapper.eq("status", "70").eq("group_hospital_id", id); |
|||
List<ApplyConsultation> conList=applyConsultationService.selectList(conWrapper); |
|||
if(!conList.isEmpty()){ |
|||
Map<String, Long> result=conList.stream().collect(Collectors.groupingBy(ApplyConsultation::getDiagnosisType,Collectors.counting())); |
|||
dataSum.setCityLX(result.get("LX")!=null?result.get("LX").intValue():0); |
|||
dataSum.setCitySP(result.get("SP")!=null?result.get("SP").intValue():0); |
|||
} |
|||
|
|||
//远程b超 远程病理 state:1:b超 2:病理 状态70 已结束 group_hospital_id
|
|||
modeWrapper.eq("status", "70").eq("group_hospital_id", id); |
|||
List<ApplyBMode> bModeList=applyBModeService.selectList(modeWrapper); |
|||
if(!bModeList.isEmpty()){ |
|||
Map<Integer, Long> result=bModeList.stream().collect(Collectors.groupingBy(ApplyBMode::getState,Collectors.counting())); |
|||
dataSum.setBmode(result.get(1)!=null?result.get(1).intValue():0); |
|||
dataSum.setBl(result.get(2)!=null?result.get(2).intValue():0); |
|||
} |
|||
//远程心电
|
|||
//ecgWrapper.eq("status", "70").eq("group_hospital_id", id);
|
|||
//dataSum.setEcg(applyEcgService.selectCount(ecgWrapper));
|
|||
|
|||
//远程影像
|
|||
//pathologyWrapper.eq("status", "70").eq("group_hospital_id", id);
|
|||
//dataSum.setShadow(applyPathologyService.selectCount(pathologyWrapper));
|
|||
|
|||
map.clear(); |
|||
map.put("dataSum", dataSum); |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 靖远县人民医院远程会诊汇总表 |
|||
*/ |
|||
@RequestMapping("/adminHospitalData") |
|||
public Map<String,Object> adminHospitalData(String id,String startTime,String endTime){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
List<ApplyConsultation> conList=new ArrayList<ApplyConsultation>(); |
|||
List<DataSummarization> dataSumList=new ArrayList<DataSummarization>(); |
|||
EntityWrapper<ApplyInformation> wrapper=new EntityWrapper<>(); |
|||
String acount; |
|||
Map<String, Long> result=null; |
|||
try { |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd"); |
|||
Calendar cal = Calendar.getInstance(); |
|||
|
|||
wrapper.setSqlSelect("hospital_name as hospitalName,setup_time as setupTime,id,rid").where(""); |
|||
if(org.apache.commons.lang.StringUtils.isNotEmpty(id)){ |
|||
wrapper.eq("id", id); |
|||
} |
|||
wrapper.orderBy("FIELD(rid,9,1),setupTime",false); |
|||
List<ApplyInformation> inforList=applyInformationService.selectList(wrapper); |
|||
if(!inforList.isEmpty()){ |
|||
for (int i = 0; i < inforList.size(); i++) { |
|||
DataSummarization dataSum=new DataSummarization(); |
|||
acount=inforList.get(i).getId(); |
|||
dataSum.setHospitalName(inforList.get(i).getHospitalName()); |
|||
dataSum.setId(acount); |
|||
dataSum.setSetupTime(inforList.get(i).getSetupTime()); |
|||
|
|||
if(inforList.get(i).getRid().intValue()!=1 && inforList.get(i).getRid().intValue()!=9){ |
|||
EntityWrapper<ApplyCase> caseAWrapper=new EntityWrapper<ApplyCase>(); |
|||
EntityWrapper<ApplyCase> caseBWrapper=new EntityWrapper<ApplyCase>(); |
|||
EntityWrapper<ApplyConsultation> conWrapper=new EntityWrapper<ApplyConsultation>(); |
|||
|
|||
if (StringUtils.isNotEmpty(startTime)) { |
|||
caseAWrapper.ge("plan_time",startTime); |
|||
caseBWrapper.ge("plan_time",startTime); |
|||
conWrapper.ge("group_date",startTime); |
|||
} |
|||
if (StringUtils.isNotEmpty(endTime)) { |
|||
cal.setTime(Date.valueOf(endTime)); |
|||
cal.add(Calendar.DATE,1);//增加一天
|
|||
caseAWrapper.lt("plan_time",dateFormat.format(cal.getTime())); |
|||
caseBWrapper.lt("plan_time",dateFormat.format(cal.getTime())); |
|||
conWrapper.lt("group_date",dateFormat.format(cal.getTime())); |
|||
} |
|||
//双向转诊 4:已接收,5:已就诊,6:已住院,7:未就诊
|
|||
//hospital_id:向上 plan_hospital_id:向下
|
|||
caseAWrapper.in("statu", "4,5,6,7").eq("hospital_id", acount); |
|||
dataSum.setTypeA(applyCaseService.selectCount(caseAWrapper)); |
|||
|
|||
caseBWrapper.in("statu", "4,5,6,7").eq("plan_hospital_id", acount); |
|||
dataSum.setTypeB(applyCaseService.selectCount(caseBWrapper)); |
|||
|
|||
//离线/视频会诊 基层到县医院(靖远县)
|
|||
conWrapper.eq("status", "70").eq("category_hospital_id", acount); |
|||
conList=applyConsultationService.selectList(conWrapper); |
|||
if(!conList.isEmpty()){ |
|||
result=conList.stream().collect(Collectors.groupingBy(ApplyConsultation::getDiagnosisType,Collectors.counting())); |
|||
dataSum.setCountyLX(result.get("LX")!=null?result.get("LX").intValue():0); |
|||
dataSum.setCountySP(result.get("SP")!=null?result.get("SP").intValue():0); |
|||
} |
|||
dataSumList.add(dataSum); |
|||
|
|||
//市级医院
|
|||
}else if(inforList.get(i).getRid().intValue()==9){ |
|||
// EntityWrapper<ApplyEcg> ecgWrapper=new EntityWrapper<ApplyEcg>();
|
|||
// EntityWrapper<ApplyPathology> pathologyWrapper=new EntityWrapper<ApplyPathology>();
|
|||
EntityWrapper<ApplyConsultation> consWrapper=new EntityWrapper<ApplyConsultation>(); |
|||
EntityWrapper<ApplyBMode> modeWrapper=new EntityWrapper<ApplyBMode>(); |
|||
if (StringUtils.isNotEmpty(startTime)) { |
|||
modeWrapper.ge("group_date",startTime); |
|||
consWrapper.ge("group_date",startTime); |
|||
} |
|||
if (StringUtils.isNotEmpty(endTime)) { |
|||
cal.setTime(Date.valueOf(endTime)); |
|||
cal.add(Calendar.DATE,1);//增加一天
|
|||
consWrapper.lt("group_date",dateFormat.format(cal.getTime())); |
|||
modeWrapper.lt("group_date",dateFormat.format(cal.getTime())); |
|||
} |
|||
// //视频会诊 status:70 LX SP group_hospital_id
|
|||
consWrapper.eq("status", "70").eq("group_hospital_id", acount); |
|||
conList=applyConsultationService.selectList(consWrapper); |
|||
if(!conList.isEmpty()){ |
|||
result=conList.stream().collect(Collectors.groupingBy(ApplyConsultation::getDiagnosisType,Collectors.counting())); |
|||
dataSum.setCityLX(result.get("LX")!=null?result.get("LX").intValue():0); |
|||
dataSum.setCitySP(result.get("SP")!=null?result.get("SP").intValue():0); |
|||
} |
|||
|
|||
//远程b超 远程病理 state:1:b超 2:病理 状态70 已结束 group_hospital_id
|
|||
modeWrapper.eq("status", "70").eq("group_hospital_id", acount); |
|||
List<ApplyBMode> bModeList=applyBModeService.selectList(modeWrapper); |
|||
|
|||
if(!bModeList.isEmpty()){ |
|||
Map<Integer, Long> result2=bModeList.stream().collect(Collectors.groupingBy(ApplyBMode::getState,Collectors.counting())); |
|||
dataSum.setBmode(result2.get(1)!=null?result2.get(1).intValue():0); |
|||
dataSum.setBl(result2.get(2)!=null?result2.get(2).intValue():0); |
|||
} |
|||
dataSumList.add(dataSum); |
|||
// //远程心电
|
|||
// ecgWrapper.eq("status", "70").eq("group_hospital_id", acount);
|
|||
// dataSum.setEcg(applyEcgService.selectCount(ecgWrapper));
|
|||
//
|
|||
// //远程影像
|
|||
// pathologyWrapper.eq("status", "70").eq("group_hospital_id", acount);
|
|||
// dataSum.setShadow(applyPathologyService.selectCount(pathologyWrapper));
|
|||
//
|
|||
|
|||
//靖远医院数据汇总
|
|||
}else if(inforList.get(i).getRid().intValue()==1){ |
|||
dataSum.setTypeA(dataSumList.stream().mapToInt(DataSummarization::getTypeA).sum()); |
|||
dataSum.setTypeB(dataSumList.stream().mapToInt(DataSummarization::getTypeB).sum()); |
|||
dataSum.setCountyLX(dataSumList.stream().mapToInt(DataSummarization::getCountyLX).sum()); |
|||
dataSum.setCountySP(dataSumList.stream().mapToInt(DataSummarization::getCountySP).sum()); |
|||
dataSum.setCityLX(dataSumList.stream().mapToInt(DataSummarization::getCityLX).sum()); |
|||
dataSum.setCitySP(dataSumList.stream().mapToInt(DataSummarization::getCitySP).sum()); |
|||
dataSum.setBmode(dataSumList.stream().mapToInt(DataSummarization::getBmode).sum()); |
|||
dataSum.setBl(dataSumList.stream().mapToInt(DataSummarization::getBl).sum()); |
|||
//dataSum.setEcg(dataSumList.stream().mapToInt(DataSummarization::getEcg).sum());
|
|||
//dataSum.setShadow(dataSumList.stream().mapToInt(DataSummarization::getShadow).sum());
|
|||
dataSum.setEcg(0); |
|||
dataSum.setShadow(0); |
|||
dataSumList.add(dataSum); |
|||
} |
|||
} |
|||
//靖远医院数据汇总
|
|||
map.clear(); |
|||
map.put("dataSum", dataSumList); |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,281 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.sql.Date; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Calendar; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.DoctorArrange; |
|||
import com.imurs.entity.ImgArrange; |
|||
import com.imurs.service.DoctorArrangeService; |
|||
import com.imurs.service.ImgArrangeService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
import com.imurs.util.page.Pagetion; |
|||
|
|||
/** |
|||
* 医生下乡排班控制器 |
|||
* |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value = "arrange") |
|||
public class DoctorArrangeController { |
|||
|
|||
@Autowired |
|||
DoctorArrangeService doctorArrangeService; |
|||
@Autowired |
|||
ImgArrangeService imgArrangeService; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 新增医生下乡排班 |
|||
* |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "insertArrange") |
|||
public Map<String, Object> insertArrange(DoctorArrange doctorArrange) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = doctorArrangeService.insert(doctorArrange); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 修改医生下乡排班 |
|||
* |
|||
* @return |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping(value = "updateArrangeById") |
|||
public Map<String, Object> updateArrangeById(@RequestBody List<DoctorArrange> adList) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
if (!adList.isEmpty()) { |
|||
boolean result = doctorArrangeService.updateById(adList.get(0)); |
|||
if (result == true && !adList.get(0).getIaList().isEmpty()) { |
|||
Long id = adList.get(0).getId(); |
|||
map.put("msg", "1"); |
|||
for (int i = 0; i < adList.get(0).getIaList().size(); i++) { |
|||
adList.get(0).getIaList().get(i).setArrangeId(id); |
|||
imgArrangeService.insert(adList.get(0).getIaList().get(i)); |
|||
} |
|||
} else { |
|||
map.put("msg", "2"); |
|||
} |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 修改医生下乡排班 |
|||
* |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "updateArrange") |
|||
public Map<String, Object> updateArrange(DoctorArrange doctorArrange) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = doctorArrangeService.updateById(doctorArrange); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 删除医生下乡排班 |
|||
* |
|||
* @return |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping(value = "deleteArrange") |
|||
public Map<String, Object> deleteArrange(Long id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = doctorArrangeService.deleteById(id); |
|||
if(result == true){ |
|||
map.put("arrange_id", id); |
|||
imgArrangeService.deleteByMap(map); |
|||
map.put("msg", "1"); |
|||
}else{ |
|||
map.put("msg", "2"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查看医生排班详情(关联查询) |
|||
*/ |
|||
@RequestMapping(value = "selectArrangeById") |
|||
public Map<String, Object> selectArrangeById(Long id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
DoctorArrange arange = doctorArrangeService.selectArrangeByUser(id); |
|||
map.put("arange", arange); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查看医生排班详情及工作照(关联查询) |
|||
*/ |
|||
@RequestMapping(value = "selectArrangeByImg") |
|||
public Map<String, Object> selectArrangeByImg(Long id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("arrange_id", id); |
|||
map.put("type", "B"); |
|||
try { |
|||
DoctorArrange arange = doctorArrangeService.selectArrangeByUser(id); |
|||
if(arange!=null){ |
|||
List<ImgArrange> iaList=imgArrangeService.selectByMap(map); |
|||
map.put("iaList", iaList); |
|||
} |
|||
map.put("arange", arange); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("arrange_id"); |
|||
map.remove("type"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 查看医生排班详情及工作照(非关联查询) |
|||
*/ |
|||
@RequestMapping(value = "selectArrangeImg") |
|||
public Map<String, Object> selectArrangeImg(Long id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("arrange_id", id); |
|||
map.put("type", "B"); |
|||
try { |
|||
DoctorArrange arange = doctorArrangeService.selectById(id); |
|||
if(arange!=null){ |
|||
List<ImgArrange> iaList=imgArrangeService.selectByMap(map); |
|||
map.put("iaList", iaList); |
|||
} |
|||
map.put("arange", arange); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("arrange_id"); |
|||
map.remove("type"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 医生排班列表分页显示 |
|||
*/ |
|||
@RequestMapping(value = "selectArrangePage") |
|||
public Map<String, Object> selectArrangePage(Integer pageNo, Integer pageSize, String startTime,String endTime, |
|||
String receiveHospitalId, String doctorName, String status) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
FrontPage<DoctorArrange> page = new FrontPage<DoctorArrange>(); |
|||
page.setRows(pageSize == null ? 6 : pageSize); |
|||
page.setPage(pageNo == null ? 1 : pageNo); |
|||
|
|||
EntityWrapper<DoctorArrange> wrapper = new EntityWrapper<DoctorArrange>(); |
|||
wrapper.eq("status", status).eq("receive_hospital_id", receiveHospitalId); |
|||
if (StringUtils.isNotEmpty(doctorName)) { |
|||
wrapper.like("doctor_name", doctorName); |
|||
} |
|||
try { |
|||
if (StringUtils.isNotEmpty(startTime)) { |
|||
wrapper.ge("start_time",startTime); |
|||
} |
|||
if (StringUtils.isNotEmpty(endTime)) { |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd"); |
|||
Calendar cal = Calendar.getInstance(); |
|||
cal.setTime(Date.valueOf(endTime)); |
|||
cal.add(Calendar.DATE,1);//增加一天
|
|||
wrapper.lt("end_time",dateFormat.format(cal.getTime())); |
|||
} |
|||
wrapper.orderBy("start_time", false); |
|||
Page<DoctorArrange> pageList = doctorArrangeService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if (pageList == null) { |
|||
map.put("msg", "3"); |
|||
} else { |
|||
CustomPage<DoctorArrange> customPage = new CustomPage<DoctorArrange>(pageList); |
|||
map.put("customPage", customPage); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 医生排班列表分页显示 关联查询 |
|||
*/ |
|||
@RequestMapping(value = "selectArrangeByPage") |
|||
public Map<String, Object> selectArrangeByPage(Integer pageNo, Integer pageSize, String startTime,String endTime, |
|||
String receiveHospitalId, String status, Long docId) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
|
|||
pageSize = pageSize == null ? 10 : pageSize; |
|||
pageNo = pageNo == null ? 1 : pageNo; |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("status", status); |
|||
map.put("receiveHospitalId", receiveHospitalId); |
|||
if (docId != null) { |
|||
map.put("docId", docId); |
|||
} |
|||
try { |
|||
Pagetion<DoctorArrange> pageList = doctorArrangeService.selectByArrangePage(map, pageNo, pageSize); |
|||
map.put("customPage", pageList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} finally { |
|||
map.remove("status"); |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("receiveHospitalId"); |
|||
map.remove("docId"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,228 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.DoctorGroup; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.DoctorGroupService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.LetterIncrementor; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@RestController |
|||
@RequestMapping("/doctorGroup") |
|||
public class DoctorGroupController { |
|||
@Autowired |
|||
DoctorGroupService doctorGroupService; |
|||
|
|||
@Autowired |
|||
UserService userService; |
|||
|
|||
//增加医生组
|
|||
@RequestMapping("/insertDoctorGroup") |
|||
public Map<String, Object> insertDoctorGroup(@RequestBody DoctorGroup doctorGroup) { |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
try { |
|||
//判断添加的组名是否已存在
|
|||
if (doctorGroup.getGroupName() != null && doctorGroup.getGroupAlias() != null) { |
|||
EntityWrapper<DoctorGroup> doctorGroupEntityWrapper = new EntityWrapper<>(); |
|||
doctorGroupEntityWrapper.eq("group_name", doctorGroup.getGroupName()); |
|||
DoctorGroup doctorGroupName = doctorGroupService.selectOne(doctorGroupEntityWrapper); |
|||
if (doctorGroupName != null) { |
|||
map.put("msg", "5"); |
|||
map.put("errorInfo", "组名已存在"); |
|||
return map; |
|||
} |
|||
EntityWrapper<DoctorGroup> doctorGroupEntityWrapper1 = new EntityWrapper<>(); |
|||
doctorGroupEntityWrapper1.eq("group_alias", doctorGroup.getGroupAlias()); |
|||
DoctorGroup doctorGroupAlias = doctorGroupService.selectOne(doctorGroupEntityWrapper1); |
|||
if (doctorGroupAlias != null) { |
|||
map.put("msg", "5"); |
|||
map.put("errorInfo", "组别名已存在"); |
|||
return map; |
|||
} |
|||
} |
|||
//查询最新一条组消息的组别名
|
|||
EntityWrapper<DoctorGroup> doctorGroupEntityWrapper = new EntityWrapper<>(); |
|||
doctorGroupEntityWrapper.orderBy( "create_time", false); |
|||
DoctorGroup doctorGroupBestNew = doctorGroupService.selectOne(doctorGroupEntityWrapper); |
|||
//如果查询结果为空
|
|||
String groupAliasBestNew = null; |
|||
if (doctorGroupBestNew != null) { |
|||
groupAliasBestNew = doctorGroupBestNew.getGroupAlias(); |
|||
} |
|||
System.out.println("groupAliasBestNew=" + groupAliasBestNew); |
|||
String next = LetterIncrementor.getNext(groupAliasBestNew, 10); |
|||
doctorGroup.setGroupAlias(next); |
|||
boolean insert = doctorGroupService.insert(doctorGroup); |
|||
map.put("msg", insert ? "1" : "2"); |
|||
map.put("result", doctorGroup.getId()); |
|||
|
|||
|
|||
} catch (Exception e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
//模糊查询全部医生组
|
|||
@RequestMapping("/selectDoctorGroup") |
|||
//groupName可以为不传项
|
|||
public Map<String, Object> selectDoctorGroup(@RequestParam(required = false) String groupName) { |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
try { |
|||
EntityWrapper<DoctorGroup> doctorGroupEntityWrapper = new EntityWrapper<>(); |
|||
|
|||
doctorGroupEntityWrapper.eq("status", "1"); |
|||
|
|||
if (groupName != null) { |
|||
doctorGroupEntityWrapper.like("group_name", groupName); |
|||
map.put("result", doctorGroupService.selectList(doctorGroupEntityWrapper)); |
|||
map.put("msg", "1"); |
|||
} else { |
|||
map.put("result", doctorGroupService.selectList(doctorGroupEntityWrapper)); |
|||
map.put("msg", "1"); |
|||
} |
|||
} catch (Exception e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
//分页查询全部医生组
|
|||
@RequestMapping("/selectDoctorGroupPage") |
|||
public Map<String, Object> selectDoctorGroupPage(@RequestParam String groupName, @RequestParam Integer pageNo, @RequestParam Integer pageSize) { |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
pageNo = Integer.valueOf((pageNo == null) ? 1 : pageNo.intValue()); |
|||
pageSize = Integer.valueOf((pageSize == null) ? 10 : pageSize.intValue()); |
|||
|
|||
Page<DoctorGroup> page = new Page<>(pageNo, pageSize); |
|||
try { |
|||
EntityWrapper<DoctorGroup> doctorGroupEntityWrapper = new EntityWrapper<>(); |
|||
if (groupName != null) { |
|||
doctorGroupEntityWrapper.like("group_name", groupName); |
|||
map.put("result", doctorGroupService.selectPage(page,doctorGroupEntityWrapper)); |
|||
map.put("msg", "1"); |
|||
} else { |
|||
map.put("result", doctorGroupService.selectPage(page,doctorGroupEntityWrapper)); |
|||
map.put("msg", "1"); |
|||
} |
|||
} catch (Exception e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
|
|||
//删除医生组并删除组内医生
|
|||
@Transactional |
|||
@RequestMapping("/deleteDoctorGroup/{id}") |
|||
public Map<String, Object> deleteDoctorGroup(@PathVariable Long id) { |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
try { |
|||
EntityWrapper<DoctorGroup> doctorGroupEntityWrapper = new EntityWrapper<>(); |
|||
doctorGroupEntityWrapper.eq("id", id); |
|||
DoctorGroup doctorGroup = doctorGroupService.selectOne(doctorGroupEntityWrapper); |
|||
if (doctorGroup != null) { |
|||
EntityWrapper<User> userEntityWrapper = new EntityWrapper<>(); |
|||
userEntityWrapper.eq("group_alias", doctorGroup.getGroupAlias()); |
|||
List<User> users = userService.selectList(userEntityWrapper); |
|||
if (users != null && !users.isEmpty()) { |
|||
for (User user : users) { |
|||
//将用户组别名置空
|
|||
user.setGroupAlias(""); |
|||
} |
|||
userService.updateBatchById(users); |
|||
} |
|||
|
|||
boolean result = doctorGroupService.deleteById(id); |
|||
map.put("msg", result ? "1" : "2"); |
|||
map.put("result", result ? "删除成功" : "删除失败"); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
map.put("errorInfo", "未找到该组"); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
// 修改医生组
|
|||
@RequestMapping("/updateDoctorGroup") |
|||
public Map<String, Object> updateDoctorGroup(@RequestBody DoctorGroup doctorGroup) { |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
|
|||
try { |
|||
if (doctorGroup == null || doctorGroup.getId() == null) { |
|||
map.put("msg", "3"); |
|||
map.put("errorInfo", "未找到该组"); |
|||
return map; |
|||
} |
|||
|
|||
// 1. 先查询出原始的医生组信息
|
|||
DoctorGroup originalGroup = doctorGroupService.selectById(doctorGroup.getId()); |
|||
if (originalGroup == null) { |
|||
map.put("msg", "3"); |
|||
map.put("errorInfo", "未找到该组"); |
|||
return map; |
|||
} |
|||
|
|||
// 2. 检查组名是否重复(排除当前记录)
|
|||
// 只有当组名真正发生变化时才检查重复
|
|||
if (!originalGroup.getGroupName().equals(doctorGroup.getGroupName())) { |
|||
EntityWrapper<DoctorGroup> nameWrapper = new EntityWrapper<>(); |
|||
nameWrapper.eq("group_name", doctorGroup.getGroupName()) |
|||
.ne("id", doctorGroup.getId()); // 排除当前记录
|
|||
|
|||
DoctorGroup existByName = doctorGroupService.selectOne(nameWrapper); |
|||
if (existByName != null) { |
|||
map.put("msg", "5"); |
|||
map.put("errorInfo", "组名重复"); |
|||
return map; |
|||
} |
|||
} |
|||
|
|||
// 3. 检查组别名是否重复(排除当前记录)
|
|||
// 只有当组别名真正发生变化时才检查重复
|
|||
if (!originalGroup.getGroupAlias().equals(doctorGroup.getGroupAlias())) { |
|||
EntityWrapper<DoctorGroup> aliasWrapper = new EntityWrapper<>(); |
|||
aliasWrapper.eq("group_alias", doctorGroup.getGroupAlias()) |
|||
.ne("id", doctorGroup.getId()); // 排除当前记录
|
|||
|
|||
DoctorGroup existByAlias = doctorGroupService.selectOne(aliasWrapper); |
|||
if (existByAlias != null) { |
|||
map.put("msg", "5"); |
|||
map.put("errorInfo", "组别名重复"); |
|||
return map; |
|||
} |
|||
} |
|||
|
|||
// 4. 执行更新
|
|||
boolean update = doctorGroupService.updateById(doctorGroup); |
|||
map.put("msg", update ? "1" : "2"); |
|||
map.put("result", update ? "修改成功" : "修改失败"); |
|||
|
|||
} catch (Exception e) { |
|||
map.put("msg", "4"); |
|||
map.put("errorInfo", "系统错误: " + e.getMessage()); |
|||
// 或者记录日志
|
|||
// log.error("修改医生组失败", e);
|
|||
} |
|||
|
|||
return map; |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,277 @@ |
|||
/*package com.imurs.controller; |
|||
|
|||
import java.io.ByteArrayInputStream; |
|||
import java.io.ByteArrayOutputStream; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.io.OutputStream; |
|||
import java.net.HttpURLConnection; |
|||
import java.net.URL; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import javax.annotation.PostConstruct; |
|||
|
|||
import org.dom4j.Document; |
|||
import org.dom4j.DocumentException; |
|||
import org.dom4j.DocumentHelper; |
|||
import org.dom4j.Element; |
|||
import org.dom4j.io.SAXReader; |
|||
import org.jdom.JDOMException; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.alibaba.druid.support.json.JSONUtils; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyCaseService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.note.ChuangLanSmsUtil; |
|||
|
|||
import net.sf.json.JSONObject; |
|||
|
|||
@Component |
|||
public class DualReferral_His { |
|||
@Autowired |
|||
private ApplyCaseService applyCaseService; |
|||
@Autowired |
|||
private UserService userService; |
|||
@Autowired |
|||
public static DualReferral_His dualReferral_His; |
|||
@PostConstruct |
|||
public void init(){ |
|||
dualReferral_His = this; |
|||
dualReferral_His.applyCaseService=this.applyCaseService; |
|||
dualReferral_His.userService=this.userService; |
|||
} |
|||
public static String translate(String FeeDate ) throws Exception { |
|||
//地址
|
|||
String urlString = "http://220.168.26.57:1001/Service.asmx"; |
|||
//方法
|
|||
String soapActionString = "http://cardtest.com/GetInterconnect"; |
|||
URL url = new URL(urlString); |
|||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection(); |
|||
String soap = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + |
|||
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:car=\"http://cardtest.com/\">\n" + |
|||
" <soapenv:Body>\n" + |
|||
" <car:GetInterconnect>\n" + |
|||
" <car:xml><![CDATA["+ |
|||
"<?xml version=\"1.0\" encoding=\"utf-8\"?><Request><InpatientId></InpatientId>"+ |
|||
"<FeeDate>"+FeeDate+"</FeeDate></Request>]]> </car:xml>\n"+ |
|||
" </car:GetInterconnect>\n" + |
|||
" </soapenv:Body>\n" + |
|||
"</soapenv:Envelope>"; |
|||
byte[] buf = soap.getBytes(); |
|||
System.out.println(soap); |
|||
//设置一些头参数
|
|||
httpConn.setRequestProperty("Content-Length", String.valueOf(buf.length)); |
|||
httpConn.setRequestProperty("Content-Type", "text/xml; charset=utf-8"); |
|||
httpConn.setRequestProperty("soapActionString", soapActionString); |
|||
httpConn.setRequestMethod("POST"); |
|||
//输入参数和输出结果
|
|||
|
|||
OutputStream out = null; |
|||
try{ |
|||
httpConn.setConnectTimeout(30000); |
|||
httpConn.setReadTimeout(30000);//30S连接不成功则直接抛错,防止对方服务器挂了,程序一直挂着
|
|||
httpConn.setDoOutput(true); |
|||
httpConn.setDoInput(true); |
|||
out = httpConn.getOutputStream(); |
|||
out.write(buf); |
|||
out.close(); |
|||
}catch (Exception e){ |
|||
DualReferral_His.sendErrorNotice("15602395710", FeeDate+"建立连接,不成功,数据未接受成功"); |
|||
} |
|||
//获取网站状态码200
|
|||
int responseCode = httpConn.getResponseCode(); |
|||
String responseMsg = httpConn.getResponseMessage(); |
|||
if(responseCode!=200){ |
|||
//说明网络异常需要重新请求
|
|||
//throw new Exception("msg");
|
|||
return "4004";//网络异常,再次请求发送
|
|||
} |
|||
byte[] datas = readInputStream(httpConn.getInputStream()); |
|||
String result = new String(datas); |
|||
// System.out.println("result:" + result);
|
|||
String result2= strToHtml(result); |
|||
System.out.println("解析后的结果"+result2); |
|||
String IsUpdate= splitXml(result2,FeeDate); |
|||
return IsUpdate; |
|||
} |
|||
|
|||
*//**
|
|||
* 从输入流中读取数据 |
|||
* |
|||
* @param inStream |
|||
* @return |
|||
* @throws Exception |
|||
*//*
|
|||
public static byte[] readInputStream(InputStream inStream) throws Exception { |
|||
ByteArrayOutputStream outStream = new ByteArrayOutputStream(); |
|||
byte[] buffer = new byte[1024]; |
|||
int len = 0; |
|||
while ((len = inStream.read(buffer)) != -1) { |
|||
outStream.write(buffer, 0, len); |
|||
} |
|||
byte[] data = outStream.toByteArray(); |
|||
outStream.close(); |
|||
inStream.close(); |
|||
return data; |
|||
} |
|||
public static String splitXml(String s,String date) throws Exception{ |
|||
String reg = "<\\?xml\\s+version=\"1.0\"\\s+encoding=\"(.*?)\"\\?>"; |
|||
String result = s.replaceAll(reg,""); |
|||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>(); |
|||
|
|||
String[] esg = parxml2(result); |
|||
//需要正则匹配去除<?xml version=\"1.0\" encoding=\"utf-16\"?>字段才可以
|
|||
//按^切割得到每个患者身份
|
|||
if(!esg[0].equals("0")){ |
|||
//发送短信信息查询吧
|
|||
// return "返回结果代码失误";
|
|||
|
|||
sendErrorNotice("15602395710","日期"+date+":"+esg[1]); |
|||
// throw new Exception("返回结果代码错误");
|
|||
return "返回结果代码错误"; |
|||
} |
|||
if(esg[1].isEmpty()){ |
|||
//throw new Exception("没有返回参数,无更新状态");
|
|||
return "没有返回参数,无更新状态"; |
|||
} |
|||
String[] s2 = esg[1].split("\\^"); |
|||
for(int i =0;i<s2.length;i++){ |
|||
//System.out.println("每行数据"+s2[i]);
|
|||
Map<String,Object> map = new HashMap<String,Object>(); |
|||
//对其按|切割
|
|||
String[] s3=s2[i].split("\\|"); |
|||
map.put("pt_card", s3[0]);//身份证号
|
|||
map.put("inpatient", s3[1]);//住院号
|
|||
map.put("statu", s3[2]);//状态
|
|||
map.put("ID", s3[3]);//这个是患者ID值,为了区分患者在同家医院多次双向转诊的
|
|||
if(s3.length>4){ |
|||
map.put("plan_time", s3[4]);//返回就诊日期
|
|||
} |
|||
list.add(map); |
|||
|
|||
} |
|||
//System.out.println(list);
|
|||
//对此数据模板进行发送
|
|||
//状态 1:已申请审批 2:已住院 3:已就诊
|
|||
//
|
|||
Boolean Istrue =null; |
|||
for(int i =0;i<list.size();i++){ |
|||
Map<String, Object> map2 = new HashMap<String, Object>(); |
|||
map2.put("id", list.get(i).get("ID"));//唯一值
|
|||
//map2.put("status", list.get(i).get("statu")==null?0:list.get(i).get("statu"));//状态 为1的要进行更新吗
|
|||
map2.put("inpatient", list.get(i).get("inpatient"));//住院号
|
|||
map2.put("consultation_time", list.get(i).get("plan_time"));//实际日期,不是转诊日期
|
|||
map2.put("pt_card", list.get(i).get("pt_card"));//身份证号
|
|||
//user 表里查询基层医生手机号
|
|||
Long id= Long.parseLong(list.get(i).get("ID").toString());//(Long) list.get(i).get("ID");
|
|||
//System.out.println("id "+id);//申请医生IO
|
|||
Map<String,Object> user = dualReferral_His.userService.selectByappuserID(id);//患者主健关联查询医生ID
|
|||
String doctorname = user.get("user_name")==null?"":user.get("user_name").toString(); |
|||
String doctorphone = user.get("phone")==null?"":user.get("phone").toString();//pt_name
|
|||
String patientname = user.get("pt_name")==null?"":user.get("pt_name").toString(); |
|||
if(list.get(i).get("statu").equals("1")){ |
|||
|
|||
} |
|||
if(list.get(i).get("statu")==null){ |
|||
map2.put("statu", "0");//处理null值
|
|||
} |
|||
if(list.get(i).get("statu")!=null&&list.get(i).get("statu").equals("2")){ |
|||
// System.out.println("身份证号为:"+list.get(i).get("pt_card")+"已住院"+list.get(i).get("statu"));
|
|||
//对应着statu 6,查询基层医生手机号,根据它返回的主健值ID去查的
|
|||
map2.put("statu", "6"); |
|||
Istrue =dualReferral_His.applyCaseService.updateByHis(map2); |
|||
sendNotice(doctorphone,doctorname,patientname);//先不发短信
|
|||
} |
|||
if(list.get(i).get("statu")!=null&&list.get(i).get("statu").equals("3")){ |
|||
// System.out.println("身份证号为:"+list.get(i).get("pt_card")+"已就诊"+list.get(i).get("statu"));
|
|||
//对应着statu 5
|
|||
map2.put("statu", "5"); |
|||
Istrue =dualReferral_His.applyCaseService.updateByHis(map2); |
|||
sendNotice(doctorphone,doctorname,patientname); |
|||
} |
|||
//保存患者得住院号和状态,数据库里。如果发送短信失败,还要保存数据吗?
|
|||
//Istrue =dualReferral_His.applyCaseService.updateByHis(map2);//更新状态是否成功
|
|||
|
|||
} |
|||
return Istrue==true?"1":"0"; |
|||
} |
|||
public static String strToHtml(String s) |
|||
{ |
|||
if (s==null||s.equals("")) return ""; |
|||
s = s.replaceAll("&","&"); |
|||
s = s.replaceAll("<","<"); |
|||
s = s.replaceAll(">",">"); |
|||
s = s.replaceAll(" "," "); |
|||
return s; |
|||
} |
|||
//解析XML格式
|
|||
public static String[] parxml2(String xml) throws JDOMException, IOException, DocumentException{ |
|||
|
|||
String[] paresu =new String[2]; |
|||
// 1.创建SAXReader的对象reader
|
|||
SAXReader reader = new SAXReader(); |
|||
// 2.通过reader对象的read()方法加载books.xml文件,获取document对象
|
|||
Document document = reader.read(new ByteArrayInputStream(xml.getBytes())); |
|||
// 3.通过document对象获取根节点bookstore
|
|||
Element root = document.getRootElement(); |
|||
Element out = |
|||
document.getRootElement().element("Body").element("GetInterconnectResponse").element("GetInterconnectResult").element("Response"); |
|||
//取2个数据.element("ErrorMsg")
|
|||
Element out2 = out.element("ErrorMsg"); |
|||
Element out3 = out.element("ResultCode"); |
|||
System.out.println("return 解析ErrorMsg:"+out2.getText()); |
|||
System.out.println("return 解析ResultCode:"+out3.getText()); |
|||
paresu[0]=out3.getText(); |
|||
paresu[1]=out2.getText(); |
|||
return paresu; |
|||
} |
|||
public static Map<String, String> sendNotice(String phone,String applydoctor,String patientname){ |
|||
|
|||
Map<String,String> resultMap=new HashMap<String, String>(); |
|||
Map<String,String> map=new HashMap<String, String>(); |
|||
//不如将患者ID保存下来
|
|||
map.put("account","N9903806"); |
|||
map.put("password","9nr02dhiK"); |
|||
map.put("msg",applydoctor+"医生,您好!您转诊的"+patientname+"患者已经如期就诊,请尽快为患者办理医保结算手续。"); |
|||
// User userApplyPhone = userService.selectById(applyUserId);
|
|||
map.put("phone",phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost("http://smssh1.253.com/msg/send/json",JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if(!jsStr.getString("code").equals("0")){ |
|||
resultMap.put("msg", "发送失败"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "发送成功"); |
|||
return resultMap; |
|||
|
|||
} |
|||
public static Map<String, String> sendErrorNotice(String phone,String errormsg){ |
|||
|
|||
Map<String,String> resultMap=new HashMap<String, String>(); |
|||
Map<String,String> map=new HashMap<String, String>(); |
|||
//不如将患者ID保存下来
|
|||
map.put("account","N9903806"); |
|||
map.put("password","9nr02dhiK"); |
|||
map.put("msg","开发者,您好!长沙市第一医院DualReferral_His接口报错,错误信息"+errormsg+"请及时处理"); |
|||
// User userApplyPhone = userService.selectById(applyUserId);
|
|||
map.put("phone",phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost("http://smssh1.253.com/msg/send/json",JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if(!jsStr.getString("code").equals("0")){ |
|||
resultMap.put("msg", "发送失败"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "发送成功"); |
|||
return resultMap; |
|||
|
|||
} |
|||
|
|||
} |
|||
*/ |
|||
@ -0,0 +1,77 @@ |
|||
/*package com.imurs.controller; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Calendar; |
|||
import java.util.Date; |
|||
|
|||
import org.springframework.scheduling.annotation.Async; |
|||
import org.springframework.scheduling.annotation.EnableAsync; |
|||
import org.springframework.scheduling.annotation.Scheduled; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
@Component |
|||
@EnableAsync |
|||
public class DualReferraltime { |
|||
static SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");//
|
|||
static String date =df.format(new Date()); |
|||
static boolean IsRun =false; |
|||
@Async |
|||
@Scheduled(cron = "0 30 07 * * ?")//暂时不启动定时器
|
|||
public void autoDividend() throws Exception { |
|||
|
|||
建立2个并发任务不会互相影响,即使一个报错,另外一个也会执行,并取30分钟间隔,用同一变量 |
|||
if(!responsecode.equals("4004")){ |
|||
//没有网络异常直接结束语句
|
|||
return ""; |
|||
} |
|||
// new DualReferral_His().translate("20181223");
|
|||
String s ="<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"+ |
|||
"<soap:Body><GetInterconnectResponse xmlns=\"http://cardtest.com/\">"+ |
|||
"<GetInterconnectResult><?xml version=\"1.0\" encoding=\"utf-16\"?>"+ |
|||
"<Response>"+ |
|||
"<ResultCode>0</ResultCode>"+ |
|||
"<ErrorMsg>430104196210101036|ZY010000705565|3|58|20190125</ErrorMsg>"+ |
|||
"</Response></GetInterconnectResult></GetInterconnectResponse></soap:Body></soap:Envelope>"; |
|||
try { |
|||
Calendar cal=Calendar.getInstance(); |
|||
cal.add(Calendar.DATE,-1); |
|||
Date time1=cal.getTime(); |
|||
String date= new SimpleDateFormat("yyyyMMdd").format(time1); |
|||
// System.out.println("=2==>");
|
|||
// String msg= DualReferral_His.translate(date);
|
|||
IsRun=true; |
|||
System.out.println(); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
@Async |
|||
@Scheduled(cron = "0 45 07 * * ?") |
|||
public void autoDividend2() throws Exception { |
|||
//得到当天日期格式为yymmdd
|
|||
// System.out.println("===========2=>");
|
|||
String date=null; |
|||
try { |
|||
Calendar cal=Calendar.getInstance(); |
|||
cal.add(Calendar.DATE,-1); |
|||
Date time1=cal.getTime(); |
|||
date= new SimpleDateFormat("yyyyMMdd").format(time1); |
|||
if(IsRun==false){ |
|||
System.out.println("=2==>"); |
|||
String msg= DualReferral_His.translate(date); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
//发送短信 报告异常,
|
|||
DualReferral_His.sendErrorNotice("15602395710", date+"定时查询任务失败"); |
|||
} |
|||
finally{ |
|||
IsRun = false; |
|||
} |
|||
} |
|||
} |
|||
*/ |
|||
@ -0,0 +1,27 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import com.imurs.entity.BMDReportInfo; |
|||
import com.imurs.util.EsUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Controller |
|||
@RestController |
|||
@RequestMapping("es") |
|||
@ConditionalOnProperty(name = "es.enabled", havingValue = "true") |
|||
public class EsController { |
|||
|
|||
@Autowired |
|||
EsUtils esUtils; |
|||
|
|||
@RequestMapping("findAll") |
|||
public List<BMDReportInfo> findAll(){ |
|||
return esUtils.findAll(); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,577 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.io.BufferedInputStream; |
|||
import java.io.ByteArrayInputStream; |
|||
import java.io.ByteArrayOutputStream; |
|||
import java.io.IOException; |
|||
import java.net.MalformedURLException; |
|||
import java.net.ProtocolException; |
|||
import java.net.URL; |
|||
import java.security.GeneralSecurityException; |
|||
import java.security.KeyManagementException; |
|||
import java.util.ArrayList; |
|||
import java.util.Comparator; |
|||
import java.util.HashMap; |
|||
import java.util.Iterator; |
|||
import java.util.LinkedList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Optional; |
|||
import java.util.function.BinaryOperator; |
|||
import java.util.stream.Collectors; |
|||
import java.util.zip.ZipEntry; |
|||
import java.util.zip.ZipInputStream; |
|||
|
|||
import javax.net.ssl.HostnameVerifier; |
|||
import javax.net.ssl.HttpsURLConnection; |
|||
import javax.net.ssl.SSLContext; |
|||
import javax.net.ssl.SSLSession; |
|||
import javax.net.ssl.TrustManager; |
|||
|
|||
import org.dom4j.Document; |
|||
import org.dom4j.DocumentException; |
|||
import org.dom4j.Element; |
|||
import org.dom4j.io.SAXReader; |
|||
import org.json.JSONObject; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.imurs.entity.InoneagentBlood; |
|||
import com.imurs.entity.InoneagentEcg; |
|||
import com.imurs.entity.InoneagentPersion; |
|||
import com.imurs.entity.InoneagentUrine; |
|||
import com.imurs.parameter.AllinoneApi; |
|||
import com.imurs.sound.ConnUtil; |
|||
import com.imurs.util.MD5; |
|||
|
|||
@RestController |
|||
@RequestMapping(value="AllinOne") |
|||
public class GeneralpractController { |
|||
|
|||
/* public static void main(String[] args) throws Exception { |
|||
// TODO Auto-generated method stub
|
|||
//InoneagentBlood f =bp("3","120106197006083031");
|
|||
//System.out.println(f);
|
|||
//基本信息获取
|
|||
//InoneagentPersion in =inoneBasic("3","120106197006083031");
|
|||
//System.out.println("设置"+in.toString());
|
|||
//InoneagentEcg ec= inoneEcg("120106197006083031");
|
|||
//System.out.println(ec.toString());
|
|||
//InoneagentBlood bloodpressure
|
|||
//InoneagentUrine iu=inoneUrine("120106197006083031");
|
|||
//System.out.println(iu.toString());
|
|||
|
|||
}*/ |
|||
//基本信息id 1,基本信息,2,体温,3,身高
|
|||
@RequestMapping(value ="InoneInfo",method = RequestMethod.POST) |
|||
public InoneagentPersion InoneagentInfo(String card,String id) throws Exception { |
|||
InoneagentPersion in=inoneBasic(id,card); |
|||
if(in.getSex()!=null){ |
|||
String sex=in.getSex(); |
|||
switch (sex){ |
|||
case "0": |
|||
in.setSex("未知的性别"); |
|||
break; |
|||
case "1": |
|||
in.setSex("男"); |
|||
break; |
|||
case "2": |
|||
in.setSex("女"); |
|||
break; |
|||
default : |
|||
in.setSex("未说明的性别"); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
return in; |
|||
|
|||
} |
|||
//id 1,血压 2,血氧,3,血糖
|
|||
@RequestMapping(value ="InoneageBloodInfo",method = RequestMethod.POST) |
|||
public InoneagentBlood InoneagentBloodInfo(String card,String id) throws Exception { |
|||
InoneagentBlood IB= bp(id,card); |
|||
if(IB.getExamtype()!=null){ |
|||
|
|||
String s= IB.getExamtype().equals("0")==true?"餐前":"餐后"; |
|||
IB.setExamtype(s); |
|||
|
|||
} |
|||
|
|||
|
|||
return IB; |
|||
|
|||
} |
|||
//心电InoneagentEcg ec= inoneEcg
|
|||
@RequestMapping(value ="InoneageEcgInfo",method = RequestMethod.POST) |
|||
public Map<String, Object> InoneageEcgInfo(String card) throws Exception { |
|||
InoneagentEcg IB= inoneEcg(card); |
|||
Map<String,Object> map = new HashMap<String,Object>(); |
|||
List<Map<String,String>> list = null; |
|||
if(IB.getFilename()!=null&&!IB.getFilename().isEmpty()){ |
|||
//文件路径不为空 ,
|
|||
try{ |
|||
String urlpath="https://d.xzhealth.cn//"+IB.getFilename(); |
|||
String xml=drawEcg(urlpath); |
|||
list= parECGxml(xml); |
|||
}catch(Exception e){ |
|||
map.put("msg", "解析异常或无波形数据"); |
|||
} |
|||
} |
|||
map.put("list", list==null?"":list); |
|||
map.put("IB", IB); |
|||
return map; |
|||
|
|||
} |
|||
//
|
|||
@RequestMapping(value ="InoneageEcgDate",method = RequestMethod.POST) |
|||
public Map<String,Object> InoneageEcgDate(String card) throws Exception { |
|||
//InoneagentEcg IB= inoneEcg(card);
|
|||
Map<String,Object> map = new HashMap<String,Object>(); |
|||
//当心电路径不为空 时,解析心电数据
|
|||
List<Map<String,String>> list = null; |
|||
if(card!=null&&!card.isEmpty()){ |
|||
//true 表示路径存在值
|
|||
String urlpath="https://d.xzhealth.cn//"+card; |
|||
String xml=drawEcg(urlpath); |
|||
list= parECGxml(xml); |
|||
} |
|||
//map.put("Ecgbasic", IB);
|
|||
map.put("list", list); |
|||
return map; |
|||
|
|||
} |
|||
//尿常规
|
|||
@RequestMapping(value ="InoneageUrineInfo",method = RequestMethod.POST) |
|||
public InoneagentUrine InoneageurineInfo(String card) throws Exception { |
|||
InoneagentUrine IB= inoneUrine(card); |
|||
return IB; |
|||
|
|||
} |
|||
//尿常规
|
|||
private InoneagentUrine inoneUrine(String IDcard) throws Exception{ |
|||
InoneagentUrine InU = new InoneagentUrine(); |
|||
String url = AllinoneApi.URINE_API; |
|||
JSONArray json=comon(url); |
|||
if(null==json){ |
|||
return InU ; |
|||
}else{ |
|||
InU= InonebasicUrine(json,IDcard); |
|||
return InU; |
|||
} |
|||
|
|||
|
|||
} |
|||
//尿常规
|
|||
private InoneagentUrine InonebasicUrine(JSONArray json, String iDcard) throws Exception { |
|||
// TODO Auto-generated method stub
|
|||
List<InoneagentUrine> BpStreamList = new ArrayList<InoneagentUrine>(); |
|||
for(int i=0;i<json.size();i++){ |
|||
InoneagentUrine IB = new InoneagentUrine(); |
|||
com.alibaba.fastjson.JSONObject job = json.getJSONObject(i); |
|||
IB.setMachineno(job.getString("MachineNo")); |
|||
IB.setUro(job.getString("URO")); |
|||
IB.setBld(job.getString("BLD")); |
|||
IB.setBil(job.getString("BIL")); |
|||
IB.setKet(job.getString("KET")); |
|||
IB.setGlu(job.getString("GLU")); |
|||
IB.setPro(job.getString("PRO")); |
|||
IB.setPh(job.getString("PH")); |
|||
IB.setNit(job.getString("NIT")); |
|||
IB.setWbc(job.getString("WBC")); |
|||
IB.setSg(job.getString("SG")); |
|||
IB.setVc(job.getString("VC")); |
|||
IB.setExamtime(job.getString("ExamTime")); |
|||
IB.setIdnumber(job.getString("IDNumber")); |
|||
BpStreamList.add(IB); |
|||
} |
|||
Comparator<InoneagentUrine> byHeight= Comparator.comparing(InoneagentUrine::getExamtime); |
|||
Optional<InoneagentUrine> fbp= BpStreamList.stream().filter(IB->IB.getIdnumber().equals(iDcard)).collect(Collectors.reducing(BinaryOperator.maxBy(byHeight))); |
|||
InoneagentUrine res= null; |
|||
if(fbp.isPresent()){ |
|||
res=fbp.get(); |
|||
}else{ |
|||
throw new Exception("无此人信息"); |
|||
} |
|||
return res; |
|||
} |
|||
//心电
|
|||
private InoneagentEcg inoneEcg(String IDcard) throws Exception{ |
|||
InoneagentEcg Ine = new InoneagentEcg(); |
|||
String url=AllinoneApi.ECG_API; |
|||
JSONArray json=comon(url); |
|||
if(null==json){ |
|||
return Ine ; |
|||
}else{ |
|||
//String IDcard ="440582199203026695";
|
|||
Ine= InonebasicEcg(json,IDcard); |
|||
// System.out.println(f);
|
|||
return Ine; |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
private InoneagentEcg InonebasicEcg(JSONArray json, String iDcard) throws Exception { |
|||
// TODO Auto-generated method stub
|
|||
List<InoneagentEcg> BpStreamList = new ArrayList<InoneagentEcg>(); |
|||
for(int i=0;i<json.size();i++){ |
|||
InoneagentEcg IB = new InoneagentEcg(); |
|||
com.alibaba.fastjson.JSONObject job = json.getJSONObject(i); |
|||
|
|||
// 心电
|
|||
IB.setIdnumber(job.getString("IDNumber")); |
|||
IB.setDiagnosis(job.getString("Diagnosis")); |
|||
IB.setFilename(job.getString("FileName")); |
|||
IB.setExamtime(job.getString("ExamTime")); |
|||
IB.setHr(job.getString("HR")); |
|||
IB.setMachineno(job.getString("MachineNo")); |
|||
IB.setPaxis(job.getString("Paxis")); |
|||
IB.setPr(job.getString("PR")); |
|||
IB.setQrs(job.getString("QRS")); |
|||
IB.setQrsaxis(job.getString("QRSaxis")); |
|||
IB.setQt(job.getString("QT")); |
|||
IB.setQtc(job.getString("QTc")); |
|||
IB.setRv5(job.getString("RV5")); |
|||
IB.setSv1(job.getString("SV1")); |
|||
IB.setTaxis(job.getString("Taxis")); |
|||
BpStreamList.add(IB); |
|||
} |
|||
Comparator<InoneagentEcg> byHeight= Comparator.comparing(InoneagentEcg::getExamtime); |
|||
Optional<InoneagentEcg> fbp= BpStreamList.stream().filter(IB->IB.getIdnumber().equals(iDcard)).filter(IB->!IB.getHr().equals("0")).collect(Collectors.reducing(BinaryOperator.maxBy(byHeight))); |
|||
// InoneagentEcg res= fbp.get();
|
|||
InoneagentEcg res= null; |
|||
if(fbp.isPresent()){ |
|||
res=fbp.get(); |
|||
}else{ |
|||
throw new Exception("无此人信息"); |
|||
} |
|||
return res; |
|||
} |
|||
// 居民健康信息,体温,身高体重
|
|||
private InoneagentPersion inoneBasic(String grade,String IDcard) throws Exception{ |
|||
//String grade="1";
|
|||
InoneagentPersion Inp = new InoneagentPersion(); |
|||
String url=null; |
|||
if(grade==null){ |
|||
throw new Exception("类型不匹配"); |
|||
} |
|||
switch(grade){ |
|||
case "1": |
|||
url=AllinoneApi.PERSON_API; |
|||
break; |
|||
case "2": |
|||
url=AllinoneApi.TEMPERATIURE_API; |
|||
break; |
|||
case "3": |
|||
url=AllinoneApi.HEIGHTWEI_API; |
|||
break; |
|||
default : |
|||
throw new Exception("类型不匹配"); |
|||
// return Inp;
|
|||
} |
|||
JSONArray json=comon(url); |
|||
|
|||
if(null==json){ |
|||
return Inp ; |
|||
}else{ |
|||
//String IDcard ="440582199203026695";
|
|||
Inp= Inonebasicdate(json,IDcard,grade); |
|||
// System.out.println(f);
|
|||
return Inp; |
|||
} |
|||
|
|||
} |
|||
private InoneagentPersion Inonebasicdate(JSONArray json, String iDcard, String grade) throws Exception { |
|||
// TODO Auto-generated method stub
|
|||
List<InoneagentPersion> BpStreamList = new ArrayList<InoneagentPersion>(); |
|||
//
|
|||
for(int i=0;i<json.size();i++){ |
|||
InoneagentPersion IB = new InoneagentPersion(); |
|||
com.alibaba.fastjson.JSONObject job = json.getJSONObject(i); |
|||
|
|||
// 居民健康信息,体温,身高体重
|
|||
IB.setPersonname(job.getString("PersonName")); |
|||
IB.setIdnumber(job.getString("IDNumber")); |
|||
IB.setBirthday(job.getString("Birthday")); |
|||
IB.setAddress(job.getString("Address")); |
|||
IB.setNation(job.getString("Nation")); |
|||
IB.setSex(job.getString("Sex")); |
|||
IB.setTemperature(job.getString("Temperature")); |
|||
IB.setWeight(job.getString("Weight")); |
|||
IB.setHeight(job.getString("Height")); |
|||
IB.setTel(job.getString("Tel")); |
|||
IB.setDomicile(job.getString("Domicile")); |
|||
IB.setArchivedate(job.getString("ArchiveDate")); |
|||
IB.setHwExamtime(job.getString("ExamTime")); |
|||
IB.setTepExamtime(job.getString("ExamTime")); |
|||
IB.setMachineno(job.getString("MachineNo")); |
|||
BpStreamList.add(IB); |
|||
} |
|||
// System.out.println(""+BpStreamList);
|
|||
Comparator<InoneagentPersion> byHeight=null; |
|||
if("1".equals(grade)){ |
|||
byHeight = Comparator.comparing(InoneagentPersion::getArchivedate); |
|||
}else if("2".equals(grade)){ |
|||
//System.out.println("wwe");
|
|||
byHeight = Comparator.comparing(InoneagentPersion::getTepExamtime); |
|||
}else if("3".equals(grade)){ |
|||
byHeight = Comparator.comparing(InoneagentPersion::getHwExamtime); |
|||
}else{ |
|||
throw new Exception("grade 为非指定的类型"); |
|||
} |
|||
|
|||
Optional<InoneagentPersion> fbp= BpStreamList.stream().filter(IB->IB.getIdnumber().equals(iDcard)).collect(Collectors.reducing(BinaryOperator.maxBy(byHeight))); |
|||
// InoneagentPersion res= fbp.get();
|
|||
// Optional<InoneagentPersion> os= Optional.ofNullable(fbp.get());
|
|||
InoneagentPersion res=null; |
|||
if(fbp.isPresent()){ |
|||
res=fbp.get(); |
|||
}else{ |
|||
throw new Exception("无此人信息"); |
|||
} |
|||
return res; |
|||
|
|||
} |
|||
private InoneagentBlood bp(String grade,String IDcard) throws Exception{ |
|||
//String grade="1";
|
|||
InoneagentBlood f = new InoneagentBlood(); |
|||
String url=null; |
|||
if(grade==null){ |
|||
throw new Exception("未指定类型"); |
|||
} |
|||
switch(grade){ |
|||
case "1": |
|||
url=AllinoneApi.BLOODP_API; |
|||
break; |
|||
case "2": |
|||
url=AllinoneApi.BLOODOXY_API; |
|||
break; |
|||
case "3": |
|||
url=AllinoneApi.BLOODGLUC_API; |
|||
break; |
|||
default : |
|||
throw new Exception("类型不匹配"); |
|||
|
|||
} |
|||
JSONArray json=comon(url); |
|||
|
|||
if(null==json){ |
|||
return f ; |
|||
}else{ |
|||
//String IDcard ="440582199203026695";
|
|||
f= blood(json,IDcard,grade); |
|||
// System.out.println(f);
|
|||
return f; |
|||
} |
|||
|
|||
} |
|||
|
|||
private JSONArray comon(String durl) throws Exception, Exception{ |
|||
SSLContext sslcontext = SSLContext.getInstance("SSL","SunJSSE"); |
|||
sslcontext.init(null, new TrustManager[]{new com.imurs.parameter.MyX509TrustManager()}, new java.security.SecureRandom()); |
|||
URL url = new URL(durl);///inoneagent/bloodoxygen
|
|||
HostnameVerifier ignoreHostnameVerifier = new HostnameVerifier() { |
|||
public boolean verify(String s, SSLSession sslsession) { |
|||
System.out.println("WARNING: Hostname is not matched for cert."); |
|||
return true; |
|||
} |
|||
}; |
|||
HttpsURLConnection.setDefaultHostnameVerifier(ignoreHostnameVerifier); |
|||
HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory()); |
|||
String ap1 = "b9e34120-7c02-4d96-8825-37f5ae5bcc9c";//这个是机器设备密钥
|
|||
String key1 ="9410b975-9f33-44b3-8b19-00fe189191c5";//需要厂家提供
|
|||
// String URL ="https://d.xzhealth.cn";
|
|||
// String ap=MD5.GetMD5Code(ap1);
|
|||
String key =MD5.GetMD5Code(key1); |
|||
JSONObject params = new JSONObject(); |
|||
params.put("ap", ap1); |
|||
params.put("sig", key); |
|||
HttpsURLConnection conn= (HttpsURLConnection) url.openConnection(); |
|||
conn.setConnectTimeout(5000); |
|||
conn.setRequestMethod("POST"); |
|||
conn.setRequestProperty("Content-Type", "application/json; charset=utf-8"); |
|||
conn.setDoOutput(true); |
|||
conn.getOutputStream().write(params.toString().getBytes()); |
|||
conn.getOutputStream().close(); |
|||
String result = ConnUtil.getResponseString(conn); |
|||
// System.out.println(result);
|
|||
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(result); |
|||
String sucess=jsonObject.get("success").toString(); |
|||
JSONArray json = null; |
|||
if(sucess.equals("0")){ |
|||
json = JSONArray.parseArray(jsonObject.get("datas").toString()); |
|||
} |
|||
|
|||
return json; |
|||
} |
|||
//处理数据过程 //血压
|
|||
/*public static InoneagentBlood bloodpressure(JSONArray json,String IDcard) throws Exception{ |
|||
List<InoneagentBlood> BpStreamList = new ArrayList<InoneagentBlood>(); |
|||
//
|
|||
for(int i=0;i<json.size();i++){ |
|||
InoneagentBlood bp = new InoneagentBlood(); |
|||
com.alibaba.fastjson.JSONObject job = json.getJSONObject(i); |
|||
|
|||
// 血压
|
|||
bp.setIdnumber(job.getString("IDNumber")); |
|||
bp.setDiastolic(job.getString("Diastolic")); |
|||
bp.setPressureExamtime(job.getString("ExamTime")); |
|||
bp.setSystolic(job.getString("Systolic")); |
|||
BpStreamList.add(bp); |
|||
} |
|||
// System.out.println("测试数据"+BpStreamList.size());
|
|||
Comparator<InoneagentBlood> byHeight = Comparator.comparing(InoneagentBlood::getPressureExamtime); |
|||
Optional<InoneagentBlood> fbp= BpStreamList.stream().filter(BP->BP.getIdnumber().equals(IDcard)).collect(Collectors.reducing(BinaryOperator.maxBy(byHeight))); |
|||
//下面的为根据检查部位不同 选择各自的最新日期
|
|||
Map<String, Optional<BP>> li2= BpStreamList.stream().filter(BP->BP.getIDNumber().equals("120106197006083031")).collect(Collectors.groupingBy(BP::getExamType, |
|||
Collectors.reducing(BinaryOperator.maxBy(byHeight)))); |
|||
Collection<Optional<BP>> cb= li2.values(); |
|||
Iterator<Optional<BP>> ib= cb.iterator(); |
|||
while(ib.hasNext()){ |
|||
Optional<BP> obp= ib.next(); |
|||
fresult.add(obp.get()); |
|||
} |
|||
InoneagentBlood res= null; |
|||
if(fbp.isPresent()){ |
|||
res=fbp.get(); |
|||
}else{ |
|||
throw new Exception("无此人信息"); |
|||
} |
|||
//InoneagentBlood res= fbp.get();
|
|||
return res; |
|||
}*/ |
|||
private InoneagentBlood blood(JSONArray json,String IDcard,String id) throws Exception{ |
|||
List<InoneagentBlood> BpStreamList = new ArrayList<InoneagentBlood>(); |
|||
//
|
|||
for(int i=0;i<json.size();i++){ |
|||
InoneagentBlood bp = new InoneagentBlood(); |
|||
com.alibaba.fastjson.JSONObject job = json.getJSONObject(i); |
|||
|
|||
// 血压
|
|||
bp.setIdnumber(job.getString("IDNumber")); |
|||
bp.setDiastolic(job.getString("Diastolic")); |
|||
if(id.equals("1")){ |
|||
bp.setPressureExamtime(job.getString("ExamTime")); |
|||
} |
|||
bp.setSystolic(job.getString("Systolic")); |
|||
bp.setMachineno(job.getString("MachineNo"));//MachineNo
|
|||
//血氧
|
|||
bp.setOxygen(job.getString("Oxygen")); |
|||
bp.setPulserate(job.getString("PulseRate")); |
|||
if(id.equals("2")){ |
|||
bp.setOxygExamtime(job.getString("ExamTime")); |
|||
} |
|||
//血糖
|
|||
bp.setGlucose(job.getString("Glucose")); |
|||
if(id.equals("3")){ |
|||
bp.setGlucoseExamtime(job.getString("ExamTime")); |
|||
} |
|||
|
|||
bp.setExamtype(job.getString("ExamType")); |
|||
BpStreamList.add(bp); |
|||
} |
|||
// 1,2,3区分血压,血氧,血糖
|
|||
Comparator<InoneagentBlood> byHeight =null; |
|||
if(id.equals("1")){ |
|||
byHeight = Comparator.comparing(InoneagentBlood::getPressureExamtime); |
|||
} |
|||
else if(id.equals("2")){ |
|||
byHeight = Comparator.comparing(InoneagentBlood::getOxygExamtime); |
|||
} |
|||
else if(id.equals("3")){ |
|||
byHeight = Comparator.comparing(InoneagentBlood::getGlucoseExamtime); |
|||
}else{ |
|||
throw new Exception("id 值为非识别类型"); |
|||
} |
|||
|
|||
Optional<InoneagentBlood> fbp= BpStreamList.stream().filter(BP->BP.getIdnumber().equals(IDcard)).collect(Collectors.reducing(BinaryOperator.maxBy(byHeight))); |
|||
//InoneagentBlood res= fbp.get();
|
|||
InoneagentBlood res= null; |
|||
if(fbp.isPresent()){ |
|||
res=fbp.get(); |
|||
}else{ |
|||
throw new Exception("无此人信息"); |
|||
} |
|||
return res; |
|||
} |
|||
//下面为心电12导联数据
|
|||
private String drawEcg(String urlPath) throws GeneralSecurityException, Exception{ |
|||
//https 下载
|
|||
SSLContext sslcontext = SSLContext.getInstance("SSL","SunJSSE"); |
|||
sslcontext.init(null, new TrustManager[]{new com.imurs.parameter.MyX509TrustManager()}, new java.security.SecureRandom()); |
|||
URL url = new URL(urlPath); |
|||
HostnameVerifier ignoreHostnameVerifier = new HostnameVerifier() { |
|||
public boolean verify(String s, SSLSession sslsession) { |
|||
//System.out.println("WARNING: Hostname is not matched for cert.");
|
|||
return true; |
|||
} |
|||
}; |
|||
HttpsURLConnection.setDefaultHostnameVerifier(ignoreHostnameVerifier); |
|||
HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory()); |
|||
HttpsURLConnection conn= (HttpsURLConnection) url.openConnection(); |
|||
conn.setConnectTimeout(5000); |
|||
conn.setRequestMethod("GET"); |
|||
conn.setRequestProperty("Content-Type", "application/octet-stream; charset=utf-8"); |
|||
conn.setDoOutput(true); |
|||
BufferedInputStream bin = new BufferedInputStream(conn.getInputStream()); |
|||
//解压成流
|
|||
ZipInputStream Zin=new ZipInputStream(bin);//
|
|||
BufferedInputStream Bin=new BufferedInputStream(Zin); |
|||
ZipEntry entry; |
|||
ByteArrayOutputStream result=null; |
|||
//解压文件下的多个文件,按照对方提供的文档是只存在一个文件的
|
|||
while((entry = Zin.getNextEntry())!=null && !entry.isDirectory()){ |
|||
result = new ByteArrayOutputStream(); |
|||
byte[] buffer = new byte[1024]; |
|||
int length; |
|||
while ((length = Bin.read(buffer)) != -1) { |
|||
result.write(buffer, 0, length); |
|||
} |
|||
} |
|||
String finallyResult =result.toString("UTF-8"); |
|||
|
|||
return finallyResult; |
|||
|
|||
} |
|||
//解析解压后的字符串
|
|||
private List<Map<String,String>> parECGxml(String xml) throws DocumentException{ |
|||
SAXReader reader = new SAXReader(); |
|||
Document document = reader.read(new ByteArrayInputStream(xml.getBytes())); |
|||
//Element root = document.getRootElement();
|
|||
//System.out.println(root);
|
|||
//Element out =
|
|||
// document.getRootElement().element("Institution");
|
|||
//String s=out.getTextTrim();
|
|||
//System.out.println("??? "+s);
|
|||
//
|
|||
Element ecglist = document.getRootElement().element("EcgLeadList"); |
|||
//String sample=ecglist.element("Sample").getText();
|
|||
//System.out.println(sample);
|
|||
Iterator<Element> it=ecglist.elementIterator(); |
|||
List<Map<String,String>> list = new LinkedList<Map<String,String>>(); |
|||
while(it.hasNext()){ |
|||
//Node node1 =it.next();
|
|||
Map<String,String> hashEcg = new HashMap<String,String>(); |
|||
Element el =it.next(); |
|||
|
|||
String leadtype =el.elementText("LeadType");//出现了null 值
|
|||
String leadDate =el.elementText("LeadData"); |
|||
//System.out.println(""+leadtype+" ");
|
|||
if(leadtype!=null){ |
|||
hashEcg.put(leadtype, leadDate); |
|||
list.add(hashEcg); |
|||
} |
|||
|
|||
} |
|||
return list; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,943 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.io.ByteArrayInputStream; |
|||
import java.io.File; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.io.OutputStream; |
|||
import java.net.HttpURLConnection; |
|||
import java.net.MalformedURLException; |
|||
import java.net.URL; |
|||
import java.util.ArrayList; |
|||
import java.util.Collection; |
|||
import java.util.Comparator; |
|||
import java.util.HashMap; |
|||
import java.util.Iterator; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Optional; |
|||
import java.util.Set; |
|||
import java.util.TreeMap; |
|||
import java.util.Map.Entry; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import org.apache.commons.io.IOUtils; |
|||
import org.dom4j.Document; |
|||
import org.dom4j.DocumentException; |
|||
import org.dom4j.DocumentHelper; |
|||
import org.dom4j.Element; |
|||
import org.dom4j.Node; |
|||
import org.dom4j.io.SAXReader; |
|||
import org.jdom.JDOMException; |
|||
import org.jsoup.Jsoup; |
|||
import org.jsoup.select.Elements; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
import com.imurs.parameter.LIS; |
|||
import com.imurs.parameter.PACS; |
|||
|
|||
|
|||
@RestController |
|||
@RequestMapping(value="JyHiS") |
|||
public class GsHisController { |
|||
/** |
|||
* HIS_PatientInfo接口 |
|||
* @throws IOException |
|||
* @throws DocumentException |
|||
* @throws JDOMException |
|||
*/ |
|||
@RequestMapping(value ="PatientInfo",method = RequestMethod.POST) |
|||
public Map<String,Object> PatientInfo(String InpatientNo,String PatientType) throws IOException, JDOMException, DocumentException{ |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
String s = new String();//GetPatientInfo
|
|||
|
|||
|
|||
StringBuilder sendmsg=new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); |
|||
sendmsg.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">") |
|||
.append("<soapenv:Header>") |
|||
.append("<tem:MySoapHeader/>") |
|||
.append("</soapenv:Header>") |
|||
.append("<soapenv:Body>") |
|||
.append("<tem:GetPatientInfo>") |
|||
|
|||
.append("<tem:strXml><![CDATA[<Request><PatientType>") |
|||
.append(PatientType) |
|||
.append("</PatientType> <InpatientNo>") |
|||
.append(InpatientNo) |
|||
.append("</InpatientNo></Request>]]></tem:strXml>") |
|||
.append("</tem:GetPatientInfo>") |
|||
.append("</soapenv:Body>") |
|||
.append("</soapenv:Envelope>"); |
|||
//字符串转发出去
|
|||
|
|||
//System.out.println("soapHeader="+sendmsg);
|
|||
//设置soap请求报文的相关属性
|
|||
//url从soapUI的request1的RAW标签的POST获取,url中不要有空格
|
|||
String url="http://2484x4726z.qicp.vip:10746/HsRcsWebService.asmx"; |
|||
URL u = new URL(url); |
|||
HttpURLConnection conn = (HttpURLConnection) u.openConnection(); |
|||
conn.setDoInput(true); |
|||
conn.setDoOutput(true); |
|||
conn.setUseCaches(false); |
|||
conn.setDefaultUseCaches(false); |
|||
//Host,Content-Type,SOAPAction从soapUI的request1的RAW标签的Host,Content-Typ,SOAPActione获取
|
|||
conn.setRequestProperty("Host", "2484x4726z.qicp.vip:10746"); |
|||
conn.setRequestProperty("Content-Type", "text/xml;charset=UTF-8"); |
|||
conn.setRequestProperty("Content-Length", String.valueOf(sendmsg.length())); |
|||
conn.setRequestProperty("SOAPAction", "http://tempuri.org/GetPatientInfo"); |
|||
conn.setRequestMethod("POST"); |
|||
OutputStream output = null; |
|||
//请求失败,可能网络不好,或工作站未打开
|
|||
try{ |
|||
conn.setConnectTimeout(10000); |
|||
conn.setReadTimeout(10000);//15S连接不成功则直接抛错,防止对方服务器挂了,程序一直挂着
|
|||
output =conn.getOutputStream(); |
|||
}catch (Exception e){ |
|||
map.put("ResultCode","3" ); |
|||
return map; |
|||
} |
|||
//定义输出流
|
|||
|
|||
if (null != sendmsg) { |
|||
byte[] b = sendmsg.toString().getBytes("utf-8"); |
|||
//发送soap请求报文
|
|||
output.write(b, 0, b.length);} |
|||
output.flush(); |
|||
output.close(); |
|||
//定义输入流,获取soap响应报文
|
|||
InputStream input = conn.getInputStream(); |
|||
//需设置编码格式,否则会乱码
|
|||
s=IOUtils.toString(input, "UTF-8"); |
|||
input.close(); |
|||
String s1=strToHtml(s); |
|||
//System.out.println("输出的xml="+s1);
|
|||
Map<String,Object> resultmap =PatientInfofoxml(s1); |
|||
return resultmap; |
|||
} |
|||
/** |
|||
* HIS_LISRESULT接口 |
|||
* @throws IOException |
|||
* @throws DocumentException |
|||
* @throws JDOMException |
|||
*/ |
|||
@RequestMapping(value ="LisResult",method = RequestMethod.POST) |
|||
public Map<String,Object> LisResult(String InpatientNo,String PatientType) throws IOException, JDOMException, DocumentException{ |
|||
String s = new String();//GetPatientInfo
|
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
|
|||
StringBuilder sendmsg=new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); |
|||
sendmsg.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">") |
|||
.append("<soapenv:Header>") |
|||
.append("<tem:MySoapHeader/>") |
|||
.append("</soapenv:Header>") |
|||
.append("<soapenv:Body>") |
|||
.append("<tem:GetLisResult>") |
|||
|
|||
.append("<tem:strXml><![CDATA[<Request><PatientType>") |
|||
.append(PatientType) |
|||
.append("</PatientType> <InpatientNo>") |
|||
.append(InpatientNo) |
|||
.append("</InpatientNo></Request>]]></tem:strXml>") |
|||
.append("</tem:GetLisResult>") |
|||
.append("</soapenv:Body>") |
|||
.append("</soapenv:Envelope>"); |
|||
//字符串转发出去
|
|||
|
|||
//System.out.println("soapHeader="+sendmsg);
|
|||
//设置soap请求报文的相关属性
|
|||
//url从soapUI的request1的RAW标签的POST获取,url中不要有空格
|
|||
String url="http://2484x4726z.qicp.vip:10746/HsRcsWebService.asmx"; |
|||
URL u = new URL(url); |
|||
HttpURLConnection conn = (HttpURLConnection) u.openConnection(); |
|||
conn.setDoInput(true); |
|||
conn.setDoOutput(true); |
|||
conn.setUseCaches(false); |
|||
conn.setDefaultUseCaches(false); |
|||
//Host,Content-Type,SOAPAction从soapUI的request1的RAW标签的Host,Content-Typ,SOAPActione获取
|
|||
conn.setRequestProperty("Host", "2484x4726z.qicp.vip:10746"); |
|||
conn.setRequestProperty("Content-Type", "text/xml;charset=UTF-8"); |
|||
conn.setRequestProperty("Content-Length", String.valueOf(sendmsg.length())); |
|||
conn.setRequestProperty("SOAPAction", "http://tempuri.org/GetLisResult"); |
|||
conn.setRequestMethod("POST"); |
|||
//定义输出流
|
|||
|
|||
OutputStream output = null; |
|||
//请求失败,可能网络不好,或工作站未打开
|
|||
try{ |
|||
conn.setConnectTimeout(10000); |
|||
conn.setReadTimeout(10000);//30S连接不成功则直接抛错,防止对方服务器挂了,程序一直挂着
|
|||
output =conn.getOutputStream(); |
|||
}catch (Exception e){ |
|||
map.put("ResultCode","3" ); |
|||
return map; |
|||
} |
|||
if (null != sendmsg) { |
|||
byte[] b = sendmsg.toString().getBytes("utf-8"); |
|||
//发送soap请求报文
|
|||
output.write(b, 0, b.length);} |
|||
output.flush(); |
|||
output.close(); |
|||
//定义输入流,获取soap响应报文
|
|||
InputStream input = conn.getInputStream(); |
|||
//需设置编码格式,否则会乱码
|
|||
s=IOUtils.toString(input, "UTF-8"); |
|||
input.close(); |
|||
String s1=strToHtml(s); |
|||
//System.out.println(s1);
|
|||
map=parLis(s1); |
|||
return map; |
|||
|
|||
} |
|||
/** |
|||
* HIS_PACSRESULT接口 |
|||
* @throws IOException |
|||
* @throws DocumentException |
|||
* @throws JDOMException |
|||
*/ |
|||
@RequestMapping(value ="PacsResult",method = RequestMethod.POST) |
|||
public Map<String,Object>PacsResult(String InpatientNo,String PatientType) throws IOException, JDOMException, DocumentException{ |
|||
String s = new String();//GetPatientInfo
|
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
StringBuilder sendmsg=new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); |
|||
sendmsg.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">") |
|||
.append("<soapenv:Header>") |
|||
.append("<tem:MySoapHeader/>") |
|||
.append("</soapenv:Header>") |
|||
.append("<soapenv:Body>") |
|||
.append("<tem:GetPacsResult>") |
|||
|
|||
.append("<tem:strXml><![CDATA[<Request><PatientType>") |
|||
.append(PatientType) |
|||
.append("</PatientType> <InpatientNo>") |
|||
.append(InpatientNo) |
|||
.append("</InpatientNo></Request>]]></tem:strXml>") |
|||
.append("</tem:GetPacsResult>") |
|||
.append("</soapenv:Body>") |
|||
.append("</soapenv:Envelope>"); |
|||
//字符串转发出去
|
|||
|
|||
//System.out.println("soapHeader="+sendmsg);
|
|||
//设置soap请求报文的相关属性
|
|||
//url从soapUI的request1的RAW标签的POST获取,url中不要有空格
|
|||
String url="http://2484x4726z.qicp.vip:10746/HsRcsWebService.asmx"; |
|||
URL u = new URL(url); |
|||
HttpURLConnection conn = (HttpURLConnection) u.openConnection(); |
|||
conn.setDoInput(true); |
|||
conn.setDoOutput(true); |
|||
conn.setUseCaches(false); |
|||
conn.setDefaultUseCaches(false); |
|||
//Host,Content-Type,SOAPAction从soapUI的request1的RAW标签的Host,Content-Typ,SOAPActione获取
|
|||
conn.setRequestProperty("Host", "2484x4726z.qicp.vip:10746"); |
|||
conn.setRequestProperty("Content-Type", "text/xml;charset=UTF-8"); |
|||
conn.setRequestProperty("Content-Length", String.valueOf(sendmsg.length())); |
|||
conn.setRequestProperty("SOAPAction", "http://tempuri.org/GetPacsResult"); |
|||
conn.setRequestMethod("POST"); |
|||
//定义输出流
|
|||
OutputStream output = null; |
|||
//请求失败,可能网络不好,或工作站未打开
|
|||
try{ |
|||
conn.setConnectTimeout(10000); |
|||
conn.setReadTimeout(10000);//30S连接不成功则直接抛错,防止对方服务器挂了,程序一直挂着
|
|||
output =conn.getOutputStream(); |
|||
}catch (Exception e){ |
|||
map.put("ResultCode","3" ); |
|||
return map; |
|||
} |
|||
//OutputStream output = conn.getOutputStream();
|
|||
if (null != sendmsg) { |
|||
byte[] b = sendmsg.toString().getBytes("utf-8"); |
|||
//发送soap请求报文
|
|||
output.write(b, 0, b.length);} |
|||
output.flush(); |
|||
output.close(); |
|||
//定义输入流,获取soap响应报文
|
|||
InputStream input = conn.getInputStream(); |
|||
//需设置编码格式,否则会乱码
|
|||
s=IOUtils.toString(input, "UTF-8"); |
|||
input.close(); |
|||
String s1=strToHtml(s); |
|||
//System.out.println("输出的xml="+s1);
|
|||
map=ParPacsResultfoxml(s1); |
|||
return map; |
|||
|
|||
} |
|||
/** |
|||
* HIS_PACSRESULT接口 |
|||
* @throws IOException |
|||
* @throws DocumentException |
|||
* @throws JDOMException |
|||
*/ |
|||
@RequestMapping(value ="MedicalRecord",method = RequestMethod.POST) |
|||
public Map<String,Object>MedicalRecord(String InpatientNo,String PatientType) throws IOException, JDOMException, DocumentException{ |
|||
String s = new String();//GetPatientInfo
|
|||
Map<String, Object> maph = new HashMap<String, Object>(); |
|||
|
|||
StringBuilder sendmsg=new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); |
|||
sendmsg.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">") |
|||
.append("<soapenv:Header>") |
|||
.append("<tem:MySoapHeader/>") |
|||
.append("</soapenv:Header>") |
|||
.append("<soapenv:Body>") |
|||
.append("<tem:GetMedicalRecord>") |
|||
|
|||
.append("<tem:strXml><![CDATA[<Request><PatientType>") |
|||
.append(PatientType) |
|||
.append("</PatientType> <InpatientNo>") |
|||
.append(InpatientNo) |
|||
.append("</InpatientNo></Request>]]></tem:strXml>") |
|||
.append("</tem:GetMedicalRecord>") |
|||
.append("</soapenv:Body>") |
|||
.append("</soapenv:Envelope>"); |
|||
//字符串转发出去
|
|||
|
|||
//设置soap请求报文的相关属性
|
|||
//url从soapUI的request1的RAW标签的POST获取,url中不要有空格
|
|||
String url="http://2484x4726z.qicp.vip:10746/HsRcsWebService.asmx"; |
|||
URL u = new URL(url); |
|||
HttpURLConnection conn = (HttpURLConnection) u.openConnection(); |
|||
conn.setDoInput(true); |
|||
conn.setDoOutput(true); |
|||
conn.setUseCaches(false); |
|||
conn.setDefaultUseCaches(false); |
|||
//Host,Content-Type,SOAPAction从soapUI的request1的RAW标签的Host,Content-Typ,SOAPActione获取
|
|||
conn.setRequestProperty("Host", "2484x4726z.qicp.vip:10746"); |
|||
conn.setRequestProperty("Content-Type", "text/xml;charset=UTF-8"); |
|||
conn.setRequestProperty("Content-Length", String.valueOf(sendmsg.length())); |
|||
conn.setRequestProperty("SOAPAction", "http://tempuri.org/GetMedicalRecord"); |
|||
conn.setRequestMethod("POST"); |
|||
//定义输出流
|
|||
OutputStream output = null; |
|||
//请求失败,可能网络不好,或工作站未打开
|
|||
try{ |
|||
conn.setConnectTimeout(10000); |
|||
conn.setReadTimeout(10000);//30S连接不成功则直接抛错,防止对方服务器挂了,程序一直挂着
|
|||
output =conn.getOutputStream(); |
|||
}catch (Exception e){ |
|||
maph.put("ResultCode","3" ); |
|||
return maph; |
|||
} |
|||
//OutputStream output = conn.getOutputStream();
|
|||
if (null != sendmsg) { |
|||
byte[] b = sendmsg.toString().getBytes("utf-8"); |
|||
//发送soap请求报文
|
|||
output.write(b, 0, b.length);} |
|||
output.flush(); |
|||
output.close(); |
|||
//定义输入流,获取soap响应报文
|
|||
InputStream input = conn.getInputStream(); |
|||
//需设置编码格式,否则会乱码
|
|||
s=IOUtils.toString(input, "UTF-8"); |
|||
input.close(); |
|||
|
|||
|
|||
//String s1=strToHtml(s);
|
|||
///和上面无关的,解析的字符串先不用做strToHtml(),下面这几句提取出HTML代码
|
|||
SAXReader reader = new SAXReader(); |
|||
Document document = reader.read(new ByteArrayInputStream(s.getBytes("UTF-8"))); |
|||
Element out = |
|||
document.getRootElement().element("Body").element("GetMedicalRecordResponse").element("GetMedicalRecordResult"); |
|||
org.jsoup.nodes.Document doc=null; |
|||
org.jsoup.nodes.Element table =null; |
|||
String s2=null; |
|||
Elements rowr=null; |
|||
try{ |
|||
doc = Jsoup.parse(out.getText(),"gb2312"); |
|||
table =doc.getElementById("table1"); |
|||
s2=table.select("td[cellid=B1]").select("span").text(); |
|||
rowr=doc.select("p[align=left]"); |
|||
}catch(Exception e){ |
|||
maph.put("ResultCode1", "2");//入院记录无此人信息
|
|||
return maph; |
|||
} |
|||
|
|||
|
|||
|
|||
Map<String,Object> map = new HashMap<String,Object>(); |
|||
|
|||
//姓名,性别,科室,住院号,床位
|
|||
//System.out.println("有记录吗"+rows2.text());//姓名
|
|||
//org.jsoup.nodes.Element table =doc.getElementById("table1");
|
|||
//String s1=table.select("td[cellid=A1]").select("span").text();
|
|||
//String s2=table.select("td[cellid=B1]").select("span").text();
|
|||
//System.out.println("获取的文本"+s+":"+s2);
|
|||
//Elements rows = doc.select("p[align=left]").get(1).select("span");
|
|||
|
|||
//Elements rowr=doc.select("p[align=left]");
|
|||
|
|||
//利用:分割对应数据
|
|||
|
|||
map.put("pname", s2); |
|||
|
|||
String xl=rowr.get(2).text(); |
|||
String[] x2=xl.split(":"); |
|||
String p=rowr.get(3).text(); |
|||
String[] ph=p.split(":"); |
|||
if(x2.length>1){ |
|||
map.put("present", x2[1]); |
|||
|
|||
}else{ |
|||
map.put("present", ""); |
|||
} |
|||
if(ph.length>1){ |
|||
map.put("past", ph[1]); |
|||
|
|||
}else{ |
|||
map.put("past", ""); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
/** |
|||
* EcgInfo接口 |
|||
* @throws IOException |
|||
* @throws DocumentException |
|||
* @throws JDOMException |
|||
*/ |
|||
@RequestMapping(value ="EcgInfo",method = RequestMethod.POST) |
|||
public Map<String,Object> soapRequestEcgInfoConnection(String InpatientNo,String PatientType) throws Exception{ |
|||
String s = new String();//GetPatientInfo
|
|||
Map<String, Object> maph = new HashMap<String, Object>(); |
|||
|
|||
StringBuilder sendmsg=new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); |
|||
sendmsg.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">") |
|||
.append("<soapenv:Header>") |
|||
.append("</soapenv:Header>") |
|||
.append("<soapenv:Body>") |
|||
.append("<tem:GetReportMessage>") |
|||
|
|||
.append("<tem:patientType>") |
|||
.append(PatientType) |
|||
.append("</tem:patientType> <tem:inpatientNo>") |
|||
.append(InpatientNo) |
|||
.append("</tem:inpatientNo>") |
|||
.append("</tem:GetReportMessage>") |
|||
.append("</soapenv:Body>") |
|||
.append("</soapenv:Envelope>"); |
|||
//字符串转发出去
|
|||
|
|||
//System.out.println("soapHeader="+sendmsg);
|
|||
//设置soap请求报文的相关属性
|
|||
//url从soapUI的request1的RAW标签的POST获取,url中不要有空格
|
|||
String url="http://2484x4726z.qicp.vip:46235/WebService.asmx"; |
|||
URL u = new URL(url); |
|||
HttpURLConnection conn = (HttpURLConnection) u.openConnection(); |
|||
conn.setDoInput(true); |
|||
conn.setDoOutput(true); |
|||
conn.setUseCaches(false); |
|||
conn.setDefaultUseCaches(false); |
|||
//Host,Content-Type,SOAPAction从soapUI的request1的RAW标签的Host,Content-Typ,SOAPActione获取
|
|||
conn.setRequestProperty("Host", "2484x4726z.qicp.vip:46235"); |
|||
conn.setRequestProperty("Content-Type", "text/xml;charset=UTF-8"); |
|||
conn.setRequestProperty("Content-Length", String.valueOf(sendmsg.length())); |
|||
conn.setRequestProperty("SOAPAction", "http://tempuri.org/GetReportMessage"); |
|||
conn.setRequestMethod("POST"); |
|||
//定义输出流
|
|||
OutputStream output = null; |
|||
try{ |
|||
conn.setConnectTimeout(10000); |
|||
conn.setReadTimeout(10000);//30S连接不成功则直接抛错,防止对方服务器挂了,程序一直挂着
|
|||
output =conn.getOutputStream(); |
|||
}catch (Exception e){ |
|||
maph.put("ResultCode","3" ); |
|||
return maph; |
|||
} |
|||
if (null != sendmsg) { |
|||
byte[] b = sendmsg.toString().getBytes("utf-8"); |
|||
//发送soap请求报文
|
|||
output.write(b, 0, b.length);} |
|||
output.flush(); |
|||
output.close(); |
|||
//定义输入流,获取soap响应报文
|
|||
InputStream input = conn.getInputStream(); |
|||
//需设置编码格式,否则会乱码
|
|||
s=IOUtils.toString(input, "UTF-8"); |
|||
input.close(); |
|||
String s1=strToHtml(s); |
|||
//System.out.println("输出的xml="+s1);
|
|||
//
|
|||
Map<String,Object> map=ParseEcGRecordxml(s1); |
|||
return map; |
|||
|
|||
} |
|||
//解析心电记录
|
|||
public Map<String,Object> ParseEcGRecordxml(String xml) throws JDOMException, IOException, DocumentException{ |
|||
|
|||
SAXReader reader = new SAXReader(); |
|||
Document document = reader.read(new ByteArrayInputStream(xml.getBytes())); |
|||
Element out = |
|||
document.getRootElement().element("Body").element("GetReportMessageResponse").element("GetReportMessageResult"); |
|||
String result = out.getText(); |
|||
//System.out.println("return 解析ErrorMsg:"+result);
|
|||
//String 转json
|
|||
Map<String,Object> rowData = new HashMap<String,Object>(); |
|||
JSONObject jsonObject = JSON.parseObject(result); |
|||
Object jsonObject1 =null; |
|||
JSONObject json= JSON.parseObject(jsonObject.get("Response").toString()); |
|||
String re= json.get("ResultCode").toString(); |
|||
if(re.equals("-1")){ |
|||
rowData.put("ResultCode", "1");//错误
|
|||
} |
|||
if(re.equals("0")&&json.get("EcgInfo")==null){ |
|||
rowData.put("ResultCode", "2");//无信息
|
|||
} |
|||
// System.out.println("错误值"+re);//等于-1 中断处理
|
|||
if(re.equals("0")&&json.get("EcgInfo")!=null){ |
|||
/// System.out.println("有错误吗"+re);
|
|||
// System.out.println("识别正常情况");
|
|||
jsonObject1 = json.get("EcgInfo"); |
|||
// List list=new LinkedList();
|
|||
// Map<String,Object> rowData = new HashMap<String,Object>();
|
|||
//获取这个RET数组
|
|||
JSONObject jsonObject2 = JSON.parseObject(jsonObject1.toString()); |
|||
// System.out.println("这是什么"+jsonObject2.toString());
|
|||
//取出其中一个值
|
|||
//String s= jsonObject2.get("Address").toString();
|
|||
//System.out.println("..."+s);
|
|||
rowData.put("patientName", jsonObject2.get("PatName")==null?"":jsonObject2.get("PatName").toString()); |
|||
rowData.put("sex", jsonObject2.get("PGender")==null?"":jsonObject2.get("PGender").toString()); |
|||
rowData.put("age", jsonObject2.get("PatientAge")==null?"":jsonObject2.get("PatientAge").toString()); |
|||
rowData.put("examineDocName", jsonObject2.get("ApplyDocName")==null?"":jsonObject2.get("ApplyDocName").toString()); |
|||
rowData.put("chamber", jsonObject2.get("ApplyDepartMent")==null?"":jsonObject2.get("ApplyDepartMent").toString()); |
|||
rowData.put("ptCard", jsonObject2.get("IDCard")==null?"":jsonObject2.get("IDCard").toString());//身份证号
|
|||
rowData.put("outPatien", jsonObject2.get("ClinicCode")==null?"":jsonObject2.get("ClinicCode").toString());//门诊号
|
|||
rowData.put("reportDocName", jsonObject2.get("Reporter")==null?"":jsonObject2.get("Reporter").toString());//报告医生
|
|||
rowData.put("auditDocName", jsonObject2.get("RepAudit")==null?"":jsonObject2.get("RepAudit").toString());//审核医生
|
|||
rowData.put("auditDate", jsonObject2.get("RepAuditTime")==null?"":jsonObject2.get("RepAuditTime").toString());//审核日期
|
|||
rowData.put("electricAxis", jsonObject2.get("QRSaxis")==null?"":jsonObject2.get("QRSaxis").toString());//电轴
|
|||
rowData.put("qrs", jsonObject2.get("QRS")==null?"":jsonObject2.get("QRS").toString());//QPS时限
|
|||
rowData.put("pr", jsonObject2.get("PR")==null?"":jsonObject2.get("PR").toString());//P-R间期
|
|||
rowData.put("qt", jsonObject2.get("QT")==null?"":jsonObject2.get("QT").toString());//P-R间期
|
|||
rowData.put("qtc", jsonObject2.get("QTC")==null?"":jsonObject2.get("QTC").toString());//P-R间期
|
|||
rowData.put("sv1", jsonObject2.get("SV1")==null?"":jsonObject2.get("SV1").toString());//P-R间期
|
|||
rowData.put("rv5", jsonObject2.get("RV5")==null?"":jsonObject2.get("RV5").toString());//P-R间期
|
|||
rowData.put("rs", jsonObject2.get("RSamp")==null?"":jsonObject2.get("RSamp").toString());//R+S
|
|||
rowData.put("hr", jsonObject2.get("HR")==null?"":jsonObject2.get("HR").toString());//P-R间期
|
|||
rowData.put("diagnos", jsonObject2.get("ClincDiagnose")==null?"":jsonObject2.get("ClincDiagnose").toString());//诊断
|
|||
rowData.put("clinicDiagnos", jsonObject2.get("RepDiagnose")==null?"":jsonObject2.get("RepDiagnose").toString());//临床诊断
|
|||
rowData.put("complain", jsonObject2.get("RepDescription")==null?"":jsonObject2.get("RepDescription").toString());//描述
|
|||
rowData.put("url", jsonObject2.get("URL")==null?"":jsonObject2.get("URL").toString()); |
|||
rowData.put("reportDate", jsonObject2.get("RepCreateDate")==null?"":jsonObject2.get("RepCreateDate").toString()); |
|||
rowData.put("hisEsrdNumber", jsonObject2.get("HospCode")==null?"":jsonObject2.get("HospCode").toString()); |
|||
} |
|||
return rowData; |
|||
} |
|||
|
|||
//解析PatientInfoXML格式
|
|||
public Map<String,Object> PatientInfofoxml(String xml) throws JDOMException, IOException, DocumentException{ |
|||
|
|||
Map<String,Object> map = new HashMap<String,Object>(); |
|||
SAXReader reader = new SAXReader(); |
|||
Document document = reader.read(new ByteArrayInputStream(xml.getBytes())); |
|||
Element out = |
|||
document.getRootElement().element("Body").element("GetPatientInfoResponse").element("GetPatientInfoResult").element("Response"); |
|||
Map<String,Object> mapf = new HashMap<String,Object>(); |
|||
Map<String,Object> mapr = new HashMap<String,Object>(); |
|||
|
|||
String text =document.getRootElement().element("Body").element("GetPatientInfoResponse").element("GetPatientInfoResult").getText(); |
|||
Map<String, Object> mape=new HashMap<String, Object>(); |
|||
String ResultCode=""; |
|||
try{ |
|||
ResultCode= out.element("ResultCode").getText(); |
|||
}catch(Exception e){ |
|||
map.put("ResultCode", "2"); |
|||
return map; |
|||
} |
|||
if(ResultCode.equals("1")||!ResultCode.matches("[0-1]")){ |
|||
map.put("ResultCode", "1");//无信息就写2
|
|||
return map; |
|||
} |
|||
if(text.equals("1")){ |
|||
map.put("ResultCode", "2");//无信息
|
|||
return map; |
|||
} |
|||
map.put("ResultCode", ResultCode); |
|||
|
|||
Iterator<Element> patientout =out.element("PatInfo").elementIterator(); |
|||
while(patientout.hasNext()){ |
|||
Node node1 =patientout.next(); |
|||
|
|||
mapf.put(node1.getName(), node1.getText()); |
|||
} |
|||
mapr.put("patientName", mapf.get("NAME")==null?"":mapf.get("NAME")); |
|||
mapr.put("sex", mapf.get("SEX")==null?"":mapf.get("SEX")); |
|||
mapr.put("age", mapf.get("AGE")==null?"":mapf.get("AGE")); |
|||
mapr.put("ptPhone", mapf.get("TELEPHONE")==null?"":mapf.get("TELEPHONE")); |
|||
mapr.put("marry", mapf.get("MARRY")==null?"":mapf.get("MARRY")); |
|||
mapr.put("ptCity", mapf.get("ADDRESS")==null?"":mapf.get("ADDRESS")); |
|||
mapr.put("outPatien", mapf.get("PATIENTNO")==null?"":mapf.get("PATIENTNO"));//病人编号
|
|||
mapr.put("hisEsrdNumber", mapf.get("INPATIENTNO")==null?"":mapf.get("INPATIENTNO"));//住院号
|
|||
mapr.put("ptCard", mapf.get("IDCARD")==null?"":mapf.get("IDCARD")); |
|||
mapr.put("doctor", mapf.get("DOCTOR")==null?"":mapf.get("DOCTOR")); |
|||
mapr.put("changeDeptid", mapf.get("CHANGE_DEPTID")==null?"":mapf.get("CHANGE_DEPTID"));//转科科别
|
|||
mapr.put("bedid", mapf.get("BEDID")==null?"":mapf.get("BEDID")); |
|||
mapr.put("initial", mapf.get("CLINICDIAGNOSE")==null?"":mapf.get("CLINICDIAGNOSE"));//初步诊断
|
|||
mapr.put("fDiagnose", mapf.get("F_DIAGNOSE")==null?"":mapf.get("F_DIAGNOSE"));//病理诊断
|
|||
mapr.put("allergy", mapf.get("ALLERGIC")==null?"":mapf.get("ALLERGIC"));//过敏药品
|
|||
mapr.put("nuhTime", mapf.get("IN_DATE")==null?"":mapf.get("IN_DATE"));//入院时间
|
|||
mapr.put("nuhSection", mapf.get("INDEPTID")==null?"":mapf.get("INDEPTID"));//入院科别
|
|||
mapr.put("examine", mapf.get("EXAM_ITEM")==null?"":mapf.get("EXAM_ITEM"));//检查
|
|||
//System.out.println(mapr.toString());
|
|||
|
|||
return mapr; |
|||
} |
|||
|
|||
public Map<String,Object> parLis(String xml) throws JDOMException, IOException, DocumentException{ |
|||
Map<String,Object> map = new HashMap<String,Object>(); |
|||
List<Map<String, Object>> hisList = new ArrayList<Map<String, Object>>(); |
|||
SAXReader reader = new SAXReader(); |
|||
Document document = reader.read(new ByteArrayInputStream(xml.getBytes())); |
|||
Element root = document.getRootElement().element("Body").element("GetLisResultResponse").element("GetLisResultResult").element("Response"); |
|||
String text=document.getRootElement().element("Body").element("GetLisResultResponse").element("GetLisResultResult").getText(); |
|||
|
|||
// Map<String, Object> mape=new HashMap<String, Object>();
|
|||
String ResultCode=""; |
|||
try{ |
|||
ResultCode= root.element("ResultCode").getText(); |
|||
}catch(Exception e){ |
|||
map.put("ResultCode", "2"); |
|||
return map; |
|||
} |
|||
//String recode=root.element("ResultCode").getText();
|
|||
if(text.equals("1")){ |
|||
map.put("ResultCode", "2");//无信息
|
|||
return map; |
|||
} |
|||
if(ResultCode.equals("1")||!ResultCode.matches("[0-1]")){ |
|||
map.put("ResultCode", "1");//ResultCode不是0,1 其他说明异常
|
|||
return map; |
|||
} |
|||
map.put("ResultCode", ResultCode); |
|||
Iterator<Element> out = |
|||
root.elementIterator(); |
|||
//取2个数据.element("ErrorMsg")
|
|||
int i=0; |
|||
while(out.hasNext()){ |
|||
i++; |
|||
Node node = out.next(); |
|||
|
|||
|
|||
Element element1 = (Element)node; |
|||
Iterator<Element> out1 = element1.elementIterator(); |
|||
Map<String, Object> mapt=new HashMap<String, Object>(); |
|||
while(out1.hasNext()){ |
|||
Node node1 = out1.next(); |
|||
|
|||
//if(!node1.getName().equals("SUNDRY_FEE_NAME"))
|
|||
mapt.put(node1.getName(), node1.getText()); |
|||
//
|
|||
|
|||
//
|
|||
} |
|||
|
|||
hisList.add(mapt); |
|||
} |
|||
for(int j=0;j<hisList.size();j++){ |
|||
if(hisList.get(j).isEmpty()){ |
|||
// System.out.println("1是有空");
|
|||
continue; |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
List<Map<String, Object>> o= hisList.stream().filter(map1->!map1.isEmpty()).distinct().collect(Collectors.toList()); |
|||
/* for(int k=0;k<o.size();k++){ |
|||
System.out.println(k+"-----"+o.get(k));//去重以后了
|
|||
}*/ |
|||
List<LIS> hisStreamList = new ArrayList<LIS>(); |
|||
|
|||
for(int j=0;j<o.size();j++){ |
|||
LIS lis=new LIS(); |
|||
//System.out.println(j+"不执行");
|
|||
for(int l=0;l<o.get(j).size();l++){ |
|||
//把map 的数据保存到 LIS中取
|
|||
//将空的列表排除
|
|||
|
|||
lis.setAbnormalIndicator(o.get(j).get("ABNORMAL_INDICATOR")==null?"":o.get(j).get("ABNORMAL_INDICATOR").toString()); |
|||
lis.setAge(o.get(j).get("AGE")==null?"":o.get(j).get("AGE").toString()); |
|||
lis.setGender(o.get(j).get("GENDER")==null?"":o.get(j).get("GENDER").toString()); |
|||
lis.setName(o.get(j).get("NAME")==null?"":o.get(j).get("NAME").toString()); |
|||
lis.setParitemName(o.get(j).get("PARITEM_NAME")==null?"":o.get(j).get("PARITEM_NAME").toString()); |
|||
lis.setPrintContext(o.get(j).get("PRINT_CONTEXT")==null?"":o.get(j).get("PRINT_CONTEXT").toString()); |
|||
lis.setPrintOrder(o.get(j).get("PRINT_ORDER")==null?"":o.get(j).get("PRINT_ORDER").toString()); |
|||
lis.setReportItemName(o.get(j).get("REPORT_ITEM_NAME")==null?"":o.get(j).get("REPORT_ITEM_NAME").toString()); |
|||
lis.setHisEsrdNumber(o.get(j).get("RESIDENTID")==null?"":o.get(j).get("RESIDENTID").toString()); |
|||
lis.setResult(o.get(j).get("RESULT")==null?"":o.get(j).get("RESULT").toString()); |
|||
lis.setResultDateTime(o.get(j).get("RESULT_DATE_TIME")==null?"":o.get(j).get("RESULT_DATE_TIME").toString()); |
|||
lis.setSampleNo(o.get(j).get("SAMPLE_NO")==null?"":o.get(j).get("SAMPLE_NO").toString()); |
|||
lis.setSampleType(o.get(j).get("SAMPLE_TYPE")==null?"":o.get(j).get("SAMPLE_TYPE").toString()); |
|||
lis.setSundryFeeName(o.get(j).get("SUNDRY_FEE_NAME")==null?"":o.get(j).get("SUNDRY_FEE_NAME").toString()); |
|||
lis.setUnits(o.get(j).get("UNITS")==null?"":o.get(j).get("UNITS").toString()); |
|||
lis.setUpdateDate(o.get(j).get("UPDATE_DATE")==null?"":o.get(j).get("UPDATE_DATE").toString()); |
|||
|
|||
|
|||
} |
|||
hisStreamList.add(lis); |
|||
|
|||
|
|||
} |
|||
|
|||
//
|
|||
if(hisStreamList.size()>=1){ |
|||
LIS re= hisStreamList.get(0); |
|||
map.put("name", re.getName()); |
|||
map.put("gender", re.getGender()); |
|||
map.put("age", re.getAge()); |
|||
map.put("hisEsrdNumber", re.getHisEsrdNumber());//改成HIS_esrd
|
|||
map.put("printOrder", re.getPrintOrder()); |
|||
map.put("sampleNo", re.getSampleNo()); |
|||
map.put("sampleType", re.getSampleType()); |
|||
map.put("resultDateTime", re.getResultDateTime()); |
|||
map.put("updateDate", re.getUpdateDate()); |
|||
} |
|||
/* for(int i1=0;i1<hisStreamList.size();i1++){ |
|||
// System.out.println(i1+"wo si"+hisStreamList.get(i1).toString());
|
|||
}*/ |
|||
List<List<LIS>> result = new ArrayList<List<LIS>>(); |
|||
|
|||
|
|||
//按项目分组
|
|||
/* Map<String,List<LIS>> partiem= hisStreamList.stream().collect(Collectors.groupingBy(LIS::getSundryFeeName)); |
|||
Set<Entry<String, List<LIS>>> s2=partiem.entrySet(); |
|||
int p=0; |
|||
for(Entry<String, List<LIS>> s:s2){ |
|||
Map<String, List<LIS>> ll= new HashMap<String, List<LIS>>(); |
|||
//System.out.println(s.getKey()+"项目指: "+s.getValue());
|
|||
ll.put(""+p++, s.getValue()); |
|||
result.add(ll); |
|||
|
|||
}*/ |
|||
//按项目,日期分组
|
|||
Map<String, Map<String, List<LIS>>> collect= hisStreamList.stream().collect(Collectors.groupingBy(LIS::getSundryFeeName,Collectors.groupingBy(LIS::getUpdateDate))); |
|||
|
|||
Set<Entry<String,Map<String,List<LIS>>>> set= collect.entrySet(); |
|||
List<Map<String, List<LIS>>> palis = new ArrayList<Map<String, List<LIS>>>(); |
|||
for (Entry<String, Map<String, List<LIS>>> en : set) { |
|||
// System.out.println("按键="+en.getKey()+"值="+en.getValue());
|
|||
//对每个键的值,进行排序
|
|||
Map<String, List<LIS>> map1 =en.getValue(); |
|||
palis.add(map1); |
|||
|
|||
} |
|||
//打印出来这个分组后的数据。
|
|||
for(int i2=0;i2<palis.size();i2++){ |
|||
Map<String, List<LIS>> mk =palis.get(i2); |
|||
//建立排序MAP
|
|||
TreeMap<String, List<LIS>> tm=new TreeMap<String, List<LIS>>(new Comparator<String>() { |
|||
@Override |
|||
public int compare(String o1, String o2) { |
|||
return o2.compareTo(o1); |
|||
} |
|||
}); |
|||
for(String k:mk.keySet()){ |
|||
//System.out.println(i2+"日期值"+k+"ffff"+mk.get(k));
|
|||
//比较K值,选择最大K值进行输出
|
|||
tm.put(k, mk.get(k)); |
|||
} |
|||
//在这次循环中,取出最大值
|
|||
//System.out.println(i2+"排序后的值"+"ffff"+tm.get(tm.firstKey()));
|
|||
result.add(tm.get(tm.firstKey())); |
|||
} |
|||
Map<String,Object> amp =new HashMap<String,Object>(); |
|||
amp.put("basic", map); |
|||
amp.put("list", result); |
|||
// System.out.println(amp.toString());
|
|||
return amp; |
|||
} |
|||
//解析PACSRESULT格式
|
|||
public Map<String,Object> ParPacsResultfoxml(String xml) throws JDOMException, IOException, DocumentException{ |
|||
|
|||
List<Map<String, Object>> hisList = new ArrayList<Map<String, Object>>(); |
|||
//soapUI自动生成的request xml路径,写入传入参数
|
|||
Map<String,Object> map = new HashMap<String,Object>(); |
|||
//String s= strToHtml(soapHeader);
|
|||
// 1.创建SAXReader的对象reader
|
|||
SAXReader reader = new SAXReader(); |
|||
// 2.通过reader对象的read()方法加载books.xml文件,获取document对象
|
|||
Document document = reader.read(new ByteArrayInputStream(xml.getBytes())); |
|||
|
|||
// 3.通过document对象获取根节点bookstore
|
|||
// Element root = document.getRootElement();
|
|||
//System.out.println(root);
|
|||
Element out = |
|||
document.getRootElement().element("Body").element("GetPacsResultResponse").element("GetPacsResultResult").element("Response"); |
|||
//Element ErrorMsg = out.element("ErrorMsg");
|
|||
// Element ResultCode = out.element("ResultCode");
|
|||
String text=document.getRootElement().element("Body").element("GetPacsResultResponse").element("GetPacsResultResult").getText(); |
|||
//System.out.println("文本内容"+text);
|
|||
String ResultCode=""; |
|||
try{ |
|||
ResultCode= out.element("ResultCode").getText(); |
|||
}catch(Exception e){ |
|||
map.put("ResultCode", "2"); |
|||
return map; |
|||
} |
|||
if(ResultCode.equals("1")||!ResultCode.matches("[0-1]")){ |
|||
map.put("ResultCode", "1");//错误代码
|
|||
return map; |
|||
} |
|||
//String ResultCode = out.element("ResultCode").getText()==null?"1":out.element("ResultCode").getText();
|
|||
if(text.equals("1")){ |
|||
map.put("ResultCode", "2");//无信息就写2
|
|||
return map; |
|||
} |
|||
|
|||
map.put("ResultCode", ResultCode); |
|||
Iterator<Element> out1 = |
|||
out.elementIterator(); |
|||
int i=0; |
|||
while(out1.hasNext()){ |
|||
i++; |
|||
Node node = out1.next(); |
|||
|
|||
|
|||
Element element1 = (Element)node; |
|||
Iterator<Element> out2 = element1.elementIterator(); |
|||
Map<String, Object> mapt=new HashMap<String, Object>(); |
|||
while(out2.hasNext()){ |
|||
Node node1 = out2.next(); |
|||
// System.out.println("---"+node1.getName()+":"+node1.getText());
|
|||
mapt.put(node1.getName(), node1.getText()); |
|||
} |
|||
hisList.add(mapt); |
|||
} |
|||
for(int j=0;j<hisList.size();j++){ |
|||
if(hisList.get(j).isEmpty()){ |
|||
//System.out.println("1是有空");
|
|||
continue; |
|||
} |
|||
//System.out.println("hislist 有数据吗"+hisList.get(j).toString());
|
|||
|
|||
} |
|||
List<Map<String, Object>> o= hisList.stream().filter(map1->!map1.isEmpty()).distinct().collect(Collectors.toList()); |
|||
/*for(int k=0;k<o.size();k++){ |
|||
// System.out.println(k+"-----"+o.get(k));//去重以后了
|
|||
}*/ |
|||
List<PACS> pacsStreamList = new ArrayList<PACS>(); |
|||
|
|||
for(int j=0;j<o.size();j++){ |
|||
PACS pacs=new PACS(); |
|||
//System.out.println(j+"不执行");
|
|||
for(int l=0;l<o.get(j).size();l++){ |
|||
pacs.setPatientName(o.get(j).get("NAME")==null?"":o.get(j).get("NAME").toString()); |
|||
pacs.setAge(o.get(j).get("AGE")==null?"":o.get(j).get("AGE").toString()); |
|||
//pacs.setEnter_chamber(o.get(j).get("AGE")==null?"":o.get(j).get("AGE").toString());
|
|||
pacs.setSex(o.get(j).get("GENDER")==null?"":o.get(j).get("GENDER").toString()); |
|||
// pacs.setEnter_chamber(enter_chamber);科别
|
|||
pacs.setHisEsrdNumber(o.get(j).get("RESIDENTID")==null?"":o.get(j).get("RESIDENTID").toString()); |
|||
pacs.setExamineType(o.get(j).get("EXAM_MODE")==null?"":o.get(j).get("EXAM_MODE").toString()); |
|||
pacs.setExamineDate(o.get(j).get("EXEC_DATE")==null?"":o.get(j).get("EXEC_DATE").toString()); |
|||
pacs.setExaminePart(o.get(j).get("EXAM_POSITION")==null?"":o.get(j).get("EXAM_POSITION").toString()); |
|||
pacs.setExamineName(o.get(j).get("EXEC_MODE")==null?"":o.get(j).get("EXEC_MODE").toString());//检查项目
|
|||
pacs.setReportDate(o.get(j).get("REPORT_DATE")==null?"":o.get(j).get("REPORT_DATE").toString()); |
|||
pacs.setCheckDocName(o.get(j).get("CHECK_DOCT_NAME")==null?"":o.get(j).get("CHECK_DOCT_NAME").toString()); |
|||
pacs.setReportDocName(o.get(j).get("EXEC_DOCT_NAME")==null?"":o.get(j).get("EXEC_DOCT_NAME").toString()); |
|||
pacs.setbSee(o.get(j).get("REPORT_CONTENT")==null?"":o.get(j).get("REPORT_CONTENT").toString()); |
|||
pacs.setbHint(o.get(j).get("REPORT_DIAG")==null?"":o.get(j).get("REPORT_DIAG").toString()); |
|||
pacs.setReportUrl(o.get(j).get("REPORT_URL")==null?"":o.get(j).get("REPORT_URL").toString()); |
|||
} |
|||
pacsStreamList.add(pacs); |
|||
} |
|||
/* for(int i1=0;i1<pacsStreamList.size();i1++){ |
|||
System.out.println(i1+"wo si"+pacsStreamList.get(i1).toString()); |
|||
}*/ |
|||
|
|||
if(pacsStreamList.size()>=1){ |
|||
PACS re= pacsStreamList.get(0); |
|||
map.put("name", re.getPatientName()); |
|||
map.put("sex", re.getSex()); |
|||
map.put("age", re.getAge()); |
|||
//map.put("esrdNumber", re.getEsrdNumber());
|
|||
|
|||
} |
|||
List<Map<String, List<PACS>>> result = new ArrayList<Map<String, List<PACS>>>(); |
|||
List<List<PACS>> fresult = new ArrayList<List<PACS>>(); |
|||
//按项目,日期进行分组
|
|||
Map<String, Map<String, List<PACS>>> collect= pacsStreamList.stream().collect(Collectors.groupingBy(PACS::getExamineName,Collectors.groupingBy(PACS::getReportDate))); |
|||
Set<Entry<String,Map<String,List<PACS>>>> set= collect.entrySet(); |
|||
for (Entry<String, Map<String, List<PACS>>> en : set) { |
|||
// System.out.println("按键="+en.getKey()+"值="+en.getValue());
|
|||
//对每个键的值,进行排序
|
|||
Map<String, List<PACS>> map1 =en.getValue(); |
|||
result.add(map1); |
|||
|
|||
} |
|||
//打印出来这个分组后的数据。
|
|||
for(int i2=0;i2<result.size();i2++){ |
|||
Map<String, List<PACS>> mk =result.get(i2); |
|||
//建立排序MAP
|
|||
TreeMap<String, List<PACS>> tm=new TreeMap<String, List<PACS>>(new Comparator<String>() { |
|||
@Override |
|||
public int compare(String o1, String o2) { |
|||
return o2.compareTo(o1); |
|||
} |
|||
}); |
|||
for(String k:mk.keySet()){ |
|||
//System.out.println(i2+"日期值"+k+"ffff"+mk.get(k));
|
|||
//比较K值,选择最大K值进行输出
|
|||
tm.put(k, mk.get(k)); |
|||
} |
|||
//在这次循环中,取出最大值
|
|||
// System.out.println(i2+"排序后的值"+"ffff"+tm.get(tm.firstKey()));
|
|||
fresult.add(tm.get(tm.firstKey())); |
|||
} |
|||
//上面是按项目日期进行分组
|
|||
/* //按项目分组
|
|||
Map<String,List<PACS>> partiem= pacsStreamList.stream().collect(Collectors.groupingBy(PACS::getExamineName)); |
|||
Set<Entry<String, List<PACS>>> s2=partiem.entrySet(); |
|||
int p=0; |
|||
for(Entry<String, List<PACS>> s:s2){ |
|||
Map<String, List<PACS>> ll= new HashMap<String, List<PACS>>(); |
|||
//System.out.println(s.getKey()+"项目指: "+s.getValue());
|
|||
ll.put(""+p++, s.getValue()); |
|||
result.add(ll); |
|||
|
|||
}*/ |
|||
/* //再次按日期划分
|
|||
for(int l=0;l<result.size();l++){ |
|||
Collection<List<PACS>> lk =result.get(l).values(); |
|||
//取出0,1,2,3的数据 做列表,然后对日期进行排序。//https://cloud.tencent.com/developer/ask/179473
|
|||
Iterator<List<PACS>> pa= lk.iterator(); |
|||
int o1=0; |
|||
while(pa.hasNext()){ |
|||
List<PACS> ls= pa.next(); |
|||
Iterator<PACS> pac= ls.iterator(); |
|||
List<PACS> reresult =new ArrayList<PACS>(); |
|||
while(pac.hasNext()){ |
|||
//System.out.println("分开"+pac.next());
|
|||
PACS P1= pac.next(); |
|||
reresult.add(P1); |
|||
} |
|||
// List<PACS> S= reresult.stream().collect(Collectors.maxBy(Comparator.comparing(PACS::getReport_date)), Optional::get);
|
|||
Optional<PACS> S= reresult.stream().sorted(Comparator.comparing(PACS::getReportDate).reversed()).findFirst(); |
|||
//System.out.println(o1+"分开"+reresult.toString());
|
|||
// System.out.println("不好"+S.get());
|
|||
fresult.add(S.get()); |
|||
o1++; |
|||
} |
|||
//System.out.println(o1+"看下P2指"+lk.size());
|
|||
}*/ |
|||
//上面是按日期处理
|
|||
Map<String,Object> amp =new HashMap<String,Object>(); |
|||
amp.put("basic", map); |
|||
amp.put("list", fresult); |
|||
// System.out.println(amp.toString());
|
|||
return amp; |
|||
} |
|||
public static String strToHtml(String s) |
|||
{ |
|||
if (s==null||s.equals("")) return ""; |
|||
s = s.replaceAll("&","&"); |
|||
s = s.replaceAll("<","<"); |
|||
s = s.replaceAll(">",">"); |
|||
s = s.replaceAll(" "," "); |
|||
s = s.replaceAll(" ", " "); |
|||
return s; |
|||
} |
|||
} |
|||
@ -0,0 +1,107 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.ApplyInformation; |
|||
import com.imurs.entity.DoctorArrange; |
|||
import com.imurs.entity.HomePageShow; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.DoctorArrangeService; |
|||
import com.imurs.service.HomePageShowService; |
|||
|
|||
/** |
|||
* 首页Html |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value="html") |
|||
public class HomePageHtmlController { |
|||
|
|||
@Autowired |
|||
HomePageShowService homePageShowService; |
|||
@Autowired |
|||
DoctorArrangeService doctorArrangeService; |
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
|
|||
|
|||
/** |
|||
* 首页显示 |
|||
* @return |
|||
* type:类型(A、政策宣导、领导关怀 B、长沙市政策宣导 C、长沙市第一医院风采 D医联体合作单位) |
|||
*/ |
|||
@RequestMapping(value="homePage") |
|||
public Map<String,Object> homePage(){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<HomePageShow> wrapper=new EntityWrapper<HomePageShow>(); |
|||
EntityWrapper<ApplyInformation> inforWrapper=new EntityWrapper<ApplyInformation>(); |
|||
wrapper.isNotNull("type").orderBy("create_time", false); |
|||
|
|||
inforWrapper.eq("state", "1"); |
|||
//map.put("state", "1");
|
|||
//map.put("credit_type", "1");
|
|||
|
|||
List<HomePageShow> hmList=new ArrayList<HomePageShow>(); |
|||
List<DoctorArrange> daList=new ArrayList<DoctorArrange>(); |
|||
List<ApplyInformation> aiList=new ArrayList<ApplyInformation>(); |
|||
try { |
|||
//医联体合作单位
|
|||
inforWrapper.orderBy("if(id='68729a2d87075bd616f7339940227f46',0,1),if(id='97561c8ecc660a36a3cdad29abd4ae3f',0,1)," |
|||
+ "if(id='07cdf216c7a7eb0e1dd5d7fc568d9285',0,1),if(id='4f74e5c6659354e6eca2d4658bf57777',0,1)"); |
|||
aiList=applyInformationService.selectList(inforWrapper); |
|||
map.put("aiList", aiList); |
|||
|
|||
hmList=homePageShowService.selectList(wrapper); |
|||
if(hmList.isEmpty()){ |
|||
map.put("hmListA", hmList); |
|||
map.put("hmListB", hmList); |
|||
map.put("hmListC", hmList); |
|||
}else{ |
|||
//分组显示
|
|||
Map<String, List<HomePageShow>> collect = hmList.stream().collect(Collectors.groupingBy(HomePageShow::getType)); |
|||
map.put("hmListA", collect.get("A"));//国家/市区政策
|
|||
map.put("hmListB", collect.get("B"));//消息通知
|
|||
map.put("hmListC", collect.get("C"));//长沙市第一医院风采
|
|||
} |
|||
//下派专家一览
|
|||
daList=doctorArrangeService.selectHonmeShowArrange(); |
|||
map.put("daList", daList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally{ |
|||
map.remove("apply_statu"); |
|||
//map.remove("credit_type");
|
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 首页排班列表分类显示 |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="homePageArrange") |
|||
public Map<String,Object> homePageArrange(@RequestParam Map<String ,Object> jsonMap){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
List<DoctorArrange> daList=new ArrayList<DoctorArrange>(); |
|||
try { |
|||
daList=doctorArrangeService.homeShowArrange(jsonMap); |
|||
map.put("daList", daList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,158 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.HomePageShow; |
|||
import com.imurs.service.HomePageShowService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
|
|||
/** |
|||
* 医院首页控制器 |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value="home") |
|||
public class HomePageShowController { |
|||
|
|||
@Autowired |
|||
HomePageShowService homePageShowService; |
|||
|
|||
/** |
|||
* 新增医院首页信息 |
|||
*/ |
|||
@RequestMapping(value="insertHome") |
|||
public Map<String,Object> insertHome(HomePageShow homePageShow){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=homePageShowService.insert(homePageShow); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 修改医院首页信息 |
|||
*/ |
|||
@RequestMapping(value="updateHome") |
|||
public Map<String,Object> updateHome(HomePageShow homePageShow){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=homePageShowService.updateById(homePageShow); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 查询医院首页信息 |
|||
*/ |
|||
@RequestMapping(value="findHomeList") |
|||
public Map<String,Object> findHomeList(){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<HomePageShow> wrapper=new EntityWrapper<HomePageShow>(); |
|||
try { |
|||
wrapper.isNotNull("type").orderBy("create_time", false); |
|||
List<HomePageShow> hmList=homePageShowService.selectList(wrapper); |
|||
if(hmList.isEmpty()){ |
|||
map.put("msg", "3"); |
|||
}else{ |
|||
//分组显示
|
|||
Map<String, List<HomePageShow>> collect = hmList.stream().collect(Collectors.groupingBy(HomePageShow::getType)); |
|||
map.put("hmListA", collect.get("A")); |
|||
map.put("hmListB", collect.get("B")); |
|||
map.put("hmListC", collect.get("C")); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 删除医院首页信息 |
|||
*/ |
|||
@RequestMapping(value="deleteHome") |
|||
public Map<String,Object> deleteHome(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=homePageShowService.deleteById(id); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 首页信息分页显示 |
|||
* type:类型(A、政策宣导、领导关怀 B、长沙市政策宣导 C、长沙市第一医院风采 ) |
|||
* |
|||
*/ |
|||
@RequestMapping(value="findHomeListPage") |
|||
public Map<String,Object> findHomeListPage(String type,Integer pageSize,Integer pageNo){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<HomePageShow> wrapper=new EntityWrapper<HomePageShow>(); |
|||
FrontPage<HomePageShow> page = new FrontPage<HomePageShow>(); |
|||
|
|||
page.setRows(pageSize == null ? 6 : pageSize); |
|||
page.setPage(pageNo == null ? 1 : pageNo); |
|||
try { |
|||
wrapper.eq("type", StringUtils.isEmpty(type)?"A":type).isNotNull("type").orderBy("create_time", false); |
|||
Page<HomePageShow> pageList = homePageShowService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if(pageList==null){ |
|||
map.put("msg", "3"); |
|||
}else{ |
|||
CustomPage<HomePageShow> customPage = new CustomPage<HomePageShow>(pageList); |
|||
map.put("customPage", customPage); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 查询首页信息详情 |
|||
*/ |
|||
@RequestMapping(value="findHomeListById") |
|||
public Map<String,Object> findHomeListById(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
HomePageShow hm=homePageShowService.selectById(id); |
|||
map.put("hm", hm); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,234 @@ |
|||
/*package com.imurs.controller; |
|||
|
|||
|
|||
import java.awt.image.BufferedImage; |
|||
import java.awt.image.DataBufferByte; |
|||
import java.io.ByteArrayInputStream; |
|||
import java.io.ByteArrayOutputStream; |
|||
import java.io.File; |
|||
import java.io.FileOutputStream; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.net.URLEncoder; |
|||
import java.util.Base64; |
|||
import java.util.Iterator; |
|||
|
|||
import javax.imageio.ImageIO; |
|||
import javax.imageio.ImageReader; |
|||
import javax.imageio.stream.ImageInputStream; |
|||
|
|||
import org.apache.commons.io.IOUtils; |
|||
import org.opencv.core.Core; |
|||
import org.opencv.core.CvType; |
|||
import org.opencv.core.Mat; |
|||
import org.opencv.core.MatOfByte; |
|||
import org.opencv.core.MatOfInt; |
|||
import org.opencv.core.Size; |
|||
import org.opencv.imgcodecs.Imgcodecs; |
|||
import org.opencv.imgproc.Imgproc; |
|||
import org.opencv.photo.Photo; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
|
|||
import com.imurs.ocr.AuthService; |
|||
import com.imurs.ocr.FileUtil; |
|||
import com.imurs.ocr.HttpUtil; |
|||
import com.imurs.ocr.PicUtils; |
|||
import com.imurs.util.Opencvload; |
|||
|
|||
import net.sf.json.JSONObject; |
|||
import sun.misc.BASE64Decoder; |
|||
|
|||
|
|||
|
|||
|
|||
@RestController |
|||
@RequestMapping(value="ImageProcess") |
|||
public class ImageProcess { |
|||
@RequestMapping(value = "/contrastimg") |
|||
public String saveImage(MultipartFile filelSavePath,String id) throws Exception { |
|||
InputStream is =filelSavePath.getInputStream(); |
|||
//限制在4M内
|
|||
String url = null; |
|||
//Map<String, Object> json =ocrdemo.OcrRecognition(is);
|
|||
*//* byte[] imgData = FileUtil.readInputStreamByBytes(is);
|
|||
//文件路径
|
|||
String imgStr = base64Encode(imgData); |
|||
String imgParam = URLEncoder.encode(imgStr, "UTF-8"); |
|||
|
|||
String param = "image=" + imgParam; |
|||
AuthService as = new AuthService();//每个应用的密钥是不一样的,所以需要重新
|
|||
String accessToken = as.getAuth("2"); |
|||
String result = HttpUtil.post(url, accessToken, param); |
|||
// JSONObject IMG = new JSONObject();
|
|||
JSONObject json=JSONObject.fromObject(result); |
|||
String base64r= json.getString("image"); |
|||
System.out.println("结果是什么"+json.getString("image")); |
|||
BASE64Decoder decoder = new BASE64Decoder(); |
|||
try { |
|||
FileOutputStream write = new FileOutputStream(new File("D://qr.png")); |
|||
byte[] decodeBytes = decoder.decodeBuffer(base64r); |
|||
write.write(decodeBytes); |
|||
write.close(); |
|||
}catch (IOException e) { |
|||
e.printStackTrace(); |
|||
}*//*
|
|||
|
|||
// return result;
|
|||
String base64r=null; |
|||
if("1".equals(id)){ |
|||
url = "https://aip.baidubce.com/rest/2.0/image-process/v1/contrast_enhance"; |
|||
base64r= commonImageInputStream(is,url); |
|||
}else if("2".equals(id)){ |
|||
url = "https://aip.baidubce.com/rest/2.0/image-process/v1/image_quality_enhance"; |
|||
base64r= commonImageInputStream(is,url); |
|||
}else if("3".equals(id)){ |
|||
url = "https://aip.baidubce.com/rest/2.0/image-process/v1/dehaze"; |
|||
base64r= commonImageInputStream(is,url); |
|||
}else{ |
|||
throw new Exception("不匹配"); |
|||
} |
|||
|
|||
return base64r; |
|||
|
|||
|
|||
} |
|||
//图像去噪功能,中值滤波5*5,需要使用的opencv
|
|||
@RequestMapping(value = "/denoise") |
|||
public String denoiseImage(MultipartFile filelSavePath,String id) throws Exception { |
|||
//Opencvload o= new Opencvload();
|
|||
// System.load("I://opencv3.4.4//opencv//build//java//x64//opencv_java344.dll");//win
|
|||
System.load("/usr/local/cvdemo/libopencv_java344.so");//centos7 64
|
|||
InputStream input =filelSavePath.getInputStream(); |
|||
//System.out.println("13434");
|
|||
// System.out.println("sds"+input.available());
|
|||
//因为截图的格式是JPG,所以只对jpg 做了处理。,也会有BMP
|
|||
|
|||
// System.load("/usr/local/cvdemo/libopencv_java344.so");//centos7
|
|||
// System.out.println("s2ds"+input.available());
|
|||
BufferedImage img =(BufferedImage)ImageIO.read(input); |
|||
|
|||
Mat source =bufferedImageToMat(img); |
|||
Mat destination = new Mat(); |
|||
MatOfByte destination1 = new MatOfByte(); |
|||
switch(id) |
|||
{ |
|||
case "1": |
|||
//System.out.println("1");
|
|||
//Photo.fastNlMeansDenoisingColored(source,destination, 10, 10, 7, 21);//非局部平均去噪,使用彩色图像
|
|||
Imgproc.medianBlur(source,destination,5);//中值滤波 高斯噪声
|
|||
break; |
|||
case "2": |
|||
//System.out.println("2");
|
|||
Imgproc.medianBlur(source,destination,3);//中值滤波 椒盐噪声
|
|||
break; |
|||
*//* case "3":
|
|||
System.out.println("3"); |
|||
Size s =new Size(3,3); |
|||
Imgproc.GaussianBlur(source, destination, s, 0);//高斯滤波
|
|||
break;*//*
|
|||
default : |
|||
return "参数不对"; |
|||
|
|||
} |
|||
|
|||
// ,默认是压缩的95,修改成百分百不压缩
|
|||
int quilatly= Imgcodecs.CV_IMWRITE_JPEG_QUALITY; |
|||
int num =100; |
|||
MatOfInt parm = new MatOfInt(quilatly,num); |
|||
//
|
|||
*//*
|
|||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|||
IOUtils.copy(input, outputStream ); |
|||
//转换成字节数组
|
|||
byte[] byteArray = outputStream .toByteArray(); |
|||
ByteArrayInputStream inputStreamClone = new ByteArrayInputStream(byteArray); |
|||
ImageInputStream imageInputStream = ImageIO.createImageInputStream(inputStreamClone);//JPEG ,bmp
|
|||
// 获取ImageReader对象的迭代器
|
|||
//默认只有一张
|
|||
String formatNameList=null; |
|||
Iterator<ImageReader> iterator = ImageIO.getImageReaders(imageInputStream); |
|||
while(iterator.hasNext()){ |
|||
formatNameList=iterator.next().getFormatName(); |
|||
}*//*
|
|||
|
|||
//if("JPEG".equals(formatNameList)){
|
|||
Imgcodecs.imencode(".jpg", destination, destination1,parm);//mat 转成matofbyte
|
|||
*//* }else if("bmp".equals(formatNameList)){
|
|||
Imgcodecs.imencode(".bmp", destination, destination1);//mat 转成matofbyte
|
|||
}*//*
|
|||
//Imgcodecs.imencode(regx, destination, destination1,parm);//mat 转成matofbyte
|
|||
byte[] d= destination1.toArray(); |
|||
//字节数组转成BASE64流,给前端返回这个流
|
|||
String img1= base64Encode(d); |
|||
//base64流,写成图片
|
|||
*//* BASE64Decoder decoder = new BASE64Decoder();
|
|||
try { |
|||
FileOutputStream write = new FileOutputStream(new File("I://TEST//2.jpg")); |
|||
byte[] decodeBytes = decoder.decodeBuffer(img1); |
|||
write.write(decodeBytes); |
|||
write.close(); |
|||
}catch (IOException e) { |
|||
e.printStackTrace(); |
|||
}*//*
|
|||
|
|||
return img1; |
|||
} |
|||
//基本工具
|
|||
public static Mat bufferedImageToMat(BufferedImage bi) { |
|||
Mat mat = new Mat(bi.getHeight(), bi.getWidth(), CvType.CV_8UC3); |
|||
byte[] data = ((DataBufferByte) bi.getRaster().getDataBuffer()).getData(); |
|||
mat.put(0, 0, data); |
|||
return mat; |
|||
} |
|||
private String commonImageInputStream(InputStream is,String url) throws Exception{ |
|||
|
|||
byte[] imgData1 = FileUtil.readInputStreamByBytes(is); |
|||
byte[] imgData = PicUtils.compressPicForScale(imgData1, 4000, "x1"); |
|||
//文件路径
|
|||
String imgStr = base64Encode(imgData); |
|||
|
|||
String imgParam = URLEncoder.encode(imgStr, "UTF-8"); |
|||
|
|||
String param = "image=" + imgParam; |
|||
AuthService as = new AuthService();//每个应用的密钥是不一样的,所以需要重新
|
|||
String accessToken = as.getAuth("2"); |
|||
String result=null; |
|||
try{ |
|||
result = HttpUtil.post(url, accessToken, param); |
|||
}catch (Exception e){ |
|||
e.printStackTrace(); |
|||
} |
|||
// JSONObject IMG = new JSONObject();
|
|||
JSONObject json=JSONObject.fromObject(result); |
|||
String base64r= json.getString("image"); |
|||
*//* System.out.println("结果是什么"+json.getString("image"));
|
|||
BASE64Decoder decoder = new BASE64Decoder(); |
|||
try { |
|||
Random ra =new Random(); |
|||
String file ="D://"+ra.nextInt(10)+".png"; |
|||
FileOutputStream write = new FileOutputStream(new File(file)); |
|||
byte[] decodeBytes = decoder.decodeBuffer(base64r); |
|||
write.write(decodeBytes); |
|||
write.close(); |
|||
}catch (IOException e) { |
|||
e.printStackTrace(); |
|||
}*//*
|
|||
return base64r; |
|||
|
|||
} |
|||
private static String base64Encode(byte[] content) { |
|||
|
|||
Base64.Encoder encoder = Base64.getEncoder(); // JDK 1.8 推荐方法
|
|||
String str = encoder.encodeToString(content); |
|||
|
|||
|
|||
// char[] chars = Base64Util.encode(content); // 1.7 及以下,不推荐,请自行跟换相关库
|
|||
// String str = new String(chars);
|
|||
|
|||
return str; |
|||
} |
|||
}*/ |
|||
//工具类读流成字节
|
|||
@ -0,0 +1,139 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.InstallModel; |
|||
import com.imurs.service.InstallModelService; |
|||
import com.imurs.service.impl.InstallModelServiceImpl; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@RestController |
|||
@RequestMapping("install") |
|||
public class InstallModelController { |
|||
|
|||
@Autowired |
|||
InstallModelServiceImpl installModelService; |
|||
|
|||
|
|||
/** |
|||
* 增加医院设备的型号数据 |
|||
* @param installModel |
|||
*/ |
|||
|
|||
@RequestMapping("addInstallModel") |
|||
public Map<String,Object> addInstallModel(InstallModel installModel) { |
|||
Map<String, Object> resultMap = new HashMap<>(4); |
|||
try { |
|||
boolean result = installModelService.insert(installModel); |
|||
if (result) { |
|||
resultMap.put("msg","1"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
resultMap.put("msg","4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 更新医院的设备型号 |
|||
* @param installModel |
|||
*/ |
|||
|
|||
@RequestMapping("updateInstallModel") |
|||
public Map<String, Object> updateInstallModel(InstallModel installModel) { |
|||
Map<String, Object> resultMap = new HashMap<>(2); |
|||
try { |
|||
boolean result = installModelService.updateById(installModel); |
|||
if (result) { |
|||
resultMap.put("msg",1); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
resultMap.put("msg",4); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 删除医院的设备型号 |
|||
* @param id |
|||
*/ |
|||
|
|||
@RequestMapping("deleteInstallModel") |
|||
public Map<String, Object> deleteInstallModel(Integer id) { |
|||
Map<String, Object> resultMap = new HashMap<>(2); |
|||
try { |
|||
boolean result = installModelService.deleteById(id); |
|||
if (result) { |
|||
resultMap.put("msg",1); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
resultMap.put("msg",4); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 根据id查询设备型号 |
|||
* @param id |
|||
*/ |
|||
|
|||
@RequestMapping("findInstallModelById") |
|||
public Map<String, Object> findInstallModel(Integer id) { |
|||
Map<String, Object> resultMap = new HashMap<>(2); |
|||
try { |
|||
InstallModel installModel = installModelService.selectById(id); |
|||
if (installModel != null) { |
|||
resultMap.put("installModel",installModel); |
|||
resultMap.put("msg","1"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
resultMap.put("msg",4); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 通过医院id与会诊类型查找设备型号 |
|||
* @param hospitalId 医院id |
|||
* @param type 会诊类型 超声视频:BMODEL 远程会诊视频:CON |
|||
* @return |
|||
*/ |
|||
|
|||
@RequestMapping("findInstallMode") |
|||
public Map<String, Object> findInstallMode(String hospitalId,String type) { |
|||
Map<String, Object> resultMap = new HashMap<>(2); |
|||
EntityWrapper<InstallModel> wrapper = new EntityWrapper<>(); |
|||
wrapper.eq("hospital_id",hospitalId); |
|||
if(type!=null) { |
|||
wrapper.eq("type",type); |
|||
} |
|||
try { |
|||
List<InstallModel> installModels = installModelService.selectList(wrapper); |
|||
|
|||
resultMap.put("installModels",installModels); |
|||
resultMap.put("msg",1); |
|||
|
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
resultMap.put("msg","4"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,190 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import com.imurs.dao.LiveMapper; |
|||
import com.imurs.entity.Live; |
|||
import com.imurs.service.LiveService; |
|||
import com.imurs.service.impl.LiveServiceImpl; |
|||
import com.imurs.util.page.Pagetion; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@RestController |
|||
@RequestMapping(value="live") |
|||
public class LiveController { |
|||
|
|||
@Autowired |
|||
private LiveService liveService; |
|||
|
|||
|
|||
/** |
|||
* 修改直播地址 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("updateLive") |
|||
public Map<String,Object> updateLive(Live live){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
boolean result = false; |
|||
try { |
|||
if(live != null) { |
|||
result=liveService.updateById(live); |
|||
liveService.updateById(live); |
|||
} |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 插入直播地址 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("insertLive") |
|||
public Map<String,Object> insertLive(Live live){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
boolean result = false; |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|||
Date date=new Date(); |
|||
try { |
|||
if(live != null) { |
|||
result=liveService.insert(live); |
|||
liveService.updateById(live); |
|||
} |
|||
live.setApplicationTime(dateFormat.parse(dateFormat.format(date))); |
|||
map.put("id",live.getId()); |
|||
map.put("applicationTime",live.getApplicationTime()); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 修改直播地址 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("deleteLive") |
|||
public Map<String,Object> deleteLive(Live live){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
boolean result = false; |
|||
try { |
|||
if(live != null) { |
|||
result=liveService.deleteById(live); |
|||
} |
|||
map.put("msg", result ?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 修改直播地址 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("selectLiveById") |
|||
public Map<String,Object> selectLive(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
Live live = liveService.selectById(id); |
|||
map.put("live",live); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 管理医院B超列表 |
|||
*/ |
|||
@RequestMapping("selectLivePage") |
|||
public Map<String,Object> selectBmodePage(String state, |
|||
Integer pageNo,Integer pageSize){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
map.put("state",state); |
|||
pageNo=pageNo==null?1:pageNo; |
|||
pageSize=pageSize==null?10:pageSize; |
|||
try { |
|||
Pagetion<Live> pagetion = liveService.selectLivePage(map, pageNo, pageSize); |
|||
map.clear(); |
|||
map.put("pagetion", pagetion); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("categoryHospitalId"); |
|||
} |
|||
return map; |
|||
} |
|||
// /***********************************
|
|||
// * 批量删除直播地址
|
|||
// */
|
|||
// @Transactional
|
|||
// @RequestMapping("deleteBatchLive")
|
|||
// public Map<String,Object> deleteBatchLive(@RequestBody List<Live> aList){
|
|||
// Live live = aList.get(0);
|
|||
// Map<String,Object> map=new HashMap<String,Object>();
|
|||
// boolean result = false;
|
|||
// try {
|
|||
// if(live != null) {
|
|||
// result=liveService.deleteBatchIds(aList);
|
|||
// }
|
|||
// map.put("msg", result==true?"1":"2");
|
|||
// } catch (Exception e) {
|
|||
// e.printStackTrace();
|
|||
// map.put("msg", "4");
|
|||
// }
|
|||
// return map;
|
|||
// }
|
|||
// /**
|
|||
// * 批量新增直播地址
|
|||
// */
|
|||
// @Transactional
|
|||
// @PostMapping("insertBatchLive")
|
|||
// public Map<String,Object> insertLive(@RequestBody List<Live> aList){
|
|||
// Map<String,Object> map=new HashMap<String,Object>();
|
|||
// try {
|
|||
// if(!aList.isEmpty()){
|
|||
// boolean result = liveService.insertBatch(aList);
|
|||
// map.put("msg", result==true?"1":"2");
|
|||
// }else{
|
|||
// map.put("msg", "3");
|
|||
// }
|
|||
// } catch (Exception e) {
|
|||
// e.printStackTrace();
|
|||
// map.put("msg", "4");
|
|||
// }
|
|||
// return map;
|
|||
// }
|
|||
// /**
|
|||
// * 批量修改直播地址
|
|||
// */
|
|||
// @Transactional
|
|||
// @RequestMapping("updateBatchLive")
|
|||
// public Map<String,Object> updateLive(List<Live> aList){
|
|||
// Live live = aList.get(0);
|
|||
// Map<String,Object> map=new HashMap<String,Object>();
|
|||
// boolean result = false;
|
|||
// try {
|
|||
// if(live != null) {
|
|||
// result=liveService.updateBatchById(aList);
|
|||
// }
|
|||
// map.put("msg", result==true?"1":"2");
|
|||
// } catch (Exception e) {
|
|||
// e.printStackTrace();
|
|||
// map.put("msg", "4");
|
|||
// }
|
|||
// return map;
|
|||
// }
|
|||
|
|||
} |
|||
@ -0,0 +1,171 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import com.imurs.shiro.ShiroUtils; |
|||
import com.imurs.util.MsgCode; |
|||
import com.imurs.util.RSAUtil; |
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.ApplyInformation; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.MD5; |
|||
|
|||
/** |
|||
* 登录 |
|||
* |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value = "login") |
|||
public class LoginController { |
|||
|
|||
@Autowired |
|||
UserService userService; |
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
|
|||
private static String privateKey = MsgCode.privateKeyString; |
|||
|
|||
|
|||
/** |
|||
* 医生修改密码(没有使用) |
|||
*/ |
|||
@RequestMapping(value = "updateUserPassword") |
|||
public Map<String, Object> updateUserPassword(String phone, String oidPassword, String newPassword) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<User> wrapper = new EntityWrapper<User>(); |
|||
try { |
|||
if (StringUtils.isNotEmpty(phone) && StringUtils.isNotEmpty(oidPassword) |
|||
&& StringUtils.isNotEmpty(newPassword)) { |
|||
wrapper.eq("phone", phone); |
|||
// 查询这个用户是否存在
|
|||
User user = userService.selectOne(wrapper); |
|||
if (user != null) { |
|||
if (user.getPassword().equals(MD5.GetMD5Code(oidPassword))) { |
|||
user.setPassword(MD5.GetMD5Code(newPassword)); |
|||
Boolean b = userService.update(user, wrapper); |
|||
map.put("msg", b == true ? "1" : "2"); |
|||
} else { |
|||
map.put("msg", "11"); |
|||
} |
|||
} else { |
|||
map.put("msg", "6"); |
|||
} |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 管理员重置医生密码(没有使用) |
|||
*/ |
|||
@RequestMapping(value = "resetUserPassword") |
|||
public Map<String, Object> resetUserPassword(String phone, String password) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
if (StringUtils.isNotEmpty(phone) && StringUtils.isNotEmpty(password)) { |
|||
// 查询这个用户是否存在
|
|||
User user = userService.selectOne(new EntityWrapper<User>().eq("phone", phone)); |
|||
if (user != null) { |
|||
user.setPassword(MD5.GetMD5Code(password)); |
|||
Boolean b = userService.updateById(user); |
|||
map.put("msg", b == true ? "1" : "2"); |
|||
} else { |
|||
map.put("msg", "6"); |
|||
} |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 医院修改密码 |
|||
*/ |
|||
@RequestMapping(value = "informationUpdatePassword") |
|||
public Map<String, Object> informationUpdatePassword(String hospitalId, String oldPassword, String newPassword) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
if (StringUtils.isNotEmpty(hospitalId) && StringUtils.isNotEmpty(oldPassword) |
|||
&& StringUtils.isNotEmpty(newPassword)) { |
|||
// 查询这个用户是否存在
|
|||
|
|||
oldPassword = RSAUtil.decrypt(oldPassword,privateKey); |
|||
newPassword = RSAUtil.decrypt(newPassword,privateKey); |
|||
|
|||
ApplyInformation applyInformation = applyInformationService |
|||
.selectOne(new EntityWrapper<ApplyInformation>().eq("id", hospitalId)); |
|||
if (applyInformation != null) { |
|||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
|||
if (passwordEncoder.matches(oldPassword,applyInformation.getPassword())) { |
|||
applyInformation.setPassword(passwordEncoder.encode(newPassword)); |
|||
Boolean b = applyInformationService.updateById(applyInformation); |
|||
map.put("msg", b ? "1" : "2"); |
|||
} else { |
|||
map.put("msg", "11"); |
|||
} |
|||
} else { |
|||
map.put("msg", "6"); |
|||
} |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 管理员重置医院密码 |
|||
*/ |
|||
@RequestMapping(value = "resetInformationPassword") |
|||
public Map<String, Object> resetInformationPassword(String hospitalId, String password) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
if (StringUtils.isNotEmpty(hospitalId) && StringUtils.isNotEmpty(password)) { |
|||
// 查询这个用户是否存在
|
|||
ApplyInformation applyInformation = applyInformationService |
|||
.selectOne(new EntityWrapper<ApplyInformation>().eq("id", hospitalId)); |
|||
if (applyInformation != null) { |
|||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
|||
applyInformation.setPassword(passwordEncoder.encode(password)); |
|||
Boolean b = applyInformationService.updateById(applyInformation); |
|||
map.put("msg", b ? "1" : "2"); |
|||
} else { |
|||
map.put("msg", "6"); |
|||
} |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,112 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.LoginRecord; |
|||
import com.imurs.service.LoginRecordService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
|
|||
/** |
|||
* 登录记录 |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value="loginRecord") |
|||
public class LoginRecordController { |
|||
|
|||
@Autowired |
|||
LoginRecordService loginRecordService; |
|||
|
|||
/** |
|||
* 新增登录记录 |
|||
* @param loginRecord |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="addLoginRecord") |
|||
public Map<String,Object> addLoginRecord(LoginRecord loginRecord,HttpServletRequest request) throws Exception { |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
|
|||
try { |
|||
/** |
|||
* 获取访问用户的客户端IP(适用于公网与局域网). |
|||
*/ |
|||
if (request == null) { |
|||
throw (new Exception("getIpAddr method HttpServletRequest Object is null")); |
|||
} |
|||
String ipString = request.getHeader("x-forwarded-for"); |
|||
if (StringUtils.isBlank(ipString) || "unknown".equalsIgnoreCase(ipString)) { |
|||
ipString = request.getHeader("Proxy-Client-IP"); |
|||
} |
|||
if (StringUtils.isBlank(ipString) || "unknown".equalsIgnoreCase(ipString)) { |
|||
ipString = request.getHeader("WL-Proxy-Client-IP"); |
|||
} |
|||
if (StringUtils.isBlank(ipString) || "unknown".equalsIgnoreCase(ipString)) { |
|||
ipString = request.getRemoteAddr(); |
|||
} |
|||
|
|||
// 多个路由时,取第一个非unknown的ip
|
|||
final String[] arr = ipString.split(","); |
|||
for (final String str : arr) { |
|||
if (!"unknown".equalsIgnoreCase(str)) { |
|||
ipString = str; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
loginRecord.setIp(ipString);//获取登录ip
|
|||
boolean result=loginRecordService.insert(loginRecord); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 分页显示登录记录信息 |
|||
*/ |
|||
@RequestMapping(value="selectLoginRecordPage") |
|||
public Map<String,Object> selectLoginRecordPage(Integer pageNo,Integer pageSize,String loginId,String loginName){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
FrontPage<LoginRecord> page=new FrontPage<LoginRecord>(); |
|||
EntityWrapper<LoginRecord> wrapper=new EntityWrapper<LoginRecord>(); |
|||
|
|||
page.setPage(pageNo==null?1:pageNo); |
|||
page.setRows(pageSize==null?12:pageSize); |
|||
|
|||
if(StringUtils.isNotEmpty(loginId)){ |
|||
wrapper.eq("login_id", loginId); |
|||
}if(StringUtils.isNotEmpty(loginName)){ |
|||
wrapper.like("login_name", loginName); |
|||
} |
|||
wrapper.orderBy("create_time",false); |
|||
try { |
|||
Page<LoginRecord> loginRecord=loginRecordService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if(loginRecord!=null){ |
|||
CustomPage<LoginRecord> customPage=new CustomPage<LoginRecord>(loginRecord); |
|||
map.put("customPage", customPage); |
|||
}else{ |
|||
map.put("msg","3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,109 @@ |
|||
package com.imurs.controller; |
|||
import java.io.BufferedInputStream; |
|||
import java.io.InputStream; |
|||
import java.text.DateFormat; |
|||
import java.text.ParseException; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import com.alibaba.excel.EasyExcelFactory; |
|||
import com.alibaba.excel.metadata.Sheet; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.imurs.ocr.ocrdemo; |
|||
@RestController |
|||
@RequestMapping(value = "/Ocrcontroller") |
|||
public class OcrDemoController { |
|||
@RequestMapping(value = "/saveimg") |
|||
public Map<String, Object> saveImage(MultipartFile filelSavePath) throws Exception { |
|||
InputStream is =filelSavePath.getInputStream(); |
|||
Map<String, Object> json =ocrdemo.OcrRecognition(is); |
|||
|
|||
|
|||
return json; |
|||
} |
|||
@RequestMapping(value = "/aliExcel") |
|||
public JSONObject aliExcel(MultipartFile filelSavePath) throws Exception { |
|||
InputStream is =filelSavePath.getInputStream(); |
|||
InputStream inputStream = new BufferedInputStream(is); |
|||
List<Object> data = EasyExcelFactory.read(inputStream, new Sheet(1, 0)); |
|||
inputStream.close(); |
|||
Map<String,Object> m= print2(data); |
|||
JSONObject JSONObj = JSONObject.parseObject(JSON.toJSONString(m)); |
|||
// Object o = JSONObject.toJSON(m);
|
|||
return JSONObj; |
|||
|
|||
|
|||
} |
|||
public Map<String,Object> print2(List<Object> datas){ |
|||
|
|||
Map<String,Object> m = new HashMap<String,Object>(); |
|||
/* for(int i=4;i<datas.size();i++){ |
|||
System.out.println(i); |
|||
System.out.println(datas.get(i)); |
|||
}*/ |
|||
//分行读取数据
|
|||
String[] s = StringUtils.strip(datas.get(4).toString(),"[]").split(","); |
|||
m.put("patientName", s[1].replace("null", "")); |
|||
m.put("sex", s[3].trim().replace("null", "")); |
|||
m.put("age", s[5].trim().replace("null", "")); |
|||
|
|||
String[] job = StringUtils.strip(datas.get(6).toString(),"[]").split(","); |
|||
|
|||
|
|||
m.put("allergy", job[7].trim().replace("null", "")); |
|||
String[] adr = StringUtils.strip(datas.get(8).toString(),"[]").split(","); |
|||
|
|||
m.put("ptCity", adr[2].trim().replace("null", "")); |
|||
m.put("ptPhone", adr[6].trim().replace("null", "")); |
|||
String[] date = StringUtils.strip(datas.get(10).toString(),"[]").split(","); |
|||
Date da=null; |
|||
String d=null; |
|||
DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd"); |
|||
|
|||
try { |
|||
String s1= date[2].trim().replace("null", ""); |
|||
da = format1.parse(s1); |
|||
d= format1.format(da); |
|||
|
|||
} catch (ParseException e) { |
|||
// TODO Auto-generated catch block
|
|||
e.printStackTrace(); |
|||
} |
|||
m.put("nuhTime", d); |
|||
String[] hos = StringUtils.strip(datas.get(12).toString(),"[]").split(","); |
|||
m.put("nuhSection", hos[6].trim().replace("null", ""));//全科诊室
|
|||
String[] maj = StringUtils.strip(datas.get(14).toString(),"[]").split(","); |
|||
m.put("complain", maj[1].trim().replace("null", ""));//主诉
|
|||
String[] pre = StringUtils.strip(datas.get(17).toString(),"[]").split(","); |
|||
String[] pre1 = StringUtils.strip(datas.get(18).toString(),"[]").split(","); |
|||
String[] pre2 = StringUtils.strip(datas.get(19).toString(),"[]").split(","); |
|||
m.put("present", (pre[0].replace("现病史:","")+pre1[0].trim()+pre2[0].trim()).replace("null", ""));//现病史
|
|||
String[] past = StringUtils.strip(datas.get(20).toString(),"[]").split(","); |
|||
String[] past1 = StringUtils.strip(datas.get(21).toString(),"[]").split(","); |
|||
String[] past2 = StringUtils.strip(datas.get(22).toString(),"[]").split(","); |
|||
|
|||
m.put("past", (past[0].replace("既往史:","")+past1[0].trim()+past2[0].trim()).replace("null", ""));//既往史
|
|||
String[] ti = StringUtils.strip(datas.get(23).toString(),"[]").split(","); |
|||
String[] ti1 = StringUtils.strip(datas.get(24).toString(),"[]").split(","); |
|||
|
|||
m.put("examine", (ti[0].replace("体察: ","")+ti1[0].trim()).replace("null", ""));//体察:
|
|||
String[] ini = StringUtils.strip(datas.get(25).toString(),"[]").split(","); |
|||
String[] ini1 = StringUtils.strip(datas.get(26).toString(),"[]").split(","); |
|||
String[] ini2 = StringUtils.strip(datas.get(27).toString(),"[]").split(","); |
|||
|
|||
m.put("initial", (ini[1].trim()+ini1[1].trim()+ini2[1].trim()).replace("null", ""));//初步诊断:
|
|||
|
|||
//System.out.println(m.toString());
|
|||
return m; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,206 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.ApplyCase; |
|||
import com.imurs.entity.ApplyConsultation; |
|||
import com.imurs.entity.Patient; |
|||
import com.imurs.service.ApplyCaseService; |
|||
import com.imurs.service.ApplyConsultationService; |
|||
import com.imurs.service.PatientService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
import com.imurs.util.page.Pagetion; |
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 患者信息表 |
|||
* |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value = "patient") |
|||
public class PatientController { |
|||
|
|||
@Autowired |
|||
PatientService patientService; |
|||
@Autowired |
|||
ApplyCaseService applyCaseService; |
|||
@Autowired |
|||
ApplyConsultationService applyConsultationService; |
|||
|
|||
/** |
|||
* 新增患者信息 |
|||
*/ |
|||
@RequestMapping(value = "insertPatient") |
|||
public Map<String, Object> insertPatient(Patient patient) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = patientService.insert(patient); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 修改患者信息 |
|||
*/ |
|||
@RequestMapping(value = "updatePatient") |
|||
public Map<String, Object> updatePatient(Patient patient) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = patientService.updateById(patient); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 删除患者信息 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping(value = "deletePatientByCard") |
|||
public Map<String, Object> deletePatientByCard(String card) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
if(StringUtils.isEmpty(card)){ |
|||
map.put("msg", "3"); |
|||
}else{ |
|||
map.put("card", card); |
|||
boolean result = patientService.deleteByMap(map); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 删除患者信息 |
|||
*/ |
|||
@RequestMapping(value = "deletePatientById") |
|||
public Map<String, Object> deletePatientById(Long id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = patientService.deleteById(id); |
|||
map.put("msg", result ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 根据患者病例号码查询 |
|||
*/ |
|||
@RequestMapping(value = "seletePatientByCard") |
|||
public Map<String, Object> seletePatientById(String esrdNumber,String hospitalId) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<Patient> wrapper=new EntityWrapper<Patient>(); |
|||
try { |
|||
if(StringUtils.isEmpty(esrdNumber)){ |
|||
map.put("msg", "3"); |
|||
}else{ |
|||
wrapper.eq("esrd_number", esrdNumber).eq("hospital_id", hospitalId);; |
|||
Patient patient = patientService.selectOne(wrapper); |
|||
map.put("patient", patient); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 分页显示患者信息 |
|||
*/ |
|||
@RequestMapping(value = "seletePatientPage") |
|||
public Map<String, Object> seletePatientPage(Integer pageNo, Integer pageSize,String card,String ptName,Integer type,String hospitalId,String esrdNumber) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("hospitalId", hospitalId); |
|||
map.put("card", card); |
|||
map.put("esrdNumber", esrdNumber); |
|||
map.put("ptName", ptName); |
|||
pageNo=pageNo==null?1:pageNo; |
|||
pageSize=pageSize==null?10:pageSize; |
|||
try { |
|||
if(type!=null && type==1){ |
|||
Pagetion<ApplyCase> acList=applyCaseService.selectCasePatient(map, pageNo, pageSize); |
|||
map.put("acList", acList); |
|||
}else if(type!=null && type==2){ |
|||
Pagetion<ApplyConsultation> conList=applyConsultationService.selectConPatient(map, pageNo, pageSize); |
|||
map.put("acList", conList); |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("hospitalId"); |
|||
map.remove("card"); |
|||
map.remove("ptName"); |
|||
map.remove("esrdNumber"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 患者列表 |
|||
*/ |
|||
@RequestMapping(value = "seletePatientByPage") |
|||
public Map<String, Object> seletePatientPage(Integer pageNo, Integer pageSize,String card,String patientName,String hospitalId,String esrdNumber) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<Patient> wrapper=new EntityWrapper<Patient>(); |
|||
FrontPage<Patient> page=new FrontPage<Patient>(); |
|||
page.setPage(pageNo == null ? 1 : pageNo); |
|||
page.setRows(pageSize == null ? 10 : pageSize); |
|||
|
|||
if(StringUtils.isNotEmpty(esrdNumber)){ |
|||
wrapper.eq("esrd_number", esrdNumber); |
|||
} |
|||
if(StringUtils.isNotEmpty(hospitalId)){ |
|||
wrapper.eq("hospital_id", hospitalId); |
|||
} |
|||
if(StringUtils.isNotEmpty(card)){ |
|||
wrapper.eq("card", card); |
|||
} |
|||
if(StringUtils.isNotEmpty(patientName)){ |
|||
wrapper.like("patient_name", patientName); |
|||
} |
|||
wrapper.orderBy("create_time", false); |
|||
try { |
|||
Page<Patient> ptList = patientService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if(ptList!=null){ |
|||
CustomPage<Patient> customPage=new CustomPage<Patient>(ptList); |
|||
map.put("customPage", customPage); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,269 @@ |
|||
package com.imurs.controller; |
|||
|
|||
|
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.pdfbox.pdfparser.PDFParser; |
|||
import org.apache.pdfbox.pdmodel.PDDocument; |
|||
import org.apache.pdfbox.util.PDFTextStripper; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
@RestController |
|||
@RequestMapping(value = "/pdfcontroller") |
|||
public class PdfReaderController { |
|||
|
|||
/*public static void main(String[] args) { |
|||
// TODO Auto-generated method stub
|
|||
|
|||
}*/ |
|||
@RequestMapping(value = "/recpdf") |
|||
public Map<String, Object> saveImage(MultipartFile filelSavePath,String id) throws Exception { |
|||
InputStream is =filelSavePath.getInputStream(); |
|||
//Map<String, Object> json =ocrdemo.OcrRecognition(is);
|
|||
|
|||
String s =getTextFromPdf (is,0,1 ) ;//0,1 没有用
|
|||
boolean IsAdmissionNote = s.contains("入院记录"); |
|||
boolean isBingChen = s.contains("病程记录"); |
|||
boolean isFirstBC =s.contains("首次病程"); |
|||
JSONObject json=null; |
|||
if(IsAdmissionNote&&"1".equals(id)){ |
|||
json=parseriuan(s);//入院记录 1
|
|||
} |
|||
else if(isBingChen&&isFirstBC&&"2".equals(id)){ |
|||
json=parsefirst(s);//第一次检查2
|
|||
} |
|||
else if(isBingChen&&!isFirstBC){ |
|||
json=parsebingchen(s);//日常检查3
|
|||
}else{ |
|||
return JSONObject.parseObject("not match"); |
|||
} |
|||
return json; |
|||
} |
|||
public String getTextFromPdf (InputStream filePath,int pageStartValue,int pageEndValue ) { |
|||
String result = null; |
|||
InputStream is = null; |
|||
PDDocument document = null; |
|||
try { |
|||
is = filePath; |
|||
PDFParser parser = new PDFParser(is); |
|||
parser.parse(); |
|||
document = parser.getPDDocument(); |
|||
PDFTextStripper stripper = new PDFTextStripper(); |
|||
/* stripper.setStartPage(0); |
|||
stripper.setEndPage(1);//设置解读页数
|
|||
*/ |
|||
|
|||
result = stripper.getText(document); |
|||
} catch (IOException e1) { |
|||
e1.printStackTrace(); |
|||
} finally { |
|||
if (is != null) { |
|||
try { |
|||
is.close(); |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
if (document != null) { |
|||
try { |
|||
document.close(); |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
public JSONObject parseriuan(String s){ |
|||
Map<String,Object> map = new HashMap<String,Object>(); |
|||
int i=s.indexOf("姓名:"); |
|||
int j=s.indexOf("性别:"); |
|||
String name=s.substring(i+3, j); |
|||
int s1=s.indexOf("科室:"); |
|||
String sex=s.substring(j+3, s1); |
|||
int depn =s.indexOf("住院号:"); |
|||
int cw= s.indexOf("床位:"); |
|||
String dept =s.substring(s1+3, depn); |
|||
String deptNo =s.substring(depn+4, cw);//住院号
|
|||
//System.out.println(deptNo);
|
|||
//籍贯
|
|||
int jg =s.indexOf("籍 贯:"); |
|||
int jg1 = s.indexOf("性 别:",j); |
|||
//String Birthplace=s.substring(jg+3, jg1);
|
|||
//System.out.println(s);
|
|||
String Birthplace=s.substring(jg+10,jg1);//籍 贯
|
|||
|
|||
int c1 = s.indexOf("住 址:"); |
|||
int c2 =s.indexOf("民 族: "); |
|||
String ptCity =s.substring(c1+10,c2); |
|||
int hd=s.indexOf("入院日期:"); |
|||
int age =s.indexOf("年 龄:"); |
|||
String mj = s.substring(c2+10,hd);//民 族
|
|||
String nuh_time=s.substring(hd+6,age);//入院日期
|
|||
|
|||
int hd1=s.indexOf("记录日期:"); |
|||
int mj1=s.indexOf("职 业:"); |
|||
String agen = s.substring(age+10, hd1); |
|||
String date=s.substring(hd1+6, mj1);//记录日期
|
|||
int bs=s.indexOf("病史陈述者:"); |
|||
String major= s.substring(mj1+10,bs);//职 业
|
|||
int mar=s.indexOf("婚 否:"); |
|||
String ismarry =s.substring(bs+7, mar);//
|
|||
|
|||
int ke =s.indexOf("可靠程度:"); |
|||
String ismar =s.substring(mar+10, ke); |
|||
int com =s.indexOf("主诉:"); |
|||
String c=s.substring(ke+5, com);//可靠程度
|
|||
|
|||
int pre=s.indexOf("现病史:"); |
|||
String complain=s.substring(com+4, pre);//主诉
|
|||
int pas =s.indexOf("既往史:"); |
|||
String present =s.substring(pre+4, pas);//现病史
|
|||
int gh=s.indexOf("个人史:"); |
|||
int yh=s.indexOf("月经史:"); |
|||
String past =s.substring(pas+4, gh); |
|||
String perhis =s.substring(gh+4, yh);//个人史
|
|||
int med=s.indexOf("婚育史:"); |
|||
int fah=s.indexOf("家族史:"); |
|||
String yueh=s.substring(yh+4, med);//月经史
|
|||
String medhis= s.substring(med+4, fah);//家族史
|
|||
|
|||
int geche =s.indexOf("体 格 检 查 "); |
|||
int zkq = s.indexOf("专科情况:"); |
|||
String fh=s.substring(fah+4, geche); |
|||
int jy= s.indexOf("靖远县", geche); |
|||
int cw2=s.indexOf("床位:",geche); |
|||
int fzjc = s.indexOf("辅助检查:"); |
|||
String specialistCase =s.substring(zkq+5, jy-6)+s.substring(cw2+5, fzjc).trim();//专科情况
|
|||
String gecheck =s.substring(geche+7, zkq); |
|||
int cyzd=s.indexOf("出院诊断:"); |
|||
String fzck =s.substring(fzjc+5, cyzd);//辅助检查
|
|||
int chubuzd =s.indexOf("初步诊断:"); |
|||
int dn =s.indexOf("医生签名:"); |
|||
int rz =s.indexOf("补充诊断:"); |
|||
int xz =s.indexOf("修正诊断:"); |
|||
String chzd=s.substring(cyzd+5, chubuzd);//出院诊断
|
|||
String initial =s.substring(chubuzd+5, dn);//初步诊断:
|
|||
String docname=s.substring(dn+5, rz);//医生签名
|
|||
String buchzd=s.substring(rz+5,xz);//补充诊断
|
|||
String xiuzzd=s.substring(xz+5);//修正诊断:
|
|||
map.put("ptName", name);//姓名
|
|||
map.put("ptSex", sex); |
|||
map.put("nuhSection", dept);//科室
|
|||
map.put("inpatient", deptNo);//住院号
|
|||
map.put("birthplace", Birthplace);//籍贯
|
|||
map.put("ptCity", ptCity);//住址
|
|||
map.put("nation", mj);//民族
|
|||
map.put("nuhTime", nuh_time);//入院日期
|
|||
map.put("age", agen);//年龄
|
|||
map.put("recordDate", date);//记录日期
|
|||
map.put("profession", major);//职业
|
|||
map.put("statement", ismarry);//病史陈述者
|
|||
map.put("marriage", ismar);//婚 否
|
|||
map.put("confidence", c);//可靠程度
|
|||
map.put("complain", complain);//主诉
|
|||
map.put("present", present);//现病史
|
|||
map.put("past", past);//既往史
|
|||
map.put("personalHistory", perhis);//个人史
|
|||
map.put("fh", fh);//家族史
|
|||
map.put("pmp", yueh);//月经史
|
|||
map.put("obstetricalHistory", medhis);//婚育史
|
|||
map.put("physicalExamination", gecheck);//体 格 检 查assistant examination
|
|||
map.put("assistantExamination", fzck);//辅助检查
|
|||
map.put("finalDiagnosis", chzd);//出院诊断 initial
|
|||
map.put("initial", initial);//初步诊断
|
|||
map.put("addDiagnosis", buchzd);//补充诊断
|
|||
map.put("correctingDiagnosis", xiuzzd);//修正诊断
|
|||
map.put("docName", docname);//医生签名
|
|||
map.put("specialistCase", specialistCase); |
|||
//System.out.println(map.toString());
|
|||
JSONObject JSONObj = JSONObject.parseObject(JSON.toJSONString(map)); |
|||
return JSONObj; |
|||
} |
|||
public JSONObject parsebingchen(String s){//日常病程
|
|||
Map<String,Object> map = new HashMap<String,Object>(); |
|||
|
|||
//日常记录
|
|||
int n1=s.indexOf("姓名:"); |
|||
int n2=s.indexOf("性别:"); |
|||
int k1=s.indexOf("科室:"); |
|||
int k2 =s.indexOf("住院号:"); |
|||
int cw =s.indexOf("床位:"); |
|||
String name =s.substring(n1+3, n2); |
|||
String sex =s.substring(n2+3, k1); |
|||
String dept =s.substring(k1+3,k2); |
|||
String inpatient=s.substring(k2+4, cw); |
|||
//病程记录了啊
|
|||
int bc=s.indexOf("病 程 记 录",cw); |
|||
int dn1 =s.indexOf("医师签名:"); |
|||
//第一次病程记录
|
|||
String fbin=s.substring(bc+7, dn1); |
|||
//System.out.println("第一次"+fbin);
|
|||
map.put("0", fbin); |
|||
int index=dn1; |
|||
int prindex=dn1; |
|||
int i=0; |
|||
String dari=null; |
|||
while((index=s.indexOf("医师签名:",index+1))!=-1){//
|
|||
dari=s.substring(prindex, index);//上次的
|
|||
prindex=index;//上次的
|
|||
index = index + 5; |
|||
//System.out.println("888"+i++);
|
|||
map.put(i+"", dari); |
|||
} |
|||
map.put("name", name); |
|||
map.put("sex", sex); |
|||
map.put("chamber", dept); |
|||
map.put("inpatient", inpatient); |
|||
JSONObject JSONObj = JSONObject.parseObject(JSON.toJSONString(map)); |
|||
return JSONObj; |
|||
|
|||
} |
|||
//首次记录
|
|||
public JSONObject parsefirst(String s){ |
|||
//首次记录
|
|||
Map<String,Object> map = new HashMap<String,Object>(); |
|||
int n1=s.indexOf("姓名:"); |
|||
int n2=s.indexOf("性别:"); |
|||
int k1=s.indexOf("科室:"); |
|||
int k2 =s.indexOf("住院号:"); |
|||
int cw =s.indexOf("床位:"); |
|||
String name =s.substring(n1+3, n2); |
|||
String sex =s.substring(n2+3, k1); |
|||
String dept =s.substring(k1+3,k2); |
|||
String inpatient=s.substring(k2+4, cw); |
|||
//
|
|||
int f= s.indexOf("首次病程"); |
|||
int bl =s.indexOf("病例特点"); |
|||
int cb =s.indexOf("初步诊断:"); |
|||
int zd= s.indexOf("诊断依据:"); |
|||
int jq= s.indexOf("鉴别诊断:"); |
|||
int pl= s.indexOf("诊疗计划:"); |
|||
int qm= s.indexOf("签名:"); |
|||
String fis=s.substring(f+4, bl); |
|||
map.put("fis", fis);// 首次病程
|
|||
map.put("name", name); |
|||
map.put("sex", sex); |
|||
map.put("nuhSection", dept); |
|||
map.put("inpatient", inpatient); |
|||
map.put("characteristic", s.substring(bl+5, cb));//病例特点
|
|||
map.put("initial", s.substring(cb+5, zd));//初步诊断
|
|||
map.put("dsm", s.substring(zd+5, jq));//诊断依据
|
|||
map.put("antidiastole", s.substring(jq+5, pl));//鉴别诊断
|
|||
map.put("assessandplan", s.substring(pl+5, qm));//诊疗计划
|
|||
//int
|
|||
JSONObject JSONObj = JSONObject.parseObject(JSON.toJSONString(map)); |
|||
//System.out.println(map.toString());
|
|||
return JSONObj; |
|||
|
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,237 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.Wrapper; |
|||
import com.imurs.shiro.ShiroUtils; |
|||
import com.imurs.util.MsgCode; |
|||
import com.imurs.util.RSAUtil; |
|||
import com.imurs.util.rateLimiter.RateLimiterAspect; |
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.ApplyInformation; |
|||
import com.imurs.entity.ApplyInformationImg; |
|||
import com.imurs.entity.Role; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyInformationImgService; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.RoleService; |
|||
import com.imurs.service.TotalInformationService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.MD5; |
|||
|
|||
import static com.imurs.shiro.ShiroUtils.generateSalt; |
|||
|
|||
/** |
|||
* 注册 |
|||
* |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value = "register") |
|||
public class RegisterController { |
|||
|
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
@Autowired |
|||
ApplyInformationImgService applyInformationImgService; |
|||
@Autowired |
|||
UserService userService; |
|||
@Autowired |
|||
TotalInformationService totalInformationService; |
|||
@Autowired |
|||
RoleService roleService; |
|||
|
|||
private static String password = MsgCode.Password; |
|||
|
|||
private static String privateKey = MsgCode.privateKeyString; |
|||
|
|||
/** |
|||
* 新增基层医院申请信息 |
|||
*/ |
|||
@RateLimiterAspect |
|||
@Transactional |
|||
@RequestMapping(value = "registerInfor") |
|||
public Map<String, Object> registerInfor(ApplyInformation applyInformation, String imgUrl2, String imgType) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
List<ApplyInformationImg> imgList = new ArrayList<ApplyInformationImg>(); |
|||
Role role = new Role(); |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
|||
Date date=new Date(); |
|||
try { |
|||
String uuid=MD5.GetMD5Code(dateFormat.format(date)); |
|||
if (applyInformation != null) { |
|||
// 判断医院名字是否已经注册,如果已经注册就不能再注册
|
|||
Wrapper<ApplyInformation> wrapper = new EntityWrapper<ApplyInformation>() |
|||
.eq("hospital_name",applyInformation.getHospitalName()); |
|||
List<ApplyInformation> informationList = applyInformationService.selectList(wrapper); |
|||
if (!informationList.isEmpty()) { |
|||
map.put("msg","5"); |
|||
return map; |
|||
} |
|||
role = roleService.selectById(applyInformation.getRid()); |
|||
if (role != null) { |
|||
applyInformation.setRpId(role.getRpId()); |
|||
} |
|||
// 医院id按照时间日期生成
|
|||
applyInformation.setId(uuid); |
|||
applyInformation.setAccount(uuid); |
|||
//9.16新增默认密码 前台默认不传
|
|||
/*if(!applyInformation.getPassword().isEmpty()&&applyInformation.getPassword()!=null){ |
|||
}*/ |
|||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
|||
applyInformation.setPassword(passwordEncoder.encode(password)); |
|||
//applyInformation.setPassword(MD5.GetMD5Code(applyInformation.getPassword()));
|
|||
boolean result = applyInformationService.insert(applyInformation); |
|||
if (result == true) { |
|||
if (StringUtils.isNotEmpty(imgUrl2) && StringUtils.isNotEmpty(imgType)) { |
|||
String str[] = imgUrl2.split(","); |
|||
String str2[] = imgType.split(","); |
|||
for (int i = 0; i < str2.length; i++) { |
|||
ApplyInformationImg img = new ApplyInformationImg(); |
|||
img.setImgUrl(str[i]); |
|||
img.setImgType(Integer.valueOf(str2[i])); |
|||
img.setHospitalId(uuid); |
|||
imgList.add(img); |
|||
} |
|||
applyInformationImgService.insertBatch(imgList); |
|||
} |
|||
map.put("msg", "1"); |
|||
} else { |
|||
map.put("msg", "2"); |
|||
} |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 医生注册 |
|||
* |
|||
* @param user |
|||
* @return |
|||
*/ |
|||
@RateLimiterAspect |
|||
@RequestMapping(value = "registerUser") |
|||
public Map<String, Object> insertUser(User user) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
Role role = new Role(); |
|||
try { |
|||
if (user != null && user.getRid() != null) { |
|||
// 如果该账号存在直接返回,不能继续注册
|
|||
Map<String, Object> existMap = selectPhone(user.getPhone()); |
|||
if (existMap.get("msg").equals("5")) { |
|||
map.put("msg","5"); |
|||
return map; |
|||
} |
|||
role = roleService.selectById(user.getRid()); |
|||
if (role != null) { |
|||
user.setRpId(role.getRpId()); |
|||
} |
|||
user.setContactPhone(user.getPhone()); |
|||
//9.16修改
|
|||
String password = RSAUtil.decrypt(user.getPassword(), privateKey); |
|||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
|||
user.setPassword(passwordEncoder.encode(password)); |
|||
boolean result = userService.insert(user); |
|||
map.put("msg", result ? "1" : "2"); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 判断当前手机号码是否已经注册 |
|||
* |
|||
*/ |
|||
@RequestMapping(value = "selectPhone") |
|||
public Map<String, Object> selectPhone(String phone) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<User> wrapper = new EntityWrapper<User>(); |
|||
wrapper.eq("phone", phone); |
|||
try { |
|||
int count = userService.selectCount(wrapper); |
|||
map.put("msg", count == 0 ? "6" : "5"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 判断当前联系手机号码是否已经注册 |
|||
* |
|||
*/ |
|||
@RequestMapping(value = "selectContactPhone") |
|||
public Map<String, Object> selectContactPhone(String contactPhone) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<User> wrapper = new EntityWrapper<User>(); |
|||
wrapper.eq("contact_phone", contactPhone); |
|||
try { |
|||
int count = userService.selectCount(wrapper); |
|||
map.put("msg", count == 0 ? "6" : "5"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 获得手机号码的角色 |
|||
*/ |
|||
@RequestMapping(value = "selectPhoneRid") |
|||
public Map<String, Object> selectPhoneRid(String phone) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<User> wrapper = new EntityWrapper<User>(); |
|||
wrapper.eq("phone", phone); |
|||
try { |
|||
User user = userService.selectOne(wrapper); |
|||
map.put("msg", user == null ? "1003" :user.getRid()); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 判断医联体负责人手机号码 |
|||
*/ |
|||
@RequestMapping(value = "selectHospitalPhone") |
|||
public Map<String, Object> selectHospitalPhone(String deanPhone) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyInformation> wrapper = new EntityWrapper<ApplyInformation>(); |
|||
wrapper.eq("dean_phone", deanPhone); |
|||
try { |
|||
int count = applyInformationService.selectCount(wrapper); |
|||
map.put("msg", count == 0 ? "6" : "5"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,82 @@ |
|||
/*package com.imurs.controller; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.ResponseBody; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import com.aliyuncs.DefaultAcsClient; |
|||
import com.aliyuncs.IAcsClient; |
|||
import com.aliyuncs.exceptions.ClientException; |
|||
import com.aliyuncs.exceptions.ServerException; |
|||
import com.aliyuncs.profile.DefaultProfile; |
|||
//import com.google.gson.Gson;
|
|||
import com.aliyuncs.live.model.v20161101.RealTimeRecordCommandRequest; |
|||
import com.aliyuncs.live.model.v20161101.RealTimeRecordCommandResponse; |
|||
import com.imurs.parameter.Bcall; |
|||
import com.imurs.parameter.Socket; |
|||
@RestController |
|||
@RequestMapping(value="SaveRecord") |
|||
public class SaveRecord { |
|||
|
|||
@Autowired |
|||
private Socket socket; |
|||
|
|||
@RequestMapping(value="/call") |
|||
@ResponseBody |
|||
public Map<String,Object> userMenu(@RequestBody Bcall user){ |
|||
//录制视频时 我需要前端传我患者信息 方便保存
|
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
// String app = request.getParameter("app");
|
|||
System.out.println("回调成功了吗"+user.getApp()+user.getUri()+"录制事件是否成功"+user.getEvent()+"录制 时长"+user.getDuration()); |
|||
try { |
|||
socket.sendMessage(user.getEvent()+":"+user.getUri()); |
|||
} catch (IOException e) { |
|||
// TODO Auto-generated catch block
|
|||
e.printStackTrace(); |
|||
} |
|||
//System.out.println("保存地址"+dualr.getUri());
|
|||
//System.out.println("保存时间"+dualr.getDuration());
|
|||
return map; |
|||
} |
|||
*//**
|
|||
* 录音 |
|||
* @return |
|||
*//*
|
|||
@RequestMapping(value="/video") |
|||
public Map<String,Object> video(String rpId){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
//String[] str=null;
|
|||
DefaultProfile profile = DefaultProfile.getProfile("cn-shenzhen", "LTAIvXeYf3fuMvDZ", "GGRbUL2hNdZBPWnGh0xkkwtQgqN7Yq"); |
|||
IAcsClient client = new DefaultAcsClient(profile); |
|||
|
|||
RealTimeRecordCommandRequest request = new RealTimeRecordCommandRequest(); |
|||
request.setRegionId("cn-shenzhen"); |
|||
request.setDomainName("yiduliveplay.jysmyy.com"); |
|||
request.setAppName("AppName"); |
|||
request.setStreamName("StreamName"); |
|||
request.setCommand(rpId);//start
|
|||
// System.out.println("自动录制");
|
|||
//调用AddLiveAppRecordConfig接口配置录制规则。设置ondemand=7,表示推流后不自动录制。
|
|||
//推流
|
|||
//调用RealTimeRecordCommand接口启动录制。
|
|||
//(如果需要)调用RealTimeRecordCommand接口停止录制
|
|||
try { |
|||
RealTimeRecordCommandResponse response = client.getAcsResponse(request); |
|||
//System.out.println(new Gson().toJson(response));
|
|||
} catch (ServerException e) { |
|||
e.printStackTrace(); |
|||
} catch (ClientException e) { |
|||
//System.out.println("ErrCode:" + e.getErrCode());
|
|||
//System.out.println("ErrMsg:" + e.getErrMsg());
|
|||
//System.out.println("RequestId:" + e.getRequestId());
|
|||
map.put("ErrMsg:", e.getErrMsg()); |
|||
} |
|||
|
|||
return map; |
|||
} |
|||
} |
|||
*/ |
|||
@ -0,0 +1,160 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.Section; |
|||
import com.imurs.service.SectionService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
|
|||
/** |
|||
* 科室管理 |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value="section") |
|||
public class SectionController { |
|||
|
|||
@Autowired |
|||
SectionService sectionService; |
|||
|
|||
|
|||
/** |
|||
* 新增科室 |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="insertSection") |
|||
public Map<String,Object> insertSection(Section section){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=sectionService.insert(section); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 修改科室 |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="updateSection") |
|||
public Map<String,Object> updateSection(Section section){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=sectionService.updateById(section); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 删除科室 |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="deleteSection") |
|||
public Map<String,Object> updateSection(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=sectionService.deleteById(id); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 判断当前科室是否存在 |
|||
*/ |
|||
@RequestMapping(value="selectSectionByName") |
|||
public Map<String,Object> updateSection(String seName,String hospitalId){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<Section> wrapper=new EntityWrapper<Section>(); |
|||
wrapper.eq("se_name", seName).eq("hospital_id", hospitalId); |
|||
try { |
|||
int count=sectionService.selectCount(wrapper); |
|||
map.put("msg",count); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查询当前医院下面的所有科室名称 |
|||
*/ |
|||
@RequestMapping(value="selectSectionById") |
|||
public Map<String,Object> selectSectionById(String hospitalId){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<Section> wrapper=new EntityWrapper<Section>(); |
|||
wrapper.setSqlSelect("se_name as seName").eq("hospital_id", hospitalId); |
|||
wrapper.orderBy("if(se_name='超声科',0,1),if(se_name='信息科',0,1)," |
|||
+ "if(se_name='外科',0,1),if(se_name='内科',0,1)"); |
|||
try { |
|||
List<Section> stList=sectionService.selectList(wrapper); |
|||
map.put("stList",stList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally{ |
|||
map.remove("hospital_id"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 科室列表分页 |
|||
*/ |
|||
@RequestMapping(value="selectSectionPage") |
|||
public Map<String,Object> selectSectionPage(String hospitalId,Integer pageNo,Integer pageSize,String seName){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<Section> wrapper=new EntityWrapper<Section>(); |
|||
wrapper.eq("hospital_id", hospitalId); |
|||
if(StringUtils.isNotEmpty(seName)){ |
|||
wrapper.like("se_name", seName); |
|||
} |
|||
wrapper.orderBy("create_time,id",false); |
|||
FrontPage<Section> page=new FrontPage<Section>(); |
|||
page.setPage(pageNo==null?1:pageNo); |
|||
page.setRows(pageSize==null?6:pageSize); |
|||
try { |
|||
Page<Section> pageList=sectionService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if(pageList!=null){ |
|||
CustomPage<Section> customPage=new CustomPage<Section>(pageList); |
|||
map.put("customPage", customPage); |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,113 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
import java.util.Random; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpSession; |
|||
|
|||
import com.imurs.util.IpCacheManager; |
|||
import com.imurs.util.rateLimiter.RateLimiterAspect; |
|||
import com.imurs.util.weblog.HttpContextUtil; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.alibaba.druid.support.json.JSONUtils; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.MsgCode; |
|||
import com.imurs.util.note.ChuangLanSmsUtil; |
|||
import net.sf.json.JSONObject; |
|||
|
|||
/** |
|||
* 短信发送 |
|||
* |
|||
* @author dgg |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value = "send") |
|||
public class SendMsgController { |
|||
|
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
|
|||
@Autowired |
|||
UserService userService; |
|||
|
|||
/** |
|||
* 忘记密码、修改密码 |
|||
*/ |
|||
@RateLimiterAspect |
|||
@RequestMapping("/forgetPwd") |
|||
public Map<String, String> forgetPwd(String phone, HttpServletRequest request) throws Exception { |
|||
HttpSession session = request.getSession(); |
|||
Map<String, String> resultMap = new HashMap<String, String>(); |
|||
Map<String, String> map = new HashMap<String, String>(); |
|||
map.put("account", MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
int flag = new Random().nextInt(999999); |
|||
while (flag < 100000) { |
|||
flag = new Random().nextInt(999999); |
|||
} |
|||
// 根据ip来限制访问次数,防止恶意攻击
|
|||
String ipAddress = "forgetPwd" + HttpContextUtil.getIpAddress(); |
|||
if (IpCacheManager.countIp(ipAddress,10)) { |
|||
map.put("msg", "您好,您正在修改密码,本次验证码为:"+flag+",验证码1分钟内有效,过时需要重新获取。如非本人操作,请勿理会。"); |
|||
map.put("phone", phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url, JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "2"); |
|||
return resultMap; |
|||
} |
|||
session.setAttribute("xllmsg", flag); |
|||
session.setMaxInactiveInterval(60); |
|||
resultMap.put("msg", "1"); |
|||
} else { |
|||
resultMap.put("msg","13"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 登录验证码 |
|||
*/ |
|||
@RequestMapping("/loginCode") |
|||
public Map<String, String> loginCode(String phone, HttpServletRequest request) throws Exception { |
|||
HttpSession session = request.getSession(); |
|||
Map<String, String> resultMap = new HashMap<String, String>(); |
|||
Map<String, String> map = new HashMap<String, String>(); |
|||
map.put("account", MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
int flag = new Random().nextInt(999999); |
|||
while (flag < 100000) { |
|||
flag = new Random().nextInt(999999); |
|||
} |
|||
map.put("msg", "您的短信验证码为"+flag+",请本人及时输入,切勿向他人泄漏。"); |
|||
map.put("phone", phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url, JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "2"); |
|||
return resultMap; |
|||
} |
|||
session.setAttribute("xllmsg", flag); |
|||
session.setMaxInactiveInterval(1 * 60); |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
|
|||
@RequestMapping("/checkmsg") |
|||
public Boolean checksms(String code, HttpServletRequest request) throws Exception { |
|||
HttpSession session = request.getSession(); |
|||
Boolean flag = code.equals(session.getAttribute("xllmsg").toString()); |
|||
return flag; |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,139 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
import java.util.Random; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpSession; |
|||
|
|||
import com.imurs.util.IpCacheManager; |
|||
import com.imurs.util.rateLimiter.RateLimiterAspect; |
|||
import com.imurs.util.weblog.HttpContextUtil; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.alibaba.druid.support.json.JSONUtils; |
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.ApplyInformation; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.MsgCode; |
|||
import com.imurs.util.note.ChuangLanSmsUtil; |
|||
|
|||
import net.sf.json.JSONObject; |
|||
|
|||
/** |
|||
* 短信验证码控制器 |
|||
* |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value = "note") |
|||
public class SendNoteController { |
|||
|
|||
@Autowired |
|||
UserService userService; |
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
|
|||
/** |
|||
* 获取短信验证码 |
|||
* @param phone |
|||
* @param request |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
@RateLimiterAspect |
|||
@RequestMapping("/sendmsg") |
|||
public Map<String, Object> sendsms(HttpServletRequest request, String phone) throws Exception { |
|||
HttpSession session = request.getSession(); |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account", MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
int flag = 0; |
|||
flag = new Random().nextInt(999999); |
|||
while (flag < 100000) { |
|||
flag = new Random().nextInt(999999); |
|||
} |
|||
String ipAddress = "sendmsg" + HttpContextUtil.getIpAddress(); |
|||
if (IpCacheManager.countIp(ipAddress,10)) { |
|||
map.put("msg", "欢迎注册"+MsgCode.hospitalName+"分级诊疗平台,验证码是:"+ flag +", 1分钟内有效,过时需要重新获取。无需回复"); |
|||
map.put("phone", phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url, JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
session.setAttribute("xllmsg", flag); |
|||
session.setMaxInactiveInterval(1*60);//设置过期时间为1分钟
|
|||
resultMap.put("msg", "1"); |
|||
} else { |
|||
resultMap.put("msg","13"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 判断当前医生是否已经注册 |
|||
*/ |
|||
@RequestMapping("selectUserPhone") |
|||
public Map<String, Object> selectUserPhone(String phone) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<User> wrapper = new EntityWrapper<User>(); |
|||
wrapper.eq("phone", phone); |
|||
try { |
|||
User user = userService.selectOne(wrapper); |
|||
map.put("msg", user == null ? "6" : "5"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 判断当前医院是否已经注册 |
|||
*/ |
|||
@RequestMapping("selectHospitalName") |
|||
public Map<String, Object> selectHospitalName(String hospitalName) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<ApplyInformation> wrapper = new EntityWrapper<ApplyInformation>(); |
|||
wrapper.eq("hospital_name", hospitalName); |
|||
try { |
|||
ApplyInformation infor = applyInformationService.selectOne(wrapper); |
|||
map.put("msg", infor == null ? "6" : "5"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 判断验证码是否正确 |
|||
* |
|||
* @param code |
|||
* @param request |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
@RequestMapping("/checkmsg") |
|||
public Map<String, String> checksms(String code, HttpServletRequest request) throws Exception { |
|||
Map<String,String> map=new HashMap<String,String>(); |
|||
HttpSession session = request.getSession(); |
|||
Boolean flag = code.equals(session.getAttribute("xllmsg").toString()); |
|||
if(flag){ |
|||
map.put("msg", "1"); |
|||
}else{ |
|||
map.put("msg", "2"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,300 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.alibaba.druid.support.json.JSONUtils; |
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.ApplyInformation; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.service.impl.UserServiceImpl; |
|||
import com.imurs.util.MsgCode; |
|||
import com.imurs.util.note.ChuangLanSmsUtil; |
|||
|
|||
import net.sf.json.JSONObject; |
|||
|
|||
/** |
|||
* 远程会诊 |
|||
* @author D140 |
|||
* |
|||
*/ |
|||
@RestController |
|||
//@RequestMapping("jyNote")
|
|||
public class SendNoteJyController { |
|||
|
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
@Autowired |
|||
UserService userService; |
|||
|
|||
|
|||
/** |
|||
*远程病理通知/铱度 |
|||
*/ |
|||
@RequestMapping("/sendPathologyYd") |
|||
public Map<String, Object> sendPathologyYd(String patientName,String docName, String chamber,String userName, |
|||
String phone, String hotName) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
|
|||
map.put("msg",userName+"老师,您好!"+hotName+"的"+chamber+"科室"+docName+"专家为"+patientName+"患者发起远程病理的申请,请及时完成病理切割工作,谢谢。"); |
|||
map.put("phone", phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
|
|||
/** |
|||
* 远程会诊分配成功/分配专家 |
|||
* 由基层上转给管理医院/分配专家/远程B超/远程心电/远程影像 |
|||
*/ |
|||
@RequestMapping("/jyNote/sendSpeGenre") |
|||
public Map<String, Object> sendSpeGenre(String patientName,String docName,String phone, String hotName, |
|||
String genre) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
|
|||
map.put("msg",docName+"老师您好!"+hotName+"为"+patientName+"患者发起一例"+genre+"会诊申请,医务科分配贵科负责首诊,请您尽快登录远程会诊平台进行会诊,谢谢!"); |
|||
map.put("phone", phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* |
|||
* @param docName 要发送的专家名字 |
|||
* @param seName 申请科室 |
|||
* @param applyDoc 申请医生 |
|||
* @param phone 要发送的手机号 |
|||
* @param applyDocPhone 申请医生电话 |
|||
* @return |
|||
*/ |
|||
@RequestMapping("/jyNote/sendConsultationUrgent") |
|||
public Map<String,Object> sendConsultationUrgent(String docName,String seName,String applyDoc,String phone, |
|||
String applyDocPhone) { |
|||
Map<String, Object> resultMap = new HashMap<>(); |
|||
Map<String, Object> map = new HashMap<>(); |
|||
|
|||
map.put("account",MsgCode.ydAccount); |
|||
map.put("password", MsgCode.ydPassword); |
|||
map.put("phone", phone); |
|||
map.put("msg",docName + "医生,您好!" + seName + "的" + applyDoc + |
|||
"医生向您发起了紧急会诊视频申请,请尽快登录系统参与,谢谢!" + applyDoc + "医生联系电话:" + applyDocPhone); |
|||
|
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.ydUrl,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 远程会诊分配成功/基层医生 |
|||
* 由基层上转给管理医院/基层医生/远程B超/远程心电/远程影像 |
|||
*/ |
|||
@RequestMapping("/sendDocGenre") |
|||
public Map<String, Object> sendDocGenre(String patientName,String docName,String phone,String time, |
|||
String genre) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
|
|||
map.put("msg",docName+"医生您好!您为"+patientName+"患者发起的"+genre+"会诊申请已经得到上级医院专家会诊同意,请在"+time+"时间准时登录远程会诊平台参加会诊。"); |
|||
map.put("phone", phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
|
|||
/** |
|||
* 远程会诊分配成功/患者 |
|||
* 由基层上转给管理医院/患者/远程B超/远程心电/远程影像 |
|||
*/ |
|||
@RequestMapping("/sendPtGenre") |
|||
public Map<String, Object> sendPtGenre(String patientName,String docName,String phone,String time, |
|||
String genre,String hotName,String applyDoc,String hname,String chamber,String appHotName, |
|||
String appDocName) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
|
|||
map.put("msg",patientName+",您好!"+hotName+"的"+applyDoc+"医生为您发起的"+genre+"会诊申请已经通过审核," |
|||
+ "接诊医生是"+hname+""+chamber+"的"+docName+"医生,请在"+time+"时间准时到"+appHotName+"的"+appDocName+"医生办公室参加会诊。"); |
|||
map.put("phone", phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
|
|||
/** |
|||
* 会诊完成/基层医生 |
|||
* 由基层上转给管理医院/基层医生/远程B超/远程心电/远程影像 |
|||
*/ |
|||
@RequestMapping("/sendDocGenreDone") |
|||
public Map<String, Object> sendDocGenreDone(String patientName,String docName,String phone, |
|||
String genre) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
|
|||
map.put("msg",docName+"医生您好!您为"+patientName+"患者发起的"+genre+"会诊申请已经得到上级医院专家的回复,请您登录平台查看参考意见!"); |
|||
map.put("phone", phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 基层兵团医院申请远程超声时发送的短信 |
|||
* @param patientName 患者姓名 |
|||
* @param hotName 兵团医院名称 |
|||
* @param genre 会诊的名称 |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
@RequestMapping("/jyNote/sendAdminGenre") |
|||
public Map<String, Object> sendAdminGenre(String patientName,String hotName,String genre, |
|||
String doctorName,String docPhone) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<>(); |
|||
|
|||
Map<String, Object> noteMap = new HashMap<>(); |
|||
noteMap.put("account",MsgCode.account); |
|||
noteMap.put("password", MsgCode.password); |
|||
|
|||
noteMap.put("msg",doctorName+"医生您好!"+hotName+"为患者"+patientName+"发起一例"+genre+"会诊申请,请协助安排专家上线会诊,谢谢!"); |
|||
noteMap.put("phone", docPhone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(noteMap)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!"0".equals(jsStr.getString("code"))) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
/** |
|||
* 远程会诊申请/管理医院(管理员) |
|||
* 由基层上转给管理医院/管理医院(管理员)/远程B超/远程心电/远程影像 |
|||
*/ |
|||
@RequestMapping("/jyNote/sendConsultation") |
|||
public Map<String, Object> sendConsultation(String fid,String hotName,String patientName,String genre,String groupChamber){ |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
if (fid != null) { |
|||
EntityWrapper<ApplyInformation> wrapper=new EntityWrapper<ApplyInformation>(); |
|||
wrapper.eq("id", fid); |
|||
ApplyInformation applyInformation=applyInformationService.selectOne(wrapper); |
|||
EntityWrapper<User> wrapper1=new EntityWrapper<User>(); |
|||
wrapper1.eq("hospital_id", fid).eq("se_name", groupChamber).eq("rid", 2); |
|||
User user = userService.selectOne(wrapper1); |
|||
if (user != null) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
String contactPhone = user.getContactPhone(); |
|||
String userName = user.getUserName(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
map.put("msg", userName+"老师您好!"+hotName+"为"+patientName+"患者发起一例"+genre+"会诊申请,请尽快安排专家进行会诊,谢谢!"); |
|||
map.put("phone",user.getContactPhone()); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url, JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
}else { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
map.put("msg", applyInformation.getChamberName()+"老师您好!"+hotName+"为"+patientName+"患者发起一例"+genre+"会诊申请,请尽快安排专家进行会诊,谢谢!"); |
|||
map.put("phone",applyInformation.getChamberPhone()); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url, JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
} |
|||
}else{ |
|||
resultMap.put("msg", "9"); |
|||
} |
|||
|
|||
return resultMap; |
|||
} |
|||
|
|||
/** |
|||
* 基层医院撤销远程会诊超声时发送的短信 |
|||
* @param patientName 患者姓名 |
|||
* @param hotName 医院名称 |
|||
* @param genre 会诊的名称 |
|||
* @param doctorName 医生姓名 |
|||
* @param docPhone 发送短信者号码 |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
@RequestMapping("/GsNote/sendUndoGenre") |
|||
public Map<String, Object> sendUndoGenre(String patientName,String hotName,String genre, |
|||
String doctorName,String docPhone) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<>(); |
|||
|
|||
Map<String, Object> noteMap = new HashMap<>(); |
|||
noteMap.put("account",MsgCode.account); |
|||
noteMap.put("password", MsgCode.password); |
|||
|
|||
noteMap.put("msg",doctorName+"老师您好!"+hotName+"为"+patientName+"患者发起一例"+genre+"会诊申请,已撤销,谢谢! "); |
|||
noteMap.put("phone", docPhone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(noteMap)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!"0".equals(jsStr.getString("code"))) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
} |
|||
@ -0,0 +1,265 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.alibaba.druid.support.json.JSONUtils; |
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.ApplyInformation; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.ApplyInformationService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.MsgCode; |
|||
import com.imurs.util.note.ChuangLanSmsUtil; |
|||
|
|||
import net.sf.json.JSONObject; |
|||
|
|||
/** |
|||
* 双向转诊 |
|||
* @author D140 |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("jyNoteTest") |
|||
public class SendNoteMsgController { |
|||
|
|||
@Autowired |
|||
ApplyInformationService applyInformationService; |
|||
@Autowired |
|||
UserService userService; |
|||
|
|||
|
|||
/** |
|||
* 由下转上/提交转诊/管理员 |
|||
*/ |
|||
@RequestMapping("/sendAdminCase") |
|||
public Map<String, Object> sendAdminCase(String patientName, String hotName,String applyDoc, |
|||
String ptPhone,Long fid) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
if(fid!=null){ |
|||
EntityWrapper<ApplyInformation> wrapper=new EntityWrapper<ApplyInformation>(); |
|||
wrapper.eq("id", fid); |
|||
ApplyInformation infor=applyInformationService.selectOne(wrapper); |
|||
if(infor!=null){ |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
|
|||
map.put("msg",infor.getChamberName()+"老师,您好!"+hotName+"的"+applyDoc+"医生,向您发起了一例转诊申请,患者姓名:"+patientName+";患者联系电话:"+ptPhone+",请及时处理。"); |
|||
map.put("phone", infor.getChamberPhone()); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
}else{ |
|||
resultMap.put("msg", "3"); |
|||
} |
|||
}else{ |
|||
resultMap.put("msg", "9"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 由下转上/转诊成功/基层医生 |
|||
*/ |
|||
@RequestMapping("/sendDocCase") |
|||
public Map<String, Object> sendDocCase(String patientName,String docName,String hotName,String applyDoc, |
|||
String chamber,String time,Long applyUserId) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
if(applyUserId!=null){ |
|||
User user=userService.selectById(applyUserId); |
|||
if(user!=null){ |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
|
|||
map.put("msg",applyDoc+"医生,您好!您为"+patientName+"患者发起的转诊申请已经接收。接诊科室:"+chamber+";接诊医师:"+docName+",接诊时间:" |
|||
+time+",请通知患者携带检查结果复印件、社保卡、本人身份证到"+hotName+"就诊。"); |
|||
map.put("phone", user.getContactPhone()); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
}else{ |
|||
resultMap.put("msg", "3"); |
|||
} |
|||
}else{ |
|||
resultMap.put("msg", "9"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
/** |
|||
* 由下转上/转诊成功/患者 |
|||
* docName:患者 |
|||
*/ |
|||
@RequestMapping("/sendPtCase") |
|||
public Map<String, Object> sendPtCase(String ptName,String phone, String hotName,String applyDoc, |
|||
String chamber,String time,String hospitalName) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
|
|||
map.put("msg",ptName+",您好!"+hospitalName+"的"+applyDoc+"医生为您发起的转诊申请已经通过审核,接诊科室:"+chamber+";接诊时间:" |
|||
+time+",请携带检查结果复印件、社保卡、本人身份证到"+hotName+"就诊。"); |
|||
map.put("phone", phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 由下转上/转诊成功/专家 |
|||
*/ |
|||
@RequestMapping("/sendSpeCase") |
|||
public Map<String, Object> sendSpeCase(String docName,String phone, String hotName, |
|||
String patientName,Long fid) throws Exception { |
|||
String applyDoc=""; |
|||
String applyDocPhone=""; |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
if(fid!=null){ |
|||
EntityWrapper<ApplyInformation> wrapper=new EntityWrapper<ApplyInformation>(); |
|||
wrapper.eq("id", fid); |
|||
ApplyInformation infro=applyInformationService.selectOne(wrapper); |
|||
if(infro!=null){ |
|||
applyDoc=infro.getChamberName(); |
|||
applyDocPhone=infro.getChamberPhone(); |
|||
} |
|||
} |
|||
map.put("msg",docName+"医生,您好!"+hotName+"通过医务科转诊"+patientName+"患者,请贵科室接待首诊,谢谢!医务科"+applyDoc+",联系电话:"+applyDocPhone); |
|||
map.put("phone", phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 由上到下/转诊申请/基层医院 |
|||
* fid:管理医院id |
|||
* jid:基层医院id |
|||
*/ |
|||
@RequestMapping("/sendHotNameCaseBelow") |
|||
public Map<String, Object> sendHotNameCaseBelow(String applyDoc,String hotName, |
|||
String chamber,String patientName,Long fid,Long jid) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
String adminDoc=""; |
|||
String adminDocPhone=""; |
|||
if(fid!=null && jid!=null){ |
|||
EntityWrapper<ApplyInformation> wrapper=new EntityWrapper<ApplyInformation>(); |
|||
wrapper.eq("id", jid); |
|||
ApplyInformation infor=applyInformationService.selectOne(wrapper); |
|||
if(infor!=null){ |
|||
|
|||
EntityWrapper<ApplyInformation> wrapper2=new EntityWrapper<ApplyInformation>(); |
|||
wrapper2.eq("id", fid); |
|||
ApplyInformation infor2=applyInformationService.selectOne(wrapper2); |
|||
if(infor2!=null){ |
|||
adminDoc=infor2.getChamberName(); |
|||
adminDocPhone=infor2.getChamberPhone(); |
|||
} |
|||
|
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
|
|||
map.put("msg",infor.getChamberName()+"医生,您好!"+hotName+""+chamber+"的"+applyDoc+"医生为"+patientName+"患者发起转诊,请您登录远程会诊平台接收!医务科"+adminDoc+",联系电话:"+adminDocPhone); |
|||
map.put("phone", infor.getChamberPhone()); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
} |
|||
|
|||
}else{ |
|||
resultMap.put("msg", "9"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
/** |
|||
* 由上到下/转诊成功/临床医生 |
|||
*/ |
|||
@RequestMapping("/sendDocCaseBelow") |
|||
public Map<String, Object> sendDocCaseBelow(String hotName,String patientName,Long applyUserId) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
if(applyUserId!=null){ |
|||
User user=userService.selectById(applyUserId); |
|||
if(user!=null){ |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
|
|||
map.put("msg",user.getUserName()+"医生,您好!您为"+patientName+"患者发起的转诊,"+hotName+"已经接收,请提醒病人尽快去基层医院就诊,同时为病人开出院医嘱。谢谢!"); |
|||
map.put("phone", user.getContactPhone()); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
}else{ |
|||
resultMap.put("msg", "3"); |
|||
} |
|||
}else{ |
|||
resultMap.put("msg", "9"); |
|||
} |
|||
return resultMap; |
|||
} |
|||
|
|||
/** |
|||
* 由上到下/转诊成功/患者 |
|||
*/ |
|||
@RequestMapping("/sendPtCaseBelow") |
|||
public Map<String, Object> sendPtCaseBelow(String docName,String phone,String hotName,String applyDoc, |
|||
String chamber,String patientName,String appHotName,String time) throws Exception { |
|||
Map<String, Object> resultMap = new HashMap<String, Object>(); |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("account",MsgCode.account); |
|||
map.put("password", MsgCode.password); |
|||
|
|||
map.put("msg",patientName+",您好!"+appHotName+""+chamber+"的"+applyDoc+"医生为您发起的转诊申请已经通过审核," |
|||
+ "接收医院:"+hotName+";接诊医师:"+docName+",接诊时间:"+time+",请携带检查结果复印件、社保卡、本人身份证到"+hotName+"就诊。"); |
|||
map.put("phone", phone); |
|||
String res = ChuangLanSmsUtil.sendSmsByPost(MsgCode.url,JSONUtils.toJSONString(map)); |
|||
JSONObject jsStr = JSONObject.fromObject(res); |
|||
if (!jsStr.getString("code").equals("0")) { |
|||
resultMap.put("msg", "4"); |
|||
return resultMap; |
|||
} |
|||
resultMap.put("msg", "1"); |
|||
return resultMap; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,79 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.io.BufferedReader; |
|||
import java.io.IOException; |
|||
import java.io.InputStreamReader; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
import java.util.Timer; |
|||
import java.util.TimerTask; |
|||
|
|||
import org.springframework.scheduling.annotation.Async; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
|
|||
@RestController |
|||
@RequestMapping(value="SVS") |
|||
public class SvsController { |
|||
private static String isSucess = null; |
|||
@RequestMapping(value ="splitsvs") |
|||
public String splitsvs(String imgurl) throws InterruptedException { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
|
|||
|
|||
//Get the result produced by executing the above commands
|
|||
excuteAsync(imgurl); |
|||
return "ok"; |
|||
} |
|||
@Async |
|||
public String excuteAsync(String imgurl){ |
|||
// do something;
|
|||
// final String isSucess="";
|
|||
Timer timer = new Timer();// 实例化Timer类
|
|||
timer.schedule(new TimerTask() { |
|||
public void run() { |
|||
//System.out.println("退出");
|
|||
try { |
|||
isSucess=parseSvs(imgurl); |
|||
} catch (InterruptedException e) { |
|||
// TODO Auto-generated catch block
|
|||
e.printStackTrace(); |
|||
} |
|||
this.cancel(); |
|||
} |
|||
}, 1000);// 这里百毫秒
|
|||
return isSucess; |
|||
|
|||
} |
|||
public String parseSvs(String imgurl) throws InterruptedException{ |
|||
//String t = imgurl;
|
|||
//System.out.println("dizi..."+imgurl);
|
|||
String[] args1=new String[]{"python","/usr/svs/3.py",imgurl}; |
|||
//Create a Process instance and execute commands
|
|||
Process pr; |
|||
try { |
|||
pr = Runtime.getRuntime().exec(args1); |
|||
BufferedReader in = new BufferedReader(new InputStreamReader(pr.getInputStream())); |
|||
String line = null; |
|||
String result = ""; |
|||
while ((line = in.readLine()) != null) |
|||
{ |
|||
result += line + "\r\n"; |
|||
} |
|||
// System.out.println("什么结果"+result);
|
|||
|
|||
in.close(); |
|||
int endFlag = pr.waitFor(); |
|||
if (endFlag == 0) |
|||
{ |
|||
//System.out.println("The process is ended normally.");
|
|||
} |
|||
} catch (IOException e) { |
|||
// TODO Auto-generated catch block
|
|||
e.printStackTrace(); |
|||
} |
|||
return ""; |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,149 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.HashSet; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.SysMenu; |
|||
import com.imurs.parameter.Children; |
|||
import com.imurs.parameter.Items; |
|||
import com.imurs.service.SysMenuService; |
|||
|
|||
@RestController |
|||
@RequestMapping(value="menu") |
|||
public class SysMenuController { |
|||
|
|||
@Autowired |
|||
SysMenuService sysMenuService; |
|||
|
|||
|
|||
/** |
|||
* 查询当前登录的用户所拥有的菜单权限 |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="/userMenu") |
|||
public Map<String,Object> userMenu(String rpId,Long rid){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
String[] str=null; |
|||
EntityWrapper<SysMenu> wrapper=new EntityWrapper<SysMenu>(); |
|||
List<SysMenu> smList=new ArrayList<SysMenu>(); |
|||
List<Items> items=new ArrayList<Items>(); |
|||
try { |
|||
if(StringUtils.isNotEmpty(rpId)){ |
|||
str=rpId.split(","); |
|||
for (int i = 0; i < str.length; i++) { |
|||
if(str.length-i==1){ |
|||
wrapper.eq("id", str[i]).eq("rid", rid); |
|||
}else{ |
|||
wrapper.eq("id", str[i]).eq("rid", rid).or(); |
|||
} |
|||
} |
|||
smList=sysMenuService.selectList(wrapper); |
|||
if(!smList.isEmpty()){ |
|||
List<String> tableNames=smList.stream().map(SysMenu::getMenuStair).collect(Collectors.toList()); |
|||
Set<String> set=new HashSet<String>(tableNames); |
|||
//将数据按照指定格式封装
|
|||
//分组查询
|
|||
Map<String, List<SysMenu>> groupBy = smList.stream().collect(Collectors.groupingBy(SysMenu::getMenuStair)); |
|||
for (String str2 : set) { |
|||
List<Children> childrens=new ArrayList<Children>(); |
|||
smList=groupBy.get(str2); |
|||
Items items2=new Items(); |
|||
for (SysMenu s:smList) { |
|||
Children c=new Children(); |
|||
c.setName(s.getMenuVfp()); |
|||
c.setPath(s.getMenuUrl()); |
|||
childrens.add(c); |
|||
items2.setIcon(s.getMenuImage()); |
|||
items2.setChildren(childrens); |
|||
c=null; |
|||
} |
|||
items2.setName(str2); |
|||
items.add(items2); |
|||
items2=null; |
|||
} |
|||
map.put("items", items); |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "2"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 查询rid用户所拥有的菜单权限 |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="/ridMenu") |
|||
public Map<String,Object> ridMenu(Long rid){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
|
|||
EntityWrapper<SysMenu> wrapper=new EntityWrapper<SysMenu>(); |
|||
List<SysMenu> smList=new ArrayList<SysMenu>(); |
|||
List<Items> items=new ArrayList<Items>(); |
|||
wrapper.eq("rid", rid).eq("menu_state",1); |
|||
|
|||
|
|||
|
|||
smList=sysMenuService.selectList(wrapper); |
|||
if(!smList.isEmpty()){ |
|||
List<String> tableNames=smList.stream().map(SysMenu::getMenuStair).collect(Collectors.toList()); |
|||
Set<String> set=new HashSet<String>(tableNames); |
|||
//将数据按照指定格式封装
|
|||
//分组查询
|
|||
Map<String, List<SysMenu>> groupBy = smList.stream().collect(Collectors.groupingBy(SysMenu::getMenuStair)); |
|||
for (String str2 : set) { |
|||
List<Children> childrens=new ArrayList<Children>(); |
|||
smList=groupBy.get(str2); |
|||
Items items2=new Items(); |
|||
for (SysMenu s:smList) { |
|||
Children c=new Children(); |
|||
c.setName(s.getMenuVfp()); |
|||
c.setId(s.getId()); |
|||
c.setPath(s.getMenuUrl()); |
|||
childrens.add(c); |
|||
items2.setIcon(s.getMenuImage()); |
|||
items2.setChildren(childrens); |
|||
c=null; |
|||
} |
|||
items2.setName(str2); |
|||
items.add(items2); |
|||
items2=null; |
|||
} |
|||
map.put("items", items); |
|||
} |
|||
|
|||
|
|||
return map; |
|||
} |
|||
/** |
|||
* 修改用户所拥有的菜单权限 |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="/updateMenu") |
|||
public Map<String,Object> updateMenu(Long rid,Integer menuState){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<SysMenu> wrapper=new EntityWrapper<SysMenu>(); |
|||
wrapper.eq("id", rid); |
|||
SysMenu s= new SysMenu(); |
|||
s.setMenuState(menuState); |
|||
Boolean result=sysMenuService.update(s, wrapper); |
|||
map.put("msg", result ? "1" : "2"); |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,120 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.awt.image.BufferedImage; |
|||
|
|||
import java.io.ByteArrayOutputStream; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
|
|||
import java.net.URLEncoder; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import javax.imageio.ImageIO; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.imurs.ocr.AuthService; |
|||
import com.imurs.ocr.Base64Util; |
|||
import com.imurs.ocr.HttpUtil; |
|||
|
|||
|
|||
@RestController |
|||
@RequestMapping(value="tess") |
|||
public class Tessocr { |
|||
@RequestMapping(value ="splitocr") |
|||
public Map<String, Object> splitsvs(MultipartFile filelSavePath) throws InterruptedException, IOException { |
|||
InputStream is =filelSavePath.getInputStream(); |
|||
BufferedImage image=(BufferedImage)ImageIO.read(is); |
|||
BufferedImage newImg= image.getSubimage(0, 300, 97, 28);//大图坐标15, 600, 222, 50//小图坐标3, 279, 97, 47
|
|||
//转成字节流
|
|||
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|||
|
|||
try { |
|||
ImageIO.write(newImg, "jpg", out); |
|||
} catch (IOException e) { |
|||
//log.error(e.getMessage());
|
|||
} |
|||
byte[] simgdata= out.toByteArray(); |
|||
Map<String, Object> map= generalBasic(simgdata); |
|||
return map; |
|||
//Map<String, Object> map = new HashMap<String, Object>();
|
|||
//图片放大2倍后处理
|
|||
|
|||
|
|||
} |
|||
public static Map<String, Object> generalBasic(byte[] simgdata) { |
|||
// 请求url
|
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
// String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic";
|
|||
String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/handwriting"; |
|||
try { |
|||
byte[] imgData = simgdata;//FileUtil.readFileByBytes(filePath);
|
|||
String imgStr = Base64Util.encode(imgData); |
|||
String imgParam = URLEncoder.encode(imgStr, "UTF-8"); |
|||
//
|
|||
String param = "image=" + imgParam+"&language_type=ENG"; |
|||
AuthService as = new AuthService();//V93fFRRnuNU1Ymr8Q0Fg3g8G Dvx22p8j3xAL95waXKfWOseLtpIu1EvZ
|
|||
String accessToken = as.getAuth("SGzN5e2ZbGRMEaIhNe40sVxU","h4DsOUieXpKfvyXf6vWvRNx4qqWSX1Pl"); |
|||
String result = HttpUtil.post(url, accessToken, param); |
|||
//System.out.println(result);
|
|||
//result json数组取出c/a
|
|||
JSONObject jsonObject = JSON.parseObject(result); |
|||
//System.out.println("2"+jsonObject.toString());
|
|||
if(jsonObject.get("error_code") != null){ |
|||
return (Map<String, Object>) map.put("errorCode", "0"); |
|||
} |
|||
JSONArray jsonArray = jsonObject.getJSONArray("words_result"); |
|||
//System.out.println("识别结果"+jsonArray);//错误识别
|
|||
int size = jsonArray.size(); |
|||
String jsonObject3 = null; |
|||
/* for(int i=0;i<size;i++){ |
|||
String ss = jsonArray.getJSONObject(i).get("words").toString(); |
|||
jsonObject3=StringUtils.deleteWhitespace(ss); |
|||
//System.out.println("di"+i+"ge"+jsonObject3);
|
|||
//正则有:C: A:
|
|||
if(!jsonObject3.contains(":")){ |
|||
continue; |
|||
} |
|||
if(jsonObject3.toLowerCase().contains("c:")){ |
|||
String[] c=jsonObject3.split(":"); |
|||
System.out.println("crle"+c[c.length-1]); |
|||
map.put("c",c[c.length-1]); |
|||
} |
|||
if(jsonObject3.toLowerCase().contains("a:")){ |
|||
String[] c=jsonObject3.split(":"); |
|||
System.out.println("area "+c[c.length-1]); |
|||
map.put("a",c[c.length-1]); |
|||
} |
|||
}*/ |
|||
//识别每次都是2个
|
|||
String sf = jsonArray.getJSONObject(0).get("words").toString(); |
|||
jsonObject3=StringUtils.deleteWhitespace(sf); |
|||
if(jsonObject3.contains(":")){ |
|||
String[] c=jsonObject3.split(":"); |
|||
//System.out.println("crle"+c[c.length-1].toLowerCase());
|
|||
map.put("c",c[c.length-1].toLowerCase()); |
|||
} |
|||
|
|||
String sc = jsonArray.getJSONObject(1).get("words").toString(); |
|||
if(jsonObject3.contains(":")){ |
|||
jsonObject3=StringUtils.deleteWhitespace(sc); |
|||
String[] c2=jsonObject3.split(":"); |
|||
//System.out.println("area"+c2[c2.length-1]);
|
|||
map.put("a",c2[c2.length-1].toLowerCase()); |
|||
} |
|||
|
|||
// return map;
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
|
|||
return map; |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,197 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.TotalTraining; |
|||
import com.imurs.entity.Training; |
|||
import com.imurs.entity.TrainingFlower; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.TotalTrainingService; |
|||
import com.imurs.service.TrainingFlowerService; |
|||
import com.imurs.service.TrainingService; |
|||
import com.imurs.service.UserService; |
|||
|
|||
|
|||
/** |
|||
* 远程培训视频(列表统计) |
|||
* @author Server |
|||
* totaltraining 统计 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value="totalTraining") |
|||
public class TotalTrainingController { |
|||
|
|||
@Autowired |
|||
TotalTrainingService totalTrainingService; |
|||
|
|||
@Autowired |
|||
TrainingService trainingService; |
|||
@Autowired |
|||
UserService userService; |
|||
|
|||
@Autowired |
|||
TrainingFlowerService trainingFlowerService; |
|||
|
|||
/** |
|||
* 视频课件播放次数增加 |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="insertTotalTraining") |
|||
public Map<String,Object> insertSection(TotalTraining totalTraining){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<TotalTraining> wrapper=new EntityWrapper<TotalTraining>(); |
|||
try { |
|||
wrapper.eq("doc_id", totalTraining.getDocId()); |
|||
wrapper.eq("training_id", totalTraining.getTrainingId()); |
|||
TotalTraining totalTrainingOne = totalTrainingService.selectOne(wrapper); |
|||
if(totalTrainingOne==null){ |
|||
boolean result=totalTrainingService.insert(totalTraining); |
|||
if(result==true){ |
|||
map.put("msg","1"); |
|||
Training training = trainingService.selectById(totalTraining.getTrainingId()); |
|||
training.setNumber(training.getNumber()+totalTraining.getNumber()); |
|||
trainingService.updateById(training); |
|||
}else{ |
|||
map.put("msg","2"); |
|||
} |
|||
}else{ |
|||
map.put("msg", "5"); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 视频课件点赞与取消点赞 |
|||
* @param section |
|||
* @return |
|||
*//*
|
|||
@RequestMapping(value="updateTotisPraise") |
|||
public Map<String,Object> updateTotIsPraise(TotalTraining totalTraining,Integer isPraise){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<TotalTraining> wrapper=new EntityWrapper<TotalTraining>(); |
|||
try { |
|||
wrapper.eq("doc_id", totalTraining.getDocId()); |
|||
wrapper.eq("training_id", totalTraining.getTrainingId()); |
|||
Boolean result = totalTrainingService.update(totalTraining, wrapper); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
*//**
|
|||
* 视频课件点赞总数 |
|||
* @param section |
|||
* @return |
|||
*//*
|
|||
@RequestMapping(value="totalTrainingTotalPraise") |
|||
public Map<String,Object> totalTrainingTotalPraise(TotalTraining totalTraining){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<TotalTraining> wrapper=new EntityWrapper<TotalTraining>(); |
|||
EntityWrapper<TotalTraining> wrapperA=new EntityWrapper<TotalTraining>(); |
|||
try { |
|||
wrapper.eq("training_id", totalTraining.getTrainingId()); |
|||
wrapper.setSqlSelect("sum(flower) as flower"); |
|||
TotalTraining totTraining = totalTrainingService.selectOne(wrapper); |
|||
wrapperA.eq("training_id", totalTraining.getTrainingId()); |
|||
int count = totalTrainingService.selectCount(wrapperA); |
|||
map.put("isPraiseNum", totTraining.getFlower()/count); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
}*/ |
|||
|
|||
/** |
|||
* 新增送花朵数 |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="trainingFlower") |
|||
public Map<String,Object> trainingFlower(TrainingFlower trainingFlower){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<TrainingFlower> wrapper=new EntityWrapper<TrainingFlower>(); |
|||
try { |
|||
wrapper.eq("training_id", trainingFlower.getTrainingId()); |
|||
wrapper.eq("give_id", trainingFlower.getGiveId()); |
|||
TrainingFlower tgFlower = trainingFlowerService.selectOne(wrapper); |
|||
if(tgFlower==null){ |
|||
Boolean result = trainingFlowerService.insert(trainingFlower); |
|||
map.put("msg", result == true?1:2); |
|||
}else{ |
|||
map.put("msg", "5");//已经送过花朵
|
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查看自己的送花朵数 |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="trainingFlowerBytId") |
|||
public Map<String,Object> trainingFlowerBytId(TrainingFlower trainingFlower){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<TrainingFlower> wrapper=new EntityWrapper<TrainingFlower>(); |
|||
try { |
|||
wrapper.eq("training_id", trainingFlower.getTrainingId()); |
|||
wrapper.eq("give_id", trainingFlower.getGiveId()); |
|||
TrainingFlower tgFlower = trainingFlowerService.selectOne(wrapper); |
|||
if(tgFlower!=null){ |
|||
map.put("myFlower", tgFlower.getFlowerNum()==null?0:tgFlower.getFlowerNum()); |
|||
}else{ |
|||
map.put("myFlower", "0"); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 送花总数 |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="trainingFlowerTotal") |
|||
public Map<String,Object> trainingFlowerTotal(Long trainingId){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
EntityWrapper<TrainingFlower> wrapper=new EntityWrapper<TrainingFlower>(); |
|||
try { |
|||
wrapper.eq("training_id", trainingId); |
|||
wrapper.setSqlSelect("sum(flower_num) as flowerNum"); |
|||
TrainingFlower tgFlower = trainingFlowerService.selectOne(wrapper); |
|||
if(tgFlower!=null){ |
|||
map.put("sumFlower", tgFlower.getFlowerNum()==null?0:tgFlower.getFlowerNum()); |
|||
}else{ |
|||
map.put("sumFlower", "0"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,291 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.TotalTraining; |
|||
import com.imurs.entity.Training; |
|||
import com.imurs.entity.TrainingOpinion; |
|||
import com.imurs.entity.User; |
|||
import com.imurs.service.TotalTrainingService; |
|||
import com.imurs.service.TrainingOpinionService; |
|||
import com.imurs.service.TrainingService; |
|||
import com.imurs.service.UserService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
import com.imurs.util.page.Pagetion; |
|||
|
|||
/** |
|||
* 远程培训视频(列表统计) |
|||
* |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value = "training") |
|||
public class TrainingController { |
|||
|
|||
@Autowired |
|||
TrainingService trainingService; |
|||
|
|||
@Autowired |
|||
TotalTrainingService totalTrainingService; |
|||
|
|||
@Autowired |
|||
UserService userService; |
|||
|
|||
@Autowired |
|||
TrainingOpinionService trainingOpinionService; |
|||
|
|||
/** |
|||
* 新增上传视频课件 |
|||
* |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "insertTraining") |
|||
public Map<String, Object> insertSection(Training training) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<User> wrapper = new EntityWrapper<User>(); |
|||
try { |
|||
wrapper.eq("phone", training.getPhone());//phone 为user表账号 通过账号查找手机号码 手机号码可以修改的
|
|||
User user = userService.selectOne(wrapper); |
|||
training.setPhone(user.getContactPhone()); |
|||
boolean result = trainingService.insert(training); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 修改视频课件 |
|||
* |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "updateTraining") |
|||
public Map<String, Object> updateSection(Training training) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = trainingService.updateById(training); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 根据id查找视频课件 |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "selectTrainingById") |
|||
public Map<String, Object> selectTrainingById(Long id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<TrainingOpinion> wrapper = new EntityWrapper<TrainingOpinion>(); |
|||
try { |
|||
Training training = trainingService.selectById(id); |
|||
User user = userService.selectById(training.getDocId()); |
|||
wrapper.eq("training_id", id); |
|||
map.put("user", user); |
|||
map.put("training", training); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 删除视频课件 |
|||
* |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "deleteTraining") |
|||
public Map<String, Object> updateSection(Long id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = trainingService.deleteById(id); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 视频课件列表分页 |
|||
*/ |
|||
@RequestMapping(value = "selectTrainingPage") |
|||
public Map<String, Object> selectSectionPage(Map<String, String> map) { |
|||
Map<String, Object> mapList = new HashMap<String, Object>(); |
|||
try { |
|||
List<Training> listTraining = trainingService.selectTraining(map); |
|||
if (listTraining != null) { |
|||
mapList.put("listTraining", listTraining); |
|||
} else { |
|||
mapList.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
mapList.put("msg", "4"); |
|||
} |
|||
return mapList; |
|||
} |
|||
|
|||
/** |
|||
* 视频课件列表分页列表显示 |
|||
*/ |
|||
@RequestMapping(value = "selectTrainingPageByType") |
|||
public Map<String, Object> selectSectionPage(Integer pageNo, Integer pageSize, Integer type, String title, |
|||
String speaker,String hospitalId) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<Training> wrapper = new EntityWrapper<Training>(); |
|||
FrontPage<Training> page = new FrontPage<Training>(); |
|||
|
|||
page.setPage(pageNo == null ? 1 : pageNo); |
|||
page.setRows(pageSize == null ? 12 : pageSize); |
|||
|
|||
if (StringUtils.isNotEmpty(title)) { |
|||
wrapper.like("title", title); |
|||
} |
|||
if (StringUtils.isNotEmpty(speaker)) { |
|||
wrapper.like("speaker", speaker); |
|||
} |
|||
if (type != null) { |
|||
wrapper.eq("type", type); |
|||
} |
|||
wrapper.orderBy("create_time", false); |
|||
try { |
|||
Page<Training> tiList = trainingService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if (tiList != null) { |
|||
CustomPage<Training> customPage = new CustomPage<Training>(tiList); |
|||
if(StringUtils.isNotEmpty(hospitalId)){ |
|||
map.put("hospital_id", hospitalId); |
|||
List<TotalTraining> totalList=totalTrainingService.selectByMap(map); |
|||
map.remove("hospital_id"); |
|||
if(!totalList.isEmpty()){ |
|||
Map<Long, Long> result=totalList.stream().collect(Collectors.groupingBy(TotalTraining::getTrainingId,Collectors.counting())); |
|||
for (int i = 0; i < customPage.getRows().size(); i++) { |
|||
if(result!=null && result.get(customPage.getRows().get(i).getId())!=null){ |
|||
customPage.getRows().get(i).setNumber(result.get(customPage.getRows().get(i).getId()).intValue()); |
|||
}else{ |
|||
customPage.getRows().get(i).setNumber(0); |
|||
} |
|||
} |
|||
}else{ |
|||
for (int i = 0; i < customPage.getRows().size(); i++) { |
|||
customPage.getRows().get(i).setNumber(0); |
|||
} |
|||
} |
|||
} |
|||
map.put("customPage", customPage); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 视频课件列表基层医院分页列表显示 |
|||
*/ |
|||
@RequestMapping(value = "selectBasicSectionPage") |
|||
public Map<String, Object> selectBasicSectionPage(Integer pageNo, Integer pageSize, Integer type, String title, |
|||
String speaker,String hospitalId) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
pageNo=pageNo==null?1:pageNo; |
|||
pageSize=pageSize==null?10:pageSize; |
|||
map.put("hospitalId", hospitalId); |
|||
map.put("speaker", speaker); |
|||
map.put("type", type); |
|||
map.put("title", title); |
|||
try{ |
|||
Pagetion<Training> tiList=trainingService.selectBasePage(map,pageNo,pageSize); |
|||
if (tiList != null) { |
|||
map.put("customPage", tiList); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
}catch(Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("hospitalId"); |
|||
map.remove("speaker"); |
|||
map.remove("type"); |
|||
map.remove("title"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 新增评论回复 |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "addTrainingOpinion") |
|||
public Map<String, Object> addTrainingOpinion(TrainingOpinion trainingOpinion) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = trainingOpinionService.insert(trainingOpinion); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 评论列表分页 |
|||
*/ |
|||
@RequestMapping(value = "selectTrainingOpinionPage") |
|||
public Map<String, Object> selectTrainingOpinionPage(Integer pageNo, Integer pageSize, String trainingId) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<TrainingOpinion> wrapper = new EntityWrapper<TrainingOpinion>(); |
|||
FrontPage<TrainingOpinion> page = new FrontPage<TrainingOpinion>(); |
|||
|
|||
page.setPage(pageNo == null ? 1 : pageNo); |
|||
page.setRows(pageSize == null ? 12 : pageSize); |
|||
|
|||
if (StringUtils.isNotEmpty(trainingId)) { |
|||
wrapper.eq("training_id", trainingId); |
|||
} |
|||
//wrapper.groupBy("reply_id");
|
|||
wrapper.orderBy("create_time", false); |
|||
try { |
|||
Page<TrainingOpinion> tiList = trainingOpinionService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if (tiList != null) { |
|||
CustomPage<TrainingOpinion> customPage = new CustomPage<TrainingOpinion>(tiList); |
|||
map.put("customPage", customPage); |
|||
/*List<TrainingOpinion> trainingOpinionList = trainingOpinionService.selectList(wrapper); |
|||
map.put("msg",trainingOpinionList);//视频评论及回复列表数据
|
|||
*/ } else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,130 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.TrainingPlan; |
|||
import com.imurs.service.TrainingOpinionService; |
|||
import com.imurs.service.TrainingPlanService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
|
|||
@RestController |
|||
@RequestMapping("trainingPlan") |
|||
public class TrainingPlanController { |
|||
|
|||
@Autowired |
|||
TrainingPlanService trainingPlanService; |
|||
|
|||
@Autowired |
|||
TrainingOpinionService trainingOpinionService; |
|||
/** |
|||
* 新增培训计划 |
|||
*/ |
|||
@RequestMapping("insertTrainingPlan") |
|||
public Map<String,Object> insertTrainingPlan(TrainingPlan trainingPlan){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=trainingPlanService.insert(trainingPlan); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 修改培训计划 |
|||
*/ |
|||
@RequestMapping("updateTrainingPlan") |
|||
public Map<String,Object> updateTrainingPlan(TrainingPlan trainingPlan){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=trainingPlanService.updateById(trainingPlan); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查看计划详情 |
|||
*/ |
|||
@RequestMapping("selectTrainingPlan") |
|||
public Map<String,Object> selectTrainingPlan(Long id,Long docId){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
TrainingPlan trainingPlan=trainingPlanService.selectById(id); |
|||
map.put("trainingPlan",trainingPlan); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
*/ |
|||
@RequestMapping("deleteTrainingPlan") |
|||
public Map<String,Object> deleteTrainingPlan(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=trainingPlanService.deleteById(id); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 视频课件列表分页列表显示 |
|||
*/ |
|||
@RequestMapping(value = "selectTrainingPlayPage") |
|||
public Map<String, Object> selectTrainingPlayPage(Integer pageNo, Integer pageSize, Integer type, String title, |
|||
String speaker) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<TrainingPlan> wrapper = new EntityWrapper<TrainingPlan>(); |
|||
FrontPage<TrainingPlan> page = new FrontPage<TrainingPlan>(); |
|||
|
|||
page.setPage(pageNo == null ? 1 : pageNo); |
|||
page.setRows(pageSize == null ? 12 : pageSize); |
|||
|
|||
if (StringUtils.isNotEmpty(title)) { |
|||
wrapper.like("title", title); |
|||
} |
|||
if (StringUtils.isNotEmpty(speaker)) { |
|||
wrapper.like("speaker", speaker); |
|||
} |
|||
if (type != null) { |
|||
wrapper.eq("type", type); |
|||
} |
|||
|
|||
wrapper.orderBy("lecture_time", false); |
|||
try { |
|||
Page<TrainingPlan> tiList = trainingPlanService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if (tiList != null) { |
|||
CustomPage<TrainingPlan> customPage = new CustomPage<TrainingPlan>(tiList); |
|||
map.put("customPage", customPage); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,173 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.sql.Date; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Calendar; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.TrainingRecord; |
|||
import com.imurs.service.TrainingRecordService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
import com.imurs.util.page.Pagetion; |
|||
|
|||
/** |
|||
* |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value="trainingRecord") |
|||
public class TrainingRecordController { |
|||
|
|||
@Autowired |
|||
TrainingRecordService trainingRecordService; |
|||
|
|||
/** |
|||
* 新增培训记录表 |
|||
* @param loginRecord |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="addTrainingRecord") |
|||
public Map<String,Object> addTrainingRecord(TrainingRecord trainingRecord) throws Exception { |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
|
|||
try { |
|||
boolean result=trainingRecordService.insert(trainingRecord); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 修改培训记录 |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="updateTrainingRecord") |
|||
public Map<String,Object> updateTrainingRecord(TrainingRecord training){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=trainingRecordService.updateById(training); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 管理医院关联查询医院名称 |
|||
*/ |
|||
@RequestMapping(value="selectTrainingRecordById") |
|||
public Map<String,Object> selectTrainingRecordById(Long trainingId){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
TrainingRecord training = trainingRecordService.selectTrainingRecordById(trainingId); |
|||
map.put("training",training); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 删除视频课件 |
|||
* @param section |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="deleteTrainingRecord") |
|||
public Map<String,Object> deleteTrainingRecord(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result=trainingRecordService.deleteById(id); |
|||
map.put("msg", result==true?"1":"2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 分页显示登录记录信息 |
|||
*/ |
|||
@RequestMapping(value="selectTrainingRecordPage") |
|||
public Map<String,Object> selectTrainingRecordPage(Integer pageNo,Integer pageSize,String title,String hospitalId,String startTime,String endTime){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
FrontPage<TrainingRecord> page=new FrontPage<TrainingRecord>(); |
|||
EntityWrapper<TrainingRecord> wrapper=new EntityWrapper<TrainingRecord>(); |
|||
|
|||
page.setPage(pageNo==null?1:pageNo); |
|||
page.setRows(pageSize==null?10:pageSize); |
|||
|
|||
if(StringUtils.isNotEmpty(hospitalId)){ |
|||
wrapper.eq("hospital_id", hospitalId); |
|||
} |
|||
if(StringUtils.isNotEmpty(title)){ |
|||
wrapper.like("title", title); |
|||
} |
|||
if(StringUtils.isNotEmpty(startTime)){ |
|||
wrapper.ge("training_time", startTime); |
|||
} |
|||
if(StringUtils.isNotEmpty(endTime)){ |
|||
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd"); |
|||
Calendar cal = Calendar.getInstance(); |
|||
cal.setTime(Date.valueOf(endTime)); |
|||
cal.add(Calendar.DATE,1);//增加一天
|
|||
wrapper.lt("training_time",dateFormat.format(cal.getTime())); |
|||
|
|||
} |
|||
wrapper.orderBy("training_time",false); |
|||
try { |
|||
Page<TrainingRecord> trainingRecord=trainingRecordService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if(trainingRecord!=null){ |
|||
CustomPage<TrainingRecord> customPage=new CustomPage<TrainingRecord>(trainingRecord); |
|||
map.put("customPage", customPage); |
|||
}else{ |
|||
map.put("msg","3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 管理医院显示培训记录 |
|||
*/ |
|||
@RequestMapping(value="selectAdminRecordPage") |
|||
public Map<String,Object> selectAdminRecordPage(Integer pageNo,Integer pageSize,String hospitalId,String startTime,String endTime){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("hospitalId", hospitalId); |
|||
try { |
|||
Pagetion<TrainingRecord> list=trainingRecordService.selectAdminRecord(map, pageNo, pageSize); |
|||
map.put("list", list); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("startTime"); |
|||
map.remove("endTime"); |
|||
map.remove("hospitalId"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,644 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.sql.Date; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Calendar; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
import java.util.Map.Entry; |
|||
import java.util.stream.Collectors; |
|||
|
|||
import com.imurs.entity.*; |
|||
import com.imurs.service.*; |
|||
import com.imurs.util.MsgCode; |
|||
import com.imurs.util.RSAUtil; |
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.slf4j.helpers.SubstituteLogger; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
|||
import org.springframework.util.CollectionUtils; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.parameter.SysMenusParameter; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
import com.imurs.util.page.Pagetion; |
|||
|
|||
|
|||
/** |
|||
* 医生登录表 |
|||
* |
|||
* @author Server |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(value = "user") |
|||
public class UserController { |
|||
|
|||
@Autowired |
|||
UserService userService; |
|||
@Autowired |
|||
SysMenuService sysMenuService; |
|||
@Autowired |
|||
ApplyCaseService applyCaseService; |
|||
@Autowired |
|||
ApplyConsultationService applyConsultationService; |
|||
@Autowired |
|||
DoctorArrangeService doctorArrangeService; |
|||
@Autowired |
|||
TrainingService trainingService; |
|||
@Autowired |
|||
TotalTrainingService totalTrainingService; |
|||
@Autowired |
|||
ApplyConsulationSpecialistService applyConsulationSpecialistService; |
|||
@Autowired |
|||
ApplyBModeSpecialistService applyBModeSpecialistService; |
|||
@Autowired |
|||
ApplyPathologySpecialistService applyPathologySpecialistService; |
|||
@Autowired |
|||
ApplyEcgSpecialistService applyEcgSpecialistService; |
|||
@Autowired |
|||
RoleService roleService; |
|||
@Autowired |
|||
ApplyBModeService applyBModeService; |
|||
|
|||
private final Logger logger = LoggerFactory.getLogger(UserController.class); |
|||
|
|||
private static String privateKey = MsgCode.privateKeyString; |
|||
private static String password = MsgCode.Password; |
|||
/** |
|||
* 新增医生信息 |
|||
* |
|||
* @param user |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "insertUser") |
|||
public Map<String, Object> insertUser(User user) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
|||
if (user.getPassword() != null) { |
|||
user.setPassword(RSAUtil.decrypt(user.getPassword(),privateKey)); |
|||
} else { |
|||
user.setPassword(password); |
|||
} |
|||
user.setPassword(passwordEncoder.encode(user.getPassword())); |
|||
boolean result = userService.insert(user); |
|||
map.put("msg", result ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 修改密码 |
|||
*/ |
|||
@RequestMapping(value = "updateUserPassword") |
|||
public Map<String, Object> updateUserPassword(Long id, String oldPassword, String newPassword) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
if (id != null && StringUtils.isNotEmpty(oldPassword) && StringUtils.isNotEmpty(newPassword)) { |
|||
// 判断旧密码是否相同
|
|||
oldPassword = RSAUtil.decrypt(oldPassword,privateKey); |
|||
newPassword = RSAUtil.decrypt(newPassword,privateKey); |
|||
User user = userService.selectById(id); |
|||
if (user != null) { |
|||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
|||
if (passwordEncoder.matches(oldPassword,user.getPassword())) { |
|||
user.setPassword(passwordEncoder.encode(newPassword)); |
|||
boolean result = userService.updateById(user); |
|||
map.put("msg", result ? "1" : "2"); |
|||
} else { |
|||
map.put("msg", "11"); |
|||
} |
|||
} else { |
|||
map.put("msg", "6"); |
|||
} |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* @param phone 电话号码 |
|||
* @param password 密码 |
|||
* @return 通过一个固定账号查出该医院所有医生账号 |
|||
*/ |
|||
@RequestMapping("getAllDocByCategoryHospital") |
|||
public Map<String, Object> getAllDocByCategoryHospital(String phone, String password) { |
|||
Map<String, Object> map = new HashMap<>(8); |
|||
try { |
|||
User user = userService.selectOne(new EntityWrapper<User>() |
|||
.eq("phone", phone)); |
|||
if (user == null) { |
|||
map.put("msg","6"); |
|||
return map; |
|||
} |
|||
String decryptPassword = RSAUtil.decrypt(password,privateKey); |
|||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
|||
if (!passwordEncoder.matches(decryptPassword,user.getPassword())) { |
|||
map.put("msg","2"); |
|||
return map; |
|||
} |
|||
List<User> users = userService.selectList(new EntityWrapper<User>() |
|||
.eq("hospital_id", user.getHospitalId()) |
|||
.notIn("phone", phone)); |
|||
map.put("users",users); |
|||
map.put("msg","1"); |
|||
} catch (Exception e) { |
|||
logger.error("查询基层医院所有医生出现异常",e); |
|||
map.put("msg","4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 修改医生信息 |
|||
* |
|||
* @param user |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "updateUser") |
|||
public Map<String, Object> updateUser(User user) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = userService.updateById(user); |
|||
String username = user.getUserName(); |
|||
EntityWrapper<ApplyBMode> wrapper = new EntityWrapper<>(); |
|||
wrapper.eq("doc_id",user.getId()); |
|||
List<ApplyBMode> applyBModeList = applyBModeService.selectList(wrapper); |
|||
if (!CollectionUtils.isEmpty(applyBModeList)) { |
|||
for (ApplyBMode applybmode: applyBModeList) { |
|||
applybmode.setDoctorName(username); |
|||
} |
|||
applyBModeService.updateBatchById(applyBModeList); |
|||
} |
|||
|
|||
// applyBModeService.updateByMyId(id,username);
|
|||
|
|||
map.put("msg", result ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
/** |
|||
* 多医生批量修改 |
|||
* |
|||
* @param users |
|||
* @return |
|||
*/ |
|||
|
|||
@RequestMapping(value = "updateUserBatch") |
|||
public Map<String, Object> updateUserBatch(@RequestBody List<User> users) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
try { |
|||
boolean result = userService.updateBatchByIds(users); |
|||
map.put("msg", result ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 根据groupAlias字段查询医生 |
|||
* @param groupAlias |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "selectUserByGroupAlias") |
|||
public Map<String, Object> selectUserByGroupAlias(@RequestParam String groupAlias) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
try { |
|||
List<User> users = userService.selectList(new EntityWrapper<User>() |
|||
.eq("group_alias", groupAlias) |
|||
.eq("state", 1) |
|||
.eq("rid", 6) |
|||
); |
|||
map.put("doctorList", users); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查询医生groupAlias字段为空的医生 |
|||
* @param |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "selectUserByGroupAliasIsNull") |
|||
public Map<String, Object> selectUserByGroupAliasIsNull() { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
try { |
|||
List<User> users = userService.selectList(new EntityWrapper<User>() |
|||
.andNew("(group_alias IS NULL OR group_alias = '')") |
|||
.eq("state", 1) |
|||
.eq("rid", 6)); // 空字符串;
|
|||
map.put("doctorList", users); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 根据手机号码查询医生 |
|||
*/ |
|||
@RequestMapping(value = "selectUserByPhone") |
|||
public Map<String, Object> selectUserByPhone(String phone, String rid) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
EntityWrapper<User> wrapper = new EntityWrapper<>(); |
|||
wrapper.eq("phone", phone); |
|||
if (StringUtils.isNotEmpty(rid)) { |
|||
wrapper.eq("rid", rid); |
|||
} |
|||
try { |
|||
User user = userService.selectOne(wrapper); |
|||
map.put("user", user); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查询医生详情 |
|||
*/ |
|||
@RequestMapping(value = "selectUserById") |
|||
public Map<String, Object> selectUserById(Long id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
User user = userService.selectById(id); |
|||
map.put("user", user); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查询医生所有权限 |
|||
*/ |
|||
@RequestMapping(value = "selectUserAllRpId") |
|||
public Map<String, Object> selectUserAllRpId(String rid) { |
|||
// 查询角色所有权限使用
|
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<SysMenu> wrapper = new EntityWrapper<SysMenu>(); |
|||
List<SysMenusParameter> list = new ArrayList<SysMenusParameter>(); |
|||
// 查询该角色拥有的所有权限
|
|||
wrapper.eq("rid", rid).eq("menu_state", "1"); |
|||
List<SysMenu> selectList = sysMenuService.selectList(wrapper); |
|||
Map<String, List<Long>> collect1 = selectList.stream().collect( |
|||
Collectors.groupingBy(SysMenu::getMenuStair, Collectors.mapping(SysMenu::getId, Collectors.toList()))); |
|||
Set<Entry<String, List<Long>>> entrySet = collect1.entrySet(); |
|||
for (Entry<String, List<Long>> entry : entrySet) { |
|||
SysMenusParameter st = new SysMenusParameter(); |
|||
st.setMenuStair(entry.getKey()); |
|||
st.setMenuId(entry.getValue().toString().replace("[", "").replace("]", "")); |
|||
// buffer1="{name:"+"\""+entry.getKey()+"\""+","+"content:"+"\""+entry.getValue()+"\""+"}";
|
|||
list.add(st); |
|||
} |
|||
map.put("AllPermissions", list); |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查询医生所有权限(dxy) |
|||
*/ |
|||
@RequestMapping(value = "selectUserSysMenue") |
|||
public Map<String, Object> selectUserSysMenue(String rid) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<SysMenu> wrapper = new EntityWrapper<SysMenu>(); |
|||
List<SysMenu> smList = new ArrayList<SysMenu>(); |
|||
List<SysMenusParameter> sysList = new ArrayList<SysMenusParameter>(); |
|||
Set<String> keySet; |
|||
try { |
|||
wrapper.eq("rid", rid).eq("menu_state", "1").ne("menu_vfp", "管理员列表"); |
|||
smList = sysMenuService.selectList(wrapper); |
|||
Map<String, List<Long>> collect = smList.stream().collect(Collectors.groupingBy(SysMenu::getMenuStair, |
|||
Collectors.mapping(SysMenu::getId, Collectors.toList()))); |
|||
keySet = collect.keySet(); |
|||
for (String menuStair : keySet) { |
|||
SysMenusParameter st = new SysMenusParameter(); |
|||
st.setMenuStair(menuStair); |
|||
st.setMenuId(collect.get(menuStair).toString().replace("[", "").replace("]", "")); |
|||
sysList.add(st); |
|||
} |
|||
map.put("sysList", sysList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查询医生详情及权限 |
|||
*/ |
|||
@RequestMapping(value = "selectUserRpId") |
|||
public Map<String, Object> selectUserRpId(Long id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<SysMenu> wrapper = new EntityWrapper<SysMenu>(); |
|||
List<SysMenu> smList = new ArrayList<SysMenu>(); |
|||
try { |
|||
User user = userService.selectById(id); |
|||
if (user != null) { |
|||
String[] str = user.getRpId().split(","); |
|||
for (int i = 0; i < str.length; i++) { |
|||
if (str.length - i == 1) { |
|||
wrapper.eq("id", str[i]).eq("rid", "1,2").eq("menu_state", "1"); |
|||
} else { |
|||
wrapper.eq("id", str[i]).eq("rid", "1,2").eq("menu_state", "1").or(); |
|||
} |
|||
} |
|||
smList = sysMenuService.selectList(wrapper); |
|||
if (smList.isEmpty()) { |
|||
map.put("rpId", null); |
|||
} else { |
|||
// 分组求出所有名称
|
|||
// 分组显示
|
|||
Map<String, List<Long>> collect = smList.stream().collect(Collectors.groupingBy( |
|||
SysMenu::getMenuStair, Collectors.mapping(SysMenu::getId, Collectors.toList()))); |
|||
map.put("limits", collect.keySet().toArray()); |
|||
} |
|||
} |
|||
map.put("user", user); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 分页显示医生信息 |
|||
*/ |
|||
@RequestMapping(value = "selectUserPage") |
|||
public Map<String, Object> selectUserPage(Integer pageNo, Integer pageSize, String contactPhone, String userName, |
|||
String startTime, String endTime, String isSucceed, String phone, String seName, Integer state, |
|||
String hospitalId, String rid, String isFamily) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
FrontPage<User> page = new FrontPage<User>(); |
|||
EntityWrapper<User> wrapper = new EntityWrapper<User>(); |
|||
|
|||
page.setPage(pageNo == null ? 1 : pageNo); |
|||
page.setRows(pageSize == null ? 12 : pageSize); |
|||
|
|||
if (StringUtils.isNotEmpty(contactPhone)) { |
|||
wrapper.eq("contact_phone", contactPhone); |
|||
} |
|||
if (StringUtils.isNotEmpty(seName)) { |
|||
wrapper.eq("se_name", seName); |
|||
} |
|||
if (StringUtils.isNotEmpty(phone)) { |
|||
wrapper.eq("phone", phone); |
|||
} |
|||
if (StringUtils.isNotEmpty(userName)) { |
|||
wrapper.like("user_name", userName); |
|||
} |
|||
if (state != null) { |
|||
wrapper.eq("state", state); |
|||
} |
|||
if (hospitalId != null) { |
|||
wrapper.eq("hospital_id", hospitalId); |
|||
} |
|||
if (StringUtils.isNotEmpty(rid)) { |
|||
wrapper.eq("rid", rid); |
|||
} |
|||
if (StringUtils.isNotEmpty(endTime)) { |
|||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
|||
Calendar cal = Calendar.getInstance(); |
|||
cal.setTime(Date.valueOf(endTime)); |
|||
cal.add(Calendar.DATE, 1);// 增加一天
|
|||
endTime = dateFormat.format(cal.getTime()); |
|||
} |
|||
if (StringUtils.isNotEmpty(isFamily)) { |
|||
wrapper.eq("is_family", isFamily); |
|||
} |
|||
if (StringUtils.isNotEmpty(isSucceed)) { |
|||
wrapper.eq("is_succeed", isSucceed); |
|||
} |
|||
wrapper.orderBy("job_level", false); |
|||
|
|||
try { |
|||
Page<User> userList = userService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if (userList != null) { |
|||
CustomPage<User> customPage = new CustomPage<User>(userList); |
|||
map.put("customPage", customPage); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 关联医院表分页显示医生信息 |
|||
*/ |
|||
@RequestMapping(value = "selectUserPageByDoc") |
|||
public Map<String, Object> selectUserPageByDoc(Integer pageNo, Integer pageSize, String phone, String userName, |
|||
Integer state, String hospitalId, String rid) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("phone", phone); |
|||
map.put("userName", userName); |
|||
map.put("state", state); |
|||
map.put("hospitalId", hospitalId); |
|||
map.put("rid", rid); |
|||
|
|||
pageNo = pageNo == null ? 1 : pageNo; |
|||
pageSize = pageSize == null ? 12 : pageSize; |
|||
|
|||
try { |
|||
Pagetion<User> pagetion = userService.selectUserPageByDoc(map, pageNo, pageSize); |
|||
map.put("pagetion", pagetion); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} finally { |
|||
map.remove("phone"); |
|||
map.remove("userName"); |
|||
map.remove("state"); |
|||
map.remove("hospitalId"); |
|||
map.remove("rid"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 删除医生 |
|||
*/ |
|||
@RequestMapping(value = "deleteUser") |
|||
public Map<String, Object> deleteUser(Long id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
boolean result = userService.deleteById(id); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 关联医院表查出医院名称 |
|||
*/ |
|||
@RequestMapping("selectUserByUid") |
|||
public Map<String, Object> selectUserByUid(Long uid) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
User user = userService.selectUserByUid(uid); |
|||
map.put("user", user); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 根据科室查询医生 ty:1 |
|||
*/ |
|||
@RequestMapping("selectUserBySeName") |
|||
public Map<String, Object> selectUserBySeName(String hospitalId, String seName, String rid, Integer status, |
|||
Long conId, Long bId, Long pId, Long eId) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
|
|||
if (StringUtils.isNotEmpty(seName)) { |
|||
map.put("se_name", seName); |
|||
} |
|||
if (StringUtils.isNotEmpty(hospitalId)) { |
|||
map.put("hospital_id", hospitalId); |
|||
map.put("rid", rid); |
|||
map.put("state", "1"); |
|||
} else { |
|||
map.put("msg", "9"); |
|||
return map; |
|||
} |
|||
try { |
|||
List<User> userList = userService.selectByMap(map); |
|||
if (!userList.isEmpty() && status != null) { |
|||
if (conId != null) { |
|||
EntityWrapper<ApplyConsulationSpecialist> wrapper = new EntityWrapper<ApplyConsulationSpecialist>(); |
|||
wrapper.setSqlSelect("spe_id as speId").where("").eq("con_id", conId); |
|||
// 查询当前专家是否已经分配过
|
|||
List<ApplyConsulationSpecialist> accsList = applyConsulationSpecialistService.selectList(wrapper); |
|||
map.put("accsList", accsList); |
|||
} else if (bId != null) { |
|||
EntityWrapper<ApplyBModeSpecialist> wrapper1 = new EntityWrapper<ApplyBModeSpecialist>(); |
|||
wrapper1.setSqlSelect("spe_id as speId").where("").eq("b_id", bId); |
|||
// 查询当前专家是否已经分配过
|
|||
List<ApplyBModeSpecialist> accsList = applyBModeSpecialistService.selectList(wrapper1); |
|||
map.put("accsList", accsList); |
|||
} else if (pId != null) { |
|||
EntityWrapper<ApplyPathologySpecialist> wrapper2 = new EntityWrapper<ApplyPathologySpecialist>(); |
|||
wrapper2.setSqlSelect("spe_id as speId").where("").eq("p_id", pId); |
|||
// 查询当前专家是否已经分配过
|
|||
List<ApplyPathologySpecialist> accsList = applyPathologySpecialistService.selectList(wrapper2); |
|||
map.put("accsList", accsList); |
|||
} else if (eId != null) { |
|||
EntityWrapper<ApplyEcgSpecialist> wrapper3 = new EntityWrapper<ApplyEcgSpecialist>(); |
|||
wrapper3.setSqlSelect("spe_id as speId").where("").eq("e_id", eId); |
|||
// 查询当前专家是否已经分配过
|
|||
List<ApplyEcgSpecialist> accsList = applyEcgSpecialistService.selectList(wrapper3); |
|||
map.put("accsList", accsList); |
|||
} |
|||
} |
|||
map.put("userList", userList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查询所有管理员子账号 |
|||
*/ |
|||
@RequestMapping("selectUserByAdmin") |
|||
public Map<String, Object> selectUserByAdmin(Long rid) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
map.put("rid", rid); |
|||
try { |
|||
List<User> userList = userService.selectByMap(map); |
|||
map.put("userList", userList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 靖远医院专家一览表 |
|||
*/ |
|||
@RequestMapping("selectUserJy") |
|||
public Map<String, Object> selectUserJy(String seName, String userName) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
List<User> userList = new ArrayList<User>(); |
|||
EntityWrapper<User> wrapper = new EntityWrapper<User>(); |
|||
wrapper.eq("rid", "6").eq("state", "1"); |
|||
if (StringUtils.isNotEmpty(seName)) { |
|||
wrapper.eq("se_name", seName); |
|||
} |
|||
if (StringUtils.isNotEmpty(userName)) { |
|||
wrapper.like("user_name", userName); |
|||
} |
|||
wrapper.orderBy("create_time", false); |
|||
try { |
|||
userList = userService.selectList(wrapper); |
|||
map.put("userList", userList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} finally { |
|||
map.remove("rid"); |
|||
map.remove("state"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 查询权限 |
|||
*/ |
|||
@RequestMapping("selectSysMenuByRid") |
|||
public Map<String, Object> selectRoleByRid(Long rid) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
Role sys = roleService.selectById(rid); |
|||
map.put("rpId", sys.getRpId()); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,87 @@ |
|||
package com.imurs.controller; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.VideoRecord; |
|||
import com.imurs.service.VideoRecordService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
|
|||
@RestController |
|||
@RequestMapping(value="video") |
|||
public class VideoRecordController { |
|||
|
|||
@Autowired |
|||
VideoRecordService videoRecordService; |
|||
|
|||
|
|||
/** |
|||
* 新增视频记录 |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="/startVideo") |
|||
public Map<String,Object> startVideo(VideoRecord videoRecord){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result = videoRecordService.insert(videoRecord); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新增视频记录 |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value="/deleteVideo") |
|||
public Map<String,Object> deleteVideo(Long id){ |
|||
Map<String,Object> map=new HashMap<String,Object>(); |
|||
try { |
|||
boolean result = videoRecordService.deleteById(id); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 分页显示医生信息 |
|||
*/ |
|||
@RequestMapping(value = "selectVideoRecordPage") |
|||
public Map<String, Object> selectVideoRecordPage(Integer pageNo, Integer pageSize, String phone, String userName, |
|||
Integer state, String hospitalId) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
FrontPage<VideoRecord> page = new FrontPage<VideoRecord>(); |
|||
EntityWrapper<VideoRecord> wrapper = new EntityWrapper<VideoRecord>(); |
|||
|
|||
page.setPage(pageNo == null ? 1 : pageNo); |
|||
page.setRows(pageSize == null ? 12 : pageSize); |
|||
|
|||
wrapper.orderBy("create_time", false); |
|||
try { |
|||
Page<VideoRecord> videoRecord = videoRecordService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if (videoRecord != null) { |
|||
CustomPage<VideoRecord> customPage = new CustomPage<VideoRecord>(videoRecord); |
|||
map.put("customPage", customPage); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
} |
|||
@ -0,0 +1,68 @@ |
|||
package com.imurs.controller; |
|||
|
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import javax.sound.sampled.UnsupportedAudioFileException; |
|||
|
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import com.imurs.sound.AsrMain; |
|||
|
|||
import net.sf.json.JSONObject; |
|||
@Controller |
|||
@RequestMapping(value = "/sound") |
|||
public class VoiceTransform { |
|||
/** |
|||
* 获取二进制数据 |
|||
* |
|||
* @param model |
|||
* @param params |
|||
* @param response |
|||
* @return |
|||
*/ |
|||
|
|||
|
|||
//百度通用语音识别
|
|||
@RequestMapping(value = "/bRecogniteSound") |
|||
public void baidusoundsound(MultipartFile audioData,HttpServletResponse response) throws UnsupportedAudioFileException, IOException, Exception { |
|||
|
|||
// long startTime=System.currentTimeMillis(); //获取开始时间
|
|||
InputStream in=audioData.getInputStream(); |
|||
|
|||
//获取结束时间
|
|||
//long startTime2=System.currentTimeMillis();
|
|||
// System.out.println(startTime2-startTime+"获取数据的时间");
|
|||
|
|||
|
|||
AsrMain demo = new AsrMain(in); |
|||
//String path = "D:\\16k.pcm";
|
|||
//AsrMain demo = new AsrMain(path);
|
|||
// demo.runJsonPostMethodIns(token)
|
|||
String result = demo.runins(); |
|||
// String result =demo.run();
|
|||
// long endTime=System.currentTimeMillis();
|
|||
// System.out.println(endTime-startTime2+"上传服务器时间");
|
|||
// long processtime =(endTime-startTime2);
|
|||
Map map =new HashMap(); |
|||
map.put("result", result); |
|||
// map.put("time", processtime+" ms");
|
|||
//System.out.println(result);
|
|||
String json=JSONObject.fromObject(map).toString(); |
|||
response.getWriter().write(json); |
|||
// System.out.println("json格式:"+json);
|
|||
//if(result != null) {
|
|||
//System.out.println("识别结果:\n" + result);
|
|||
//System.out.println(processtime);
|
|||
|
|||
//}
|
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,151 @@ |
|||
package com.imurs.controller.maternity; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
import java.util.UUID; |
|||
|
|||
|
|||
|
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.imurs.entity.PatientUser; |
|||
import com.imurs.service.PatientUserService; |
|||
import com.imurs.util.MD5; |
|||
|
|||
|
|||
@RestController |
|||
@RequestMapping("ptUser") |
|||
public class PatientUserController { |
|||
|
|||
@Autowired |
|||
PatientUserService patientUserService; |
|||
|
|||
|
|||
/** |
|||
* 患者注册 |
|||
*/ |
|||
@RequestMapping(value = "registerPtUser") |
|||
public Map<String, Object> registerPtUser(PatientUser ptUser) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
if (ptUser != null) { |
|||
ptUser.setAccount(ptUser.getPhone()); |
|||
ptUser.setPhone(ptUser.getPhone()); |
|||
ptUser.setPassword(MD5.GetMD5Code(ptUser.getPassword())); |
|||
ptUser.setPtIccid(UUID.randomUUID().toString()); |
|||
boolean result = patientUserService.insert(ptUser); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 判断当前手机号码是否已经注册 |
|||
* |
|||
*/ |
|||
@RequestMapping(value = "selectPtPhone") |
|||
public Map<String, Object> selectPtPhone(String phone) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<PatientUser> wrapper = new EntityWrapper<PatientUser>(); |
|||
wrapper.eq("account", phone); |
|||
try { |
|||
int count = patientUserService.selectCount(wrapper); |
|||
map.put("msg", count == 0 ? "6" : "5"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
/** |
|||
* 修改密码 |
|||
*/ |
|||
@RequestMapping(value = "updatePtUserPassword") |
|||
public Map<String, Object> updatePtUserPassword(PatientUser patientUser) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<PatientUser> wrapper=new EntityWrapper<PatientUser>(); |
|||
try { |
|||
if(patientUser!=null && (StringUtils.isNotEmpty(patientUser.getAccount()) && StringUtils.isNotEmpty(patientUser.getPassword()))){ |
|||
wrapper.eq("account", patientUser.getAccount()); |
|||
//判断旧密码是否相同
|
|||
patientUser.setPassword(MD5.GetMD5Code(patientUser.getPassword())); |
|||
boolean result = patientUserService.update(patientUser, wrapper); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 个人信息 |
|||
*/ |
|||
@RequestMapping(value = "selectPtUser") |
|||
public Map<String, Object> selectPtUser(String account,String ptCard) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<PatientUser> wrapper = new EntityWrapper<PatientUser>(); |
|||
if(StringUtils.isNotEmpty(account)){ |
|||
wrapper.eq("account", account); |
|||
}else if(StringUtils.isNotEmpty(ptCard)){ |
|||
wrapper.eq("card", ptCard); |
|||
} |
|||
|
|||
try { |
|||
if (StringUtils.isNotEmpty(account) || StringUtils.isNotEmpty(ptCard)) { |
|||
PatientUser patientUser=patientUserService.selectOne(wrapper); |
|||
map.put("patientUser", patientUser); |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
@RequestMapping(value = "updatePtUser") |
|||
public Map<String, Object> updatePtUser(PatientUser ptUser) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
try { |
|||
if (ptUser != null) { |
|||
if(StringUtils.isNotEmpty(ptUser.getPtName())){ |
|||
ptUser.setPtName(ptUser.getPtName()); |
|||
} |
|||
if(StringUtils.isNotEmpty(ptUser.getCard())){ |
|||
ptUser.setCard(ptUser.getCard()); |
|||
} |
|||
if(StringUtils.isNotEmpty(ptUser.getPhone())){ |
|||
ptUser.setPhone(ptUser.getPhone()); |
|||
} |
|||
|
|||
boolean result = patientUserService.updateById(ptUser); |
|||
map.put("msg", result == true ? "1" : "2"); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,191 @@ |
|||
package com.imurs.controller.maternity; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.EntityWrapper; |
|||
import com.baomidou.mybatisplus.plugins.Page; |
|||
import com.imurs.entity.PatientUser; |
|||
import com.imurs.entity.PatientUserRecord; |
|||
import com.imurs.entity.PatientUserRecordImg; |
|||
import com.imurs.service.PatientUserRecordImgService; |
|||
import com.imurs.service.PatientUserRecordService; |
|||
import com.imurs.service.PatientUserService; |
|||
import com.imurs.util.page.CustomPage; |
|||
import com.imurs.util.page.FrontPage; |
|||
import com.imurs.util.page.Pagetion; |
|||
|
|||
@RestController |
|||
@RequestMapping("record") |
|||
public class PatientUserRecordController { |
|||
|
|||
@Autowired |
|||
PatientUserRecordService patientUserRecordService; |
|||
@Autowired |
|||
PatientUserRecordImgService patientUserRecordImgService; |
|||
@Autowired |
|||
PatientUserService patientUserService; |
|||
|
|||
|
|||
/** |
|||
*资料上传 |
|||
*/ |
|||
@Transactional |
|||
@RequestMapping("inserRecord") |
|||
public Map<String, Object> inserRecord(@RequestBody List<PatientUserRecord> rdList) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
boolean result=false; |
|||
try { |
|||
if (!rdList.isEmpty() && rdList.get(0) != null) { |
|||
result = patientUserRecordService.insert(rdList.get(0)); |
|||
if (result == true) { |
|||
Integer id=rdList.get(0).getId(); |
|||
for (int i = 0; i < rdList.get(0).getImgList().size(); i++) { |
|||
rdList.get(0).getImgList().get(i).setRdId(id); |
|||
patientUserRecordImgService.insert(rdList.get(0).getImgList().get(i)); |
|||
} |
|||
} |
|||
map.put("msg", result == true?"1":"2"); |
|||
} else { |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
@RequestMapping(value = "selectRecordPage") |
|||
public Map<String, Object> selectRecordPage(Integer uid,Integer pageNo,Integer pageSize) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
EntityWrapper<PatientUserRecord> wrapper=new EntityWrapper<PatientUserRecord>(); |
|||
FrontPage<PatientUserRecord> page=new FrontPage<PatientUserRecord>(); |
|||
page.setPage(pageNo==null?1:pageNo); |
|||
page.setRows(pageSize==null?10:pageSize); |
|||
|
|||
if(uid!=null){ |
|||
wrapper.eq("pt_uid", uid); |
|||
} |
|||
wrapper.orderBy("id",false); |
|||
try { |
|||
Page<PatientUserRecord> pageList=patientUserRecordService.selectPage(page.getPagePlusTwo(), wrapper); |
|||
if(pageList!=null){ |
|||
CustomPage<PatientUserRecord> customPage=new CustomPage<PatientUserRecord>(pageList); |
|||
map.put("customPage", customPage); |
|||
}else{ |
|||
map.put("msg", "3"); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
@RequestMapping(value = "selectRecordPtUserPage") |
|||
public Map<String, Object> selectRecordPtUserPage(String startTime,String endTime,String ptName,Integer pageNo,Integer pageSize) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
pageNo=pageNo==null?1:pageNo; |
|||
pageSize=pageSize==null?10:pageSize; |
|||
map.put("startTime", startTime); |
|||
map.put("endTime", endTime); |
|||
map.put("ptName", ptName); |
|||
|
|||
try { |
|||
Pagetion<PatientUserRecord> pageList=patientUserRecordService.selectRecordPtUserPage(map,pageNo, pageSize); |
|||
map.put("pageList", pageList); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("ptName"); |
|||
map.remove("endTime"); |
|||
map.remove("startTime"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 数据统计 |
|||
*/ |
|||
@RequestMapping(value = "selectRecordCount") |
|||
public Map<String, Object> selectRecordCount(Integer ptUid) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
List<PatientUserRecord> rdList=new ArrayList<PatientUserRecord>(); |
|||
EntityWrapper<PatientUserRecord> wrapper=new EntityWrapper<PatientUserRecord>(); |
|||
try { |
|||
if(ptUid!=null){ |
|||
wrapper.eq("pt_uid", ptUid).orderBy("id", false); |
|||
rdList=patientUserRecordService.selectList(wrapper); |
|||
if(!rdList.isEmpty()){ |
|||
map.put("rdList", rdList); |
|||
} |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
map.put("msg", "4"); |
|||
} |
|||
|
|||
return map; |
|||
} |
|||
|
|||
|
|||
@RequestMapping(value = "selectRecordImg") |
|||
public Map<String, Object> selectRecordImg(Integer rdId) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
List<PatientUserRecordImg> imgList=new ArrayList<PatientUserRecordImg>(); |
|||
try { |
|||
if(rdId!=null){ |
|||
map.put("rd_id", rdId); |
|||
imgList=patientUserRecordImgService.selectByMap(map); |
|||
map.remove("rd_id"); |
|||
map.put("imgList", imgList); |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
map.put("msg", "4"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
|
|||
@RequestMapping(value = "selectRecordById") |
|||
public Map<String, Object> selectRecordById(Integer id) { |
|||
Map<String, Object> map = new HashMap<String, Object>(); |
|||
PatientUserRecord patientUserRecord=new PatientUserRecord(); |
|||
PatientUser patientUser=new PatientUser(); |
|||
List<PatientUserRecordImg> imgList=new ArrayList<PatientUserRecordImg>(); |
|||
map.put("rd_id", id); |
|||
try { |
|||
if(id!=null){ |
|||
patientUserRecord=patientUserRecordService.selectById(id); |
|||
patientUser=patientUserService.selectById(patientUserRecord.getPtUid()); |
|||
imgList=patientUserRecordImgService.selectByMap(map); |
|||
map.put("patientUser", patientUser); |
|||
map.put("imgList", imgList); |
|||
map.put("patientUserRecord", patientUserRecord); |
|||
}else{ |
|||
map.put("msg", "9"); |
|||
} |
|||
} catch (Exception e) { |
|||
map.put("msg", "4"); |
|||
}finally { |
|||
map.remove("rd_id"); |
|||
} |
|||
return map; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.AgoraRecord; |
|||
|
|||
public interface AgoraRecordMapper extends BaseMapper<AgoraRecord> { |
|||
|
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.AiQcVocabulary; |
|||
|
|||
public interface AiQcVocabularyMapper extends BaseMapper<AiQcVocabulary> { |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApiUrl; |
|||
|
|||
public interface ApiUrlMapper extends BaseMapper<ApiUrl>{ |
|||
|
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyBModeImg; |
|||
|
|||
public interface ApplyBModeImgMapper extends BaseMapper<ApplyBModeImg>{ |
|||
|
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyBMode; |
|||
import com.imurs.utils.Excelvo; |
|||
|
|||
public interface ApplyBModeMapper extends BaseMapper<ApplyBMode>{ |
|||
|
|||
public List<ApplyBMode> selectBmodePage(Map<String,Object> map); |
|||
|
|||
public List<Map<String,Object>> selectBmodeSpePage(Map<String,Object> map); |
|||
|
|||
public List<Map<String,Object>> diagnosisTypeNumber(); |
|||
|
|||
public List<Map<String,Object>> hospitalApplyNumber(); |
|||
List<Excelvo> selectWorkTotalByTime(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("conditions")String conditions,@Param("consultationMode")String consultationMode, @Param("categoryHospitalId")String categoryHospitalId ); |
|||
|
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyBModeSpecialist; |
|||
|
|||
public interface ApplyBModeSpecialistMapper extends BaseMapper<ApplyBModeSpecialist>{ |
|||
|
|||
List<Map<String,Object>> selectbySpe(@Param("startTime")String startTime, @Param("endTime")String endTime); |
|||
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyCaseImg; |
|||
|
|||
|
|||
public interface ApplyCaseImgMapper extends BaseMapper<ApplyCaseImg>{ |
|||
|
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyCase; |
|||
|
|||
public interface ApplyCaseMapper extends BaseMapper<ApplyCase>{ |
|||
|
|||
public List<ApplyCase> export(Map<String, Object> map); |
|||
|
|||
public List<ApplyCase> getExport(Map<String, Object> map); |
|||
|
|||
public List<ApplyCase> arrangeOutExport(Map<String, Object> map); |
|||
|
|||
public List<ApplyCase> arrangeGetExport(Map<String, Object> map); |
|||
|
|||
public List<ApplyCase> selectCasePage(Map<String, Object> map); |
|||
|
|||
public ApplyCase selectCaseById(Long id); |
|||
|
|||
public List<ApplyCase> selectAdminCasePage(Map<String, Object> map); |
|||
|
|||
public int selectUpWayReferralNumer(Map<String, Object> upWayReferralMap); |
|||
|
|||
public int selectDownWayReferralNumer(Map<String, Object> upWayReferralMap); |
|||
|
|||
public List<ApplyCase> selectCasePatient(Map<String, Object> map); |
|||
|
|||
public Boolean updateByHis(Map<String, Object> map2); |
|||
|
|||
public Map<String, Object> selectPatientById(Map<String, Object> map); |
|||
|
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyConsulationSpecialist; |
|||
|
|||
public interface ApplyConsulationSpecialistMapper extends BaseMapper<ApplyConsulationSpecialist>{ |
|||
|
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyConsultationImg; |
|||
|
|||
public interface ApplyConsultationImgMapper extends BaseMapper<ApplyConsultationImg> { |
|||
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyConsultation; |
|||
|
|||
|
|||
public interface ApplyConsultationMapper extends BaseMapper<ApplyConsultation>{ |
|||
|
|||
public List<ApplyConsultation> selectConByCategory(Map<String,Object> map); |
|||
|
|||
public List<ApplyConsultation> selectConPatient(Map<String,Object> map); |
|||
|
|||
public int selectConsultationNumer(Map<String, Object> downWayReferralMap); |
|||
|
|||
public List<ApplyConsultation> selectConsultationSpe(Map<String,Object> map); |
|||
|
|||
public List<ApplyConsultation> selectConByPage(Map<String,Object> map); |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package com.imurs.dao; |
|||
|
|||
|
|||
import java.util.Map; |
|||
|
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyDoctorPromote; |
|||
|
|||
|
|||
public interface ApplyDoctorPromoteMapper extends BaseMapper<ApplyDoctorPromote>{ |
|||
|
|||
|
|||
int selectrefresherCount(Map<String, Object> refresherNumerMap); |
|||
|
|||
public List<ApplyDoctorPromote> selectAdminPromote(Map<String, Object> map); |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyEcgImg; |
|||
|
|||
public interface ApplyEcgImgMapper extends BaseMapper<ApplyEcgImg>{ |
|||
|
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package com.imurs.dao; |
|||
|
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyEcg; |
|||
|
|||
public interface ApplyEcgMapper extends BaseMapper<ApplyEcg>{ |
|||
|
|||
public List<ApplyEcg> selectEcgPage(Map<String,Object> map); |
|||
|
|||
public List<ApplyEcg> selectEcgSpePage(Map<String,Object> map); |
|||
|
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyEcgSpecialist; |
|||
|
|||
public interface ApplyEcgSpecialistMapper extends BaseMapper<ApplyEcgSpecialist>{ |
|||
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyInformationImg; |
|||
|
|||
|
|||
public interface ApplyInformationImgMapper extends BaseMapper<ApplyInformationImg>{ |
|||
|
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyInformation; |
|||
|
|||
|
|||
public interface ApplyInformationMapper extends BaseMapper<ApplyInformation>{ |
|||
|
|||
List<ApplyInformation> selectHospitalList(String hospitalName); |
|||
|
|||
List<ApplyInformation> selectInfromationList(Map<String, Object> infromationMap); |
|||
|
|||
|
|||
List<ApplyInformation> findAifmAdminPage(Map<String, Object> map); |
|||
|
|||
|
|||
boolean updateByIds(List<ApplyInformation> applyInformation); |
|||
|
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyLis; |
|||
|
|||
public interface ApplyLisMapper extends BaseMapper<ApplyLis>{ |
|||
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyPathologyFile; |
|||
|
|||
public interface ApplyPathologyFileMapper extends BaseMapper<ApplyPathologyFile>{ |
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,8 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyPathologyImg; |
|||
|
|||
public interface ApplyPathologyImgMapper extends BaseMapper<ApplyPathologyImg>{ |
|||
|
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyPathology; |
|||
|
|||
|
|||
public interface ApplyPathologyMapper extends BaseMapper<ApplyPathology>{ |
|||
|
|||
public List<ApplyPathology> selectAphPage(Map<String, Object> map); |
|||
|
|||
public List<ApplyPathology> selectAphSpePage(Map<String, Object> map); |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplyPathologySpecialist; |
|||
|
|||
|
|||
public interface ApplyPathologySpecialistMapper extends BaseMapper<ApplyPathologySpecialist>{ |
|||
|
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.ApplySpecialist; |
|||
|
|||
public interface ApplySpecialistMapper extends BaseMapper<ApplySpecialist>{ |
|||
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.BModeReport; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
@Mapper |
|||
public interface BModeReportMapper extends BaseMapper<BModeReport> { |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.Bdiagnosis; |
|||
|
|||
public interface BdiagnosisMapper extends BaseMapper<Bdiagnosis> { |
|||
|
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
package com.imurs.dao; |
|||
|
|||
import java.util.List; |
|||
|
|||
import com.baomidou.mybatisplus.mapper.BaseMapper; |
|||
import com.imurs.entity.BdiagnosisNext; |
|||
|
|||
public interface BdiagnosisNextMapper extends BaseMapper<BdiagnosisNext> { |
|||
|
|||
List<BdiagnosisNext> selectDiagnosisList(Integer id); |
|||
|
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue