|
@ -0,0 +1,387 @@
|
|
|
|
package com.yihu.jw.entrance.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
|
|
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
import net.sf.json.JSON;
|
|
|
|
import net.sf.json.JSONArray;
|
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by zdm on 2019/5/16.
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping(value ="/mqsdk")
|
|
|
|
@Api(value = "his信息获取解析", description = "his信息获取解析", tags = {"hospital-entrance基础服务"})
|
|
|
|
public class MqSdkController extends EnvelopRestEndpoint {
|
|
|
|
private boolean testProfiles=false;
|
|
|
|
@Autowired
|
|
|
|
private EntranceService entranceService;
|
|
|
|
@Value("${demo.flag}")
|
|
|
|
private boolean demoFlag;
|
|
|
|
|
|
|
|
@GetMapping(value = "/BS15017")
|
|
|
|
@ApiOperation(value = "固定入参:门诊余额查询")
|
|
|
|
public ObjEnvelop BS15017(
|
|
|
|
@ApiParam(name = "cardNo", value = "卡号", required = true)
|
|
|
|
@RequestParam(value = "cardNo") String cardNo) {
|
|
|
|
try {
|
|
|
|
String obj = entranceService.qutpatientBalance(cardNo,demoFlag);
|
|
|
|
return convertObjectEnvelopByString(obj);
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
return ObjEnvelop.getError("获取失败"+e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "/BS15018")
|
|
|
|
@ApiOperation(value = "固定入参:门诊就诊卡列表")
|
|
|
|
public ListEnvelop BS15018(
|
|
|
|
@ApiParam(name = "socialNo", value = "身份证号", required = false)
|
|
|
|
@RequestParam(value = "socialNo",required = false) String socialNo,
|
|
|
|
@ApiParam(name = "cardNo", value = "就诊卡号", required = false)
|
|
|
|
@RequestParam(value = "cardNo",required = false) String cardNo) throws Exception {
|
|
|
|
String obj = entranceService.BS15018(socialNo, cardNo, demoFlag);
|
|
|
|
return convertListEnvelopByString(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "/BS16017")
|
|
|
|
@ApiOperation(value = "根据流水号或者居民id查找门诊处方信息(所有处方)")
|
|
|
|
public ListEnvelop BS16017(
|
|
|
|
@ApiParam(name = "registerSn", value = "流水号", required = false)
|
|
|
|
@RequestParam(value = "registerSn",required = false) String registerSn,
|
|
|
|
@ApiParam(name = "patNo", value = "病人id", required = false)
|
|
|
|
@RequestParam(value = "patNo",required = false) String patNo,
|
|
|
|
@ApiParam(name = "admNo", value = "住院唯一号", required = false)
|
|
|
|
@RequestParam(value = "admNo",required = false) String admNo) throws Exception {
|
|
|
|
String obj = entranceService.BS16017(registerSn, patNo, admNo, demoFlag);
|
|
|
|
return convertListEnvelopInBodyRow(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "/BS30025")
|
|
|
|
@ApiOperation(value = " 查询某个时间段的患者门诊就诊记录 V1.00")
|
|
|
|
public ListEnvelop BS30025(@ApiParam(name = "patNo", value = "居民id")
|
|
|
|
@RequestParam(value = "patNo",required = false) String patNo,
|
|
|
|
@ApiParam(name = "admNo", value = "就诊唯一号")
|
|
|
|
@RequestParam(value = "admNo",required = false) String admNo,
|
|
|
|
@ApiParam(name = "registerSn", value = "流水号(处方号)")
|
|
|
|
@RequestParam(value = "registerSn",required = false) String registerSn,
|
|
|
|
@ApiParam(name = "patCardNo", value = "卡号")
|
|
|
|
@RequestParam(value = "patCardNo",required = false) String patCardNo,
|
|
|
|
@ApiParam(name = "socialNo", value = "身份证号")
|
|
|
|
@RequestParam(value = "socialNo",required = false) String socialNo) throws Exception {
|
|
|
|
String obj = entranceService.BS30025(patNo, admNo, registerSn, patCardNo, socialNo, demoFlag);
|
|
|
|
return convertListEnvelopInRow(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "/MS30001")
|
|
|
|
@ApiOperation(value = "医院药品字典 V1.00--弃用")
|
|
|
|
public ListEnvelop MS30001(@ApiParam(name = "DRUG_CODE", value = "字典编码")
|
|
|
|
@RequestParam(value = "DRUG_CODE", required = false) String DRUG_CODE,
|
|
|
|
@ApiParam(name = "startTime", value = "就诊开始时间")
|
|
|
|
@RequestParam(value = "startTime", required = false) String startTime) throws Exception{
|
|
|
|
String obj= entranceService.MS30001();
|
|
|
|
return convertListEnvelopInBody(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/MS53001")
|
|
|
|
@ApiOperation(value = " 医院药品字典")
|
|
|
|
public ListEnvelop MS53001(@ApiParam(name = "chargeCode", value = "收费码")
|
|
|
|
@RequestParam(value = "chargeCode", required = false) String chargeCode,
|
|
|
|
@ApiParam(name = "pyCode", value = "拼音码")
|
|
|
|
@RequestParam(value = "pyCode", required = false) String pyCode,
|
|
|
|
@ApiParam(name = "stockAmount", value = "库存")
|
|
|
|
@RequestParam(value = "stockAmount", required = false) String stockAmount,
|
|
|
|
@ApiParam(name = "visibleFlag", value = "可用标志(0可用1不可用)")
|
|
|
|
@RequestParam(value = "visibleFlag", required = false) String visibleFlag)throws Exception{
|
|
|
|
String obj= entranceService.MS53001(chargeCode,pyCode,stockAmount,visibleFlag,demoFlag);
|
|
|
|
return convertListEnvelopInBodyRow(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "/BS10110")
|
|
|
|
@ApiOperation(value = "门诊给药方式")
|
|
|
|
public ListEnvelop BS10110(
|
|
|
|
@ApiParam(name = "supplyCode", value = "编码")
|
|
|
|
@RequestParam(value = "supplyCode", required = false) String supplyCode) throws Exception{
|
|
|
|
String obj= entranceService.BS10110(supplyCode,demoFlag);
|
|
|
|
return convertListEnvelopInBodyRow(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping(value = "/BS10111")
|
|
|
|
@ApiOperation(value = " 线上挂号接口")
|
|
|
|
public ObjEnvelop BS10111(
|
|
|
|
@ApiParam(name = "cardNo", value = "卡号")
|
|
|
|
@RequestParam(value = "cardNo", required = false) String cardNo,
|
|
|
|
@ApiParam(name = "doctor", value = "医生工号")
|
|
|
|
@RequestParam(value = "doctor", required = false) String doctor,
|
|
|
|
@ApiParam(name = "dept", value = "科室编码")
|
|
|
|
@RequestParam(value = "dept", required = false) String dept,
|
|
|
|
@ApiParam(name = "chargeType", value = "号别")
|
|
|
|
@RequestParam(value = "chargeType", required = false) String chargeType,
|
|
|
|
@ApiParam(name = "winNo", value = "分部号")
|
|
|
|
@RequestParam(value = "winNo", required = false) String winNo) throws Exception {
|
|
|
|
String obj = entranceService.BS10111(cardNo, doctor, dept, chargeType, winNo,demoFlag);
|
|
|
|
return convertListEnvelopInRequest(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
//多个前端使用json传参
|
|
|
|
@PostMapping(value = "/BS10112")
|
|
|
|
@ApiOperation(value = "线上处方接口")
|
|
|
|
public ObjEnvelop BS10112(
|
|
|
|
@ApiParam(name = "cardNo", value = "卡号")
|
|
|
|
@RequestParam(value = "cardNo", required = true) String cardNo,
|
|
|
|
@ApiParam(name = "doctor", value = "医生工号")
|
|
|
|
@RequestParam(value = "doctor", required = true) String doctor,
|
|
|
|
@ApiParam(name = "dept", value = "科室编码")
|
|
|
|
@RequestParam(value = "dept", required = true) String dept,
|
|
|
|
@ApiParam(name = "chargeCode", value = "收费码")
|
|
|
|
@RequestParam(value = "chargeCode", required = true) String chargeCode,
|
|
|
|
@ApiParam(name = "winNo", value = "分部号")
|
|
|
|
@RequestParam(value = "winNo", required = true) String winNo,
|
|
|
|
@ApiParam(name = "chargeFlag", value = "项目类别")
|
|
|
|
@RequestParam(value = "chargeFlag", required = true) String chargeFlag,
|
|
|
|
@ApiParam(name = "quantity", value = "数量")
|
|
|
|
@RequestParam(value = "quantity", required = true) String quantity,
|
|
|
|
@ApiParam(name = "serialNo", value = "挂号流水号")
|
|
|
|
@RequestParam(value = "serialNo", required = true) String serialNo,
|
|
|
|
@ApiParam(name = "groupNo", value = "库房号")
|
|
|
|
@RequestParam(value = "groupNo", required = true) String groupNo,
|
|
|
|
@ApiParam(name = "serial", value = "药品序列号")
|
|
|
|
@RequestParam(value = "serial", required = true) String serial,
|
|
|
|
@ApiParam(name = "icdCode", value = "主诊断编码")
|
|
|
|
@RequestParam(value = "icdCode", required = true) String icdCode,
|
|
|
|
@ApiParam(name = "diagTwo", value = "第二诊断")
|
|
|
|
@RequestParam(value = "diagTwo", required = false) String diagTwo,
|
|
|
|
@ApiParam(name = "diagThree", value = "第三诊断")
|
|
|
|
@RequestParam(value = "diagThree", required = false) String diagThree,
|
|
|
|
@ApiParam(name = "diagFour", value = "第四诊断")
|
|
|
|
@RequestParam(value = "diagFour", required = false) String diagFour,
|
|
|
|
@ApiParam(name = "diagFive", value = "第五诊断")
|
|
|
|
@RequestParam(value = "diagFive", required = false) String diagFive,
|
|
|
|
@ApiParam(name = "dosage", value = "用量")
|
|
|
|
@RequestParam(value = "dosage", required = false) String dosage,
|
|
|
|
@ApiParam(name = "unit", value = "用量单位")
|
|
|
|
@RequestParam(value = "unit", required = false) String unit,
|
|
|
|
@ApiParam(name = "usage", value = "频率")
|
|
|
|
@RequestParam(value = "usage", required = false) String usage,
|
|
|
|
@ApiParam(name = "supplyCode", value = "用法")
|
|
|
|
@RequestParam(value = "supplyCode", required = false) String supplyCode,
|
|
|
|
@ApiParam(name = "days", value = "天数")
|
|
|
|
@RequestParam(value = "days", required = false) String days,
|
|
|
|
@ApiParam(name = "frequency", value = "组号")
|
|
|
|
@RequestParam(value = "frequency", required = false) String frequency) throws Exception {
|
|
|
|
//TODO 处理多条药品
|
|
|
|
String obj = entranceService.BS10112(cardNo, doctor, dept, chargeCode, winNo, chargeFlag, quantity, serialNo, groupNo,
|
|
|
|
serial, icdCode, diagTwo, diagThree, diagFour, diagFive, dosage, unit, usage, supplyCode, days, frequency,demoFlag);
|
|
|
|
return convertListEnvelopInRequest(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/BS10114")
|
|
|
|
@ApiOperation(value = "医生挂号权限查询接口 ")
|
|
|
|
public ListEnvelop BS10114(
|
|
|
|
@ApiParam(name = "doctorCode", value = "医生工号")
|
|
|
|
@RequestParam(value = "doctorCode", required = false) String doctorCode,
|
|
|
|
@ApiParam(name = "dept", value = "科室编码")
|
|
|
|
@RequestParam(value = "dept", required = false) String dept,
|
|
|
|
@ApiParam(name = "chargeType", value = "号别编码")
|
|
|
|
@RequestParam(value = "chargeType", required = false) String chargeType,
|
|
|
|
@ApiParam(name = "winNo", value = "分部号")
|
|
|
|
@RequestParam(value = "winNo", required = false) String winNo) throws Exception {
|
|
|
|
String obj = entranceService.BS10114(doctorCode, dept, chargeType, winNo,demoFlag);
|
|
|
|
return convertListEnvelopInBodyRow(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "/MS02001")
|
|
|
|
@ApiOperation(value = "科室字典 ")
|
|
|
|
public ListEnvelop MS02001() throws Exception {
|
|
|
|
String obj = entranceService.MS02001(demoFlag);
|
|
|
|
//TODO 待解析 存储入库
|
|
|
|
return convertListEnvelopInBody(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "/MS02013")
|
|
|
|
@ApiOperation(value = "号别字典接口 ")
|
|
|
|
public ListEnvelop MS02013() throws Exception {
|
|
|
|
String obj = entranceService.MS02013(demoFlag);
|
|
|
|
return convertListEnvelopInBodyRow(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "/MS30012")
|
|
|
|
@ApiOperation(value = "医院频次")
|
|
|
|
public ListEnvelop MS30012() throws Exception {
|
|
|
|
String obj = entranceService.MS30012(demoFlag);
|
|
|
|
return convertListEnvelopInBody(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/MS25001")
|
|
|
|
@ApiOperation(value = "Icd10诊断编码")
|
|
|
|
public ListEnvelop MS25001( @ApiParam(name = "pyCode", value = "拼音码")
|
|
|
|
@RequestParam(value = "pyCode", required = false) String pyCode)throws Exception {
|
|
|
|
String obj = entranceService.MS25001(pyCode,demoFlag);
|
|
|
|
return convertListEnvelopInBodyRow(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 返回单个对象数据解析
|
|
|
|
* @param obj
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public ObjEnvelop convertObjectEnvelopByString(String obj)throws Exception{
|
|
|
|
JSONObject jsonObject=JSONObject.fromObject(obj);
|
|
|
|
if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
|
|
|
|
JSONObject jsonObjectMgsInfo=(JSONObject)jsonObject.get("MsgInfo");
|
|
|
|
if(null!=jsonObjectMgsInfo){
|
|
|
|
return ObjEnvelop.getSuccess("获取成功",jsonObjectMgsInfo.get("Msg").toString());
|
|
|
|
}else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
return ObjEnvelop.getError("获取失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 返回对象数组数据解析
|
|
|
|
* @param obj
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public ListEnvelop convertListEnvelopByString(String obj)throws Exception{
|
|
|
|
JSONObject jsonObject=JSONObject.fromObject(obj);
|
|
|
|
if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
|
|
|
|
JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
|
|
|
|
if(null!=jsonObjectMgsInfo){
|
|
|
|
return success(jsonObjectMgsInfo);
|
|
|
|
}else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 返回对象数组数据解析
|
|
|
|
* @param obj
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public ListEnvelop convertListEnvelopInBodyRow(String obj)throws Exception{
|
|
|
|
JSONObject jsonObject=JSONObject.fromObject(obj);
|
|
|
|
JSONArray jsonArray=new JSONArray();
|
|
|
|
if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
|
|
|
|
JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
|
|
|
|
if(null!=jsonObjectMgsInfo){
|
|
|
|
for (Object object : jsonObjectMgsInfo) {
|
|
|
|
JSONObject jsonObjectBody=(JSONObject)object;
|
|
|
|
jsonObjectBody= (JSONObject)jsonObjectBody.get("body");
|
|
|
|
if(null!=jsonObjectBody){
|
|
|
|
jsonArray.add(jsonObjectBody.get("row")) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return success(jsonArray);
|
|
|
|
}else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 返回对象数组数据解析
|
|
|
|
* @param obj
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public ListEnvelop convertListEnvelopInRow(String obj)throws Exception{
|
|
|
|
JSONObject jsonObject=JSONObject.fromObject(obj);
|
|
|
|
JSONArray jsonArray=new JSONArray();
|
|
|
|
if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
|
|
|
|
JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
|
|
|
|
if(null!=jsonObjectMgsInfo){
|
|
|
|
for (Object object : jsonObjectMgsInfo) {
|
|
|
|
JSONObject jsonObjectBody=(JSONObject)object;
|
|
|
|
if(null!=jsonObjectBody){
|
|
|
|
jsonArray.add(jsonObjectBody.get("row")) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return success(jsonArray);
|
|
|
|
}else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 返回对象数组数据解析
|
|
|
|
* @param obj
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public ListEnvelop convertListEnvelopInBody(String obj)throws Exception{
|
|
|
|
JSONObject jsonObject=JSONObject.fromObject(obj);
|
|
|
|
JSONArray jsonArray=new JSONArray();
|
|
|
|
if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
|
|
|
|
JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
|
|
|
|
if(null!=jsonObjectMgsInfo){
|
|
|
|
for (Object object : jsonObjectMgsInfo) {
|
|
|
|
JSONObject jsonObjectBody=(JSONObject)object;
|
|
|
|
Object objectBody=jsonObjectBody.get("body");
|
|
|
|
if(objectBody instanceof JSONArray){
|
|
|
|
net.sf.json.JSONArray jsonArrayBody = (net.sf.json.JSONArray) jsonObjectBody.get("body");
|
|
|
|
for (Object objectBodySub : jsonArrayBody) {
|
|
|
|
jsonArray.add(objectBodySub);
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
jsonArray.add(jsonObjectBody) ;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return success(jsonArray);
|
|
|
|
}else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 返回对象数组数据解析
|
|
|
|
* @param obj
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public ObjEnvelop convertListEnvelopInRequest(String obj)throws Exception{
|
|
|
|
JSONObject jsonObject=JSONObject.fromObject(obj);
|
|
|
|
if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
|
|
|
|
JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
|
|
|
|
if(null!=jsonObjectMgsInfo){
|
|
|
|
for (Object object : jsonObjectMgsInfo) {
|
|
|
|
JSONObject jsonObjectBody = (JSONObject) object;
|
|
|
|
return ObjEnvelop.getSuccess("获取成功", jsonObjectBody.get("resquest"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|