1.1新增处方表
CREATE TABLE `tb_prescription` (`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',`account_id` int(11) DEFAULT NULL COMMENT '医生id',`patient_id` int(11) DEFAULT NULL COMMENT '患者id',`goods_id` int(11) DEFAULT NULL COMMENT '药品id',`count` int(11) DEFAULT NULL COMMENT '数量',`status` tinyint(1) DEFAULT '0' COMMENT '分享状态 0:未处理,1已处理',`is_deleted` tinyint(1) DEFAULT '0' COMMENT '是否删除 0:否,1:是',`gmt_created` timestamp NULL DEFAULT NULL COMMENT '创建时间',`gmt_modified` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分享处方单表';
1.2新增同步阿康药品表
CREATE TABLE `tb_sys_drug` (`goods_id` int(11) NOT NULL COMMENT '商品id',`bar_code` varchar(255) DEFAULT NULL COMMENT '条码',`goods_name` varchar(32) DEFAULT NULL COMMENT '商品名',`goods_type` varchar(64) DEFAULT NULL COMMENT '商品规格',`goods_unit` varchar(64) DEFAULT NULL COMMENT '商品单位',`goods_current_name` varchar(32) DEFAULT NULL COMMENT '通用名',`price` int(11) DEFAULT NULL COMMENT '价格',`availableqty` int(11) DEFAULT NULL COMMENT '数量',`factory_name` varchar(64) DEFAULT NULL COMMENT '生产厂家',`prod_date` datetime DEFAULT NULL COMMENT '生产日期',`invaild_date` varchar(8) DEFAULT NULL COMMENT '有效期',`lot_no` varchar(64) DEFAULT NULL COMMENT '批文',`approve_doc_no` varchar(64) DEFAULT NULL COMMENT '批准文号',`pro_place` varchar(255) DEFAULT NULL COMMENT '生产地',`ks` varchar(16) DEFAULT NULL COMMENT '科室',`otc_flag` tinyint(4) DEFAULT NULL COMMENT '是否处方:0:处方,1:非处方甲类,2非处方乙类',`cold_flag` tinyint(4) DEFAULT NULL COMMENT '是否冷链:0:否冷链,1:冷链',`pinyin` varchar(64) DEFAULT NULL COMMENT '拼音简写',PRIMARY KEY (`goods_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='阿康数据同步表';
1.3 修改表结构
修改goods表
alter table goods add column pinyin varchar(256) default null comment '拼音简写'
2.新增接口
2.1
/*** 获取常用药列表*/@GetMapping("/getCommonDrugsList")@ResponseBodypublic UpmsResult getCommonDrugsList(@RequestParam("doctorId") int doctorId,@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {DrugDetailVo drugDetailVo = new DrugDetailVo();return new UpmsResult(UpmsResultConstant.SUCCESS_NEW, drugDetailVo);}
public class DrugDetailVo {private Integer goodsId;/*** 药品名称*/private String name;/*** 库存*/private Integer stock;/*** 价格*/private BigDecimal price;/*** 药品图片*/private String drugImage;/*** 生产厂家*/private String manufacturer;}
2.2新增或者修改购物车
/*** 新增或者修改购物车*/@PostMapping("/saveOrUpdateShoppingCart")@ResponseBodypublic UpmsResult saveOrUpdateShoppingCart(@RequestParam(value = "doctorId",required = false) int doctorId,@RequestParam(value = "patientId",required = false) int patientId,@RequestParam(value = "shoppingCartId",required = false) int shoppingCartId,@RequestParam(value = "count",required = false) int count ,@RequestParam(value = "goodsId",required = false) int goodsId){if (shoppingCartId == 0) {return new UpmsResult(UpmsResultConstant.SUCCESS_NEW, "新增购物车成功");} else if (count == 0) {return new UpmsResult(UpmsResultConstant.SUCCESS_NEW, "删除购物车成功");}return new UpmsResult(UpmsResultConstant.SUCCESS_NEW, "修改购物车成功");}
2.3购物车列表展示
/*** 购物车列表展示*/@PostMapping("/getShoppingCartList")@ResponseBodypublic UpmsResult getShoppingCartList(@RequestParam(value = "doctorId") int doctorId,@RequestParam(value = "patientId") int patientId,@RequestParam("userType") Integer userType,@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){return new UpmsResult(UpmsResultConstant.SUCCESS_NEW, ShoppingCartVo);}
public class ShoppingCartVo {private List<DrugDetailVo> drugDetailVoList;private Integer totalCount;private BigDecimal totalPrice;}
2.4 分享商品列表(修改)
@ApiOperation(value = "分享商品列表")@RequestMapping(value = "/goodList", method = {RequestMethod.GET, RequestMethod.POST})@ResponseBodypublic UpmsResult listBySort(@RequestParam(required = false, defaultValue = "1", value = "pagenum") int pagenum,@RequestParam(required = false, defaultValue = "10", value = "pagesize") int pagesize,@RequestParam(required = false, defaultValue = "0", value = "type") int type,@RequestParam(required = false, value = "name") String name,@RequestParam(required = false, defaultValue = "0", value = "sort") int sort) {
2.5 地址管理
@ApiOperation(value = "公众号粉丝收货地址列表")@RequestMapping(value = "/list", method = RequestMethod.GET)@ResponseBodypublic Object list() {Map<String, Object> data = mpUserAddressService.list();if(data != null) {return new UpmsResult(UpmsResultConstant.SUCCESS, data);}else {_log.error("xiaoc>> 公众号粉丝收货地址列表查询失败");return new UpmsResult(UpmsResultConstant.FAILED, "查询失败");}}@ApiOperation(value = "公众号粉丝收货地址信息详细")@RequestMapping(value = "/info/{id}", method = RequestMethod.POST)@ResponseBodypublic Object info(@PathVariable("id") int id) {Object data = mpUserAddressService.info(id);return new UpmsResult(UpmsResultConstant.SUCCESS, data);}@ApiOperation(value = "新增公众号粉丝收货地址页")@RequestMapping(value = "/create", method = RequestMethod.GET)public String create() {return "/wxpublic/mpuseraddress/create.jsp";}@ApiOperation(value = "新增公众号粉丝收货地址")@RequestMapping(value = "/create", method = RequestMethod.POST)@ResponseBodypublic Object create(MpUserAddress mpUserAddress) {mpUserAddress.setId(null);mpUserAddress.setOpenid(getUpmsUserInfo().getAccount());mpUserAddress.setCtime(new Date());mpUserAddress.setDefaulttime(mpUserAddress.getCtime());mpUserAddressService.create(mpUserAddress);return new UpmsResult(UpmsResultConstant.SUCCESS, null);}@ApiOperation(value = "修改公众号粉丝地址")@RequestMapping(value = "/update", method = RequestMethod.POST)@ResponseBodypublic Object update(MpUserAddress mpUserAddress) {if(mpUserAddress.getId() == null || mpUserAddress.getId() <= 0) {_log.info("xiaoc>> 修改公众号粉丝地址,无效的请求参数id: {}", mpUserAddress.getId());return new UpmsResult(UpmsResultConstant.FAILED, "无效的请求参数id");}// 设置不可修改值mpUserAddress.setOpenid(getUpmsUserInfo().getAccount());mpUserAddress.setCtime(null);mpUserAddressService.updateByIdOpenid(mpUserAddress);return new UpmsResult(UpmsResultConstant.SUCCESS, null);}@ApiOperation(value = "删除公众号粉丝地址")@RequestMapping(value = "/delete/{ids}",method = RequestMethod.GET)@ResponseBodypublic Object delete(@PathVariable("ids") String ids) {if(!ids.matches("^(\\d{1,11})(,\\d{1,11})*(,)?$")) {_log.error("xiaoc>> 删除公众号粉丝地址,无效的参数ids: {}", ids);return new UpmsResult(UpmsResultConstant.INVALID_PARAMETER, "无效的请求参数");}mpUserAddressService.deleteByIdOpenid(ids, getUpmsUserInfo().getAccount());return new UpmsResult(UpmsResultConstant.SUCCESS, null);}
2.6 下单接口
@ApiOperation(value = "新增公众号订单")@ResponseBody@RequestMapping(value = "/create", method = RequestMethod.POST)public Object create(HttpServletRequest request,@RequestParam(required = false, value = "shoppingtrolleyids") String shoppingtrolleyIds,@RequestParam(required = false, value = "goodsspecificationids") String goodsSpecificationIds,@RequestParam(required = false, value = "sourcenum") String sourcenum,@RequestParam(required = false, value = "phone") String phone,@RequestParam(required = false, value = "receiver") String receiver,@RequestParam(required = false, value = "address") String address ) {
文档更新时间: 2019-01-18 10:04