Commit 13ed6a75 authored by 谢希宇's avatar 谢希宇

增加小程序处方开票流程!

parent 38438eae
...@@ -73,13 +73,152 @@ ...@@ -73,13 +73,152 @@
<!-- general form elements disabled --> <!-- general form elements disabled -->
<div class="box box-primary"> <div class="box box-primary">
<form role="form" id="myForm"> <form role="form" id="myForm">
<input name="id" value="$!{data.id}" hidden="true"/> <input name="id" value="$!{data.id}" hidden="true"/>
<div class="box-body"> <div class="box-body">
</div>
<div class="form-group form-md-line-input col-md-12">
<label>处方编号</label>
<input type="text" required readonly class="form-control pull-right"
value="$!{data.number}" maxlength="500" required
name="productName" placeholder="处方编号"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>药店编码</label>
<input type="text" required readonly class="form-control pull-right"
value="$!{data.storeId}" maxlength="500" required
name="productName" placeholder="药店编码"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>医院名称</label>
<input type="text" required readonly class="form-control pull-right"
value="$!{data.hospitalName}" maxlength="500" required
name="productName" placeholder="医院名称"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>药店名称</label>
<input type="text" required readonly class="form-control pull-right"
value="$!{data.storeName}" maxlength="500" required
name="productName" placeholder="药店名称"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>用户姓名</label>
<input type="text" required readonly class="form-control pull-right"
value="$!{data.custName}" maxlength="500" required
name="productName" placeholder="用户姓名"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>患者性别</label>
<input type="text" required readonly class="form-control pull-right"
#if($!data.custSex=='S00030001') value="男" #elseif($!data.custSex == 'S00030002') value="女" #else value="位置" #end
maxlength="500" required
name="productName" placeholder="患者性别"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>用户电话</label>
<input type="text" required readonly class="form-control pull-right"
value="$!{data.custPhone}" maxlength="500" required
name="productName" placeholder="用户电话"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>病人状况描述</label>
<input type="text" required readonly class="form-control pull-right"
value="$!{data.symptom}" maxlength="500" required
name="productName" placeholder="病人状况描述"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>开方的医生</label>
<input type="text" required readonly class="form-control pull-right"
value="$!{data.doctorName}" maxlength="500" required
name="productName" placeholder="开方的医生"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>医生科室</label>
<input type="text" required readonly class="form-control pull-right"
value="$!{data.doctorDpmtName}" maxlength="500"
name="productName" placeholder="医生科室"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>医生开方状态</label>
<input type="text" required readonly class="form-control pull-right"
#if($!data.docStatus == '0') value="通过" #elseif($!data.docStatus == '1') value="未通过" #else value="未审核" #end
maxlength="500"
name="productName" placeholder="医生开方状态"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>医生审核不通过理由</label>
<input type="text" required readonly class="form-control pull-right"
value="$!{data.docResult}" maxlength="500" required
name="docResult" placeholder="医生审核不通过理由"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>本次开方时间</label>
<input type="text" required readonly class="form-control pull-right"
value="$!date.format('yyyy-MM-dd HH:mm:ss', $!data.createTime)" maxlength="500" required
name="docResult" placeholder="本次开方时间"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>过敏史</label>
<input type="text" required readonly class="form-control pull-right"
value="$!{data.guoms}" maxlength="500" required
name="docResult" placeholder="过敏史"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>用户年龄</label>
<input type="text" required readonly class="form-control pull-right"
value="$!{data.age}" maxlength="500" required
name="docResult" placeholder="用户年龄"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>处方图片</label>
<!-- <input type="text" required readonly class="form-control pull-right"-->
<!-- value="$!{data.presUrl}" maxlength="500" required-->
<!-- name="docResult" placeholder="处方图片"-->
<!-- >-->
<div class="form-group " id="imageurl"
style="width: 120px; height: 120px; margin-left: 5px; padding: 10px; background-color: #f4f4f4; border: 1px solid #CCCCCC">
<img id="prescription"
style="cursor:zoom-in; width: 100%; height: 100% "
src="$!{data.presUrl}" onclick="imgcli(this)">
</div>
</div>
</div>
<div class="box-footer"> <div class="box-footer">
#if($shiro.hasPermission("qy:prescription:edit")) #if($shiro.hasPermission("qy:prescription:edit"))
<input class="btn btn-primary" id="save" value="保存" type="submit"> <!-- <input class="btn btn-primary" id="save" value="保存" type="submit">-->
#end #end
<a href="#springUrl('/a/prescription/list')" class="btn btn-default">取消</a> <a href="#springUrl('/a/prescription/list')" class="btn btn-default">取消</a>
</div> </div>
...@@ -98,7 +237,10 @@ ...@@ -98,7 +237,10 @@
immediately after the control sidebar --> immediately after the control sidebar -->
<div class="control-sidebar-bg"></div> <div class="control-sidebar-bg"></div>
</div><!-- ./wrapper --> </div><!-- ./wrapper -->
<div id="divimg"
style="cursor:zoom-out; background: rgba(0,0,0,.6); width:100%; height:100%; position: absolute;z-index: 9999;left: 0;top: 0;display: none" onclick="hide()">
<img>
</div>
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script> <script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 --> <!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script>
...@@ -129,14 +271,40 @@ ...@@ -129,14 +271,40 @@
recdTypeAdd.init(); recdTypeAdd.init();
}); });
function imgcli(obj) {
$('#divimg img').attr('src', $(obj).attr("src"));
var img = $(obj)[0];
let imgH = img.naturalHeight;//图片高度
let imgW = img.naturalWidth;//图片宽度
let finalImgH = ($('.content-wrapper').height() * 0.8).toFixed(2);
let algorithm = (imgH / finalImgH).toFixed(2);
let finalImgW = (imgW / algorithm).toFixed(2);
let val = (1 - (finalImgW / $('.content-wrapper').width()).toFixed(2)) / 2 * 100 - 3;
$('#divimg').height($('.content-wrapper').height());
$('#divimg img').height(finalImgH);
$('#divimg img').width(finalImgW);
$('#divimg img').css("margin-left", val + "%");
$('#divimg img').css("margin-top", "5%");
$('#divimg').fadeIn(200);
}
$('#divimg').click(function () {
$(this).fadeOut(200)
});
var recdTypeAdd = function () { var recdTypeAdd = function () {
var initForm = function () { var initForm = function () {
var initFormCtrl = function () { var initFormCtrl = function () {
bindEvent(); bindEvent();
imgcli();
hide();
}; };
var bindEvent = function () { var bindEvent = function () {
$("#myForm").validate({ $("#myForm").validate({
rules: {}, rules: {},
messages: {}, messages: {},
......
...@@ -77,13 +77,13 @@ ...@@ -77,13 +77,13 @@
<div class="box"> <div class="box">
<div class="box-header"> <div class="box-header">
<form id="seachTableForm" action="#springUrl('/a/prescription/list')" method="get"> <form id="seachTableForm" action="#springUrl('/a/prescription/list')" method="get">
<div class="col-xs-5"> <div class="col-xs-5">
<button type="button" class="search btn btn-primary">搜索</button> <button type="button" class="search btn btn-primary">搜索</button>
#if($shiro.hasPermission("qy:prescription:edit")) #if($shiro.hasPermission("qy:prescription:edit"))
<a href="#springUrl('/a/prescription/form')" class="btn btn-primary">新增</a> <a href="#springUrl('/a/prescription/form')" class="btn btn-primary">新增</a>
<a href="#springUrl('/a/prescription/exportExcel')" class="btn btn-primary">导出</a> <!-- <a href="#springUrl('/a/prescription/exportExcel')" class="btn btn-primary">导出</a>-->
<a onclick="importExcel();" class="btn btn-primary">导入</a> <!-- <a onclick="importExcel();" class="btn btn-primary">导入</a>-->
#end #end
</div> </div>
</form> </form>
</div><!-- /.box-header --> </div><!-- /.box-header -->
...@@ -91,7 +91,19 @@ ...@@ -91,7 +91,19 @@
<table id="table" class="table table-bordered table-striped"> <table id="table" class="table table-bordered table-striped">
<thead> <thead>
<tr> <tr>
<td hidden="true">Id</td><th>创建时间</th> <td hidden="true">Id</td>
<th>处方编号</th>
<th>咨询单编号</th>
<th>药店编号</th>
<th>医院名称</th>
<th>药店名称</th>
<th>用户姓名</th>
<th>用户手机号码</th>
<th>医生开方状态</th>
<th>本次处方开方时间</th>
<th>处方状态</th>
<th>付费金额</th>
<th>付费时间</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
...@@ -145,7 +157,7 @@ ...@@ -145,7 +157,7 @@
var minute = now.getMinutes(); var minute = now.getMinutes();
var second = now.getSeconds(); var second = now.getSeconds();
return year + "-" + month + "-" + date + " " + hour + ":" return year + "-" + month + "-" + date + " " + hour + ":"
+ minute + ":" + second; + minute + ":" + second;
} }
function seachTable() { function seachTable() {
...@@ -185,32 +197,96 @@ ...@@ -185,32 +197,96 @@
"fnServerData": retrieveData, "fnServerData": retrieveData,
"pagingType": "full_numbers", "pagingType": "full_numbers",
"aoColumns": [ "aoColumns": [
{ {
"mData": "id" "mData": "id"
}, },
{ {
"mData": "createTime" "mData": "number"
}, },
{ {
"mData": "consultNo"
},
{
"mData": "storeId"
},
{
"mData": "hospitalName"
},
{
"mData": "storeName"
},
{
"mData": "custName"
},
{
"mData": "custPhone"
},
{
"mData": "docStatus"
},
{
"mData": "createTime"
},
{
"mData": "status"
},
{
"mData": "paymentPrice"
},
{
"mData": "paymentDate"
},
{
"mData": "id" "mData": "id"
}], }],
"aoColumnDefs": [ "aoColumnDefs": [
{ // set default column settings { // set default column settings
'visible': false, 'visible': false,
'targets': [0] 'targets': [0]
}, },
{ // set default column settings
{ 'targets': [8],
"aTargets": [1], "mRender": function (a, b, c, d) {
"mData": "createTime", if (a == '0') {
"mRender": function (a, b, c, d) { return '未审核';
return '<a href="#springUrl("/a/prescription/form?id=' + c.id + '")" data-id="' + c.id + '" data-action="view">' + formatDates(a, "yyyy-MM-dd HH:mm:ss"); } else if (a == '1') {
+'</a>'; return '审核通过';
} else if (a == '2') {
} return '审核拒绝';
}, }
}
] },
{
"aTargets": [9],
"mData": "createTime",
"mRender": function (a, b, c, d) {
return '<a href="#springUrl("/a/prescription/form?id=' + c.id + '")" data-id="' + c.id + '" data-action="view">' + formatDates(a, "yyyy-MM-dd HH:mm:ss");
+'</a>';
}
},
{ // set default column settings
'targets': [10],
"mRender": function (a, b, c, d) {
if (a == '0') {
return '未审核';
} else if (a == '1') {
return '审核通过';
} else if (a == '2') {
return '审核拒绝';
}
}
},
{
"aTargets": [13],
"mData": "id",
"mRender": function (a, b, c, d) {
var html = '';
html += '<a href="#springUrl("/a/prescription/form?id=' + a + '")" class="btn green">查看</a>';
return html;
}
}
]
}); });
} }
...@@ -231,6 +307,7 @@ ...@@ -231,6 +307,7 @@
}); });
Cfapp.init(); Cfapp.init();
function removeData(data) { function removeData(data) {
Cfapp.confirm({ Cfapp.confirm({
message: "确定要删除吗", message: "确定要删除吗",
...@@ -262,22 +339,23 @@ ...@@ -262,22 +339,23 @@
} }
}); });
} }
function importExcel() {
var templateExcelUrl = "#springUrl('/a/prescription/templateExcel')";
var importExcelUrl = "#springUrl('/a/prescription/importExcel')";
Cfapp.importExcel({
title: '处方单列表导入',
importurl: importExcelUrl,
templateurl: templateExcelUrl,
cancel: function () {
}, function importExcel() {
success: function () { var templateExcelUrl = "#springUrl('/a/prescription/templateExcel')";
var importExcelUrl = "#springUrl('/a/prescription/importExcel')";
Cfapp.importExcel({
title: '处方单列表导入',
importurl: importExcelUrl,
templateurl: templateExcelUrl,
cancel: function () {
},
success: function () {
}
});
}
}
});
}
</script> </script>
......
...@@ -10,14 +10,4 @@ ...@@ -10,14 +10,4 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>prescription-module</artifactId> <artifactId>prescription-module</artifactId>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project> </project>
\ No newline at end of file
...@@ -4,7 +4,7 @@ package com.cftech.cdfortis.service; ...@@ -4,7 +4,7 @@ package com.cftech.cdfortis.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.cdfortis.model.FbusiDetail; import com.cftech.cdfortis.model.FbusiDetail;
import com.cftech.prescription.model.Prescription; import com.cftech.prescription.model.Prescription;
import com.cftech.product.model.Product; import org.mp.api.wxstore.product.model.Product;
import java.util.List; import java.util.List;
...@@ -16,14 +16,6 @@ import java.util.List; ...@@ -16,14 +16,6 @@ import java.util.List;
*/ */
public interface CdfortisService { public interface CdfortisService {
/**
* 药品清单上传
*
* @param productList
* @return
*/
JSONObject uploadDrugInfo(List<Product> productList) throws Exception;
/** /**
* 获取图文处方列表 * 获取图文处方列表
* *
......
...@@ -12,7 +12,6 @@ import com.cftech.cdfortis.util.CdfortisTokenUtil; ...@@ -12,7 +12,6 @@ import com.cftech.cdfortis.util.CdfortisTokenUtil;
import com.cftech.core.util.StringUtils; import com.cftech.core.util.StringUtils;
import com.cftech.core.util.SystemConfig; import com.cftech.core.util.SystemConfig;
import com.cftech.prescription.model.Prescription; import com.cftech.prescription.model.Prescription;
import com.cftech.product.model.Product;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
...@@ -44,31 +43,6 @@ public class CdfortisServiceImpl implements CdfortisService { ...@@ -44,31 +43,6 @@ public class CdfortisServiceImpl implements CdfortisService {
private static String appid = SystemConfig.p.getProperty("cdfortis.appid"); private static String appid = SystemConfig.p.getProperty("cdfortis.appid");
/**
* 上传药品清单
*
* @param productList
* @return
*/
@Override
public JSONObject uploadDrugInfo(List<Product> productList) throws Exception {
String uploadUrl = SystemConfig.p.getProperty("cdfortis.drug_upload_url");
// 构建参数
JSONObject param = new JSONObject();
param.put("appid", appid);
param.put("token", cdfortisTokenUtil.getToken());
// 转换药品类型为微问诊需要的结构
List<CdfortisDrugInfo> cdfortisDrugList = productList.stream().map(this::fromProduct).collect(Collectors.toList());
param.put("drugInfo", cdfortisDrugList);
RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, param.toJSONString());
// 请求获取数据
String data = CdfortisResponseUtil.request(uploadUrl, CdfortisConstant.METHOD_POST,
null, null, body);
// 判断数据是否正确
return JSONObject.parseObject(data);
}
/** /**
* 获取图文处方列表 * 获取图文处方列表
* *
...@@ -173,24 +147,4 @@ public class CdfortisServiceImpl implements CdfortisService { ...@@ -173,24 +147,4 @@ public class CdfortisServiceImpl implements CdfortisService {
return picUrl; return picUrl;
} }
/**
* 转换药品信息
*
* @return
* @para preDrugs
*/
private CdfortisDrugInfo fromProduct(Product product) {
CdfortisDrugInfo cdfortisDrug = new CdfortisDrugInfo();
cdfortisDrug.setApprNumber(product.getApproveNumber());
cdfortisDrug.setSpec(product.getFormat());
cdfortisDrug.setPrice(String.valueOf(product.getPrice()));
// 这里不确定是否应该用这个字段
cdfortisDrug.setErpId(product.getProductNumber());
cdfortisDrug.setDrugName(product.getProductName());
cdfortisDrug.setFactoryName(product.getManufacturer());
return cdfortisDrug;
}
} }
package com.cftech.cdfortis.web; package com.cftech.cdfortis.web;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.cdfortis.model.FbusiDetail;
import com.cftech.cdfortis.service.CdfortisService; import com.cftech.cdfortis.service.CdfortisService;
import com.cftech.cdfortis.util.CdfortisTokenUtil; import com.cftech.cdfortis.util.CdfortisTokenUtil;
import com.cftech.prescription.model.Prescription; import com.cftech.prescription.model.Prescription;
import com.cftech.prescription.service.PrescriptionService; import com.cftech.prescription.service.PrescriptionService;
import com.cftech.product.model.Product;
import com.cftech.product.service.ProductService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 微问诊相关接口调用Controller * 微问诊相关接口调用Controller
...@@ -39,15 +33,12 @@ public class CdfortisController { ...@@ -39,15 +33,12 @@ public class CdfortisController {
@Autowired @Autowired
PrescriptionService prescriptionService; PrescriptionService prescriptionService;
@Autowired
ProductService productService;
/** /**
* 获取微问诊token * 获取微问诊token
* *
* @return * @return
*/ */
@GetMapping("/get/token") @PostMapping("/get/token")
public JSONObject getToken() { public JSONObject getToken() {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
...@@ -67,34 +58,34 @@ public class CdfortisController { ...@@ -67,34 +58,34 @@ public class CdfortisController {
* @param productList * @param productList
* @return * @return
*/ */
@PostMapping("/upload/druginfo") // @PostMapping("/upload/druginfo")
public JSONObject uploadDrugInfo(@RequestBody List<Product> productList) { // public JSONObject uploadDrugInfo(@RequestBody List<Product> productList) {
JSONObject rtnJson = new JSONObject(); // JSONObject rtnJson = new JSONObject();
try { // try {
JSONObject dataJsonObj = cdfortisService.uploadDrugInfo(productList); // JSONObject dataJsonObj = cdfortisService.uploadDrugInfo(productList);
boolean isAllSuccess = dataJsonObj.getBooleanValue("isAllSuccess"); // boolean isAllSuccess = dataJsonObj.getBooleanValue("isAllSuccess");
Object data = ""; // Object data = "";
if (!isAllSuccess) { // if (!isAllSuccess) {
JSONArray failedDataArr = dataJsonObj.getJSONArray("failedData"); // JSONArray failedDataArr = dataJsonObj.getJSONArray("failedData");
// List转map,key是productNumber、value是product本身 // // List转map,key是productNumber、value是product本身
List<String> productNumberList = productList.stream() // List<String> productNumberList = productList.stream()
.map(Product::getProductNumber) // .map(Product::getProductNumber)
.collect(Collectors.toList()); // .collect(Collectors.toList());
//
// 遍历上传失败的数据,排除掉 // // 遍历上传失败的数据,排除掉
for (int i = 0; i < failedDataArr.size(); i++) { // for (int i = 0; i < failedDataArr.size(); i++) {
String erpId = failedDataArr.getJSONObject(i).getString("erpId"); // String erpId = failedDataArr.getJSONObject(i).getString("erpId");
productNumberList.remove(erpId); // productNumberList.remove(erpId);
} // }
productService.updateUploadFlag(productNumberList, true); // productService.updateUploadFlag(productNumberList, true);
data = failedDataArr; // data = failedDataArr;
} // }
setSuccResult(rtnJson, data); // setSuccResult(rtnJson, data);
} catch (Exception e) { // } catch (Exception e) {
handleException(rtnJson, e); // handleException(rtnJson, e);
} // }
return rtnJson; // return rtnJson;
} // }
/** /**
...@@ -106,7 +97,7 @@ public class CdfortisController { ...@@ -106,7 +97,7 @@ public class CdfortisController {
* @param endTime 结束时间 * @param endTime 结束时间
* @return * @return
*/ */
@GetMapping("/get/fbusi/list") @PostMapping("/get/fbusi/list")
public JSONObject getFbusiList(int iDisplayStart, int iDisplayLength, String startTime, String endTime) { public JSONObject getFbusiList(int iDisplayStart, int iDisplayLength, String startTime, String endTime) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
...@@ -125,7 +116,7 @@ public class CdfortisController { ...@@ -125,7 +116,7 @@ public class CdfortisController {
* @param presId 处方编号 * @param presId 处方编号
* @return * @return
*/ */
@GetMapping("/get/fbusi/detail") @PostMapping("/get/fbusi/detail")
public JSONObject getFbusiDetail(@RequestParam String presId) { public JSONObject getFbusiDetail(@RequestParam String presId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
...@@ -144,7 +135,7 @@ public class CdfortisController { ...@@ -144,7 +135,7 @@ public class CdfortisController {
* @param orderId 处方编号 * @param orderId 处方编号
* @return * @return
*/ */
@GetMapping("/get/fbusi/info") @PostMapping("/get/fbusi/info")
public JSONObject getFbusiDetailByOrderId(@RequestParam String orderId) { public JSONObject getFbusiDetailByOrderId(@RequestParam String orderId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
...@@ -163,7 +154,7 @@ public class CdfortisController { ...@@ -163,7 +154,7 @@ public class CdfortisController {
* @param presId 处方编号 * @param presId 处方编号
* @return * @return
*/ */
@GetMapping("/get/fbusi/picture") @PostMapping("/get/fbusi/picture")
public JSONObject getFbusiPicture(@RequestParam String presId) { public JSONObject getFbusiPicture(@RequestParam String presId) {
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
......
...@@ -104,7 +104,6 @@ public class PreDrugsController { ...@@ -104,7 +104,6 @@ public class PreDrugsController {
Long accountsId = UserUtils.getmpaccounts(request); Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("del_flag", Constants.DEL_FLAG_0); conds.equal("del_flag", Constants.DEL_FLAG_0);
conds.equal("accounts_id", accountsId);
Sort sort = new Sort("create_time", OrderType.DESC); Sort sort = new Sort("create_time", OrderType.DESC);
List<PreDrugs> list = preDrugsService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength); List<PreDrugs> list = preDrugsService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
...@@ -138,7 +137,6 @@ public class PreDrugsController { ...@@ -138,7 +137,6 @@ public class PreDrugsController {
Sort sort = new Sort("create_time", OrderType.ASC); Sort sort = new Sort("create_time", OrderType.ASC);
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("del_flag", 0); conds.equal("del_flag", 0);
conds.equal("accounts_id", accountId);
List<PreDrugs> list = preDrugsService.fetchSearchByPage(conds, sort, 0, 0); List<PreDrugs> list = preDrugsService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(PreDrugs.class, response).toExcel(list, "处方单药品列表信息"); ExcelKit.$Export(PreDrugs.class, response).toExcel(list, "处方单药品列表信息");
} }
......
...@@ -3,6 +3,8 @@ package com.cftech.prescription.dao; ...@@ -3,6 +3,8 @@ package com.cftech.prescription.dao;
import com.cftech.prescription.model.Prescription; import com.cftech.prescription.model.Prescription;
import com.cftech.core.generic.GenericDao; import com.cftech.core.generic.GenericDao;
import java.util.Map;
/** /**
* 处方单列表Mapper * 处方单列表Mapper
* *
...@@ -11,4 +13,17 @@ import com.cftech.core.generic.GenericDao; ...@@ -11,4 +13,17 @@ import com.cftech.core.generic.GenericDao;
*/ */
public interface PrescriptionMapper extends GenericDao<Prescription> { public interface PrescriptionMapper extends GenericDao<Prescription> {
/**
* 查询药品实体
* @param three_drugs_id
* @return
*/
Map<String, Object> fetchByProjectId(String three_drugs_id);
/**
* 通过处方单编码更新处方单
* @param prescription
* @return
*/
int updateByNumber(Prescription prescription);
} }
\ No newline at end of file
...@@ -291,4 +291,100 @@ ...@@ -291,4 +291,100 @@
set del_flag=1 set del_flag=1
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="fetchByProjectId" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
t.product_number productNumber,
t.unit
FROM t_aidea_product t
where id = #{id,jdbcType=BIGINT}
</select>
<update id="updateByNumber" parameterType="com.cftech.prescription.model.Prescription">
update t_aidea_prescription
<set>
<if test="minProgramNo != null">
min_program_no = #{minProgramNo, jdbcType=VARCHAR},
</if>
<if test="storeId != null">
store_id = #{storeId, jdbcType=VARCHAR},
</if>
<if test="hospitalName != null">
hospital_name = #{hospitalName, jdbcType=VARCHAR},
</if>
<if test="storeName != null">
store_name = #{storeName, jdbcType=VARCHAR},
</if>
<if test="custName != null">
cust_name = #{custName, jdbcType=VARCHAR},
</if>
<if test="weight != null">
weight = #{weight, jdbcType=VARCHAR},
</if>
<if test="custSex != null">
cust_sex = #{custSex, jdbcType=VARCHAR},
</if>
<if test="custPhone != null">
cust_phone = #{custPhone, jdbcType=VARCHAR},
</if>
<if test="symptom != null">
symptom = #{symptom, jdbcType=VARCHAR},
</if>
<if test="syptmFlag != null">
syptm_flag = #{syptmFlag, jdbcType=VARCHAR},
</if>
<if test="doctorName != null">
doctor_name = #{doctorName, jdbcType=VARCHAR},
</if>
<if test="doctorDpmtName != null">
doctor_dpmt_name = #{doctorDpmtName, jdbcType=VARCHAR},
</if>
<if test="docStatus != null">
doc_status = #{docStatus, jdbcType=VARCHAR},
</if>
<if test="docResult != null">
doc_result = #{docResult, jdbcType=VARCHAR},
</if>
<if test="pharmName != null">
pharm_name = #{pharmName, jdbcType=VARCHAR},
</if>
<if test="result != null">
result = #{result, jdbcType=VARCHAR},
</if>
<if test="guoms != null">
guoms = #{guoms, jdbcType=VARCHAR},
</if>
<if test="age != null">
age = #{age, jdbcType=VARCHAR},
</if>
<if test="presUrl != null">
pres_url = #{presUrl, jdbcType=VARCHAR},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
<if test="openid != null">
openid = #{openid, jdbcType=BIGINT},
</if>
</set>
where number = #{number,jdbcType=VARCHAR}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.cftech.core.poi.ExportConfig; ...@@ -4,6 +4,7 @@ import com.cftech.core.poi.ExportConfig;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
...@@ -68,6 +69,8 @@ public class Prescription implements Serializable { ...@@ -68,6 +69,8 @@ public class Prescription implements Serializable {
/* 此处方被审核后审方药师名 */ /* 此处方被审核后审方药师名 */
@ExportConfig(value = "此处方被审核后审方药师名", width = 100, showLevel = 1) @ExportConfig(value = "此处方被审核后审方药师名", width = 100, showLevel = 1)
private String pharmName; private String pharmName;
@ExportConfig(value = "药师审核 0 通过 1未审核 2 未通过", width = 100, showLevel = 1)
private String pharmStatus;
/* 本次审核结果,若不通过则此处为不通过的理 */ /* 本次审核结果,若不通过则此处为不通过的理 */
@ExportConfig(value = "本次审核结果,若不通过则此处为不通过的理", width = 100, showLevel = 1) @ExportConfig(value = "本次审核结果,若不通过则此处为不通过的理", width = 100, showLevel = 1)
private String result; private String result;
...@@ -91,12 +94,20 @@ public class Prescription implements Serializable { ...@@ -91,12 +94,20 @@ public class Prescription implements Serializable {
/* 更新时间 */ /* 更新时间 */
private Date updateTime; private Date updateTime;
/* 备注 */ /* 备注 */
private String description; private String description;//0-临时状态 1-提交状态 2-返回状态
/* 创建人 */ /* 创建人 */
private Long createBy; private Long createBy;
/* 更新人 */ /* 更新人 */
private Long updateBy; private Long updateBy;
/**
* 展示字段
*/
private String consultNo;
private BigDecimal paymentPrice;
private String paymentDate;
public Prescription() { public Prescription() {
this.delFlag = false; this.delFlag = false;
this.status = "0"; this.status = "0";
......
...@@ -22,6 +22,15 @@ public interface PrescriptionService extends GenericService<Prescription> { ...@@ -22,6 +22,15 @@ public interface PrescriptionService extends GenericService<Prescription> {
*/ */
JSONObject generatePre(String appId, String openId); JSONObject generatePre(String appId, String openId);
/**
* 修改处方单编码
* @param appId
* @param openId
* @param number
* @return
*/
JSONObject updatePrescription(String appId, String openId, String number);
/** /**
* 获取处方单列表(从距今日7天内的数据) * 获取处方单列表(从距今日7天内的数据)
* *
......
...@@ -9,6 +9,7 @@ import com.cftech.cdfortis.model.FbusiDrug; ...@@ -9,6 +9,7 @@ import com.cftech.cdfortis.model.FbusiDrug;
import com.cftech.cdfortis.service.CdfortisService; import com.cftech.cdfortis.service.CdfortisService;
import com.cftech.core.scope.OrderType; import com.cftech.core.scope.OrderType;
import com.cftech.core.sql.Sort; import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants;
import com.cftech.core.util.DateUtils; import com.cftech.core.util.DateUtils;
import com.cftech.core.util.SystemConfig; import com.cftech.core.util.SystemConfig;
import com.cftech.predrugs.model.PreDrugs; import com.cftech.predrugs.model.PreDrugs;
...@@ -19,19 +20,15 @@ import com.cftech.prescription.service.PrescriptionService; ...@@ -19,19 +20,15 @@ import com.cftech.prescription.service.PrescriptionService;
import com.cftech.core.generic.GenericDao; import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl; import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.sql.Conds; import com.cftech.core.sql.Conds;
import com.cftech.product.model.Product;
import com.cftech.product.service.ProductService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;;
import org.springframework.data.redis.connection.ConnectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.List;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.*; import java.util.*;
...@@ -57,9 +54,6 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -57,9 +54,6 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
@Autowired @Autowired
private MpAccountsService accountsService; private MpAccountsService accountsService;
@Autowired
private ProductService productService;
@Autowired @Autowired
CdfortisService cdfortisService; CdfortisService cdfortisService;
...@@ -76,19 +70,40 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -76,19 +70,40 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
JSONObject retObj = new JSONObject(); JSONObject retObj = new JSONObject();
try { try {
MpAccountsEntity accountsEntity = accountsService.getMpAccountsAppid(appId); MpAccountsEntity accountsEntity = accountsService.getMpAccountsAppid(appId);
String storeNo = SystemConfig.p.getProperty("cdfortis.store_no");
Map<String, Object> params = prescriptionMapper.fetchByProjectId(SystemConfig.p.getProperty("THREE_DRUGS_ID"));
//获取当前用户当天开取的处方单
Conds conds = new Conds();
conds.equal("t.description", 0);//临时订单
conds.equal("DATE_FORMAT(t.create_time ,'%Y-%m-%d')", DateUtils.getDate());
conds.equal("t.openid", openId);
Prescription prescription = this.fetchSearchByConds(conds);
if (prescription != null) {
JSONObject data = new JSONObject();
data.put("prescriptionNo", prescription.getNumber());
data.put("productNo", params.get("productNumber"));
data.put("unit", params.get("unit"));
data.put("storeNo", storeNo);
retObj.put("errorNo", 0);
retObj.put("data", data);
return retObj;
}
prescription = new Prescription();
//生成处方单编码 //生成处方单编码
String number = codingruleUtils.getNumber(accountsEntity.getId(), Prescription.class.getName()); String number = codingruleUtils.getNumber(accountsEntity.getId(), Prescription.class.getName());
Product product = productService.fetchById(SystemConfig.p.getProperty("THREE_DRUGS_ID"));
Prescription prescription = new Prescription();
prescription.setNumber(number); prescription.setNumber(number);
prescription.setOpenid(openId); prescription.setOpenid(openId);
prescription.setDescription("0");
if (this.save(prescription)) { if (this.save(prescription)) {
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("prescriptionNo", number); data.put("prescriptionNo", number);
data.put("productNo", product.getProductNumber()); data.put("productNo", params.get("productNumber"));
data.put("unit", product.getUnit()); data.put("unit", params.get("unit"));
data.put("storeNo", SystemConfig.p.getProperty("cdfortis.store_no")); data.put("storeNo", storeNo);
retObj.put("errorNo", 0); retObj.put("errorNo", 0);
retObj.put("data", data); retObj.put("data", data);
...@@ -104,24 +119,59 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -104,24 +119,59 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
return retObj; return retObj;
} }
@Override
public JSONObject updatePrescription(String appId, String openId, String number) {
JSONObject retObj = new JSONObject();
try {
//获取当前用户当天开取的处方单
Conds conds = new Conds();
conds.equal("t.description", "0");
conds.equal("t.number", number);
conds.equal("t.openid", openId);
Prescription prescription = this.fetchSearchByConds(conds);
if (prescription != null) {
prescription.setDescription("1");
this.update(prescription);
retObj.put("errorNo", 0);
return retObj;
}
} catch (Exception e) {
retObj.put("errorNo", 1);
e.printStackTrace();
}
retObj.put("errorNo", 1);
return retObj;
}
@Override @Override
public JSONObject findLastPrescription(String appId, String openId) { public JSONObject findLastPrescription(String appId, String openId) {
JSONObject retObj = new JSONObject(); JSONObject retObj = new JSONObject();
try { try {
//获取最新处方单数据 //获取最新处方单数据
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.openid", openId); conds.equal("t.openid", openId);
conds.in("t.description", new String[] {"1", "2"});//已获取返回结果
conds.equal("DATE_FORMAT(t.create_time ,'%Y-%m-%d')", DateUtils.getDate());
Sort sort = new Sort("t.create_time", OrderType.DESC); Sort sort = new Sort("t.create_time", OrderType.DESC);
List<Prescription> list = this.fetchSearchByPage(conds, sort, 0, 0); List<Prescription> list = this.fetchSearchByPage(conds, sort, 0, 0);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
retObj.put("errorNo", 1); retObj.put("errorNo", 1);
retObj.put("errorMsg", "暂无处方单信息,请稍后"); retObj.put("errorMsg", "处方暂未开具");
return retObj; return retObj;
} }
retObj.put("errorNo", 0);
retObj.put("data", list.get(0)); Prescription prescription = list.get(0);
if ("2".equals(prescription.getDescription()) && "0".equals(prescription.getDocStatus())) {
retObj.put("errorNo", 0);
retObj.put("data", prescription);
} else {
prescription = this.findPreScriptionByOrderId(prescription.getNumber());
retObj.put("errorNo", 0);
retObj.put("data", prescription);
}
} catch (Exception e) { } catch (Exception e) {
retObj.put("errorNo", 1);
e.printStackTrace(); e.printStackTrace();
} }
return retObj; return retObj;
...@@ -145,7 +195,7 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -145,7 +195,7 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
startTime = DateUtils.formatDateTime(startDate); startTime = DateUtils.formatDateTime(startDate);
endTime = DateUtils.formatDateTime(endDate); endTime = DateUtils.formatDateTime(endDate);
} }
Sort sort = new Sort("create_time", OrderType.DESC); Sort sort = new Sort("t.create_time", OrderType.DESC);
// TODO 查询在时间范围内的数据 // TODO 查询在时间范围内的数据
Conds listConds = new Conds(); Conds listConds = new Conds();
...@@ -166,7 +216,7 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -166,7 +216,7 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
// 构建查询参数 // 构建查询参数
Long[] idArr = onLineList.stream().map(Prescription::getId).toArray(Long[]::new); Long[] idArr = onLineList.stream().map(Prescription::getId).toArray(Long[]::new);
Conds idConds = new Conds(); Conds idConds = new Conds();
idConds.in("id", idArr); idConds.in("t.id", idArr);
// 将db里面数据查询出来转成Set,数据为id // 将db里面数据查询出来转成Set,数据为id
Set<Long> dbIdSet = fetchSearchByPage(idConds, sort, iDisplayStart, iDisplayLength) Set<Long> dbIdSet = fetchSearchByPage(idConds, sort, iDisplayStart, iDisplayLength)
.stream() .stream()
...@@ -199,7 +249,7 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -199,7 +249,7 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
return prescription; return prescription;
} }
FbusiDetail fbusiDetail = cdfortisService.getFbusiDetail(presId); FbusiDetail fbusiDetail = cdfortisService.getFbusiDetail(presId);
prescription = handlePrescription(prescription, fbusiDetail); prescription = handlePrescription(fbusiDetail, prescription.getNumber());
return prescription; return prescription;
} }
...@@ -213,33 +263,28 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im ...@@ -213,33 +263,28 @@ public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> im
*/ */
@Override @Override
public Prescription findPreScriptionByOrderId(String orderId) throws Exception { public Prescription findPreScriptionByOrderId(String orderId) throws Exception {
Conds conds = new Conds();
conds.equal("number", orderId);
Prescription prescription = fetchSearchByConds(conds);
if (prescription != null && !StringUtils.isEmpty(prescription.getSymptom())) {
return prescription;
}
FbusiDetail fbusiDetail = cdfortisService.getFbusiDetailByOrderId(orderId); FbusiDetail fbusiDetail = cdfortisService.getFbusiDetailByOrderId(orderId);
prescription = handlePrescription(prescription, fbusiDetail); return handlePrescription(fbusiDetail, orderId);
return prescription;
} }
@NotNull @NotNull
private Prescription handlePrescription(Prescription prescription, FbusiDetail fbusiDetail) throws Exception { private Prescription handlePrescription(FbusiDetail fbusiDetail, String number) throws Exception {
if (fbusiDetail == null) { if (fbusiDetail == null) {
throw new Exception("找不到对应的处方数据(暂无数据)"); throw new Exception("找不到对应的处方数据(暂无数据)");
} }
if (prescription == null) { //更新
// save数据 Prescription prescription = new Prescription();
prescription = new Prescription(); BeanUtils.copyProperties(fbusiDetail, prescription);
BeanUtils.copyProperties(fbusiDetail, prescription); prescription.setDescription("2");//已返回
save(prescription); prescription.setNumber(number);//通过编码更新
} else { prescription.setMinProgramNo(fbusiDetail.getId());
// update 数据 prescriptionMapper.updateByNumber(prescription);
BeanUtils.copyProperties(fbusiDetail, prescription);
update(prescription); //设置分录
} Conds conds = new Conds();
conds.equal("t.number", number);
prescription = fetchSearchByConds(conds);
handleFrug(fbusiDetail, prescription); handleFrug(fbusiDetail, prescription);
return prescription; return prescription;
} }
......
...@@ -20,7 +20,7 @@ public class MobilePrecriptionController { ...@@ -20,7 +20,7 @@ public class MobilePrecriptionController {
* @param openId * @param openId
* @return * @return
*/ */
@RequestMapping(value = "generatePrescriptionNumber", method = { RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "generatePrescriptionNumber", method = { RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject generatePrescriptionNumber(@RequestParam String appId, public JSONObject generatePrescriptionNumber(@RequestParam String appId,
@RequestParam String openId) { @RequestParam String openId) {
return prescriptionService.generatePre(appId, openId); return prescriptionService.generatePre(appId, openId);
...@@ -32,9 +32,23 @@ public class MobilePrecriptionController { ...@@ -32,9 +32,23 @@ public class MobilePrecriptionController {
* @param openId * @param openId
* @return * @return
*/ */
@RequestMapping(value = "findLastPrescription", method = { RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "findLastPrescription", method = { RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject findLastPrescription(@RequestParam String appId, public JSONObject findLastPrescription(@RequestParam String appId,
@RequestParam String openId) { @RequestParam String openId) {
return prescriptionService.findLastPrescription(appId, openId); return prescriptionService.findLastPrescription(appId, openId);
} }
/**
* 更新处方单
* @param appId
* @param openId
* @param number
* @return
*/
@RequestMapping(value = "updatePrescription", method = { RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject updatePrescription(@RequestParam String appId,
@RequestParam String openId,
@RequestParam String number) {
return prescriptionService.updatePrescription(appId, openId, number);
}
} }
...@@ -103,9 +103,9 @@ public class PrescriptionController { ...@@ -103,9 +103,9 @@ public class PrescriptionController {
public JSONObject listData(int iDisplayStart, int iDisplayLength, Prescription prescription, HttpServletRequest request) { public JSONObject listData(int iDisplayStart, int iDisplayLength, Prescription prescription, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request); Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("del_flag", Constants.DEL_FLAG_0); conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("accounts_id", accountsId); conds.equal("t.description", "2");
Sort sort = new Sort("create_time", OrderType.DESC); Sort sort = new Sort("t.create_time", OrderType.DESC);
List<Prescription> list = prescriptionService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength); List<Prescription> list = prescriptionService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = prescriptionService.count(conds); Integer counts = prescriptionService.count(conds);
...@@ -137,8 +137,7 @@ public class PrescriptionController { ...@@ -137,8 +137,7 @@ public class PrescriptionController {
Long accountId = UserUtils.getmpaccounts(request); Long accountId = UserUtils.getmpaccounts(request);
Sort sort = new Sort("create_time", OrderType.ASC); Sort sort = new Sort("create_time", OrderType.ASC);
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("del_flag", 0); conds.equal("t.del_flag", 0);
conds.equal("accounts_id", accountId);
List<Prescription> list = prescriptionService.fetchSearchByPage(conds, sort, 0, 0); List<Prescription> list = prescriptionService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(Prescription.class, response).toExcel(list, "处方单列表信息"); ExcelKit.$Export(Prescription.class, response).toExcel(list, "处方单列表信息");
} }
......
...@@ -115,15 +115,7 @@ ...@@ -115,15 +115,7 @@
<th>产品名称</th> <th>产品名称</th>
<th>通用名</th> <th>通用名</th>
<th>产品编码</th> <th>产品编码</th>
<!-- <th>剂型</th>-->
<!-- <th>规格</th>-->
<!-- <th>批准文号</th>-->
<th>生产企业</th> <th>生产企业</th>
<!-- <th>温馨提示</th>-->
<!-- <th>服用类型</th>-->
<!-- <th>服用频率</th>-->
<!-- <th>服用数量</th>-->
<!-- <th>库存</th>-->
<th>价格</th> <th>价格</th>
<th>处方药</th> <th>处方药</th>
<th>创建时间</th> <th>创建时间</th>
...@@ -247,33 +239,9 @@ ...@@ -247,33 +239,9 @@
{ {
"mData":"productNumber" "mData":"productNumber"
}, },
// {
// "mData":"dosagaFrom"
// },
// {
// "mData":"format"
// },
// {
// "mData":"approveNumber"
// },
{ {
"mData":"manufacturer" "mData":"manufacturer"
}, },
// {
// "mData":"tips"
// },
// {
// "mData":"takeType"
// },
// {
// "mData":"takeFrequency"
// },
// {
// "mData":"takeAmount"
// },
// {
// "mData":"stock"
// },
{ {
"mData":"price" "mData":"price"
}, },
...@@ -307,7 +275,6 @@ ...@@ -307,7 +275,6 @@
return formatDates(a, "yyyy-MM-dd HH:mm:ss"); return formatDates(a, "yyyy-MM-dd HH:mm:ss");
} }
}, },
{ {
"aTargets": [10], "aTargets": [10],
"mData": "id", "mData": "id",
...@@ -315,6 +282,9 @@ ...@@ -315,6 +282,9 @@
var html = '#if($shiro.hasPermission("qy:product:edit"))'; var html = '#if($shiro.hasPermission("qy:product:edit"))';
html += '<a href="#springUrl("/a/product/form?id=' + a + '")" data-id="' + a + '" data-action="view" class="btn green">修改</a>'; html += '<a href="#springUrl("/a/product/form?id=' + a + '")" data-id="' + a + '" data-action="view" class="btn green">修改</a>';
html += '<a href="javascript:void(0);" data-id="' + a + '" data-action="remove" onclick="removeData(' + a + ')" class="btn red">删除</a>'; html += '<a href="javascript:void(0);" data-id="' + a + '" data-action="remove" onclick="removeData(' + a + ')" class="btn red">删除</a>';
if (c.uploadFlag == '0') {
html += '<a href="javascript:void(0);" data-id="' + a + '" data-action="remove" onclick="uploadPlatform(' + a + ')" class="btn red">上传</a>';
}
html += '#end'; html += '#end';
return html; return html;
} }
...@@ -343,6 +313,38 @@ ...@@ -343,6 +313,38 @@
Cfapp.init(); Cfapp.init();
function uploadPlatform(data) {
Cfapp.confirm({
message: "确定上传?",
btnoktext: "确定",
btncanceltext: "取消",
success: function () {
$.ajax({
type: "POST",
url: "#springUrl('/a/product/uploadPlatform')",
"data": { id: data, _csrfheader: csrfheader.value, _csrf: csrftoken.value},
dataType: "json",
success: function (data) {
if (data.errorNo == 0) {
Cfapp.alert({
message: "上传成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/product/list')";
}
});
}
},
error: function () {
}
})
},
cancel: function () {
$(".modal-backdrop").fadeOut();
}
});
}
function removeData(data) { function removeData(data) {
Cfapp.confirm({ Cfapp.confirm({
message: "确定要删除吗", message: "确定要删除吗",
......
...@@ -31,6 +31,12 @@ ...@@ -31,6 +31,12 @@
<artifactId>product-detail-module</artifactId> <artifactId>product-detail-module</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>prescription-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
......
...@@ -130,7 +130,8 @@ ...@@ -130,7 +130,8 @@
t.isreading, t.isreading,
t.invoice_code invoiceCode, t.invoice_code invoiceCode,
t.deviation, t.deviation,
t.upload_flag AS uploadFlag t.upload_flag AS uploadFlag,
t.unit
</sql> </sql>
<insert id="save" parameterType="com.cftech.product.model.Product" useGeneratedKeys="true" <insert id="save" parameterType="com.cftech.product.model.Product" useGeneratedKeys="true"
......
...@@ -56,5 +56,7 @@ public class ProductVO { ...@@ -56,5 +56,7 @@ public class ProductVO {
private String productImgDetail; private String productImgDetail;
/*是否展示销量*/ /*是否展示销量*/
private Long isreading; private Long isreading;
/*单位*/
private String unit;
} }
...@@ -51,4 +51,12 @@ public interface ProductService extends GenericService<Product> { ...@@ -51,4 +51,12 @@ public interface ProductService extends GenericService<Product> {
* @param uploadFlag * @param uploadFlag
*/ */
void updateUploadFlag(List<String> productNumberList, boolean uploadFlag); void updateUploadFlag(List<String> productNumberList, boolean uploadFlag);
/**
* 药品清单上传
*
* @param productList
* @return
*/
JSONObject uploadDrugInfo(List<Product> productList) throws Exception;
} }
...@@ -4,8 +4,13 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,8 +4,13 @@ import com.alibaba.fastjson.JSONObject;
import com.cftech.accounts.model.MpAccountsEntity; import com.cftech.accounts.model.MpAccountsEntity;
import com.cftech.accounts.service.MpAccountsService; import com.cftech.accounts.service.MpAccountsService;
import com.cftech.base.codingrule.utils.CodingruleUtils; import com.cftech.base.codingrule.utils.CodingruleUtils;
import com.cftech.cdfortis.constants.CdfortisConstant;
import com.cftech.cdfortis.model.CdfortisDrugInfo;
import com.cftech.cdfortis.util.CdfortisResponseUtil;
import com.cftech.cdfortis.util.CdfortisTokenUtil;
import com.cftech.core.sql.Sort; import com.cftech.core.sql.Sort;
import com.cftech.core.util.StringUtils; import com.cftech.core.util.StringUtils;
import com.cftech.core.util.SystemConfig;
import com.cftech.product.model.Product; import com.cftech.product.model.Product;
import com.cftech.product.dao.ProductMapper; import com.cftech.product.dao.ProductMapper;
import com.cftech.product.model.ProductVO; import com.cftech.product.model.ProductVO;
...@@ -18,6 +23,8 @@ import com.cftech.productdetail.model.ProductDetail; ...@@ -18,6 +23,8 @@ import com.cftech.productdetail.model.ProductDetail;
import com.cftech.productintowareroom.dao.ProductIntoWareroomMapper; import com.cftech.productintowareroom.dao.ProductIntoWareroomMapper;
import com.cftech.productintowareroom.model.ProductIntoWareroom; import com.cftech.productintowareroom.model.ProductIntoWareroom;
import com.esotericsoftware.minlog.Log; import com.esotericsoftware.minlog.Log;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -27,6 +34,7 @@ import java.math.BigDecimal; ...@@ -27,6 +34,7 @@ import java.math.BigDecimal;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 产品ServiceImpl * 产品ServiceImpl
...@@ -53,6 +61,10 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P ...@@ -53,6 +61,10 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P
@Autowired @Autowired
private MpAccountsService mpAccountsService; private MpAccountsService mpAccountsService;
@Autowired
private CdfortisTokenUtil cdfortisTokenUtil;
@Override @Override
public GenericDao<Product> getGenericMapper() { public GenericDao<Product> getGenericMapper() {
return productMapper; return productMapper;
...@@ -205,5 +217,45 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P ...@@ -205,5 +217,45 @@ public class ProductServiceImpl extends GenericServiceImpl<Product> implements P
productMapper.updateUploadFlag(productNumberList, uploadFlag ? 1 : 0); productMapper.updateUploadFlag(productNumberList, uploadFlag ? 1 : 0);
} }
/**
* 上传药品清单
*
* @param productList
* @return
*/
@Override
public JSONObject uploadDrugInfo(List<Product> productList) throws Exception {
String uploadUrl = SystemConfig.p.getProperty("cdfortis.drug_upload_url");
// 构建参数
JSONObject param = new JSONObject();
param.put("appid", SystemConfig.p.getProperty("cdfortis.appid"));
param.put("token", cdfortisTokenUtil.getToken());
// 转换药品类型为微问诊需要的结构
List<CdfortisDrugInfo> cdfortisDrugList = productList.stream().map(this::fromProduct).collect(Collectors.toList());
param.put("drugInfo", cdfortisDrugList);
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), param.toJSONString());
// 请求获取数据
String data = CdfortisResponseUtil.request(uploadUrl, CdfortisConstant.METHOD_POST,
null, null, body);
// 判断数据是否正确
return JSONObject.parseObject(data);
}
/**
* 转换药品信息
*
* @return
* @para preDrugs
*/
private CdfortisDrugInfo fromProduct(Product product) {
CdfortisDrugInfo cdfortisDrug = new CdfortisDrugInfo();
cdfortisDrug.setApprNumber(product.getApproveNumber());
cdfortisDrug.setSpec(product.getFormat());
cdfortisDrug.setPrice(String.valueOf(product.getPrice()));
// 这里不确定是否应该用这个字段
cdfortisDrug.setErpId(product.getProductNumber());
cdfortisDrug.setDrugName(product.getProductName());
cdfortisDrug.setFactoryName(product.getManufacturer());
return cdfortisDrug;
}
} }
\ No newline at end of file
package com.cftech.product.web; package com.cftech.product.web;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.base.codingrule.utils.CodingruleUtils; import com.cftech.base.codingrule.utils.CodingruleUtils;
import com.cftech.cdfortis.service.CdfortisService;
import com.cftech.core.util.StringUtils; import com.cftech.core.util.StringUtils;
import com.cftech.product.model.Product; import com.cftech.product.model.Product;
import com.cftech.product.service.ProductService; import com.cftech.product.service.ProductService;
...@@ -19,6 +21,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; ...@@ -19,6 +21,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -27,8 +30,10 @@ import javax.servlet.http.HttpServletRequest; ...@@ -27,8 +30,10 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
...@@ -58,6 +63,8 @@ public class ProductController { ...@@ -58,6 +63,8 @@ public class ProductController {
@Autowired @Autowired
private CodingruleUtils codingruleUtils; private CodingruleUtils codingruleUtils;
@Autowired
private CdfortisService cdfortisService;
//列表页面 //列表页面
@RequiresPermissions(value = PRODUCT_VIEW) @RequiresPermissions(value = PRODUCT_VIEW)
...@@ -138,7 +145,6 @@ public class ProductController { ...@@ -138,7 +145,6 @@ public class ProductController {
Long accountsId = UserUtils.getmpaccounts(request); Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("a.del_flag", Constants.DEL_FLAG_0); conds.equal("a.del_flag", Constants.DEL_FLAG_0);
conds.equal("a.accounts_id", accountsId);
List<String> classifyId = null; List<String> classifyId = null;
if (!StringUtils.isEmpty(product.getProductName())) { if (!StringUtils.isEmpty(product.getProductName())) {
conds.like("a.product_name", product.getProductName()); conds.like("a.product_name", product.getProductName());
...@@ -176,13 +182,50 @@ public class ProductController { ...@@ -176,13 +182,50 @@ public class ProductController {
return rtnJosn; return rtnJosn;
} }
//删除数据
@RequiresPermissions(value = PRODUCT_EDIT)
@RequestMapping("/uploadPlatform")
@ResponseBody
public JSONObject uploadPlatform(String id) {
JSONObject rtnJosn = new JSONObject();
Object data = "";
try {
Product product = productService.fetchById(id);
List<Product> list = new ArrayList<>();
list.add(product);
JSONObject dataJsonObj = productService.uploadDrugInfo(list);
boolean isAllSuccess = dataJsonObj.getBooleanValue("isAllSuccess");
if (!isAllSuccess) {
JSONArray failedDataArr = dataJsonObj.getJSONArray("failedData");
// List转map,key是productNumber、value是product本身
List<String> productNumberList = list.stream()
.map(Product::getProductNumber)
.collect(Collectors.toList());
// 遍历上传失败的数据,排除掉
for (int i = 0; i < failedDataArr.size(); i++) {
String erpId = failedDataArr.getJSONObject(i).getString("erpId");
productNumberList.remove(erpId);
}
if (!CollectionUtils.isEmpty(productNumberList))
productService.updateUploadFlag(productNumberList, true);
data = failedDataArr;
}
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
rtnJosn.put("errorMsg", data);
return rtnJosn;
}
@RequestMapping("/exportExcel") @RequestMapping("/exportExcel")
@RequiresPermissions(value = PRODUCT_VIEW) @RequiresPermissions(value = PRODUCT_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response, Product product) { public void exportExcel(HttpServletRequest request, HttpServletResponse response, Product product) {
Long accountsId = UserUtils.getmpaccounts(request); Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds(); Conds conds = new Conds();
conds.equal("a.del_flag", Constants.DEL_FLAG_0); conds.equal("a.del_flag", Constants.DEL_FLAG_0);
conds.equal("a.accounts_id", accountsId);
List<String> classifyId = null; List<String> classifyId = null;
if (!StringUtils.isEmpty(product.getProductName())) { if (!StringUtils.isEmpty(product.getProductName())) {
conds.like("a.product_name", product.getProductName()); conds.like("a.product_name", product.getProductName());
......
...@@ -86,7 +86,7 @@ jwt.duration=86400000 ...@@ -86,7 +86,7 @@ jwt.duration=86400000
#\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u03AAtrue #\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u03AAtrue
security.secure=false security.secure=false
#\u662F\u5426\u96C6\u7FA4 master\u4E3Atrue #\u662F\u5426\u96C6\u7FA4 master\u4E3Atrue
quartz.isCluster=false quartz.isCluster=true
#\u987A\u4E30\u7269\u6D41\u914D\u7F6E\u4FE1\u606F\u53C2\u6570 #\u987A\u4E30\u7269\u6D41\u914D\u7F6E\u4FE1\u606F\u53C2\u6570
#\u987A\u4E30\u5BA2\u6237\u7F16\u7801 #\u987A\u4E30\u5BA2\u6237\u7F16\u7801
...@@ -108,7 +108,7 @@ APP_SECRET=SD25624CC1DF4AB7 ...@@ -108,7 +108,7 @@ APP_SECRET=SD25624CC1DF4AB7
KAIHUHANG_ADDRESS=\u6C5F\u82CF\u94F6\u884C\u626C\u5DDE\u5510\u57CE\u652F\u884C 90160188000128434 KAIHUHANG_ADDRESS=\u6C5F\u82CF\u94F6\u884C\u626C\u5DDE\u5510\u57CE\u652F\u884C 90160188000128434
CLERK=\u5415\u5029 CLERK=\u5415\u5029
CHECKER=\u7530\u59DD CHECKER=\u7530\u59DD
PAYEE=\u6C6A\u8A00\u52C7 PAYEE=\u6C6A\u8A00\u52C7
#\u5F00\u53D1\u7968\u63A5\u53E3 #\u5F00\u53D1\u7968\u63A5\u53E3
INVOICE_API=nuonuo.ElectronInvoice.requestBillingNew INVOICE_API=nuonuo.ElectronInvoice.requestBillingNew
#\u67E5\u8BE2\u53D1\u7968\u63A5\u53E3 #\u67E5\u8BE2\u53D1\u7968\u63A5\u53E3
...@@ -152,8 +152,8 @@ cdfortis.token_url=https://api.cdfortis.com/api/verify/token?appid={appid}&flag= ...@@ -152,8 +152,8 @@ cdfortis.token_url=https://api.cdfortis.com/api/verify/token?appid={appid}&flag=
cdfortis.appid=74523ca670a6ceab8095a7476805c649 cdfortis.appid=74523ca670a6ceab8095a7476805c649
#\u5FAE\u95EE\u8BCAsecret #\u5FAE\u95EE\u8BCAsecret
cdfortis.secret=c2cf8d3e9a6c715a8046541bf397ccc6 cdfortis.secret=c2cf8d3e9a6c715a8046541bf397ccc6
#\u5FAE\u95EE\u8BCAflag #\u5FAE\u95EE\u8BCAflag old=aidea888
cdfortis.flag=aidea888 cdfortis.flag=wxc43bd62c1
#\u5FAE\u95EE\u8BCA\u836F\u54C1\u6E05\u5355\u4E0A\u4F20\u63A5\u53E3\u5730\u5740 #\u5FAE\u95EE\u8BCA\u836F\u54C1\u6E05\u5355\u4E0A\u4F20\u63A5\u53E3\u5730\u5740
cdfortis.drug_upload_url=https://api.cdfortis.com/api/drug/chain cdfortis.drug_upload_url=https://api.cdfortis.com/api/drug/chain
#\u5FAE\u95EE\u8BCA\u83B7\u53D6\u56FE\u6587\u5904\u65B9\u5217\u8868\u63A5\u53E3 #\u5FAE\u95EE\u8BCA\u83B7\u53D6\u56FE\u6587\u5904\u65B9\u5217\u8868\u63A5\u53E3
...@@ -164,5 +164,5 @@ cdfortis.get_fbusi_pic_url=https://api.cdfortis.com/api/fbusi/getFbusiPicture ...@@ -164,5 +164,5 @@ cdfortis.get_fbusi_pic_url=https://api.cdfortis.com/api/fbusi/getFbusiPicture
cdfortis.get_fbusi_info_url=https://api.cdfortis.com/api/fbusi/getFbusiInfo cdfortis.get_fbusi_info_url=https://api.cdfortis.com/api/fbusi/getFbusiInfo
#\u5FAE\u95EE\u8BCA\u901A\u8FC7\u8BA2\u5355\u53F7\u56FE\u6587\u5904\u65B9\u8BE6\u60C5 #\u5FAE\u95EE\u8BCA\u901A\u8FC7\u8BA2\u5355\u53F7\u56FE\u6587\u5904\u65B9\u8BE6\u60C5
cdfortis.get_fbusi_info_by_order_id_url=https://api.cdfortis.com/api/fbusi/getFbusiInfoByOrderId cdfortis.get_fbusi_info_by_order_id_url=https://api.cdfortis.com/api/fbusi/getFbusiInfoByOrderId
#\u5FAE\u95EE\u8BCA\u836F\u5E97\u7F16\u7801 #\u5FAE\u95EE\u8BCA\u95E8\u5E97\u7F16\u7801
cdfortis.store_no=aidea888 cdfortis.store_no=wxc43bd62c1
\ No newline at end of file
package com.cftech.base.org.api; package com.cftech.base.org.api;
import bsh.StringUtil;
import com.alibaba.excel.util.StringUtils;
import com.cftech.accounts.model.MpAccountsEntity; import com.cftech.accounts.model.MpAccountsEntity;
import com.cftech.core.constants.MpApiConstants; import com.cftech.core.constants.MpApiConstants;
import com.cftech.core.constants.WxApiConstants; import com.cftech.core.constants.WxApiConstants;
...@@ -15,7 +17,9 @@ import java.io.File; ...@@ -15,7 +17,9 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLConnection;
import java.util.UUID; import java.util.UUID;
/** /**
...@@ -58,6 +62,34 @@ public class QyMediaUtil { ...@@ -58,6 +62,34 @@ public class QyMediaUtil {
return res; return res;
} }
/**
* 下载媒体文件至本地
* @param accountsId
* @param moduleName
* @param imageUrl
* @return
*/
public String downloadLocalToDisk(Long accountsId, String moduleName, String imageUrl) {
if (StringUtils.isEmpty(imageUrl)) {
return null;
}
String finalFileName = "";
MpAccountsEntity accountsEntity = mpTokenUtil.searchAccountsById(accountsId);
try {
URL url = new URL(imageUrl);
URLConnection conn = url.openConnection();
conn.setDoInput(true);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
}
return null;
}
/** /**
* 下载媒体文件至磁盘(服务号) * 下载媒体文件至磁盘(服务号)
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment