|
@@ -12,17 +12,13 @@ $(function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
-function getTcmMr(mrId) {
|
|
|
+function getTcmMr(mrId, num) {
|
|
|
post('/sys/mr/getTcmMr', {mrId: mrId}).then((res) => {
|
|
|
- console.log(res)
|
|
|
+ //console.log(res)
|
|
|
let data = res.data.data || {}
|
|
|
const {tcmdisease, tcmsyndrome} = data;
|
|
|
- if (!tcmdisease) {
|
|
|
- $(".recipe").hide();
|
|
|
- return;
|
|
|
- }
|
|
|
if (res.data.code === '0') {
|
|
|
- getTcmData({tcmDiag: tcmdisease.uniqueName, tcmSyndrome: tcmsyndrome.uniqueName})
|
|
|
+ getTcmData({tcmDiag: tcmdisease.uniqueName, tcmSyndrome: tcmsyndrome.uniqueName}, num)
|
|
|
} else {
|
|
|
|
|
|
}
|
|
@@ -30,7 +26,7 @@ function getTcmMr(mrId) {
|
|
|
}
|
|
|
|
|
|
//获取处方推荐
|
|
|
-function getTcmData(param) {
|
|
|
+function getTcmData(param, num) {
|
|
|
$(".recipe").show();
|
|
|
const {tcmDiag, tcmSyndrome} = param;
|
|
|
$("#jibing").text(tcmDiag + "-" + tcmSyndrome);
|
|
@@ -41,16 +37,16 @@ function getTcmData(param) {
|
|
|
});
|
|
|
//处方推荐
|
|
|
get('/lantone/private/zycftj?jibing=' + tcmDiag + "&zhengxing=" + tcmSyndrome).then((res) => {
|
|
|
- console.log(res)
|
|
|
- let data = res.data.data || {}
|
|
|
+ //console.log(res)
|
|
|
+ let data = res.data.data || []
|
|
|
if (res.data.status) {
|
|
|
- renderTcm(data)
|
|
|
+ renderTcm(data, num)
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
})
|
|
|
- //治法推荐
|
|
|
- get('/lantone/private/zhongyizx?type=1&code=' + tcmDiag + '&value=' + tcmSyndrome).then((res) => {
|
|
|
+ //治法推荐-暂时不用
|
|
|
+ /*get('/lantone/private/zhongyizx?type=1&code=' + tcmDiag + '&value=' + tcmSyndrome).then((res) => {
|
|
|
console.log(res)
|
|
|
let data = res.data.data || {}
|
|
|
if (res.data.status) {
|
|
@@ -58,21 +54,31 @@ function getTcmData(param) {
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
- })
|
|
|
+ })*/
|
|
|
}
|
|
|
|
|
|
-function renderTcm(data) {
|
|
|
- let str = ``;
|
|
|
- data.map((it, i) => {
|
|
|
+function renderTcm(data, num = 3) {
|
|
|
+ let str = ``, it;
|
|
|
+ $("#goTreat").hide();
|
|
|
+ console.log(num)
|
|
|
+ const n = num < data.length ? num : data.length;
|
|
|
+ for (let i = 0; i < n; i++) {
|
|
|
+ it = data[i];
|
|
|
str += `<li class="clearfix"><div class="label">处方${i + 1}:</div>
|
|
|
<div class="val">
|
|
|
<p class="name">${it.name}</p>
|
|
|
<p class="desc">${it.matStr}</p>
|
|
|
</div></li>`;
|
|
|
+ }
|
|
|
|
|
|
- })
|
|
|
- if (data.length > 3) {
|
|
|
- str += `<a class="go go-push" id="goTreat">更多 <img class="icon" src="./images/go.png" alt=""></a>`;
|
|
|
+ if (data.length > num) {
|
|
|
+ if ($("#goTreat").length) { //竖版不增加更多按钮,显示即可
|
|
|
+ str += ``;
|
|
|
+ $("#goTreat").show();
|
|
|
+ } else {
|
|
|
+ str += `<a class="go go-push" id="goTreat">更多 <img class="icon" src="./images/go.png" alt=""></a>`;
|
|
|
+ $("#goTreat").show();
|
|
|
+ }
|
|
|
}
|
|
|
$('.detail ul').html(str);
|
|
|
//更多治法
|