This commit is contained in:
parent
5ce3e291dc
commit
a4ac6b6652
|
|
@ -0,0 +1,50 @@
|
|||
package com.syjiaer.clinic.server.common.api.input.im3301;
|
||||
|
||||
import com.syjiaer.clinic.server.common.api.annotations.IMField;
|
||||
import com.syjiaer.clinic.server.common.api.input.BaseInputModel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/*
|
||||
* @Description 新疆地区特殊版本的3301
|
||||
* @Author 佟明轩
|
||||
* @Date 09:18 2025/5/30
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class IM3301 extends BaseInputModel {
|
||||
@IMField(key="fixmedins_hilist_id",name = "定点医药机构目录编号",required = true)
|
||||
private String fixmedinsHilistId;
|
||||
@IMField(key="fixmedins_hilist_name",name = "定点医药机构目录名称",required = true)
|
||||
private String fixmedinsHilistName;
|
||||
@IMField(key="list_type",name = "目录类别",required = true)
|
||||
private String listType;
|
||||
@IMField(key="med_list_codg",name = "医疗目录编码",required = true)
|
||||
private String medListCodg;
|
||||
@IMField(key="begndate",name = "开始日期",required = true)
|
||||
private LocalDateTime begndate;
|
||||
@IMField(key="enddate",name = "结束日期",required = true)
|
||||
private LocalDateTime enddate;
|
||||
@IMField(key="aprvno",name = "批准文号")
|
||||
private String aprvno;
|
||||
@IMField(key="dosform",name = "剂型")
|
||||
private String dosform;
|
||||
@IMField(key="exct_cont",name = "除外内容")
|
||||
private String exctCont;
|
||||
@IMField(key="item_cont",name = "项目内涵")
|
||||
private String itemCont;
|
||||
@IMField(key="prcunt",name = "计价单位")
|
||||
private String prcunt;
|
||||
@IMField(key="spec",name = "规格")
|
||||
private String spec;
|
||||
@IMField(key="pacspec",name = "包装规格")
|
||||
private String pacspec;
|
||||
@IMField(key="memo",name = "备注")
|
||||
private String memo;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.syjiaer.clinic.server.common.api.input.im3302;
|
||||
import com.syjiaer.clinic.server.common.api.input.BaseInputModel;
|
||||
import com.syjiaer.clinic.server.common.api.annotations.IMField;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class IM3302 extends BaseInputModel{
|
||||
@IMField(key="fixmedins_code",name = "定点医药机构编号",required = true)
|
||||
private String fixmedinsCode;
|
||||
@IMField(key="fixmedins_hilist_id",name = "定点医药机构目录编号",required = true)
|
||||
private String fixmedinsHilistId;
|
||||
@IMField(key="list_type",name = "目录类别",required = true)
|
||||
private String listType;
|
||||
@IMField(key="med_list_codg",name = "医疗目录编码",required = true)
|
||||
private String medListCodg;
|
||||
}
|
||||
|
|
@ -1,14 +1,19 @@
|
|||
package com.syjiaer.clinic.server.common.api.request;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.syjiaer.clinic.server.common.api.input.*;
|
||||
import com.syjiaer.clinic.server.common.api.input.im3301.IM3301;
|
||||
import com.syjiaer.clinic.server.common.api.input.im3302.IM3302;
|
||||
import com.syjiaer.clinic.server.common.api.output.*;
|
||||
import com.syjiaer.clinic.server.common.util.DebugUtil;
|
||||
import com.syjiaer.clinic.server.common.util.HttpUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
|
|
@ -262,4 +267,14 @@ public class SocialRequest {
|
|||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
public JSONObject call3301(List<Object> arrayList) {
|
||||
|
||||
return httpUtil.call("3301", "data", arrayList);
|
||||
}
|
||||
|
||||
public JSONObject call3302(IM3302 im3302) {
|
||||
|
||||
return httpUtil.call("3302", "data", im3302.buildToMap());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.syjiaer.clinic.server.common.enums;
|
||||
|
||||
public enum ListTypeEnum {
|
||||
WESTERN_MEDICINE(101, "西药中成药"),
|
||||
CHINESE_DECOCCTION_PIECES(102, "中药饮片"),
|
||||
CHINESE_DECOCCTION_PIECES_2(103, "中药饮片"),
|
||||
SELF_PREPARED(104, "自制剂"),
|
||||
NATIONAL_MEDICINE(105, "民族药"),
|
||||
SERVICE_ITEM(201, "服务项目"),
|
||||
MEDICAL_MATERIALS(301, "医用材料");
|
||||
|
||||
private final int codeValue;
|
||||
private final String codeName;
|
||||
|
||||
ListTypeEnum(int codeValue, String codeName) {
|
||||
this.codeValue = codeValue;
|
||||
this.codeName = codeName;
|
||||
}
|
||||
|
||||
public int getCodeValue() {
|
||||
return codeValue;
|
||||
}
|
||||
|
||||
public String getCodeName() {
|
||||
return codeName;
|
||||
}
|
||||
}
|
||||
|
|
@ -70,6 +70,8 @@ public class HttpUtil {
|
|||
String tempLine = null;
|
||||
|
||||
reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
|
||||
// reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "GBK"));
|
||||
|
||||
while ((tempLine = reader.readLine()) != null) {
|
||||
resultBuffer.append(tempLine);
|
||||
}
|
||||
|
|
@ -220,6 +222,16 @@ public class HttpUtil {
|
|||
JSONObject output = post(config.get("social", "url"), JSON.toJSONString(getparms(infno, tag, input)),timeout);
|
||||
return output;
|
||||
}
|
||||
public JSONObject call(String infno, String tag, List<Object> input) {
|
||||
|
||||
JSONObject output = post(config.get("social", "url"), JSON.toJSONString(getparms(infno, tag, input)),120000);
|
||||
return output;
|
||||
}
|
||||
public JSONObject call(String infno, String tag, List<Object> input,int timeout) {
|
||||
|
||||
JSONObject output = post(config.get("social", "url"), JSON.toJSONString(getparms(infno, tag, input)),timeout);
|
||||
return output;
|
||||
}
|
||||
|
||||
public JSONObject callBackMsgId(String infno, Map<String, Object> input,int timeout) {
|
||||
Map<String, Object> parmsMap = getparms(infno, input);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ public class ManagerUtil {
|
|||
ManagerUser managerUser = new ManagerUser();
|
||||
managerUser.setId(1);
|
||||
managerUser.setUsername("test");
|
||||
managerUser.setName("test");
|
||||
return managerUser;
|
||||
}
|
||||
Object managerId = map.get("manager_id");
|
||||
|
|
|
|||
|
|
@ -3,20 +3,19 @@ package com.syjiaer.clinic.server.entity.social;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
/**
|
||||
* <p>
|
||||
* 医保目录
|
||||
* </p>
|
||||
*
|
||||
* @author NiuZiYuan
|
||||
* @since 2025-04-17
|
||||
* @since 2025-05-30
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
@ -57,4 +56,7 @@ public class SocialDirectory implements Serializable {
|
|||
|
||||
@ApiModelProperty("json处理后的数据")
|
||||
private String data;
|
||||
|
||||
@ApiModelProperty("调用3301传递的本系统ID")
|
||||
private String compareCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,20 +5,19 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
/**
|
||||
* <p>
|
||||
* 医保服务项目目录1305,1320
|
||||
* </p>
|
||||
*
|
||||
* @author NiuZiYuan
|
||||
* @since 2025-04-25
|
||||
* @since 2025-05-30
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
@ -50,4 +49,7 @@ public class SocialItem implements Serializable {
|
|||
|
||||
@ApiModelProperty("数据修改时间")
|
||||
private LocalDateTime updateDatetime;
|
||||
|
||||
@ApiModelProperty("调用3301传递的本系统ID")
|
||||
private String compareCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,20 +2,29 @@ package com.syjiaer.clinic.server.service.item;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.syjiaer.clinic.server.common.api.input.im3301.IM3301;
|
||||
import com.syjiaer.clinic.server.common.api.input.im3302.IM3302;
|
||||
import com.syjiaer.clinic.server.common.api.request.SocialRequest;
|
||||
import com.syjiaer.clinic.server.common.config.Config;
|
||||
import com.syjiaer.clinic.server.common.enums.ChrgitmLvEnum;
|
||||
import com.syjiaer.clinic.server.common.exception.MessageException;
|
||||
import com.syjiaer.clinic.server.common.util.DebugUtil;
|
||||
import com.syjiaer.clinic.server.common.util.PinYinUtil;
|
||||
import com.syjiaer.clinic.server.common.vo.Page;
|
||||
import com.syjiaer.clinic.server.entity.goods.Goods;
|
||||
import com.syjiaer.clinic.server.entity.item.Item;
|
||||
import com.syjiaer.clinic.server.entity.item.ItemGroupList;
|
||||
import com.syjiaer.clinic.server.entity.item.param.ItemParam;
|
||||
import com.syjiaer.clinic.server.entity.item.vo.ItemSearchVo;
|
||||
import com.syjiaer.clinic.server.entity.manager.ManagerUser;
|
||||
import com.syjiaer.clinic.server.entity.social.SocialDirectory;
|
||||
import com.syjiaer.clinic.server.entity.social.SocialDirectoryUpinfo;
|
||||
import com.syjiaer.clinic.server.entity.social.SocialItem;
|
||||
import com.syjiaer.clinic.server.mapper.goods.GoodsMapper;
|
||||
import com.syjiaer.clinic.server.mapper.item.ItemGroupListMapper;
|
||||
import com.syjiaer.clinic.server.mapper.item.ItemMapper;
|
||||
import com.syjiaer.clinic.server.mapper.social.SocialDirectoryMapper;
|
||||
import com.syjiaer.clinic.server.mapper.social.SocialDirectoryUpinfoMapper;
|
||||
import com.syjiaer.clinic.server.mapper.social.SocialItemMapper;
|
||||
import com.syjiaer.clinic.server.service.BaseService;
|
||||
|
|
@ -31,6 +40,7 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
|
|
@ -46,6 +56,15 @@ public class ItemService extends BaseService {
|
|||
@Autowired
|
||||
private SocialItemMapper socialItemMapper;
|
||||
|
||||
@Autowired
|
||||
private GoodsMapper goodsMapper;
|
||||
@Autowired
|
||||
private SocialDirectoryMapper socialDirectoryMapper;
|
||||
@Autowired
|
||||
private SocialRequest socialRequest;
|
||||
@Autowired
|
||||
private Config config;
|
||||
|
||||
/*
|
||||
* 获取项目列表
|
||||
* @param pageNum 页码
|
||||
|
|
@ -386,4 +405,204 @@ public class ItemService extends BaseService {
|
|||
itemGroupListUpdateWrapper.set("del_flag",true);
|
||||
itemGroupListMapper.update(itemGroupListUpdateWrapper);
|
||||
}
|
||||
|
||||
/*
|
||||
* @Description 组织数据调用3301接口并且更新social_item或social_directory表
|
||||
* @Author 佟明轩
|
||||
* @Date 10:19 2025/5/30
|
||||
* @param code 医保目录编号
|
||||
* @param type goods:商品 item:诊疗项目 item_group_list:组套
|
||||
* goods 查询goods表
|
||||
* item 查询item表
|
||||
* item_group_list 查询item_group_list表
|
||||
* @param createOrDelete create:新增 delete:删除
|
||||
* @return
|
||||
**/
|
||||
public HashMap<String,Object> call3301(String code,String type,String createOrDelete) {
|
||||
|
||||
log.info("call3301:接收到数据:code:{}:type:{}:createOrDelete:{}",code,type,createOrDelete);
|
||||
|
||||
HashMap<String,Object> resultMap = new HashMap<>();
|
||||
|
||||
resultMap.put("createOrDelete",createOrDelete);
|
||||
|
||||
QueryWrapper<SocialItem> socialItemQueryWrapper = new QueryWrapper<>();
|
||||
socialItemQueryWrapper.eq("code",code);
|
||||
socialItemQueryWrapper.last("limit 1");
|
||||
|
||||
QueryWrapper<SocialDirectory> directoryQueryWrapper = new QueryWrapper<>();
|
||||
directoryQueryWrapper.eq("code",code);
|
||||
directoryQueryWrapper.last("limit 1");
|
||||
|
||||
//请求入参目录类别
|
||||
String requestListType = "";
|
||||
//查询3301编号是否存在已及更新的表
|
||||
String handleTable = "social_item";
|
||||
//自己系统的自增ID
|
||||
String selfId = "";
|
||||
//自己系统的名称
|
||||
String selfName = "";
|
||||
|
||||
if (type.equals("goods")) {
|
||||
QueryWrapper<Goods> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("hilist_code",code);
|
||||
queryWrapper.last(" limit 1");
|
||||
|
||||
|
||||
|
||||
Goods goods = goodsMapper.selectOne(queryWrapper);
|
||||
|
||||
if (goods == null) {
|
||||
throw new MessageException("商品医保编码不存在");
|
||||
}
|
||||
|
||||
//1301 西药中成药
|
||||
//1302 中药饮片
|
||||
//1306 医用材料
|
||||
requestListType = switch (goods.getType()) {
|
||||
case 1301 -> "101";
|
||||
case 1302 -> "102";
|
||||
case 1306 -> "301";
|
||||
default -> requestListType;
|
||||
};
|
||||
|
||||
handleTable = "social_directory";
|
||||
selfId = "sd_"+goods.getId().toString();
|
||||
selfName = goods.getName();
|
||||
} else if (type.equals("item")) {
|
||||
QueryWrapper<Item> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("social_code",code);
|
||||
queryWrapper.last(" limit 1");
|
||||
Item item = itemMapper.selectOne(queryWrapper);
|
||||
if (item == null) {
|
||||
throw new MessageException("诊疗项目医保编码不存在");
|
||||
}
|
||||
|
||||
//全部对应服务项目
|
||||
requestListType = "201";
|
||||
|
||||
selfId = "i_"+item.getId().toString();
|
||||
selfName = item.getName();
|
||||
|
||||
}else if (type.equals("item_group_list")) {
|
||||
QueryWrapper<ItemGroupList> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("social_code",code);
|
||||
queryWrapper.last(" limit 1");
|
||||
ItemGroupList itemGroupListInfo = itemGroupListMapper.selectOne(queryWrapper);
|
||||
if (itemGroupListInfo == null) {
|
||||
throw new MessageException("组套医保编码不存在");
|
||||
}
|
||||
|
||||
//全部对应服务项目
|
||||
requestListType = "201";
|
||||
selfId = "igl_"+itemGroupListInfo.getId().toString();
|
||||
selfName = itemGroupListInfo.getName();
|
||||
}
|
||||
|
||||
|
||||
if (requestListType.isEmpty()) {
|
||||
throw new MessageException("请求参数错误");
|
||||
}
|
||||
|
||||
|
||||
if (handleTable.equals("social_directory")) {
|
||||
SocialDirectory socialDirectory = socialDirectoryMapper.selectOne(directoryQueryWrapper);
|
||||
|
||||
if (socialDirectory == null) {
|
||||
throw new MessageException("医保目录编码不存在");
|
||||
}
|
||||
|
||||
//当前商品已经处设置过compareCode socialDirectory.getCompareCode()!=""
|
||||
|
||||
|
||||
if (socialDirectory.getCompareCode()!=null && !socialDirectory.getCompareCode().isEmpty() && !Objects.equals(createOrDelete, "delete")) {
|
||||
|
||||
System.out.println(socialDirectory.getCompareCode());
|
||||
|
||||
log.info("call3301:socialDirectory已存在compareCode:code:{}:compareCode:{}",code,socialDirectory.getCompareCode());
|
||||
|
||||
resultMap.put("compareCode",socialDirectory.getCompareCode());
|
||||
return resultMap;
|
||||
}
|
||||
}else{
|
||||
SocialItem socialItem = socialItemMapper.selectOne(socialItemQueryWrapper);
|
||||
|
||||
if (socialItem == null) {
|
||||
throw new MessageException("诊疗项目-医保目录编码不存在");
|
||||
}
|
||||
|
||||
if (socialItem.getCompareCode()!=null && !socialItem.getCompareCode().isEmpty() && !Objects.equals(createOrDelete, "delete")) {
|
||||
|
||||
log.info("call3301:socialItem已存在compareCode:code:{}:compareCode:{}",code,socialItem.getCompareCode());
|
||||
|
||||
resultMap.put("compareCode",socialItem.getCompareCode());
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
||||
if (createOrDelete.equals("delete"))
|
||||
{
|
||||
|
||||
if (handleTable.equals("social_directory")) {
|
||||
//更新socialDirectoryMapper中compareCode字段为空
|
||||
socialDirectoryMapper.update(
|
||||
new SocialDirectory(),
|
||||
new UpdateWrapper<SocialDirectory>().set("compare_code","").eq("code",code)
|
||||
);
|
||||
}else{
|
||||
//更新socialItemMapper中compareCode字段为空
|
||||
socialItemMapper.update(
|
||||
new SocialItem(),
|
||||
new UpdateWrapper<SocialItem>().set("compare_code","").eq("code",code)
|
||||
);
|
||||
}
|
||||
|
||||
IM3302 iM3302 = new IM3302();
|
||||
iM3302.setFixmedinsCode(config.get("social","msgid"));
|
||||
iM3302.setFixmedinsHilistId(selfId);
|
||||
iM3302.setListType(requestListType);
|
||||
iM3302.setMedListCodg(code);
|
||||
|
||||
socialRequest.call3302(iM3302);
|
||||
|
||||
log.info("call3302:socialItem删除compareCode:code:{}:compareCode:{}",code,selfId);
|
||||
|
||||
resultMap.put("compareCode",code);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
IM3301 iM3301 = new IM3301();
|
||||
iM3301.setFixmedinsHilistId(selfId);
|
||||
iM3301.setFixmedinsHilistName(selfName);
|
||||
iM3301.setListType(requestListType);
|
||||
iM3301.setMedListCodg(code);
|
||||
iM3301.setBegndate(LocalDateTime.of(2025,1,1,0,0,0));
|
||||
iM3301.setEnddate(LocalDateTime.of(2050,1,1,0,0,0));
|
||||
|
||||
List<Object> list = new ArrayList<>();
|
||||
list.add(iM3301.buildToMap());
|
||||
|
||||
socialRequest.call3301(list);
|
||||
|
||||
if (handleTable.equals("social_directory")) {
|
||||
//更新socialDirectoryMapper中compareCode字段为code
|
||||
UpdateWrapper<SocialDirectory> socialDirectoryUpdateWrapper = new UpdateWrapper<>();
|
||||
socialDirectoryUpdateWrapper.eq("code",code);
|
||||
socialDirectoryUpdateWrapper.set("compare_code",selfId);
|
||||
socialDirectoryMapper.update(socialDirectoryUpdateWrapper);
|
||||
log.info("call3301:socialDirectoryMapper更新compareCode:code:{}:compareCode:{}",code,code);
|
||||
}else{
|
||||
//更新socialItemMapper中compareCode字段为code
|
||||
UpdateWrapper<SocialItem> socialItemUpdateWrapper = new UpdateWrapper<>();
|
||||
socialItemUpdateWrapper.eq("code",code);
|
||||
socialItemUpdateWrapper.set("compare_code",selfId);
|
||||
socialItemMapper.update(socialItemUpdateWrapper);
|
||||
log.info("call3301:socialItemMapper更新compareCode:code:{}:compareCode:{}",code,code);
|
||||
}
|
||||
|
||||
resultMap.put("compareCode",code);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue