Browse Source

历史排班

28169 1 year ago
parent
commit
145ebf9635

+ 3 - 3
controllers/dialysis_record_api_controller.go View File

@@ -1645,9 +1645,9 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
1645 1645
 		tempassessmentAfterDislysis.SealingFluidDispose = lastAssessmentAfterDislysis.SealingFluidDispose
1646 1646
 		tempassessmentAfterDislysis.SealingFluidSpecial = lastAssessmentAfterDislysis.SealingFluidSpecial
1647 1647
 
1648
-		if adminUserInfo.CurrentOrgId == 10375 {
1649
-			tempassessmentAfterDislysis.SystolicBloodPressure = 0
1650
-			tempassessmentAfterDislysis.DiastolicBloodPressure = 0
1648
+		if adminUserInfo.CurrentOrgId != 10375 {
1649
+			tempassessmentAfterDislysis.SystolicBloodPressure = lastAssessmentAfterDislysis.SystolicBloodPressure
1650
+			tempassessmentAfterDislysis.DiastolicBloodPressure = lastAssessmentAfterDislysis.DiastolicBloodPressure
1651 1651
 		}
1652 1652
 
1653 1653
 	}

+ 2 - 3
controllers/drug_stock_api_contorller.go View File

@@ -251,7 +251,7 @@ func (c *StockDrugApiController) CreateDrugWarehouse() {
251 251
 					Price:            last_price,
252 252
 					TotalPrice:       total,
253 253
 					Status:           1,
254
-					Ctime:            ctime,
254
+					Ctime:            warehousingDate.Unix(),
255 255
 					Remark:           remark,
256 256
 					OrgId:            adminUserInfo.CurrentOrgId,
257 257
 					Type:             types,
@@ -267,7 +267,6 @@ func (c *StockDrugApiController) CreateDrugWarehouse() {
267 267
 					IsCheck:          2,
268 268
 					StockMinNumber:   0,
269 269
 				}
270
-				//fmt.Println(warehouseInfo)
271 270
 				warehousingInfo = append(warehousingInfo, warehouseInfo)
272 271
 			}
273 272
 		}
@@ -3616,7 +3615,7 @@ func (c *StockDrugApiController) CheckWarehousingInfo() {
3616 3615
 				Creator:                 Creator,
3617 3616
 				UpdateCreator:           Creator,
3618 3617
 				Status:                  1,
3619
-				Ctime:                   time.Now().Unix(),
3618
+				Ctime:                   item.Ctime,
3620 3619
 				Mtime:                   0,
3621 3620
 				Price:                   item.Price,
3622 3621
 				WarehousingDetailId:     item.ID,

+ 0 - 7
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -1315,7 +1315,6 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1315 1315
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
1316 1316
 	actual_ultrafiltration, _ := c.GetFloat("actual_ultrafiltration", 0)
1317 1317
 
1318
-	fmt.Println("actual_ultrafiltration233232322323", actual_ultrafiltration)
1319 1318
 	actual_displacement, _ := c.GetFloat("actual_displacement", 0)
1320 1319
 
1321 1320
 	actualtreatHour, _ := c.GetInt64("actual_treatment_hour", 0)
@@ -2561,9 +2560,6 @@ func (c *DialysisAPIController) Finish() {
2561 2560
 		if adminUserInfo.Org.Id != 10375 {
2562 2561
 			tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
2563 2562
 			tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
2564
-		} else {
2565
-			tempassessmentAfterDislysis.SystolicBloodPressure = 0
2566
-			tempassessmentAfterDislysis.DiastolicBloodPressure = 0
2567 2563
 		}
2568 2564
 
2569 2565
 		if adminUserInfo.Org.Id != 10445 {
@@ -2774,9 +2770,6 @@ func (c *DialysisAPIController) Finish() {
2774 2770
 		if adminUserInfo.Org.Id != 10375 {
2775 2771
 			tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
2776 2772
 			tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
2777
-		} else {
2778
-			tempassessmentAfterDislysis.SystolicBloodPressure = 0
2779
-			tempassessmentAfterDislysis.DiastolicBloodPressure = 0
2780 2773
 		}
2781 2774
 
2782 2775
 	}

+ 259 - 265
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -1384,313 +1384,307 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1384 1384
 			defer redis.Close()
1385 1385
 		}
1386 1386
 
1387
-		if err == nil {
1388
-
1389
-			//药品管理信息
1390
-			_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(adminInfo.Org.Id)
1387
+		//药品管理信息
1388
+		_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(adminInfo.Org.Id)
1391 1389
 
1392
-			storeHouseConfig, _ := service.GetAllStoreHouseConfig(adminInfo.Org.Id)
1393
-			if drugStockConfig.IsOpen == 1 {
1394
-				for _, item := range advices {
1395
-					//查询改药品信息
1396
-					medical, _ := service.GetBaseDrugMedical(item.DrugId)
1397
-
1398
-					//判断单位是否合格
1399
-					if item.PrescribingNumberUnit != medical.MaxUnit && item.PrescribingNumberUnit != medical.MinUnit {
1400
-						//查询该药品是否有出库记录
1401
-						flowMap, _ := service.GetDrugFLowByAdviceById(item.DrugId, item.PatientId, item.UserOrgId, item.AdviceDate)
1402
-						if len(flowMap) == 0 {
1403
-							errs := service.UpdateHisAdviceById(item.ID)
1404
-							if errs != nil {
1405
-								drugError := models.XtDrugError{
1406
-									UserOrgId:             adminInfo.Org.Id,
1407
-									DrugId:                item.DrugId,
1408
-									RecordDate:            item.AdviceDate,
1409
-									PatientId:             item.PatientId,
1410
-									Remark:                "单位不统一,执行失败",
1411
-									Status:                1,
1412
-									Ctime:                 time.Now().Unix(),
1413
-									Mtime:                 0,
1414
-									SumCount:              0,
1415
-									Prescribingnumber:     item.PrescribingNumber,
1416
-									PrescribingNumberUnit: item.PrescribingNumberUnit,
1417
-								}
1418
-								service.CreateDrugError(drugError)
1390
+		storeHouseConfig, _ := service.GetAllStoreHouseConfig(adminInfo.Org.Id)
1391
+		if drugStockConfig.IsOpen == 1 {
1392
+			for _, item := range advices {
1393
+				//查询改药品信息
1394
+				medical, _ := service.GetBaseDrugMedical(item.DrugId)
1395
+
1396
+				//判断单位是否合格
1397
+				if item.PrescribingNumberUnit != medical.MaxUnit && item.PrescribingNumberUnit != medical.MinUnit {
1398
+					//查询该药品是否有出库记录
1399
+					flowMap, _ := service.GetDrugFLowByAdviceById(item.DrugId, item.PatientId, item.UserOrgId, item.AdviceDate)
1400
+					if len(flowMap) == 0 {
1401
+						errs := service.UpdateHisAdviceById(item.ID)
1402
+						if errs != nil {
1403
+							drugError := models.XtDrugError{
1404
+								UserOrgId:             adminInfo.Org.Id,
1405
+								DrugId:                item.DrugId,
1406
+								RecordDate:            item.AdviceDate,
1407
+								PatientId:             item.PatientId,
1408
+								Remark:                "单位不统一,执行失败",
1409
+								Status:                1,
1410
+								Ctime:                 time.Now().Unix(),
1411
+								Mtime:                 0,
1412
+								SumCount:              0,
1413
+								Prescribingnumber:     item.PrescribingNumber,
1414
+								PrescribingNumberUnit: item.PrescribingNumberUnit,
1419 1415
 							}
1416
+							service.CreateDrugError(drugError)
1420 1417
 						}
1421
-						advice, _ := service.FindHisDoctorAdviceById(adminInfo.Org.Id, item.ID)
1422
-						c.ServeSuccessJSON(map[string]interface{}{
1423
-							"msg":    "7",
1424
-							"advice": advice,
1425
-							"ids":    ids,
1426
-						})
1427
-						return
1428 1418
 					}
1419
+					advice, _ := service.FindHisDoctorAdviceById(adminInfo.Org.Id, item.ID)
1420
+					c.ServeSuccessJSON(map[string]interface{}{
1421
+						"msg":    "7",
1422
+						"advice": advice,
1423
+						"ids":    ids,
1424
+					})
1425
+					return
1426
+				}
1429 1427
 
1430
-					//查询这个患者这个患者这个药已经出库的所有数量
1431
-					advicelist, _ := service.GetAllHisDoctorAdviceById(item.DrugId, item.PatientId, item.AdviceDate, item.UserOrgId)
1432
-					drugoutlist, _ := service.GetAllDrugFlowById(item.DrugId, item.PatientId, item.AdviceDate, item.UserOrgId)
1433
-					var total_count int64
1434
-					var drug_count int64
1435
-					for _, it := range advicelist {
1436
-						if it.PrescribingNumberUnit == medical.MaxUnit {
1437
-							prescribingNumber_temp := strconv.FormatFloat(math.Abs(it.PrescribingNumber), 'f', 0, 64)
1438
-							prenumber, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
1439
-							total_count += prenumber * medical.MinNumber
1440
-						}
1441
-						if it.PrescribingNumberUnit == medical.MinUnit {
1442
-							prescribingNumber_temp := strconv.FormatFloat(math.Abs(it.PrescribingNumber), 'f', 0, 64)
1443
-							prenumber, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
1444
-							total_count += prenumber
1445
-						}
1446
-
1428
+				//查询这个患者这个患者这个药已经出库的所有数量
1429
+				advicelist, _ := service.GetAllHisDoctorAdviceById(item.DrugId, item.PatientId, item.AdviceDate, item.UserOrgId)
1430
+				drugoutlist, _ := service.GetAllDrugFlowById(item.DrugId, item.PatientId, item.AdviceDate, item.UserOrgId)
1431
+				var total_count int64
1432
+				var drug_count int64
1433
+				for _, it := range advicelist {
1434
+					if it.PrescribingNumberUnit == medical.MaxUnit {
1435
+						prescribingNumber_temp := strconv.FormatFloat(math.Abs(it.PrescribingNumber), 'f', 0, 64)
1436
+						prenumber, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
1437
+						total_count += prenumber * medical.MinNumber
1438
+					}
1439
+					if it.PrescribingNumberUnit == medical.MinUnit {
1440
+						prescribingNumber_temp := strconv.FormatFloat(math.Abs(it.PrescribingNumber), 'f', 0, 64)
1441
+						prenumber, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
1442
+						total_count += prenumber
1447 1443
 					}
1448 1444
 
1449
-					for _, its := range drugoutlist {
1450
-						if its.CountUnit == medical.MaxUnit {
1451
-							drug_count += its.Count * medical.MinNumber
1452
-						}
1453
-						if its.CountUnit == medical.MinUnit {
1454
-							drug_count += its.Count
1455
-						}
1445
+				}
1446
+
1447
+				for _, its := range drugoutlist {
1448
+					if its.CountUnit == medical.MaxUnit {
1449
+						drug_count += its.Count * medical.MinNumber
1456 1450
 					}
1457
-					if total_count == drug_count {
1458
-
1459
-						advice, _ := service.FindHisDoctorAdviceById(adminInfo.Org.Id, item.ID)
1460
-						c.ServeSuccessJSON(map[string]interface{}{
1461
-							"msg":    "1",
1462
-							"advice": advice,
1463
-							"ids":    ids,
1464
-						})
1465
-						return
1451
+					if its.CountUnit == medical.MinUnit {
1452
+						drug_count += its.Count
1466 1453
 					}
1454
+				}
1455
+				if total_count == drug_count {
1467 1456
 
1468 1457
 					advice, _ := service.FindHisDoctorAdviceById(adminInfo.Org.Id, item.ID)
1458
+					c.ServeSuccessJSON(map[string]interface{}{
1459
+						"msg":    "1",
1460
+						"advice": advice,
1461
+						"ids":    ids,
1462
+					})
1463
+					return
1464
+				}
1469 1465
 
1470
-					var total int64
1471
-					var prescribing_number_total int64
1466
+				advice, _ := service.FindHisDoctorAdviceById(adminInfo.Org.Id, item.ID)
1472 1467
 
1473
-					config, _ := service.GetDrugOpenConfigOne(adminInfo.Org.Id)
1468
+				var total int64
1469
+				var prescribing_number_total int64
1474 1470
 
1475
-					if config.IsOpen != 1 {
1476
-						//查询该药品是否有库存
1477
-						houseConfig, _ := service.GetAllStoreHouseConfig(advice.UserOrgId)
1478
-						list, _ := service.GetDrugTotalCount(advice.DrugId, advice.UserOrgId, houseConfig.DrugStorehouseOut)
1471
+				config, _ := service.GetDrugOpenConfigOne(adminInfo.Org.Id)
1479 1472
 
1480
-						//判断单位是否相等
1481
-						if medical.MaxUnit == advice.PrescribingNumberUnit {
1482
-							prescribingNumber_temp := strconv.FormatFloat(math.Abs(advice.PrescribingNumber), 'f', 0, 64)
1483
-							count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
1484
-							//转化为最小单位
1485
-							total = list.Count*medical.MinNumber + list.StockMinNumber
1486
-							prescribing_number_total = count * medical.MinNumber
1487
-						}
1488
-						//fmt.Println("医嘱开的数量", total)
1489
-						if medical.MinUnit == advice.PrescribingNumberUnit {
1490
-							prescribingNumber_temp := strconv.FormatFloat(math.Abs(advice.PrescribingNumber), 'f', 0, 64)
1491
-							count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
1492
-							total = list.Count*medical.MinNumber + list.StockMinNumber
1493
-							prescribing_number_total = count
1494
-						}
1473
+				if config.IsOpen != 1 {
1474
+					//查询该药品是否有库存
1475
+					houseConfig, _ := service.GetAllStoreHouseConfig(advice.UserOrgId)
1476
+					list, _ := service.GetDrugTotalCount(advice.DrugId, advice.UserOrgId, houseConfig.DrugStorehouseOut)
1495 1477
 
1496
-						if medical.IsUse == 1 {
1497
-
1498
-							if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1499
-								drugError := models.XtDrugError{
1500
-									UserOrgId:             adminInfo.Org.Id,
1501
-									DrugId:                item.DrugId,
1502
-									RecordDate:            item.AdviceDate,
1503
-									PatientId:             item.PatientId,
1504
-									Remark:                "零用药品库存不足",
1505
-									Status:                1,
1506
-									Ctime:                 time.Now().Unix(),
1507
-									Mtime:                 0,
1508
-									SumCount:              list.Count*medical.MinNumber + list.StockMinNumber,
1509
-									Prescribingnumber:     advice.PrescribingNumber,
1510
-									PrescribingNumberUnit: advice.PrescribingNumberUnit,
1511
-								}
1512
-								service.CreateDrugError(drugError)
1513
-								c.ServeSuccessJSON(map[string]interface{}{
1514
-									"msg":    "1",
1515
-									"advice": advice,
1516
-									"ids":    ids,
1517
-								})
1518
-								return
1478
+					//判断单位是否相等
1479
+					if medical.MaxUnit == advice.PrescribingNumberUnit {
1480
+						prescribingNumber_temp := strconv.FormatFloat(math.Abs(advice.PrescribingNumber), 'f', 0, 64)
1481
+						count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
1482
+						//转化为最小单位
1483
+						total = list.Count*medical.MinNumber + list.StockMinNumber
1484
+						prescribing_number_total = count * medical.MinNumber
1485
+					}
1486
+					//fmt.Println("医嘱开的数量", total)
1487
+					if medical.MinUnit == advice.PrescribingNumberUnit {
1488
+						prescribingNumber_temp := strconv.FormatFloat(math.Abs(advice.PrescribingNumber), 'f', 0, 64)
1489
+						count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
1490
+						total = list.Count*medical.MinNumber + list.StockMinNumber
1491
+						prescribing_number_total = count
1492
+					}
1493
+
1494
+					if medical.IsUse == 1 {
1495
+
1496
+						if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1497
+							drugError := models.XtDrugError{
1498
+								UserOrgId:             adminInfo.Org.Id,
1499
+								DrugId:                item.DrugId,
1500
+								RecordDate:            item.AdviceDate,
1501
+								PatientId:             item.PatientId,
1502
+								Remark:                "零用药品库存不足",
1503
+								Status:                1,
1504
+								Ctime:                 time.Now().Unix(),
1505
+								Mtime:                 0,
1506
+								SumCount:              list.Count*medical.MinNumber + list.StockMinNumber,
1507
+								Prescribingnumber:     advice.PrescribingNumber,
1508
+								PrescribingNumberUnit: advice.PrescribingNumberUnit,
1519 1509
 							}
1510
+							service.CreateDrugError(drugError)
1511
+							c.ServeSuccessJSON(map[string]interface{}{
1512
+								"msg":    "1",
1513
+								"advice": advice,
1514
+								"ids":    ids,
1515
+							})
1516
+							return
1520 1517
 						}
1521
-						if medical.IsUse != 1 {
1522
-
1523
-							if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1524
-								drugError := models.XtDrugError{
1525
-									UserOrgId:             adminInfo.Org.Id,
1526
-									DrugId:                item.DrugId,
1527
-									RecordDate:            item.AdviceDate,
1528
-									PatientId:             item.PatientId,
1529
-									Remark:                "药品库存不足",
1530
-									Status:                1,
1531
-									Ctime:                 time.Now().Unix(),
1532
-									Mtime:                 0,
1533
-									SumCount:              list.Count*medical.MinNumber + list.StockMinNumber,
1534
-									Prescribingnumber:     advice.PrescribingNumber,
1535
-									PrescribingNumberUnit: advice.PrescribingNumberUnit,
1536
-								}
1537
-								service.CreateDrugError(drugError)
1538
-								c.ServeSuccessJSON(map[string]interface{}{
1539
-									"msg":    "3",
1540
-									"advice": advice,
1541
-									"ids":    ids,
1542
-								})
1543
-								return
1518
+					}
1519
+					if medical.IsUse != 1 {
1520
+
1521
+						if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1522
+							drugError := models.XtDrugError{
1523
+								UserOrgId:             adminInfo.Org.Id,
1524
+								DrugId:                item.DrugId,
1525
+								RecordDate:            item.AdviceDate,
1526
+								PatientId:             item.PatientId,
1527
+								Remark:                "药品库存不足",
1528
+								Status:                1,
1529
+								Ctime:                 time.Now().Unix(),
1530
+								Mtime:                 0,
1531
+								SumCount:              list.Count*medical.MinNumber + list.StockMinNumber,
1532
+								Prescribingnumber:     advice.PrescribingNumber,
1533
+								PrescribingNumberUnit: advice.PrescribingNumberUnit,
1544 1534
 							}
1545
-							if prescribing_number_total > total {
1546
-								drugError := models.XtDrugError{
1547
-									UserOrgId:             adminInfo.Org.Id,
1548
-									DrugId:                item.DrugId,
1549
-									RecordDate:            item.AdviceDate,
1550
-									PatientId:             item.PatientId,
1551
-									Remark:                "出库数量大于库存",
1552
-									Status:                1,
1553
-									Ctime:                 time.Now().Unix(),
1554
-									Mtime:                 0,
1555
-									SumCount:              list.Count*medical.MinNumber + list.StockMinNumber,
1556
-									Prescribingnumber:     advice.PrescribingNumber,
1557
-									PrescribingNumberUnit: advice.PrescribingNumberUnit,
1558
-								}
1559
-								service.CreateDrugError(drugError)
1560
-								c.ServeSuccessJSON(map[string]interface{}{
1561
-									"msg":    "2",
1562
-									"advice": advice,
1563
-									"ids":    ids,
1564
-								})
1565
-								return
1535
+							service.CreateDrugError(drugError)
1536
+							c.ServeSuccessJSON(map[string]interface{}{
1537
+								"msg":    "3",
1538
+								"advice": advice,
1539
+								"ids":    ids,
1540
+							})
1541
+							return
1542
+						}
1543
+						if prescribing_number_total > total {
1544
+							drugError := models.XtDrugError{
1545
+								UserOrgId:             adminInfo.Org.Id,
1546
+								DrugId:                item.DrugId,
1547
+								RecordDate:            item.AdviceDate,
1548
+								PatientId:             item.PatientId,
1549
+								Remark:                "出库数量大于库存",
1550
+								Status:                1,
1551
+								Ctime:                 time.Now().Unix(),
1552
+								Mtime:                 0,
1553
+								SumCount:              list.Count*medical.MinNumber + list.StockMinNumber,
1554
+								Prescribingnumber:     advice.PrescribingNumber,
1555
+								PrescribingNumberUnit: advice.PrescribingNumberUnit,
1566 1556
 							}
1557
+							service.CreateDrugError(drugError)
1558
+							c.ServeSuccessJSON(map[string]interface{}{
1559
+								"msg":    "2",
1560
+								"advice": advice,
1561
+								"ids":    ids,
1562
+							})
1563
+							return
1567 1564
 						}
1565
+					}
1568 1566
 
1569
-						if prescribing_number_total <= total {
1567
+					if prescribing_number_total <= total {
1570 1568
 
1571
-							pharmacyConfig, _ := service.FindPharmacyConfig(advice.UserOrgId)
1572
-							//判断药品是否零用
1573
-							if medical.IsUse == 2 {
1569
+						pharmacyConfig, _ := service.FindPharmacyConfig(advice.UserOrgId)
1570
+						//判断药品是否零用
1571
+						if medical.IsUse == 2 {
1574 1572
 
1575
-								if config.IsOpen != 1 {
1576
-									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
1577
-										service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1578
-
1579
-										if adminInfo.Org.Id == 3877 || adminInfo.Org.Id == 10265 {
1580
-											//查询该药品是否有出库记录
1581
-											flowMap, _ := service.GetDrugFLowByAdviceById(advice.DrugId, advice.PatientId, advice.UserOrgId, advice.AdviceDate)
1582
-											if len(flowMap) == 0 {
1583
-												errs := service.UpdateHisAdviceById(advice.ID)
1584
-												if errs != nil {
1585
-													drugError := models.XtDrugError{
1586
-														UserOrgId:             adminInfo.Org.Id,
1587
-														DrugId:                item.DrugId,
1588
-														RecordDate:            item.AdviceDate,
1589
-														PatientId:             item.PatientId,
1590
-														Remark:                "出库记录为空,更新执行人失败",
1591
-														Status:                1,
1592
-														Ctime:                 time.Now().Unix(),
1593
-														Mtime:                 0,
1594
-														SumCount:              list.Count*medical.MinNumber + list.StockMinNumber,
1595
-														Prescribingnumber:     advice.PrescribingNumber,
1596
-														PrescribingNumberUnit: advice.PrescribingNumberUnit,
1597
-													}
1598
-													service.CreateDrugError(drugError)
1573
+							if config.IsOpen != 1 {
1574
+								if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
1575
+									service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1576
+
1577
+									if adminInfo.Org.Id == 3877 || adminInfo.Org.Id == 10265 {
1578
+										//查询该药品是否有出库记录
1579
+										flowMap, _ := service.GetDrugFLowByAdviceById(advice.DrugId, advice.PatientId, advice.UserOrgId, advice.AdviceDate)
1580
+										if len(flowMap) == 0 {
1581
+											errs := service.UpdateHisAdviceById(advice.ID)
1582
+											if errs != nil {
1583
+												drugError := models.XtDrugError{
1584
+													UserOrgId:             adminInfo.Org.Id,
1585
+													DrugId:                item.DrugId,
1586
+													RecordDate:            item.AdviceDate,
1587
+													PatientId:             item.PatientId,
1588
+													Remark:                "出库记录为空,更新执行人失败",
1589
+													Status:                1,
1590
+													Ctime:                 time.Now().Unix(),
1591
+													Mtime:                 0,
1592
+													SumCount:              list.Count*medical.MinNumber + list.StockMinNumber,
1593
+													Prescribingnumber:     advice.PrescribingNumber,
1594
+													PrescribingNumberUnit: advice.PrescribingNumberUnit,
1599 1595
 												}
1600
-												c.ServeSuccessJSON(map[string]interface{}{
1601
-													"msg":    "6",
1602
-													"advice": advice,
1603
-													"ids":    ids,
1604
-												})
1605
-												return
1596
+												service.CreateDrugError(drugError)
1606 1597
 											}
1598
+											c.ServeSuccessJSON(map[string]interface{}{
1599
+												"msg":    "6",
1600
+												"advice": advice,
1601
+												"ids":    ids,
1602
+											})
1603
+											return
1607 1604
 										}
1608 1605
 									}
1609
-									if pharmacyConfig.IsOpen != 1 {
1606
+								}
1607
+								if pharmacyConfig.IsOpen != 1 {
1610 1608
 
1611
-										service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1612
-										if adminInfo.Org.Id == 3877 || adminInfo.Org.Id == 10265 {
1613
-											//查询该药品是否有出库记录
1614
-											flowMap, _ := service.GetDrugFLowByAdviceById(advice.DrugId, advice.PatientId, advice.UserOrgId, advice.AdviceDate)
1615
-
1616
-											if len(flowMap) == 0 {
1617
-
1618
-												errs := service.UpdateHisAdviceById(advice.ID)
1619
-												if errs != nil {
1620
-													drugError := models.XtDrugError{
1621
-														UserOrgId:             adminInfo.Org.Id,
1622
-														DrugId:                item.DrugId,
1623
-														RecordDate:            item.AdviceDate,
1624
-														PatientId:             item.PatientId,
1625
-														Remark:                "出库记录为空,更新执行人失败",
1626
-														Status:                1,
1627
-														Ctime:                 time.Now().Unix(),
1628
-														Mtime:                 0,
1629
-														SumCount:              list.Count*medical.MinNumber + list.StockMinNumber,
1630
-														Prescribingnumber:     advice.PrescribingNumber,
1631
-														PrescribingNumberUnit: advice.PrescribingNumberUnit,
1632
-													}
1633
-													service.CreateDrugError(drugError)
1609
+									service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1610
+									if adminInfo.Org.Id == 3877 || adminInfo.Org.Id == 10265 {
1611
+										//查询该药品是否有出库记录
1612
+										flowMap, _ := service.GetDrugFLowByAdviceById(advice.DrugId, advice.PatientId, advice.UserOrgId, advice.AdviceDate)
1613
+
1614
+										if len(flowMap) == 0 {
1615
+
1616
+											errs := service.UpdateHisAdviceById(advice.ID)
1617
+											if errs != nil {
1618
+												drugError := models.XtDrugError{
1619
+													UserOrgId:             adminInfo.Org.Id,
1620
+													DrugId:                item.DrugId,
1621
+													RecordDate:            item.AdviceDate,
1622
+													PatientId:             item.PatientId,
1623
+													Remark:                "出库记录为空,更新执行人失败",
1624
+													Status:                1,
1625
+													Ctime:                 time.Now().Unix(),
1626
+													Mtime:                 0,
1627
+													SumCount:              list.Count*medical.MinNumber + list.StockMinNumber,
1628
+													Prescribingnumber:     advice.PrescribingNumber,
1629
+													PrescribingNumberUnit: advice.PrescribingNumberUnit,
1634 1630
 												}
1635
-												c.ServeSuccessJSON(map[string]interface{}{
1636
-													"msg":    "6",
1637
-													"advice": advice,
1638
-													"ids":    ids,
1639
-												})
1640
-												return
1631
+												service.CreateDrugError(drugError)
1641 1632
 											}
1633
+											c.ServeSuccessJSON(map[string]interface{}{
1634
+												"msg":    "6",
1635
+												"advice": advice,
1636
+												"ids":    ids,
1637
+											})
1638
+											return
1642 1639
 										}
1643 1640
 									}
1641
+								}
1644 1642
 
1645
-									//更新字典里面的库存
1646
-									stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1647
-									var sum_count int64
1648
-									for _, its := range stockInfo {
1649
-										if its.MaxUnit == medical.MaxUnit {
1650
-											its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1651
-										}
1652
-										sum_count += its.StockMaxNumber + its.StockMinNumber
1643
+								//更新字典里面的库存
1644
+								stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1645
+								var sum_count int64
1646
+								for _, its := range stockInfo {
1647
+									if its.MaxUnit == medical.MaxUnit {
1648
+										its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1653 1649
 									}
1654
-									service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1655
-									//剩余库存
1656
-									service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1650
+									sum_count += its.StockMaxNumber + its.StockMinNumber
1657 1651
 								}
1658
-
1652
+								service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1653
+								//剩余库存
1654
+								service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1659 1655
 							}
1656
+
1660 1657
 						}
1661 1658
 					}
1659
+				}
1662 1660
 
1663
-					//
1664
-					//if config.IsOpen == 1 && item.UserOrgId == 10188 {
1665
-					//
1666
-					//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1667
-					//	//更新字典里面的库存
1668
-					//	stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1669
-					//	var sum_count int64
1670
-					//	for _, its := range stockInfo {
1671
-					//		if its.MaxUnit == medical.MaxUnit {
1672
-					//			its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1673
-					//		}
1674
-					//		sum_count += its.StockMaxNumber + its.StockMinNumber
1675
-					//	}
1676
-					//	service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1677
-					//	//剩余库存
1678
-					//	service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1679
-					//}
1661
+				//
1662
+				//if config.IsOpen == 1 && item.UserOrgId == 10188 {
1663
+				//
1664
+				//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1665
+				//	//更新字典里面的库存
1666
+				//	stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1667
+				//	var sum_count int64
1668
+				//	for _, its := range stockInfo {
1669
+				//		if its.MaxUnit == medical.MaxUnit {
1670
+				//			its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1671
+				//		}
1672
+				//		sum_count += its.StockMaxNumber + its.StockMinNumber
1673
+				//	}
1674
+				//	service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1675
+				//	//剩余库存
1676
+				//	service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1677
+				//}
1680 1678
 
1681
-				}
1682 1679
 			}
1683
-			for _, item := range advices {
1684
-				advice, _ := service.FindHisDoctorAdviceById(adminInfo.Org.Id, item.ID)
1685
-				c.ServeSuccessJSON(map[string]interface{}{
1686
-					"msg":    "1",
1687
-					"advice": advice,
1688
-					"ids":    ids,
1689
-				})
1690
-			}
1691
-
1692
-		} else {
1693
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1680
+		}
1681
+		for _, item := range advices {
1682
+			advice, _ := service.FindHisDoctorAdviceById(adminInfo.Org.Id, item.ID)
1683
+			c.ServeSuccessJSON(map[string]interface{}{
1684
+				"msg":    "1",
1685
+				"advice": advice,
1686
+				"ids":    ids,
1687
+			})
1694 1688
 		}
1695 1689
 
1696 1690
 	}

+ 2 - 1
controllers/self_drug_api_congtroller.go View File

@@ -1771,7 +1771,8 @@ func (this *SelfDrugApiController) GetWarehoseInfoById() {
1771 1771
 
1772 1772
 	id, _ := this.GetInt64("id")
1773 1773
 	storehouse_id, _ := this.GetInt64("storehouse_id")
1774
-	list, _ := service.GetWarehoseInfoById(id, storehouse_id)
1774
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1775
+	list, _ := service.GetWarehoseInfoById(id, storehouse_id, orgId)
1775 1776
 
1776 1777
 	this.ServeSuccessJSON(map[string]interface{}{
1777 1778
 		"list": list,

+ 81 - 44
controllers/sign_api_controller.go View File

@@ -84,6 +84,8 @@ func SignApiRegistRouters() {
84 84
 	//删除
85 85
 	beego.Router("/api/device/tosavepdfinformation", &SignApiController{}, "Get:SavePdfInformation")
86 86
 
87
+	beego.Router("/api/device/tocheckinformation", &SignApiController{}, "Get:ToCheckInformation")
88
+
87 89
 }
88 90
 
89 91
 // 短信服务接口
@@ -669,17 +671,20 @@ func (this *SignApiController) SavePdfInformation() {
669 671
 	//业务单号
670 672
 	maprequest["orderId"] = "13318464642"
671 673
 
672
-	maprequest["signTitle"] = "合同"
674
+	maprequest["signTitle"] = "举报合同"
673 675
 
674
-	file := "C:/Users/28169/Desktop/2.pdf"
676
+	//file := "C:/Users/28169/Desktop/2.pdf"
677
+	file := "/swspan/gopath/src/XT_New/static/2.pdf"
675 678
 
676 679
 	fileBytes, _ := ioutil.ReadFile(file) // 读取file
677 680
 
678 681
 	contractBase64 := base64.StdEncoding.EncodeToString(fileBytes) // 加密成base64字符串
679 682
 	//文件获取方式
680
-	maprequest["fileType"] = contractBase64
683
+	maprequest["fileType"] = 1
684
+
685
+	maprequest["pdfBase64"] = contractBase64
681 686
 	//合同内容
682
-	maprequest["fileContent"] = "绝密文件"
687
+	maprequest["fileContent"] = contractBase64
683 688
 
684 689
 	//签署用户人ID
685 690
 	maprequest["userId"] = "JMO9U8JH4TN8E3QOI0GUVUF2"
@@ -701,63 +706,95 @@ func (this *SignApiController) SavePdfInformation() {
701 706
 	//证件编码
702 707
 	Receiver["cardNumber"] = "430526199408156511"
703 708
 
704
-	stepStamper := make([]map[string]interface{}, 0)
705
-	for _, item := range stepStamper {
706
-		fmt.Println(item)
707
-		keywordSignControls := make(map[string]interface{})
708
-		keywordSignControls["sealName"] = "1"
709
-		keywordSignControls["keyword"] = ""
710
-		keywordSignControls["pages"] = "0"
711
-		keywordSignControls["offsetX"] = "100"
712
-		keywordSignControls["offsetY"] = "100"
713
-		stepStamper = append(stepStamper, keywordSignControls)
714
-
715
-		crossSignControls := make(map[string]interface{})
716
-		crossSignControls["sealName"] = "2"
717
-		crossSignControls["positionX"] = "100"
718
-		crossSignControls["positionY"] = "100"
719
-		stepStamper = append(stepStamper, crossSignControls)
720
-
721
-		xySignControls := make(map[string]interface{})
722
-		xySignControls["sealName"] = "2"
723
-		xySignControls["positionX"] = "100"
724
-		xySignControls["positionY"] = "100"
725
-
726
-		stepStamper = append(stepStamper, xySignControls)
727
-	}
709
+	stepStamper := make(map[string]interface{})
710
+
711
+	keywordSignControls := make([]map[string]interface{}, 0)
712
+
713
+	inputArrOne := make(map[string]interface{})
714
+
715
+	inputArrOne["sealName"] = "1"
716
+	inputArrOne["keyword"] = ""
717
+	inputArrOne["pages"] = "0"
718
+	inputArrOne["offsetX"] = "100"
719
+	inputArrOne["offsetY"] = "100"
720
+
721
+	keywordSignControls = append(keywordSignControls, inputArrOne)
722
+
723
+	stepStamper["keywordSignControls"] = keywordSignControls
724
+
725
+	crossSignControls := make([]map[string]interface{}, 0)
726
+
727
+	inputArrTwo := make(map[string]interface{})
728
+	inputArrTwo["sealName"] = "2"
729
+	inputArrTwo["positionX"] = "100"
730
+	inputArrTwo["positionY"] = "100"
731
+	crossSignControls = append(crossSignControls, inputArrTwo)
732
+
733
+	stepStamper["crossSignControls"] = crossSignControls
734
+
735
+	xySignControls := make([]map[string]interface{}, 0)
736
+
737
+	inputArrThree := make(map[string]interface{})
738
+	inputArrThree["sealName"] = "2"
739
+	inputArrThree["positionX"] = "100"
740
+	inputArrThree["positionY"] = "100"
741
+
742
+	xySignControls = append(xySignControls, inputArrThree)
743
+
744
+	stepStamper["xySignControls"] = xySignControls
728 745
 
729 746
 	maprequest["stepStamper"] = stepStamper
730 747
 
731 748
 	seals := make([]map[string]interface{}, 0)
732 749
 
733
-	sealImages := make(map[string]interface{})
734
-	sealImages["sealBase64"] = "2"
735
-	sealImages["width"] = "100"
736
-	sealImages["height"] = "100"
737
-	sealImages["verticalAlign"] = "middle"
750
+	sealImagesList := make(map[string]interface{})
751
+
752
+	fileOne := "/swspan/gopath/src/XT_New/static/seal.jpg"
753
+
754
+	fileBytesOne, _ := ioutil.ReadFile(fileOne) // 读取file
755
+
756
+	contractBase64One := base64.StdEncoding.EncodeToString(fileBytesOne) // 加密成base64字符串
757
+	sealImagesList["sealBase64"] = contractBase64One
758
+	sealImagesList["width"] = "100"
759
+	sealImagesList["height"] = "100"
760
+	sealImagesList["verticalAlign"] = "middle"
738 761
 
739
-	seals = append(seals, sealImages)
762
+	sealTextsList := make(map[string]interface{})
763
+	sealTextsList["text"] = "2"
764
+	sealTextsList["fontSize"] = "100"
765
+	sealTextsList["fontColor"] = "100"
766
+	sealTextsList["isTextArea"] = true
767
+	sealTextsList["textAlign"] = 0
768
+	sealTextsList["width"] = 300
769
+	sealTextsList["height"] = 300
740 770
 
741
-	sealTexts := make(map[string]interface{})
742
-	sealTexts["text"] = "2"
743
-	sealTexts["fontSize"] = "100"
744
-	sealTexts["fontColor"] = "100"
745
-	sealTexts["isTextArea"] = true
746
-	sealTexts["textAlign"] = 0
747
-	sealTexts["width"] = 300
748
-	sealTexts["height"] = 300
771
+	sealsObj := make(map[string]interface{})
749 772
 
750
-	seals = append(seals, sealTexts)
773
+	sealsObj["sealWidth"] = "300"
774
+	sealsObj["sealHeight"] = "300"
775
+	sealsObj["sealName"] = 1
776
+	sealsObj["sealImage"] = sealImagesList
777
+	sealsObj["sealText"] = sealTextsList
751 778
 
779
+	seals = append(seals, sealsObj)
752 780
 	maprequest["seals"] = seals
753 781
 
754 782
 	maprequest["isUserWishes"] = true
755 783
 	maprequest["phone"] = "13318464642"
756 784
 	maprequest["verificationCode"] = "18888888888"
757 785
 	this.ServeSuccessJSON(map[string]interface{}{
786
+		"maprequest":  maprequest,
758 787
 		"information": information,
759 788
 		"orderId":     orderId,
760
-		"maprequest":  maprequest,
761 789
 	})
762 790
 
763 791
 }
792
+
793
+func (this *SignApiController) ToCheckInformation() {
794
+
795
+	information := service.ToCheckInformation()
796
+
797
+	this.ServeSuccessJSON(map[string]interface{}{
798
+		"information": information,
799
+	})
800
+}

+ 10 - 21
controllers/stock_in_api_controller.go View File

@@ -406,7 +406,7 @@ func (c *StockManagerApiController) CreateWarehouse() {
406 406
 					Price:            price,
407 407
 					TotalPrice:       total,
408 408
 					Status:           1,
409
-					Ctime:            ctime,
409
+					Ctime:            warehousingDate.Unix(),
410 410
 					Remark:           remark,
411 411
 					OrgId:            adminUserInfo.CurrentOrgId,
412 412
 					Type:             types,
@@ -1413,18 +1413,6 @@ func (c *StockManagerApiController) CreateWarehouseOut() {
1413 1413
 		if it.ID > 0 {
1414 1414
 			service.ModifyWarehouseOutInfo(it.ID, warehouseOutInfo)
1415 1415
 		}
1416
-
1417
-		//lastWarehouseOutInfo, _ := service.GetLastGoodWarehouseOutInfoById(it.OrgId)
1418
-
1419
-		//if(it.ID == 0){
1420
-		//  //创建出库流水
1421
-		//  service.CreateStockFlowOne(stockFlow)
1422
-		//}
1423
-		//if(it.ID > 0){
1424
-		//  //更新流水
1425
-		//  service.UpdateWarehouseOutFlow(stockFlow,it.ID)
1426
-		//}
1427
-
1428 1416
 	}
1429 1417
 	appId := adminUserInfo.CurrentAppId
1430 1418
 
@@ -6873,13 +6861,19 @@ func (this *StockManagerApiController) SaveStockInventoryList() {
6873 6861
 				//更改库存
6874 6862
 				service.UpdatedWarehousingInfo(info, id)
6875 6863
 			}
6864
+			//查询该机构默认仓库
6865
+			storeConfig, _ := service.GetAllStoreHouseConfig(warehosueinfos.OrgId)
6866
+			goodListOne, _ := service.GetSumGoodList(orgId, storeConfig.StorehouseOutInfo, good_id)
6867
+			var flush_count int64
6868
+			for _, it := range goodListOne {
6869
+				flush_count += it.StockCount
6870
+			}
6876 6871
 
6877 6872
 			if stock_count != last_stock_count {
6873
+				stockFlow.OverCount = flush_count
6878 6874
 				service.CreateStockFlowOne(stockFlow)
6879 6875
 			}
6880 6876
 
6881
-			//查询该机构默认仓库
6882
-			storeConfig, _ := service.GetAllStoreHouseConfig(warehosueinfos.OrgId)
6883 6877
 			//查询已审核单据的剩余库存
6884 6878
 			goodList, _ := service.GetGoodSumCountByStoreId(storeConfig.StorehouseOutInfo, good_id, warehosueinfos.OrgId)
6885 6879
 			var sum_count int64
@@ -6890,11 +6884,6 @@ func (this *StockManagerApiController) SaveStockInventoryList() {
6890 6884
 			}
6891 6885
 			service.UpdateGoodByGoodId(good_id, sum_count, sum_in_count, warehosueinfos.OrgId)
6892 6886
 
6893
-			goodListOne, _ := service.GetSumGoodList(orgId, storeConfig.StorehouseOutInfo, good_id)
6894
-			var flush_count int64
6895
-			for _, it := range goodListOne {
6896
-				flush_count += it.StockCount
6897
-			}
6898 6887
 			service.UpdateSumGood(orgId, storeConfig.StorehouseOutInfo, good_id, flush_count)
6899 6888
 			this.ServeSuccessJSON(map[string]interface{}{
6900 6889
 				"inventory": inventory,
@@ -7496,7 +7485,7 @@ func (this *StockManagerApiController) CheckWarehouseInfo() {
7496 7485
 				Creator:                 Creator,
7497 7486
 				UpdateCreator:           0,
7498 7487
 				Status:                  1,
7499
-				Ctime:                   time.Now().Unix(),
7488
+				Ctime:                   item.Ctime,
7500 7489
 				Mtime:                   0,
7501 7490
 				Price:                   item.PackingPrice,
7502 7491
 				WarehousingDetailId:     item.ID,

+ 1 - 1
service/dialysis_service.go View File

@@ -1471,7 +1471,7 @@ func GetGoodInfoMationSix(orgid int64, storehouse_id int64) (goodinfo []*models.
1471 1471
 
1472 1472
 func GetGoodInfoMationSeven(orgid int64, storehouse_id int64) (goodinfo []*models.GoodInfo, err error) {
1473 1473
 
1474
-	err = XTReadDB().Model(&goodinfo).Where("org_id = ? and status = 1 AND  find_in_set('停用',good_status) = 0", orgid).Preload("GoodSotckInfo", "status = 1 and storehouse_id = ?", storehouse_id).Find(&goodinfo).Error
1474
+	err = XTReadDB().Model(&goodinfo).Where("org_id = ? and status = 1 AND  find_in_set('停用',good_status) = 0", orgid).Preload("GoodSotckInfo", "status = 1 and storehouse_id = ? and stock_count>0", storehouse_id).Find(&goodinfo).Error
1475 1475
 
1476 1476
 	return goodinfo, err
1477 1477
 }

+ 10 - 4
service/self_drug_service.go View File

@@ -827,7 +827,7 @@ func GetLastDrugWarehouseOutInfo(drugid int64, warehouseOutId int64, orgid int64
827 827
 }
828 828
 
829 829
 func PostSearchDrugWarehouseList(keyword string, orgid int64, storehouse_id int64) (info []*models.BloodDrugWarehouseInfo, err error) {
830
-	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1 and x.is_check = 1")
830
+	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1 and x.is_check = 1 and (x.stock_max_number>0 or x.stock_min_number>0)")
831 831
 	table := XTReadDB().Table("xt_base_drug as t").Where("t.status")
832 832
 	fmt.Println(table)
833 833
 	likeKey := "%" + keyword + "%"
@@ -979,10 +979,16 @@ func GetDrugDamagePrint(ids []string) (damage []*models.XtDrugDamage, err error)
979 979
 	return damage, err
980 980
 }
981 981
 
982
-func GetWarehoseInfoById(id int64, storehouse_id int64) (info []*models.XtDrugWarehouseInfo, err error) {
982
+func GetWarehoseInfoById(id int64, storehouse_id int64, orgid int64) (info []*models.XtDrugWarehouseInfo, err error) {
983
+
984
+	if orgid == 10191 {
985
+		err = XTReadDB().Model(&info).Where("drug_id=? and status = 1 and storehouse_id = ? and is_check = 1", id, storehouse_id).Preload("XtBaseDrug", "status= 1").Find(&info).Error
986
+		return info, err
987
+	} else {
988
+		err = XTReadDB().Model(&info).Where("drug_id=? and status = 1 and storehouse_id = ? and is_check = 1 and (stock_max_number>0 or stock_min_number>0)", id, storehouse_id).Preload("XtBaseDrug", "status= 1").Find(&info).Error
989
+		return info, err
990
+	}
983 991
 
984
-	err = XTReadDB().Model(&info).Where("drug_id=? and status = 1 and storehouse_id = ? and is_check = 1", id, storehouse_id).Preload("XtBaseDrug", "status= 1").Find(&info).Error
985
-	return info, err
986 992
 }
987 993
 
988 994
 func CreateDrugInventory(inventory models.XtDrugInventory) error {

+ 127 - 38
service/sign_service.go View File

@@ -1671,17 +1671,20 @@ func SavePdfInformation() (string, string) {
1671 1671
 	//业务单号
1672 1672
 	maprequest["orderId"] = "13318464642"
1673 1673
 
1674
-	maprequest["signTitle"] = "合同"
1674
+	maprequest["signTitle"] = "举报合同"
1675 1675
 
1676
-	file := "C:/Users/28169/Desktop/2.pdf"
1676
+	//file := "C:/Users/28169/Desktop/2.pdf"
1677
+	file := "/swspan/gopath/src/XT_New/static/2.pdf"
1677 1678
 
1678
-	fileBytes, err := ioutil.ReadFile(file) // 读取file
1679
+	fileBytes, _ := ioutil.ReadFile(file) // 读取file
1679 1680
 
1680 1681
 	contractBase64 := base64.StdEncoding.EncodeToString(fileBytes) // 加密成base64字符串
1681 1682
 	//文件获取方式
1682
-	maprequest["fileType"] = contractBase64
1683
+	maprequest["fileType"] = 1
1684
+
1685
+	maprequest["pdfBase64"] = contractBase64
1683 1686
 	//合同内容
1684
-	maprequest["fileContent"] = "绝密文件"
1687
+	maprequest["fileContent"] = contractBase64
1685 1688
 
1686 1689
 	//签署用户人ID
1687 1690
 	maprequest["userId"] = "JMO9U8JH4TN8E3QOI0GUVUF2"
@@ -1703,54 +1706,79 @@ func SavePdfInformation() (string, string) {
1703 1706
 	//证件编码
1704 1707
 	Receiver["cardNumber"] = "430526199408156511"
1705 1708
 
1706
-	stepStamper := make([]map[string]interface{}, 0)
1709
+	stepStamper := make(map[string]interface{})
1707 1710
 
1708
-	keywordSignControls := make(map[string]interface{})
1711
+	keywordSignControls := make([]map[string]interface{}, 0)
1712
+
1713
+	inputArrOne := make(map[string]interface{})
1714
+
1715
+	inputArrOne["sealName"] = "1"
1716
+	inputArrOne["keyword"] = "王志文"
1717
+	inputArrOne["pages"] = "0"
1718
+	inputArrOne["offsetX"] = "100"
1719
+	inputArrOne["offsetY"] = "100"
1720
+
1721
+	keywordSignControls = append(keywordSignControls, inputArrOne)
1722
+
1723
+	stepStamper["keywordSignControls"] = keywordSignControls
1724
+
1725
+	crossSignControls := make([]map[string]interface{}, 0)
1709 1726
 
1710
-	keywordSignControls["sealName"] = "1"
1711
-	keywordSignControls["keyword"] = ""
1712
-	keywordSignControls["pages"] = "0"
1713
-	keywordSignControls["offsetX"] = "100"
1714
-	keywordSignControls["offsetY"] = "100"
1727
+	inputArrTwo := make(map[string]interface{})
1728
+	inputArrTwo["sealName"] = "1"
1729
+	inputArrTwo["positionX"] = "100"
1730
+	inputArrTwo["positionY"] = "100"
1731
+	inputArrTwo["pages"] = "0"
1732
+	crossSignControls = append(crossSignControls, inputArrTwo)
1715 1733
 
1716
-	stepStamper = append(stepStamper, keywordSignControls)
1734
+	stepStamper["crossSignControls"] = crossSignControls
1717 1735
 
1718
-	crossSignControls := make(map[string]interface{})
1719
-	crossSignControls["sealName"] = "2"
1720
-	crossSignControls["positionX"] = "100"
1721
-	crossSignControls["positionY"] = "100"
1722
-	stepStamper = append(stepStamper, crossSignControls)
1736
+	xySignControls := make([]map[string]interface{}, 0)
1723 1737
 
1724
-	xySignControls := make(map[string]interface{})
1725
-	xySignControls["sealName"] = "2"
1726
-	xySignControls["positionX"] = "100"
1727
-	xySignControls["positionY"] = "100"
1738
+	inputArrThree := make(map[string]interface{})
1739
+	inputArrThree["sealName"] = "1"
1740
+	inputArrThree["positionX"] = "100"
1741
+	inputArrThree["positionY"] = "100"
1742
+	inputArrThree["pages"] = "0"
1728 1743
 
1729
-	stepStamper = append(stepStamper, xySignControls)
1744
+	xySignControls = append(xySignControls, inputArrThree)
1745
+
1746
+	stepStamper["xySignControls"] = xySignControls
1730 1747
 
1731 1748
 	maprequest["stepStamper"] = stepStamper
1732 1749
 
1733 1750
 	seals := make([]map[string]interface{}, 0)
1734 1751
 
1735
-	sealImages := make(map[string]interface{})
1736
-	sealImages["sealBase64"] = "2"
1737
-	sealImages["width"] = "100"
1738
-	sealImages["height"] = "100"
1739
-	sealImages["verticalAlign"] = "middle"
1752
+	sealImagesList := make(map[string]interface{})
1753
+
1754
+	fileOne := "/swspan/gopath/src/XT_New/static/seal.jpg"
1755
+
1756
+	fileBytesOne, _ := ioutil.ReadFile(fileOne) // 读取file
1757
+
1758
+	contractBase64One := base64.StdEncoding.EncodeToString(fileBytesOne) // 加密成base64字符串
1759
+	sealImagesList["sealBase64"] = contractBase64One
1760
+	sealImagesList["width"] = "100"
1761
+	sealImagesList["height"] = "100"
1762
+	sealImagesList["verticalAlign"] = "middle"
1740 1763
 
1741
-	seals = append(seals, sealImages)
1764
+	sealTextsList := make(map[string]interface{})
1765
+	sealTextsList["text"] = "2"
1766
+	sealTextsList["fontSize"] = "100"
1767
+	sealTextsList["fontColor"] = "100"
1768
+	sealTextsList["isTextArea"] = true
1769
+	sealTextsList["textAlign"] = 0
1770
+	sealTextsList["width"] = 300
1771
+	sealTextsList["height"] = 300
1742 1772
 
1743
-	sealTexts := make(map[string]interface{})
1744
-	sealTexts["text"] = "2"
1745
-	sealTexts["fontSize"] = "100"
1746
-	sealTexts["fontColor"] = "100"
1747
-	sealTexts["isTextArea"] = true
1748
-	sealTexts["textAlign"] = 0
1749
-	sealTexts["width"] = 300
1750
-	sealTexts["height"] = 300
1773
+	sealsObj := make(map[string]interface{})
1751 1774
 
1752
-	seals = append(seals, sealTexts)
1775
+	sealsObj["sealWidth"] = "300"
1776
+	sealsObj["sealHeight"] = "300"
1777
+	sealsObj["sealName"] = "1"
1778
+	sealsObj["sealImage"] = sealImagesList
1779
+	sealsObj["sealText"] = sealTextsList
1753 1780
 
1781
+	seals = append(seals, sealsObj)
1754 1782
 	maprequest["seals"] = seals
1755 1783
 
1756 1784
 	maprequest["isUserWishes"] = true
@@ -1802,3 +1830,64 @@ func SavePdfInformation() (string, string) {
1802 1830
 	//fmt.Println("str", orderId)
1803 1831
 	return str, orderId
1804 1832
 }
1833
+
1834
+func ToCheckInformation() string {
1835
+
1836
+	var url string
1837
+
1838
+	url = "http://localhost:8890/sdk/pdf/verify"
1839
+	maprequest := make(map[string]interface{})
1840
+
1841
+	file := "/swspan/gopath/src/XT_New/static/2.pdf"
1842
+
1843
+	fileBytes, _ := ioutil.ReadFile(file) // 读取file
1844
+
1845
+	contractBase64 := base64.StdEncoding.EncodeToString(fileBytes) // 加密成base64字符串
1846
+
1847
+	maprequest["fileType"] = 1
1848
+
1849
+	maprequest["fileContent"] = contractBase64
1850
+
1851
+	byterequest, _ := json.Marshal(maprequest)
1852
+
1853
+	appId := beego.AppConfig.String("sign_appid")
1854
+
1855
+	serviceKye := beego.AppConfig.String("serviceKye")
1856
+
1857
+	reader := bytes.NewReader(byterequest)
1858
+	serviceCode := beego.AppConfig.String("serviceCode")
1859
+	signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
1860
+
1861
+	request, err := http.NewRequest("POST", url, reader)
1862
+	if err != nil {
1863
+		fmt.Println(err.Error())
1864
+	}
1865
+	fmt.Println("请求参数", request)
1866
+	fmt.Println("Content-Signature", signatureStr)
1867
+
1868
+	request.Header.Set("appId", appId)
1869
+	request.Header.Set("appKey", serviceKye)
1870
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1871
+	request.Header.Set("Content-Signature", signatureStr)
1872
+	client := http.Client{}
1873
+
1874
+	resp, err := client.Do(request)
1875
+
1876
+	if err != nil {
1877
+		fmt.Println(err.Error())
1878
+
1879
+	}
1880
+	respBytes, err := ioutil.ReadAll(resp.Body)
1881
+	if err != nil {
1882
+		fmt.Println(err.Error())
1883
+
1884
+	}
1885
+	str := string(respBytes)
1886
+
1887
+	var respJSON map[string]interface{}
1888
+	if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
1889
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1890
+	}
1891
+
1892
+	return str
1893
+}

+ 9 - 3
service/stock_service.go View File

@@ -6231,7 +6231,7 @@ func ModifyDrugWarehouseInfoSix(info *models.DrugWarehouseInfo, id int64) error
6231 6231
 
6232 6232
 func GetGoodInventoryWarehouseList(id int64, storehouse_id int64) (info []*models.WarehousingInfo, err error) {
6233 6233
 
6234
-	err = XTReadDB().Model(&info).Where("good_id = ? and status = 1 and storehouse_id=? and is_check= 1", id, storehouse_id).Preload("GoodInfo", "status = 1").Find(&info).Error
6234
+	err = XTReadDB().Model(&info).Where("good_id = ? and status = 1 and storehouse_id=? and is_check= 1 and stock_count>0", id, storehouse_id).Preload("GoodInfo", "status = 1").Find(&info).Error
6235 6235
 	return info, err
6236 6236
 }
6237 6237
 
@@ -8242,8 +8242,14 @@ func ReduceGoodSumOutCount(storehouse_id int64, good_id int64, user_org_id int64
8242 8242
 
8243 8243
 func GetInvetoryWarehouseInfoList(orgid int64, storehouse_id int64) (info []*models.WarehousingInfo, err error) {
8244 8244
 
8245
-	err = XTReadDB().Model(&info).Where("status = 1 and storehouse_id=? and is_check= 1 and org_id = ? and stock_count >0", storehouse_id, orgid).Preload("GoodInfo", "status = 1").Order("good_id").Find(&info).Error
8246
-	return info, err
8245
+	if orgid == 10191 {
8246
+		err = XTReadDB().Model(&info).Where("status = 1 and storehouse_id=? and is_check= 1 and org_id = ?", storehouse_id, orgid).Preload("GoodInfo", "status = 1").Order("good_id").Find(&info).Error
8247
+		return info, err
8248
+	} else {
8249
+		err = XTReadDB().Model(&info).Where("status = 1 and storehouse_id=? and is_check= 1 and org_id = ? and stock_count >0", storehouse_id, orgid).Preload("GoodInfo", "status = 1").Order("good_id").Find(&info).Error
8250
+		return info, err
8251
+	}
8252
+
8247 8253
 }
8248 8254
 
8249 8255
 func GetSettleOpenConfig(user_org_id int64) (*models.HisSettleStockConfig, error) {