template.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. import {renderTemplate} from '@/components/print/tools';
  2. export function template60_40(model = {}, title = '') {
  3. const template = renderTemplate.bind(this, model);
  4. const width = 227;
  5. const height = 151;
  6. const margin = 6;
  7. this.PRINT_INITA(0, 0, width, height, title);
  8. // 宽度按纸张的整宽缩放
  9. this.SET_PRINT_MODE('PRINT_PAGE_PERCENT', 'Full-Width');
  10. this.SET_PRINT_MODE('FULL_WIDTH_FOR_OVERFLOW', true);
  11. this.SET_PRINT_MODE('FULL_HEIGHT_OVERFLOW', true);
  12. // 设置输出位置以纸张边缘为基点
  13. this.SET_PRINT_MODE('POS_BASEON_PAPER', true);
  14. let x = margin, y = margin;
  15. let w = 0, h = 0;
  16. this.SET_PRINT_STYLE('Alignment', 2);
  17. w = 215;
  18. h = 20;
  19. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.title}}`));
  20. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  21. y += h;
  22. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.no}}`));
  23. y += h;
  24. w = 115;
  25. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{patient.name}}`));
  26. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  27. x += w;
  28. w = 30;
  29. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.count}}`));
  30. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  31. x += w;
  32. w = 20;
  33. this.ADD_PRINT_TEXT(y, x, w, h, '帖');
  34. x += w;
  35. w = 30;
  36. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.total}}`));
  37. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  38. x += w;
  39. w = 20;
  40. this.ADD_PRINT_TEXT(y, x, w, h, '包');
  41. this.SET_PRINT_STYLE('Alignment', 1);
  42. y += h;
  43. x = margin;
  44. w = 60;
  45. this.ADD_PRINT_TEXT(y, x, w, h, '备注:');
  46. this.SET_PRINT_STYLE('Alignment', 2);
  47. x += w - 2;
  48. w = 60;
  49. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.volume}}`));
  50. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  51. x += w;
  52. w = 50;
  53. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.method}}`));
  54. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  55. x += w;
  56. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.decoction}}`));
  57. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  58. this.SET_PRINT_STYLE('Alignment', 1);
  59. this.ADD_PRINT_TEXT(86, margin, 170, 44, template(`{{record.remark}}`));
  60. this.SET_PRINT_STYLEA(0, 'FontSize', 8);
  61. if (model.record.no) this.ADD_PRINT_BARCODE(99, 175, 46, 46, 'QRCode', model.record.no);
  62. y = 130;
  63. x = margin;
  64. w = 70;
  65. h = 20;
  66. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.delivery}}`));
  67. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  68. x += w;
  69. w = 100;
  70. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.date}}`));
  71. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  72. }
  73. export function template80_50(model = {}, title = '') {
  74. const template = renderTemplate.bind(this, model);
  75. const width = 302;
  76. const height = 189;
  77. const margin = 12;
  78. this.PRINT_INITA(0, 0, width, height, title);
  79. // 宽度按纸张的整宽缩放
  80. this.SET_PRINT_MODE('PRINT_PAGE_PERCENT', 'Full-Width');
  81. this.SET_PRINT_MODE('FULL_WIDTH_FOR_OVERFLOW', true);
  82. this.SET_PRINT_MODE('FULL_HEIGHT_OVERFLOW', true);
  83. // 设置输出位置以纸张边缘为基点
  84. this.SET_PRINT_MODE('POS_BASEON_PAPER', true);
  85. let x = margin, y = margin;
  86. let w = 0, h = 0;
  87. w = 290;
  88. h = 20;
  89. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.title}}`));
  90. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  91. y += h;
  92. w = 196;
  93. this.ADD_PRINT_TEXT(y, x, w, h, '中药煎药取药凭证');
  94. y += h;
  95. w = 50;
  96. this.ADD_PRINT_TEXT(y, x, w, h, '病历号');
  97. x += w - 1;
  98. w = 100;
  99. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.medicalRecordNumber}}`));
  100. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  101. x += w - 3;
  102. w = 50;
  103. this.ADD_PRINT_TEXT(y, x, w, h, '处方号');
  104. x += w - 6;
  105. w = 94 + 6;
  106. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.no}}`));
  107. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  108. y += h;
  109. x = margin;
  110. w = 50;
  111. this.ADD_PRINT_TEXT(y, x, w, h, '姓名:');
  112. x += w;
  113. w = 146 + 6;
  114. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{patient.name}}`));
  115. this.SET_PRINT_STYLEA(0, 'FontSize', 12);
  116. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  117. x += w;
  118. w = 44;
  119. this.ADD_PRINT_TEXT(y, x, w, h, '贴数');
  120. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  121. x += w;
  122. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.count}}`));
  123. this.SET_PRINT_STYLEA(0, 'FontSize', 12);
  124. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  125. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  126. y += h;
  127. x = margin;
  128. h = 44;
  129. this.ADD_PRINT_TEXT(y, x, 230, h, template(`地址:{{recipe.address}}`));
  130. y += h;
  131. x = margin;
  132. h = 20;
  133. w = 50;
  134. this.ADD_PRINT_TEXT(y, x, w, h, '取药:');
  135. x += w;
  136. this.ADD_PRINT_TEXT(y, x, 130, h, template(`{{department}}`));
  137. this.SET_PRINT_STYLEA(0, 'FontSize', 10);
  138. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  139. y += h;
  140. x = margin;
  141. this.ADD_PRINT_TEXT(y, x, 180, h, template(`{{record.remark}}`));
  142. this.SET_PRINT_STYLEA(0, 'FontSize', 8);
  143. y += h - 4;
  144. x = margin;
  145. this.ADD_PRINT_TEXT(y, x, 180, h, template(`{{recipe.method}}`));
  146. this.SET_PRINT_STYLEA(0, 'FontSize', 10);
  147. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  148. this.ADD_PRINT_TEXT(98, 236, 60, 20, template(`{{recipe.delivery}}`));
  149. this.SET_PRINT_STYLEA(0, 'FontSize', 12);
  150. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  151. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  152. if (model.record.no) this.ADD_PRINT_BARCODE(133, 189, 107, 50, '128Auto', model.record.no);
  153. }
  154. /**
  155. * A5 纸 96 PPI (559px * 794px)
  156. *
  157. * @param model
  158. * @param title
  159. */
  160. export function templateA5(model = {}, title = '') {
  161. const template = renderTemplate.bind(this, model);
  162. const size = 40;
  163. const width = 559;
  164. const height = 794;
  165. const margin = 12;
  166. this.PRINT_INITA(0, 0, width, height, title);
  167. // 宽度按纸张的整宽缩放
  168. this.SET_PRINT_MODE('PRINT_PAGE_PERCENT', 'Full-Width');
  169. // 设置输出位置以纸张边缘为基点
  170. this.SET_PRINT_MODE('POS_BASEON_PAPER', true);
  171. const chunks = (function (array, size = 32) {
  172. let result = [];
  173. for (let i = 0; i < array.length; i += size) {result.push(array.slice(i, i + size));}
  174. return result;
  175. })(model.recipe['medicines'], size);
  176. if (!chunks.length) chunks.push([]);
  177. const single = chunks.length === 1;
  178. for (const chunk of chunks) {
  179. let x = margin, y = margin;
  180. let w = 0, h = 0, offset = 0;
  181. // 绘制头部
  182. this.ADD_PRINT_TEXT(y, x, 310, 26, template(`{{record.title}}`));
  183. this.SET_PRINT_STYLEA(0, 'FontSize', 12);
  184. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  185. y = 37;
  186. this.ADD_PRINT_TEXT(y, 117, 100, 20, template(`{{recipe.type}}`));
  187. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  188. this.ADD_PRINT_TEXT(y, 12, 100, 20, template(`{{recipe.decoction}}`));
  189. this.SET_PRINT_STYLEA(0, 'FontSize', 12);
  190. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  191. this.ADD_PRINT_TEXT(y, 222, 100, 20, template(`{{record.serialNumber}}`));
  192. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  193. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  194. if (model.record.no) this.ADD_PRINT_BARCODE(12, 331, 216, 50, '128Auto', model.record.no);
  195. // 绘制顶部信息
  196. y = 66;
  197. h = 20;
  198. offset = 2;
  199. this.ADD_PRINT_TEXT(y, 12, 45, h, '姓名:');
  200. this.ADD_PRINT_TEXT(y, 151, 60, h, template(`性别:{{patient.gender}}`));
  201. this.ADD_PRINT_TEXT(y, 211, 80, h, template(`年龄:{{patient.age}}`));
  202. this.ADD_PRINT_TEXT(y, 291, 100, h, template(`床号:{{record.bedNo}}`));
  203. this.ADD_PRINT_TEXT(y - 6, 56, 96, h + 6, template(`{{patient.name}}`));
  204. this.SET_PRINT_STYLEA(0, 'FontSize', 12);
  205. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  206. y += h + offset;
  207. this.ADD_PRINT_TEXT(y, 12, 200, h, template(`科室:{{department}}`));
  208. this.ADD_PRINT_TEXT(y, 211, 150, h, template(`病历号:{{record.recordNo}}`));
  209. this.ADD_PRINT_TEXT(y, 360, 185, h, template(`开方日期:{{record.date}}`));
  210. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  211. y += h + offset;
  212. h = 34;
  213. this.ADD_PRINT_TEXT(y, 12, 418, h, template(`地址:{{recipe.address}}`));
  214. this.ADD_PRINT_TEXT(y, 430, 120, h, template(`电话:{{patient.phone}}`));
  215. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  216. y += h;
  217. this.ADD_PRINT_TEXT(y, 12, 418, h, template(`临床诊断:{{diagnosis}}`));
  218. this.ADD_PRINT_TEXT(y, 430, 120, h, template(`{{recipe.delivery}}`));
  219. this.SET_PRINT_STYLEA(0, 'FontSize', 12);
  220. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  221. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  222. // 分割线
  223. this.ADD_PRINT_SHAPE(4, 178, 12, 535, 1, 0, 1, '#000000');
  224. y = 188;
  225. this.ADD_PRINT_TEXT(y, 48, 120, 20, '药品名');
  226. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  227. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  228. this.ADD_PRINT_TEXT(y, 168, 50, 20, '单帖量');
  229. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  230. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  231. this.ADD_PRINT_TEXT(y, 220, 48, 20, '用法');
  232. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  233. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  234. if (chunk.length > 1) {
  235. this.ADD_PRINT_TEXT(y, 291, 120, 20, '药品名');
  236. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  237. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  238. this.ADD_PRINT_TEXT(y, 411, 50, 20, '单贴量');
  239. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  240. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  241. this.ADD_PRINT_TEXT(y, 463, 48, 20, '用法');
  242. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  243. }
  244. // 绘制药品
  245. chunk.forEach((medicine, i) => {
  246. const template = renderTemplate.bind(this, medicine);
  247. if (i % 2) {
  248. x = 291;
  249. } else {
  250. y += 20 + 2;
  251. x = 48;
  252. }
  253. this.ADD_PRINT_TEXT(y, x, 120, 20, template(`{{name}}`));
  254. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  255. x += 120;
  256. this.ADD_PRINT_TEXT(y, x, 50, 20, template(`{{dosage}}{{unit}}`));
  257. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  258. x += 50 + 2;
  259. this.ADD_PRINT_TEXT(y, x, 48, 16, template(`{{usage}}`));
  260. this.SET_PRINT_STYLEA(0, 'FontSize', 6);
  261. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  262. });
  263. y += 20 + 2 + 12;
  264. this.ADD_PRINT_TEXT(y, 12, 536, 40, template(`{{record.remark}}`));
  265. y += 40;
  266. x = margin;
  267. h = 20;
  268. w = 130;
  269. this.ADD_PRINT_TEXT(y, x, w, h, template(`用法:{{recipe.method}}`));
  270. this.ADD_PRINT_TEXT(y, width - margin - w, w, 40, template(`{{recipe.volume}}`));
  271. this.SET_PRINT_STYLEA(0, 'FontSize', 12);
  272. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  273. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  274. y += h;
  275. x = margin;
  276. h = 20;
  277. w = 130;
  278. offset = 5;
  279. this.ADD_PRINT_TEXT(y, x, w, h, template(`金额:{{recipe.totalFees}} 元`));
  280. x += w + offset;
  281. this.ADD_PRINT_TEXT(y, x, w, h, template(`共 {{recipe.count}} 剂`));
  282. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  283. x += w + offset;
  284. this.ADD_PRINT_TEXT(y, x, w, h, template(`煎 {{recipe.count}} 剂`));
  285. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  286. y += h;
  287. x = margin;
  288. this.ADD_PRINT_TEXT(y, x, w, h, template(`医生:{{sign.field1}}`));
  289. x += w + offset;
  290. this.ADD_PRINT_TEXT(y, x, w, h, template(`单剂重量:{{recipe.unitWeight}}`));
  291. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  292. x += w + offset;
  293. this.ADD_PRINT_TEXT(y, x, w, h, template(`总重量:{{recipe.totalWeight}}`));
  294. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  295. y += h;
  296. x = margin;
  297. this.ADD_PRINT_TEXT(y, x, w, h, template(`审方人:{{sign.field2}}`));
  298. x += w + offset;
  299. this.ADD_PRINT_TEXT(y, x, w, h, template(`配药人:{{sign.field3}}`));
  300. x += w + offset;
  301. this.ADD_PRINT_TEXT(y, x, w, h, template(`复核人:{{sign.field4}}`));
  302. x += w + offset;
  303. this.ADD_PRINT_TEXT(y, x, w, h, template(`煎药人:{{sign.field6}}`));
  304. if (!single) this.NEWPAGEA();
  305. }
  306. }
  307. /**
  308. * 药品明细清单
  309. * @param model
  310. * @param title
  311. */
  312. export function template72(model, title) {
  313. const template = renderTemplate.bind(this, model);
  314. const width = 272;
  315. const height = 794;
  316. const margin = 0;
  317. this.PRINT_INITA(0, 0, width, height, title);
  318. // 宽度按纸张的整宽缩放
  319. this.SET_PRINT_MODE('PRINT_PAGE_PERCENT', 'Full-Width');
  320. // 设置输出位置以纸张边缘为基点
  321. this.SET_PRINT_MODE('POS_BASEON_PAPER', true);
  322. let x = margin, y = margin;
  323. let w = 0, h = 0;
  324. w = 60;
  325. h = 20;
  326. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.delivery}}`));
  327. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  328. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  329. x += w;
  330. h = 30;
  331. this.ADD_PRINT_TEXT(y, x, width - x - margin, h, template(`{{record.title}}`));
  332. this.SET_PRINT_STYLEA(0, 'FontSize', 12);
  333. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  334. this.SET_PRINT_STYLEA(0, 'Bold', 1);
  335. x = margin;
  336. y += h;
  337. h = 36;
  338. this.ADD_PRINT_TEXT(y, x, width - x - margin, h, template(`{{recipe.address}}`));
  339. this.SET_PRINT_STYLEA(0, 'Underline', 1);
  340. x = margin;
  341. y += h;
  342. w = 118;
  343. h = 20;
  344. this.ADD_PRINT_TEXT(y, x, w, h, template(`序号:{{bedNo}}`));
  345. x += w;
  346. this.ADD_PRINT_TEXT(y, x, width - x - margin, h, template(`处方号:{{record.no}}`));
  347. y += h;
  348. x = margin;
  349. this.ADD_PRINT_TEXT(y, x, 118, h, template(`姓名:{{patient.name}}`));
  350. this.ADD_PRINT_TEXT(y, 118, 75, 20, template(`{{recipe.method}}`));
  351. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  352. this.SET_PRINT_STYLEA(0, 'Underline', 1);
  353. this.ADD_PRINT_TEXT(y, 197, 75, 20, template(`{{recipe.decoction}}`));
  354. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  355. this.SET_PRINT_STYLEA(0, 'Underline', 1);
  356. y += h;
  357. x = margin;
  358. h = 96;
  359. if (model.record.no) this.ADD_PRINT_BARCODE(y, x, h, h, 'QRCode', model.record.no);
  360. x = 94;
  361. h = 45;
  362. this.ADD_PRINT_TEXT(y, x, 178, h, template(`备注:{{record.remark}}`));
  363. y += h;
  364. this.ADD_PRINT_TEXT(y, x, 178, h, template(`另包:`));
  365. x = margin;
  366. y += h;
  367. w = 72;
  368. h = 20;
  369. this.ADD_PRINT_TEXT(y, x, w, h, `药味:${model.recipe.medicines.length}`);
  370. x += w;
  371. w = 100;
  372. this.ADD_PRINT_TEXT(y, x, w, h, template(`帖重:{{recipe.unitWeight}}`));
  373. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  374. x += w;
  375. this.ADD_PRINT_TEXT(y, x, w, h, template(`总重:{{recipe.totalWeight}}`));
  376. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  377. x = margin;
  378. y += h;
  379. w = 100;
  380. this.ADD_PRINT_TEXT(y, x, w, h, template(`开单:{{doctor}}`));
  381. x += w;
  382. this.ADD_PRINT_TEXT(y, x, width - x - margin, h, template(`共 {{recipe.count}} 帖 煎 {{recipe.total}} 包`));
  383. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  384. y += h;
  385. this.ADD_PRINT_SHAPE(4, y, 0, 278, 1, 0, 1, '#000000');
  386. x = margin;
  387. y += 8;
  388. w = 178;
  389. h = 20;
  390. this.ADD_PRINT_TEXT(y, x, w, h, [
  391. template(`{{recipe.frequency}}`),
  392. template(`{{recipe.frequencyTime}}`),
  393. ].filter(Boolean).join(','));
  394. w = 100;
  395. this.ADD_PRINT_TEXT(y, width - w - margin, w, h, template(`装量:{{recipe.totalVolume}} ML`));
  396. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  397. y += h - 2;
  398. this.ADD_PRINT_SHAPE(4, y, 0, 278, 1, 0, 1, '#000000');
  399. y += 10;
  400. this.ADD_PRINT_TEXT(y, 0, 60, 20, '斗号');
  401. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  402. this.ADD_PRINT_TEXT(y, 53, 86, 20, '品名');
  403. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  404. this.ADD_PRINT_TEXT(y, 136, 36, 20, '单帖');
  405. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  406. this.ADD_PRINT_TEXT(y, 166, 36, 20, '总量');
  407. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  408. this.ADD_PRINT_TEXT(y, 196, 36, 20, '单位');
  409. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  410. this.ADD_PRINT_TEXT(y, 228, 44, 20, '特煎');
  411. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  412. y += 20;
  413. this.ADD_PRINT_SHAPE(4, y, 0, 278, 1, 0, 1, '#000000');
  414. y = 285 + h;
  415. this.SET_PRINT_STYLE('FontSize', 8);
  416. model.recipe.medicines.forEach((medicine, i) => {
  417. const template = renderTemplate.bind(this, medicine);
  418. x = margin;
  419. w = 54;
  420. h = 30;
  421. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{mark}}`));
  422. x += w - 1;
  423. w = 86;
  424. this.ADD_PRINT_TEXT(y, x, w, h, template(`{{name}}`));
  425. this.SET_PRINT_STYLEA(0, 'Alignment', 2);
  426. this.ADD_PRINT_TEXT(y, 132, 40, h, template(`{{dosage}}`));
  427. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  428. this.ADD_PRINT_TEXT(y, 164, 40, h, template(`{{total}}`));
  429. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  430. this.ADD_PRINT_TEXT(y, 200, 22, h, template(`{{unit}}`));
  431. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  432. this.ADD_PRINT_TEXT(y, 222, 50, h, template(`{{usage}}`));
  433. this.SET_PRINT_STYLEA(0, 'Alignment', 3);
  434. y += h + 2;
  435. });
  436. this.SET_PRINT_STYLE('FontSize', 9);
  437. // y += 2;
  438. this.ADD_PRINT_SHAPE(4, y, 0, 278, 1, 0, 1, '#000000');
  439. }