|
@@ -105,6 +105,8 @@ func HisManagerApiRegistRouters() {
|
105
|
105
|
|
106
|
106
|
beego.Router("/api/orders", &HisApiController{}, "get:GetAllOrder")
|
107
|
107
|
|
|
108
|
+ beego.Router("/api/his/gethistdoctoradviceinfo", &HisApiController{}, "get:GetHisDoctorAdviceInfo")
|
|
109
|
+
|
108
|
110
|
}
|
109
|
111
|
|
110
|
112
|
func (c *HisApiController) GetHisUnChargePatientList() {
|
|
@@ -702,13 +704,15 @@ func (c *HisApiController) CreateHisPrescription() {
|
702
|
704
|
var drug_id int64
|
703
|
705
|
var prescribing_number float64
|
704
|
706
|
var prescribingNumberUnit string
|
705
|
|
-
|
|
707
|
+ var prescribingNumber string
|
|
708
|
+ var adviceId int64
|
706
|
709
|
if advice.(map[string]interface{})["id"] != nil || reflect.TypeOf(advice.(map[string]interface{})["id"]).String() == "float64" {
|
707
|
710
|
drug_id = int64(advice.(map[string]interface{})["id"].(float64))
|
708
|
711
|
}
|
709
|
712
|
if advice.(map[string]interface{})["prescribing_number"] != nil || reflect.TypeOf(advice.(map[string]interface{})["prescribing_number"]).String() == "string" {
|
710
|
713
|
//prescribing_number = advice.(map[string]interface{})["prescribing_number"].(string)
|
711
|
714
|
prescribing_number_str := advice.(map[string]interface{})["prescribing_number"].(string)
|
|
715
|
+ prescribingNumber = advice.(map[string]interface{})["prescribing_number"].(string)
|
712
|
716
|
prescribing_number, _ = strconv.ParseFloat(prescribing_number_str, 64)
|
713
|
717
|
|
714
|
718
|
}
|
|
@@ -717,38 +721,114 @@ func (c *HisApiController) CreateHisPrescription() {
|
717
|
721
|
prescribingNumberUnit, _ = advice.(map[string]interface{})["prescribing_number_unit"].(string)
|
718
|
722
|
}
|
719
|
723
|
|
|
724
|
+ if advice.(map[string]interface{})["advice_id"] != nil || reflect.TypeOf(advice.(map[string]interface{})["advice_id"]).String() == "float64" {
|
|
725
|
+ adviceId = int64(advice.(map[string]interface{})["advice_id"].(float64))
|
|
726
|
+ }
|
|
727
|
+
|
720
|
728
|
drug, _ := service.FindBaseDrugLibRecord(adminInfo.CurrentOrgId, drug_id)
|
721
|
729
|
if drug.ID == 0 {
|
722
|
730
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
723
|
731
|
return
|
724
|
732
|
}
|
725
|
733
|
|
726
|
|
- //查询药品的搜有库存
|
|
734
|
+ //查询药品的所有库存
|
727
|
735
|
list, _ := service.GetDrugWarehouseInfoPrescription(drug_id, adminInfo.CurrentOrgId)
|
728
|
736
|
var total_count int64
|
|
737
|
+
|
729
|
738
|
for _, it := range list {
|
730
|
739
|
total_count += it.StockMaxNumber*drug.MinNumber + it.StockMinNumber
|
731
|
740
|
}
|
732
|
741
|
totals := strconv.FormatInt(total_count, 10)
|
733
|
|
- all_count, _ := strconv.ParseFloat(totals, 64)
|
734
|
|
- fmt.Println("all_count2323323233232", all_count)
|
735
|
|
- if prescribingNumberUnit == drug.MinUnit {
|
736
|
|
- if prescribing_number > all_count {
|
737
|
|
- c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
738
|
|
- //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
|
739
|
|
- return
|
|
742
|
+ //查询该药品是否存在开药记录
|
|
743
|
+ advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
|
|
744
|
+ //修改处方
|
|
745
|
+ if advicelist.ID > 0 {
|
|
746
|
+ var device_number int64
|
|
747
|
+ if advicelist.PrescribingNumberUnit == drug.MaxUnit {
|
|
748
|
+ prescribingNumber := strconv.FormatFloat(advicelist.PrescribingNumber, 'f', -1, 64)
|
|
749
|
+ prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
|
750
|
+ device_number = prescribingNumberInt * drug.MinNumber
|
|
751
|
+ }
|
|
752
|
+ if advicelist.PrescribingNumberUnit == drug.MinUnit {
|
|
753
|
+ prescribingNumber := strconv.FormatFloat(advicelist.PrescribingNumber, 'f', -1, 64)
|
|
754
|
+ prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
|
755
|
+ device_number = prescribingNumberInt
|
740
|
756
|
}
|
741
|
|
- } else {
|
|
757
|
+
|
|
758
|
+ var number_count int64
|
742
|
759
|
if prescribingNumberUnit == drug.MaxUnit {
|
743
|
|
- num := prescribing_number * float64(drug.MinNumber)
|
744
|
|
- if num > all_count {
|
|
760
|
+ prescribingNumber := strconv.FormatFloat(advicelist.PrescribingNumber, 'f', -1, 64)
|
|
761
|
+ prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
|
762
|
+ number_count = prescribingNumberInt * drug.MinNumber
|
|
763
|
+ }
|
|
764
|
+ if prescribingNumberUnit == drug.MinUnit {
|
|
765
|
+ prescribingNumber := strconv.FormatFloat(advicelist.PrescribingNumber, 'f', -1, 64)
|
|
766
|
+ prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
|
767
|
+ number_count = prescribingNumberInt
|
|
768
|
+ }
|
|
769
|
+ //如果修改的数量大于之前修改的数量
|
|
770
|
+ if (number_count - device_number) > 0 {
|
|
771
|
+ //如果修改的差数量 大于库存数量
|
|
772
|
+ if (number_count - device_number) > total_count {
|
745
|
773
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
746
|
|
- //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOutOfStockParamWrong)
|
747
|
774
|
return
|
748
|
775
|
}
|
749
|
776
|
}
|
|
777
|
+
|
|
778
|
+ var sum_count int64
|
|
779
|
+ //判断是否做过修改
|
|
780
|
+ if prescribingNumberUnit == drug.MaxUnit {
|
|
781
|
+
|
|
782
|
+ prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
|
783
|
+
|
|
784
|
+ sum_count = prescribingNumberInt * drug.MinNumber
|
|
785
|
+ }
|
|
786
|
+ if prescribingNumberUnit == drug.MinUnit {
|
|
787
|
+ prescribingNumberInt, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
|
788
|
+ sum_count = prescribingNumberInt
|
|
789
|
+ }
|
|
790
|
+ fmt.Println("原先药品记录", device_number)
|
|
791
|
+ fmt.Println("现在出库数量", sum_count)
|
|
792
|
+ if device_number != sum_count {
|
|
793
|
+
|
|
794
|
+ // 查询该药品最后一次出库记录
|
|
795
|
+ druginfo, _ := service.GetLastDrugWarehouseOutByDrugId(drug_id, patient_id, recordDateTime)
|
|
796
|
+ //回退库存
|
|
797
|
+ if druginfo.CountUnit == drug.MaxUnit && drug.MaxUnit != drug.MinUnit {
|
|
798
|
+ service.ModefyDrugByWarehouseInfo(druginfo.WarehouseInfoId, druginfo.Count)
|
|
799
|
+ }
|
|
800
|
+ if druginfo.CountUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
|
|
801
|
+ service.ModefyDrugByWarehouseInfoOne(druginfo.WarehouseInfoId, druginfo.Count)
|
|
802
|
+ }
|
|
803
|
+
|
|
804
|
+ if druginfo.CountUnit == drug.MaxUnit && druginfo.CountUnit == drug.MinUnit && drug.MaxUnit == drug.MinUnit {
|
|
805
|
+ service.ModefyDrugByWarehouseInfo(druginfo.WarehouseInfoId, druginfo.Count)
|
|
806
|
+ }
|
|
807
|
+
|
|
808
|
+ //删除记录
|
|
809
|
+ service.DeleteDrugAutoWarehouseSeven(drug_id, patient_id, recordDateTime, adviceId)
|
|
810
|
+ }
|
|
811
|
+
|
750
|
812
|
}
|
751
|
813
|
|
|
814
|
+ //新增处方
|
|
815
|
+ if advicelist.ID == 0 {
|
|
816
|
+ all_count, _ := strconv.ParseFloat(totals, 64)
|
|
817
|
+ if prescribingNumberUnit == drug.MinUnit {
|
|
818
|
+ if prescribing_number > all_count {
|
|
819
|
+ c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
|
820
|
+ return
|
|
821
|
+ }
|
|
822
|
+ } else {
|
|
823
|
+ if prescribingNumberUnit == drug.MaxUnit {
|
|
824
|
+ num := prescribing_number * float64(drug.MinNumber)
|
|
825
|
+ if num > all_count {
|
|
826
|
+ c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
|
827
|
+ return
|
|
828
|
+ }
|
|
829
|
+ }
|
|
830
|
+ }
|
|
831
|
+ }
|
752
|
832
|
}
|
753
|
833
|
}
|
754
|
834
|
}
|
|
@@ -770,6 +850,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
770
|
850
|
var project_id int64
|
771
|
851
|
var project_type int64
|
772
|
852
|
var totals float64
|
|
853
|
+ var parsetotal int64
|
773
|
854
|
if project.(map[string]interface{})["project_id"] != nil || reflect.TypeOf(project.(map[string]interface{})["project_id"]).String() == "float64" {
|
774
|
855
|
project_id = int64(project.(map[string]interface{})["project_id"].(float64))
|
775
|
856
|
}
|
|
@@ -780,27 +861,53 @@ func (c *HisApiController) CreateHisPrescription() {
|
780
|
861
|
total, _ := project.(map[string]interface{})["total"].(string)
|
781
|
862
|
|
782
|
863
|
totals, _ = strconv.ParseFloat(total, 64)
|
|
864
|
+ parsetotal, _ = strconv.ParseInt(total, 10, 64)
|
783
|
865
|
}
|
784
|
866
|
if project_type == 3 {
|
785
|
|
- good, _ := service.FindGoodInfoByIdTwo(project_id)
|
786
|
|
- if good.ID == 0 {
|
787
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
788
|
|
- return
|
789
|
|
- }
|
790
|
|
- //查询耗材库存
|
791
|
|
- list, _ := service.GetGoodWarehouseInfo(project_id)
|
792
|
|
- var stock_count int64
|
793
|
|
- for _, it := range list {
|
794
|
|
- stock_count += it.StockCount
|
795
|
|
- }
|
796
|
|
- stock_counts := strconv.FormatInt(stock_count, 10)
|
797
|
|
- stock_total_count, _ := strconv.ParseFloat(stock_counts, 64)
|
798
|
|
- if totals > stock_total_count {
|
799
|
|
- c.ServeDynamicFailJsonSend(good.GoodName + "库存不足")
|
800
|
867
|
|
801
|
|
- return
|
802
|
|
- }
|
|
868
|
+ //查找该耗材的出库记录
|
|
869
|
+ goodWarehouseInfo, _ := service.GetAutoRecordByGoodId(project_id, patient_id, recordDateTime)
|
|
870
|
+ fmt.Println("出库数量00000000000000000000000", parsetotal)
|
|
871
|
+ fmt.Println("已经出库数量0000000000000000000", goodWarehouseInfo.Count)
|
|
872
|
+
|
|
873
|
+ //查询该患者耗材的历史数据
|
|
874
|
+ ordProject, _ := service.GetHisProjectPrescriptionByPatientId(patient_id, recordDateTime)
|
|
875
|
+ fmt.Println("长度1", len(ordProject))
|
|
876
|
+ fmt.Println("新长度", len(projects))
|
|
877
|
+ if goodWarehouseInfo.ID > 0 {
|
|
878
|
+ //数量发生改变
|
|
879
|
+ if parsetotal != goodWarehouseInfo.Count || len(ordProject) != len(projects) {
|
|
880
|
+ //查找今日该患者已经出库的所有耗材
|
|
881
|
+ goodList, _ := service.GetAllAutoRecordByPatient(patient_id, recordDateTime)
|
|
882
|
+ for _, item := range goodList {
|
|
883
|
+ //回退库存
|
|
884
|
+ service.ModefyWarehouseInfo(item.Count, item.WarehouseInfotId)
|
|
885
|
+ //删除记录
|
|
886
|
+ service.DeleteAutoWarehouse(item.PatientId, item.SysRecordTime)
|
|
887
|
+ }
|
|
888
|
+
|
|
889
|
+ }
|
803
|
890
|
|
|
891
|
+ }
|
|
892
|
+ if goodWarehouseInfo.ID == 0 {
|
|
893
|
+ good, _ := service.FindGoodInfoByIdTwo(project_id)
|
|
894
|
+ if good.ID == 0 {
|
|
895
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
896
|
+ return
|
|
897
|
+ }
|
|
898
|
+ //查询耗材库存
|
|
899
|
+ list, _ := service.GetGoodWarehouseInfo(project_id)
|
|
900
|
+ var stock_count int64
|
|
901
|
+ for _, it := range list {
|
|
902
|
+ stock_count += it.StockCount
|
|
903
|
+ }
|
|
904
|
+ stock_counts := strconv.FormatInt(stock_count, 10)
|
|
905
|
+ stock_total_count, _ := strconv.ParseFloat(stock_counts, 64)
|
|
906
|
+ if totals > stock_total_count {
|
|
907
|
+ c.ServeDynamicFailJsonSend(good.GoodName + "库存不足")
|
|
908
|
+ return
|
|
909
|
+ }
|
|
910
|
+ }
|
804
|
911
|
}
|
805
|
912
|
|
806
|
913
|
}
|
|
@@ -1478,20 +1585,117 @@ func (c *HisApiController) DeletePrescription() {
|
1478
|
1585
|
if stockConfig.IsOpen == 1 {
|
1479
|
1586
|
if item.Type == 3 {
|
1480
|
1587
|
good, _ := service.FindGoodInfoByIdTwo(item.ProjectId)
|
1481
|
|
- //cnt, _ := strconv.ParseInt(item.Count, 10, 64)
|
1482
|
1588
|
f_count, _ := strconv.ParseFloat(item.Count, 64)
|
1483
|
1589
|
good.Total = good.Total + f_count
|
1484
|
1590
|
service.UpdateGoodInfo(&good)
|
1485
|
|
- }
|
1486
|
|
- }
|
|
1591
|
+ operation_time := time.Now().Unix()
|
|
1592
|
+ creater := c.GetAdminUserInfo().AdminUser.Id
|
|
1593
|
+ //创建退库单
|
|
1594
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
1595
|
+ timeArr := strings.Split(timeStr, "-")
|
|
1596
|
+ total, _ := service.FindAllCancelStockTotal(c.GetAdminUserInfo().CurrentOrgId)
|
|
1597
|
+ total = total + 1
|
|
1598
|
+ orderNumber := "CKTKD" + strconv.FormatInt(c.GetAdminUserInfo().CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
|
1599
|
+
|
|
1600
|
+ cancelStock := models.CancelStock{
|
|
1601
|
+ OrderNumber: orderNumber,
|
|
1602
|
+ OperaTime: operation_time,
|
|
1603
|
+ OrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
1604
|
+ Creater: creater,
|
|
1605
|
+ Ctime: time.Now().Unix(),
|
|
1606
|
+ Status: 1,
|
|
1607
|
+ ReturnTime: item.RecordDate,
|
|
1608
|
+ Type: 1,
|
|
1609
|
+ }
|
|
1610
|
+ _, msgerrkonde := service.GetCancelStockDetailByOrderNumberOne(item.RecordDate, c.GetAdminUserInfo().CurrentOrgId)
|
|
1611
|
+ if msgerrkonde == gorm.ErrRecordNotFound {
|
|
1612
|
+ service.AddSigleCancelStock(&cancelStock)
|
|
1613
|
+ }
|
|
1614
|
+ cancel, _ := service.GetLastCancelStockById(c.GetAdminUserInfo().CurrentOrgId)
|
|
1615
|
+ floatPrescrip := strconv.FormatFloat(f_count, 'f', -1, 32)
|
|
1616
|
+ prescribingNumber, _ := strconv.ParseInt(floatPrescrip, 10, 64)
|
|
1617
|
+ //获取该耗材有库存的第一条数据
|
|
1618
|
+ info, _ := service.GetLastWarehoseByGoodId(item.ProjectId, item.PatientId, item.RecordDate)
|
|
1619
|
+
|
|
1620
|
+ manufacturer, _ := service.GetManufactureById(info.Manufacturer)
|
|
1621
|
+ deaerler, _ := service.GetDealerById(info.Dealer)
|
|
1622
|
+ if info.ID > 0 {
|
|
1623
|
+ cancelStockInfo := models.CancelStockInfo{
|
|
1624
|
+ GoodId: item.ProjectId,
|
|
1625
|
+ CancelStockId: cancel.ID,
|
|
1626
|
+ GoodTypeId: info.GoodTypeId,
|
|
1627
|
+ Count: prescribingNumber,
|
|
1628
|
+ Price: info.Price,
|
|
1629
|
+ Total: 0,
|
|
1630
|
+ ProductDate: info.ProductDate,
|
|
1631
|
+ ExpiryDate: info.ExpiryDate,
|
|
1632
|
+ Ctime: time.Now().Unix(),
|
|
1633
|
+ Status: 1,
|
|
1634
|
+ OrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
1635
|
+ OrderNumber: cancel.OrderNumber,
|
|
1636
|
+ Type: 0,
|
|
1637
|
+ Dealer: deaerler.DealerName,
|
|
1638
|
+ Manufacturer: manufacturer.ManufacturerName,
|
|
1639
|
+ Number: info.Number,
|
|
1640
|
+ RegisterAccount: "",
|
|
1641
|
+ Remark: "",
|
|
1642
|
+ WarehouseInfoId: info.WarehouseInfotId,
|
|
1643
|
+ }
|
|
1644
|
+
|
|
1645
|
+ service.CreateCancelStockInfoOne(&cancelStockInfo)
|
|
1646
|
+
|
|
1647
|
+ cancelInfo, _ := service.GetLastCancelStockInfoByGoodId(item.ProjectId)
|
|
1648
|
+
|
|
1649
|
+ flow := models.VmStockFlow{
|
|
1650
|
+ WarehousingId: 0,
|
|
1651
|
+ GoodId: item.ProjectId,
|
|
1652
|
+ Number: info.Number,
|
|
1653
|
+ LicenseNumber: info.LicenseNumber,
|
|
1654
|
+ Count: prescribingNumber,
|
|
1655
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
1656
|
+ PatientId: item.PatientId,
|
|
1657
|
+ SystemTime: time.Now().Unix(),
|
|
1658
|
+ ConsumableType: 7,
|
|
1659
|
+ IsSys: 0,
|
|
1660
|
+ WarehousingOrder: "",
|
|
1661
|
+ WarehouseOutId: 0,
|
|
1662
|
+ WarehouseOutOrderNumber: "",
|
|
1663
|
+ IsEdit: 0,
|
|
1664
|
+ CancelStockId: cancel.ID,
|
|
1665
|
+ CancelOrderNumber: cancel.OrderNumber,
|
|
1666
|
+ Manufacturer: manufacturer.ID,
|
|
1667
|
+ Dealer: 0,
|
|
1668
|
+ Creator: c.GetAdminUserInfo().CurrentOrgId,
|
|
1669
|
+ UpdateCreator: 0,
|
|
1670
|
+ Status: 1,
|
|
1671
|
+ Ctime: time.Now().Unix(),
|
|
1672
|
+ Mtime: 0,
|
|
1673
|
+ Price: info.Price,
|
|
1674
|
+ WarehousingDetailId: info.WarehouseInfotId,
|
|
1675
|
+ WarehouseOutDetailId: 0,
|
|
1676
|
+ CancelOutDetailId: cancelInfo.ID,
|
|
1677
|
+ ProductDate: info.ProductDate,
|
|
1678
|
+ ExpireDate: info.ExpiryDate,
|
|
1679
|
+ }
|
|
1680
|
+ service.CreateStockFlowOne(flow)
|
|
1681
|
+
|
|
1682
|
+ //删除出库表
|
|
1683
|
+ service.DeleteAutoRedeceDetailTen(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, item.ProjectId)
|
|
1684
|
+
|
|
1685
|
+ //回退库存
|
|
1686
|
+ service.UpDateWarehouseInfoByStockDelete(info.WarehouseInfotId, prescribingNumber)
|
|
1687
|
+ }
|
1487
|
1688
|
|
1488
|
|
- if item.Type == 3 { //处理透前准备耗材数量数据
|
1489
|
|
- consumables, _ := service.FindHisConsumablesByID(item.UserOrgId, item.PatientId, item.RecordDate, item.ProjectId)
|
1490
|
|
- if consumables.ID > 0 {
|
1491
|
|
- consumables.Count = 0
|
1492
|
|
- service.UpdateConsumables(&consumables)
|
1493
|
1689
|
}
|
1494
|
1690
|
}
|
|
1691
|
+
|
|
1692
|
+ //if item.Type == 3 { //处理透前准备耗材数量数据
|
|
1693
|
+ // consumables, _ := service.FindHisConsumablesByID(item.UserOrgId, item.PatientId, item.RecordDate, item.ProjectId)
|
|
1694
|
+ // if consumables.ID > 0 {
|
|
1695
|
+ // consumables.Count = 0
|
|
1696
|
+ // service.UpdateConsumables(&consumables)
|
|
1697
|
+ // }
|
|
1698
|
+ //}
|
1495
|
1699
|
}
|
1496
|
1700
|
}
|
1497
|
1701
|
|
|
@@ -1503,6 +1707,224 @@ func (c *HisApiController) DeletePrescription() {
|
1503
|
1707
|
keyFive := strconv.FormatInt(item.UserOrgId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":his_advices_list_all"
|
1504
|
1708
|
redis.Set(keyFive, "", time.Second)
|
1505
|
1709
|
redis.Close()
|
|
1710
|
+
|
|
1711
|
+ //查询该药品是否存在出库记录
|
|
1712
|
+ info, errcode := service.GetDrugAutoWarehouseOutSeven(item.PatientId, item.AdviceDate, item.DrugId, item.ID)
|
|
1713
|
+
|
|
1714
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
1715
|
+
|
|
1716
|
+ } else if errcode == nil {
|
|
1717
|
+ if item.PrescribingNumberUnit == drug.MinUnit {
|
|
1718
|
+
|
|
1719
|
+ floatPrescrip := strconv.FormatFloat(item.PrescribingNumber, 'f', -1, 32)
|
|
1720
|
+ prescribingNumber, _ := strconv.ParseInt(floatPrescrip, 10, 64)
|
|
1721
|
+
|
|
1722
|
+ //退库
|
|
1723
|
+ warehouseInfo := models.DrugWarehouseInfo{
|
|
1724
|
+ StockMinNumber: prescribingNumber,
|
|
1725
|
+ }
|
|
1726
|
+
|
|
1727
|
+ service.UpdateDrugWarehouse(info.WarehouseInfoId, warehouseInfo)
|
|
1728
|
+
|
|
1729
|
+ adminUserInfo := c.GetAdminUserInfo()
|
|
1730
|
+ operation_time := time.Now().Unix()
|
|
1731
|
+ creater := adminUserInfo.AdminUser.Id
|
|
1732
|
+
|
|
1733
|
+ ctime := time.Now().Unix()
|
|
1734
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
1735
|
+ timeArr := strings.Split(timeStr, "-")
|
|
1736
|
+ total, _ := service.FindAllDrugCancelStockTotal(adminUserInfo.CurrentOrgId)
|
|
1737
|
+ total = total + 1
|
|
1738
|
+ orderNumber := "CKTKD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
|
1739
|
+
|
|
1740
|
+ cancelStock := models.DrugCancelStock{
|
|
1741
|
+ OrderNumber: orderNumber,
|
|
1742
|
+ OperaTime: operation_time,
|
|
1743
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
1744
|
+ Creater: creater,
|
|
1745
|
+ Ctime: ctime,
|
|
1746
|
+ Status: 1,
|
|
1747
|
+ ReturnTime: item.AdviceDate,
|
|
1748
|
+ Dealer: info.Dealer,
|
|
1749
|
+ Manufacturer: info.Manufacturer,
|
|
1750
|
+ Type: 1,
|
|
1751
|
+ }
|
|
1752
|
+ service.AddSigleDrugCancelStock(&cancelStock)
|
|
1753
|
+
|
|
1754
|
+ manufactureName, _ := service.GetManufactureById(info.Manufacturer)
|
|
1755
|
+ dealer, _ := service.GetDealerById(info.Dealer)
|
|
1756
|
+ cancelInfo, _ := service.GetLastDrugCancelStockById(adminUserInfo.CurrentOrgId)
|
|
1757
|
+ cancelStockInfo := models.DrugCancelStockInfo{
|
|
1758
|
+ OrderNumber: cancelInfo.OrderNumber,
|
|
1759
|
+ CancelStockId: cancelInfo.ID,
|
|
1760
|
+ DrugId: info.DrugId,
|
|
1761
|
+ Count: info.Count,
|
|
1762
|
+ Status: 1,
|
|
1763
|
+ Ctime: ctime,
|
|
1764
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
1765
|
+ Type: 1,
|
|
1766
|
+ Manufacturer: manufactureName.ManufacturerName,
|
|
1767
|
+ Dealer: dealer.DealerName,
|
|
1768
|
+ Total: 0,
|
|
1769
|
+ RetailPrice: info.RetailPrice,
|
|
1770
|
+ RetailTotalPrice: info.RetailTotalPrice,
|
|
1771
|
+ Price: info.Price,
|
|
1772
|
+ RegisterAccount: "",
|
|
1773
|
+ Remark: info.Remark,
|
|
1774
|
+ BatchNumber: info.BatchNumber,
|
|
1775
|
+ MaxUnit: info.CountUnit,
|
|
1776
|
+ ProductDate: info.ProductDate,
|
|
1777
|
+ ExpiryDate: info.ExpiryDate,
|
|
1778
|
+ BatchNumberId: info.WarehouseInfoId,
|
|
1779
|
+ }
|
|
1780
|
+
|
|
1781
|
+ flow := models.DrugFlow{
|
|
1782
|
+ WarehousingId: 0,
|
|
1783
|
+ DrugId: info.DrugId,
|
|
1784
|
+ Number: "",
|
|
1785
|
+ BatchNumber: info.BatchNumber,
|
|
1786
|
+ Count: info.Count,
|
|
1787
|
+ UserOrgId: adminUserInfo.CurrentOrgId,
|
|
1788
|
+ PatientId: 0,
|
|
1789
|
+ SystemTime: ctime,
|
|
1790
|
+ ConsumableType: 7,
|
|
1791
|
+ IsSys: 0,
|
|
1792
|
+ WarehousingOrder: "",
|
|
1793
|
+ WarehouseOutId: 0,
|
|
1794
|
+ WarehouseOutOrderNumber: "",
|
|
1795
|
+ IsEdit: 0,
|
|
1796
|
+ CancelStockId: cancelStock.ID,
|
|
1797
|
+ CancelOrderNumber: cancelStock.OrderNumber,
|
|
1798
|
+ Manufacturer: info.Manufacturer,
|
|
1799
|
+ Dealer: info.Dealer,
|
|
1800
|
+ Creator: adminUserInfo.AdminUser.Id,
|
|
1801
|
+ UpdateCreator: 0,
|
|
1802
|
+ Status: 1,
|
|
1803
|
+ Ctime: time.Now().Unix(),
|
|
1804
|
+ Mtime: 0,
|
|
1805
|
+ Price: info.Price,
|
|
1806
|
+ WarehousingDetailId: 0,
|
|
1807
|
+ WarehouseOutDetailId: 0,
|
|
1808
|
+ CancelOutDetailId: 0,
|
|
1809
|
+ ExpireDate: info.ExpiryDate,
|
|
1810
|
+ ProductDate: info.ProductDate,
|
|
1811
|
+ MaxUnit: info.CountUnit,
|
|
1812
|
+ MinUnit: "",
|
|
1813
|
+ }
|
|
1814
|
+ service.CreatedCancelStock(cancelStockInfo)
|
|
1815
|
+ service.CreateDrugFlowOne(flow)
|
|
1816
|
+
|
|
1817
|
+ //删除出库记录
|
|
1818
|
+ service.UpdateDrugFlowSeven(info.PatientId, info.SysRecordTime, info.DrugId, item.ID)
|
|
1819
|
+ //删除流水
|
|
1820
|
+ service.UpdateDrugFlowTens(info.PatientId, info.WarehouseOutOrderNumber, info.DrugId, item.ID)
|
|
1821
|
+ } else {
|
|
1822
|
+ floatPrescrip := strconv.FormatFloat(item.PrescribingNumber, 'f', -1, 32)
|
|
1823
|
+
|
|
1824
|
+ prescribingNumber, _ := strconv.ParseInt(floatPrescrip, 10, 64)
|
|
1825
|
+
|
|
1826
|
+ if item.PrescribingNumberUnit == drug.MaxUnit {
|
|
1827
|
+ warehouseInfo := models.DrugWarehouseInfo{
|
|
1828
|
+ StockMaxNumber: prescribingNumber,
|
|
1829
|
+ }
|
|
1830
|
+ service.UpdateDrugWarehouseOne(info.WarehouseInfoId, warehouseInfo)
|
|
1831
|
+
|
|
1832
|
+ }
|
|
1833
|
+
|
|
1834
|
+ adminUserInfo := c.GetAdminUserInfo()
|
|
1835
|
+ operation_time := time.Now().Unix()
|
|
1836
|
+ creater := adminUserInfo.AdminUser.Id
|
|
1837
|
+
|
|
1838
|
+ ctime := time.Now().Unix()
|
|
1839
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
1840
|
+ timeArr := strings.Split(timeStr, "-")
|
|
1841
|
+ total, _ := service.FindAllDrugCancelStockTotal(adminUserInfo.CurrentOrgId)
|
|
1842
|
+ total = total + 1
|
|
1843
|
+ orderNumber := "CKTKD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
|
1844
|
+
|
|
1845
|
+ cancelStock := models.DrugCancelStock{
|
|
1846
|
+ OrderNumber: orderNumber,
|
|
1847
|
+ OperaTime: operation_time,
|
|
1848
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
1849
|
+ Creater: creater,
|
|
1850
|
+ Ctime: ctime,
|
|
1851
|
+ Status: 1,
|
|
1852
|
+ ReturnTime: item.AdviceDate,
|
|
1853
|
+ Dealer: info.Dealer,
|
|
1854
|
+ Manufacturer: info.Manufacturer,
|
|
1855
|
+ Type: 1,
|
|
1856
|
+ }
|
|
1857
|
+ service.AddSigleDrugCancelStock(&cancelStock)
|
|
1858
|
+
|
|
1859
|
+ manufactureName, _ := service.GetManufactureById(info.Manufacturer)
|
|
1860
|
+ dealer, _ := service.GetDealerById(info.Dealer)
|
|
1861
|
+ cancelInfo, _ := service.GetLastDrugCancelStockById(adminUserInfo.CurrentOrgId)
|
|
1862
|
+ cancelStockInfo := models.DrugCancelStockInfo{
|
|
1863
|
+ OrderNumber: cancelInfo.OrderNumber,
|
|
1864
|
+ CancelStockId: cancelInfo.ID,
|
|
1865
|
+ DrugId: info.DrugId,
|
|
1866
|
+ Count: info.Count,
|
|
1867
|
+ Status: 1,
|
|
1868
|
+ Ctime: ctime,
|
|
1869
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
1870
|
+ Type: 1,
|
|
1871
|
+ Manufacturer: manufactureName.ManufacturerName,
|
|
1872
|
+ Dealer: dealer.DealerName,
|
|
1873
|
+ Total: 0,
|
|
1874
|
+ RetailPrice: info.RetailPrice,
|
|
1875
|
+ RetailTotalPrice: info.RetailTotalPrice,
|
|
1876
|
+ Price: info.Price,
|
|
1877
|
+ RegisterAccount: "",
|
|
1878
|
+ Remark: info.Remark,
|
|
1879
|
+ BatchNumber: info.BatchNumber,
|
|
1880
|
+ MaxUnit: info.CountUnit,
|
|
1881
|
+ ProductDate: info.ProductDate,
|
|
1882
|
+ ExpiryDate: info.ExpiryDate,
|
|
1883
|
+ BatchNumberId: info.WarehouseInfoId,
|
|
1884
|
+ }
|
|
1885
|
+
|
|
1886
|
+ flow := models.DrugFlow{
|
|
1887
|
+ WarehousingId: 0,
|
|
1888
|
+ DrugId: info.DrugId,
|
|
1889
|
+ Number: "",
|
|
1890
|
+ BatchNumber: info.BatchNumber,
|
|
1891
|
+ Count: info.Count,
|
|
1892
|
+ UserOrgId: adminUserInfo.CurrentOrgId,
|
|
1893
|
+ PatientId: 0,
|
|
1894
|
+ SystemTime: ctime,
|
|
1895
|
+ ConsumableType: 7,
|
|
1896
|
+ IsSys: 0,
|
|
1897
|
+ WarehousingOrder: "",
|
|
1898
|
+ WarehouseOutId: 0,
|
|
1899
|
+ WarehouseOutOrderNumber: "",
|
|
1900
|
+ IsEdit: 0,
|
|
1901
|
+ CancelStockId: cancelStock.ID,
|
|
1902
|
+ CancelOrderNumber: cancelStock.OrderNumber,
|
|
1903
|
+ Manufacturer: info.Manufacturer,
|
|
1904
|
+ Dealer: info.Dealer,
|
|
1905
|
+ Creator: adminUserInfo.AdminUser.Id,
|
|
1906
|
+ UpdateCreator: 0,
|
|
1907
|
+ Status: 1,
|
|
1908
|
+ Ctime: time.Now().Unix(),
|
|
1909
|
+ Mtime: 0,
|
|
1910
|
+ Price: info.Price,
|
|
1911
|
+ WarehousingDetailId: 0,
|
|
1912
|
+ WarehouseOutDetailId: 0,
|
|
1913
|
+ CancelOutDetailId: 0,
|
|
1914
|
+ ExpireDate: info.ExpiryDate,
|
|
1915
|
+ ProductDate: info.ProductDate,
|
|
1916
|
+ MaxUnit: info.CountUnit,
|
|
1917
|
+ MinUnit: "",
|
|
1918
|
+ }
|
|
1919
|
+ service.CreatedCancelStock(cancelStockInfo)
|
|
1920
|
+ service.CreateDrugFlowOne(flow)
|
|
1921
|
+ //删除出库记录
|
|
1922
|
+ service.UpdateDrugFlowSeven(info.PatientId, info.SysRecordTime, info.DrugId, item.ID)
|
|
1923
|
+ //删除流水
|
|
1924
|
+ service.UpdateDrugFlowTens(info.PatientId, info.WarehouseOutOrderNumber, info.DrugId, item.ID)
|
|
1925
|
+ }
|
|
1926
|
+ }
|
|
1927
|
+
|
1506
|
1928
|
if item.PrescribingNumberUnit == drug.MinUnit {
|
1507
|
1929
|
drug.Total = drug.Total + item.PrescribingNumber
|
1508
|
1930
|
service.UpdateBaseDrugLib(&drug)
|
|
@@ -1513,6 +1935,7 @@ func (c *HisApiController) DeletePrescription() {
|
1513
|
1935
|
service.UpdateBaseDrugLib(&drug)
|
1514
|
1936
|
}
|
1515
|
1937
|
}
|
|
1938
|
+
|
1516
|
1939
|
}
|
1517
|
1940
|
}
|
1518
|
1941
|
}
|
|
@@ -1536,13 +1959,17 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
1536
|
1959
|
redis := service.RedisClient()
|
1537
|
1960
|
keyFive := strconv.FormatInt(advice.UserOrgId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":his_advices_list_all"
|
1538
|
1961
|
redis.Set(keyFive, "", time.Second)
|
|
1962
|
+ keyOne := strconv.FormatInt(advice.UserOrgId, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":his_doctor_advice"
|
|
1963
|
+ redis.Set(keyOne, "", time.Second)
|
|
1964
|
+
|
1539
|
1965
|
redis.Close()
|
1540
|
1966
|
if err == nil {
|
1541
|
1967
|
if drugStockConfig.IsOpen == 1 {
|
1542
|
1968
|
//判断该医嘱是否执行了
|
1543
|
1969
|
if advice.ExecutionState == 1 {
|
|
1970
|
+ fmt.Println("advice_id23323232323233232323233223322323", advice.ID)
|
1544
|
1971
|
//查询该病人该药品是否有库存记录
|
1545
|
|
- info, errcode := service.GetDrugAutoWarehouseOut(advice.PatientId, advice.AdviceDate, advice.DrugId)
|
|
1972
|
+ info, errcode := service.GetDrugAutoWarehouseOutSeven(advice.PatientId, advice.AdviceDate, advice.DrugId, advice.ID)
|
1546
|
1973
|
if errcode == gorm.ErrRecordNotFound {
|
1547
|
1974
|
|
1548
|
1975
|
} else {
|
|
@@ -1621,7 +2048,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
1621
|
2048
|
UserOrgId: adminUserInfo.CurrentOrgId,
|
1622
|
2049
|
PatientId: 0,
|
1623
|
2050
|
SystemTime: ctime,
|
1624
|
|
- ConsumableType: 4,
|
|
2051
|
+ ConsumableType: 7,
|
1625
|
2052
|
IsSys: 0,
|
1626
|
2053
|
WarehousingOrder: "",
|
1627
|
2054
|
WarehouseOutId: 0,
|
|
@@ -1647,20 +2074,25 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
1647
|
2074
|
}
|
1648
|
2075
|
service.CreatedCancelStock(cancelStockInfo)
|
1649
|
2076
|
service.CreateDrugFlowOne(flow)
|
|
2077
|
+
|
|
2078
|
+ //删除出库记录
|
|
2079
|
+ service.UpdateDrugFlowSeven(info.PatientId, info.SysRecordTime, info.DrugId, advice.ID)
|
|
2080
|
+ //删除流水
|
|
2081
|
+ service.UpdateDrugFlowTens(info.PatientId, info.WarehouseOutOrderNumber, info.DrugId, advice.ID)
|
1650
|
2082
|
} else {
|
1651
|
2083
|
|
1652
|
2084
|
floatPrescrip := strconv.FormatFloat(advice.PrescribingNumber, 'f', -1, 32)
|
1653
|
2085
|
|
1654
|
2086
|
prescribingNumber, _ := strconv.ParseInt(floatPrescrip, 10, 64)
|
1655
|
2087
|
|
1656
|
|
- fmt.Println("PrescribingNumber", prescribingNumber)
|
1657
|
2088
|
if advice.PrescribingNumberUnit == drug.MaxUnit {
|
1658
|
2089
|
warehouseInfo := models.DrugWarehouseInfo{
|
1659
|
|
- StockMinNumber: prescribingNumber,
|
|
2090
|
+ StockMaxNumber: prescribingNumber,
|
1660
|
2091
|
}
|
1661
|
2092
|
service.UpdateDrugWarehouseOne(info.WarehouseInfoId, warehouseInfo)
|
1662
|
2093
|
|
1663
|
2094
|
}
|
|
2095
|
+
|
1664
|
2096
|
adminUserInfo := c.GetAdminUserInfo()
|
1665
|
2097
|
operation_time := time.Now().Unix()
|
1666
|
2098
|
creater := adminUserInfo.AdminUser.Id
|
|
@@ -1722,7 +2154,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
1722
|
2154
|
UserOrgId: adminUserInfo.CurrentOrgId,
|
1723
|
2155
|
PatientId: 0,
|
1724
|
2156
|
SystemTime: ctime,
|
1725
|
|
- ConsumableType: 4,
|
|
2157
|
+ ConsumableType: 7,
|
1726
|
2158
|
IsSys: 0,
|
1727
|
2159
|
WarehousingOrder: "",
|
1728
|
2160
|
WarehouseOutId: 0,
|
|
@@ -1748,6 +2180,11 @@ func (c *HisApiController) DeleteDoctorAdvice() {
|
1748
|
2180
|
}
|
1749
|
2181
|
service.CreatedCancelStock(cancelStockInfo)
|
1750
|
2182
|
service.CreateDrugFlowOne(flow)
|
|
2183
|
+ //删除出库记录
|
|
2184
|
+ service.UpdateDrugFlowSeven(info.PatientId, info.SysRecordTime, info.DrugId, advice.ID)
|
|
2185
|
+ //删除流水
|
|
2186
|
+ service.UpdateDrugFlowTens(info.PatientId, info.WarehouseOutOrderNumber, info.DrugId, advice.ID)
|
|
2187
|
+
|
1751
|
2188
|
}
|
1752
|
2189
|
}
|
1753
|
2190
|
}
|
|
@@ -1768,12 +2205,12 @@ func (c *HisApiController) DeleteProject() {
|
1768
|
2205
|
id, _ := c.GetInt64("id")
|
1769
|
2206
|
adminInfo := c.GetAdminUserInfo()
|
1770
|
2207
|
project, _ := service.GetHisProjectByID(id)
|
1771
|
|
- var consumable models.DialysisBeforePrepare
|
|
2208
|
+ // var consumable models.DialysisBeforePrepare
|
1772
|
2209
|
_, stockConfig := service.FindAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
|
1773
|
2210
|
|
1774
|
|
- if project.ID > 0 && project.Type == 3 {
|
1775
|
|
- consumable, _ = service.FindHisConsumablesByID(adminInfo.CurrentOrgId, project.PatientId, project.RecordDate, project.ProjectId)
|
1776
|
|
- }
|
|
2211
|
+ //if project.ID > 0 && project.Type == 3 {
|
|
2212
|
+ // consumable, _ = service.FindHisConsumablesByID(adminInfo.CurrentOrgId, project.PatientId, project.RecordDate, project.ProjectId)
|
|
2213
|
+ //}
|
1777
|
2214
|
err := service.DelelteProject(id, c.GetAdminUserInfo().CurrentOrgId)
|
1778
|
2215
|
if err == nil {
|
1779
|
2216
|
service.DeletePrintInfo(id)
|
|
@@ -1787,12 +2224,110 @@ func (c *HisApiController) DeleteProject() {
|
1787
|
2224
|
f_count, _ := strconv.ParseFloat(project.Count, 64)
|
1788
|
2225
|
good.Total = good.Total + f_count
|
1789
|
2226
|
service.UpdateGoodInfo(&good)
|
|
2227
|
+
|
|
2228
|
+ operation_time := time.Now().Unix()
|
|
2229
|
+ creater := adminInfo.AdminUser.Id
|
|
2230
|
+ //创建退库单
|
|
2231
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
2232
|
+ timeArr := strings.Split(timeStr, "-")
|
|
2233
|
+ total, _ := service.FindAllCancelStockTotal(adminInfo.CurrentOrgId)
|
|
2234
|
+ total = total + 1
|
|
2235
|
+ orderNumber := "CKTKD" + strconv.FormatInt(adminInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
|
2236
|
+
|
|
2237
|
+ cancelStock := models.CancelStock{
|
|
2238
|
+ OrderNumber: orderNumber,
|
|
2239
|
+ OperaTime: operation_time,
|
|
2240
|
+ OrgId: adminInfo.CurrentOrgId,
|
|
2241
|
+ Creater: creater,
|
|
2242
|
+ Ctime: time.Now().Unix(),
|
|
2243
|
+ Status: 1,
|
|
2244
|
+ ReturnTime: project.RecordDate,
|
|
2245
|
+ Type: 1,
|
|
2246
|
+ }
|
|
2247
|
+ _, msgerrkonde := service.GetCancelStockDetailByOrderNumberOne(project.RecordDate, adminInfo.CurrentOrgId)
|
|
2248
|
+ if msgerrkonde == gorm.ErrRecordNotFound {
|
|
2249
|
+ service.AddSigleCancelStock(&cancelStock)
|
|
2250
|
+ }
|
|
2251
|
+ cancel, _ := service.GetLastCancelStockById(adminInfo.CurrentOrgId)
|
|
2252
|
+ floatPrescrip := strconv.FormatFloat(f_count, 'f', -1, 32)
|
|
2253
|
+ prescribingNumber, _ := strconv.ParseInt(floatPrescrip, 10, 64)
|
|
2254
|
+ //获取该耗材有库存的第一条数据
|
|
2255
|
+ info, _ := service.GetLastWarehoseByGoodId(project.ProjectId, project.PatientId, project.RecordDate)
|
|
2256
|
+
|
|
2257
|
+ manufacturer, _ := service.GetManufactureById(info.Manufacturer)
|
|
2258
|
+ deaerler, _ := service.GetDealerById(info.Dealer)
|
|
2259
|
+ if info.ID > 0 {
|
|
2260
|
+ cancelStockInfo := models.CancelStockInfo{
|
|
2261
|
+ GoodId: project.ProjectId,
|
|
2262
|
+ CancelStockId: cancel.ID,
|
|
2263
|
+ GoodTypeId: info.GoodTypeId,
|
|
2264
|
+ Count: prescribingNumber,
|
|
2265
|
+ Price: info.Price,
|
|
2266
|
+ Total: 0,
|
|
2267
|
+ ProductDate: info.ProductDate,
|
|
2268
|
+ ExpiryDate: info.ExpiryDate,
|
|
2269
|
+ Ctime: time.Now().Unix(),
|
|
2270
|
+ Status: 1,
|
|
2271
|
+ OrgId: adminInfo.CurrentOrgId,
|
|
2272
|
+ OrderNumber: cancel.OrderNumber,
|
|
2273
|
+ Type: 0,
|
|
2274
|
+ Dealer: deaerler.DealerName,
|
|
2275
|
+ Manufacturer: manufacturer.ManufacturerName,
|
|
2276
|
+ Number: info.Number,
|
|
2277
|
+ RegisterAccount: "",
|
|
2278
|
+ Remark: "",
|
|
2279
|
+ WarehouseInfoId: info.WarehouseInfotId,
|
|
2280
|
+ }
|
|
2281
|
+
|
|
2282
|
+ service.CreateCancelStockInfoOne(&cancelStockInfo)
|
|
2283
|
+
|
|
2284
|
+ cancelInfo, _ := service.GetLastCancelStockInfoByGoodId(project.ProjectId)
|
|
2285
|
+
|
|
2286
|
+ flow := models.VmStockFlow{
|
|
2287
|
+ WarehousingId: 0,
|
|
2288
|
+ GoodId: project.ProjectId,
|
|
2289
|
+ Number: info.Number,
|
|
2290
|
+ LicenseNumber: info.LicenseNumber,
|
|
2291
|
+ Count: prescribingNumber,
|
|
2292
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
2293
|
+ PatientId: project.PatientId,
|
|
2294
|
+ SystemTime: time.Now().Unix(),
|
|
2295
|
+ ConsumableType: 7,
|
|
2296
|
+ IsSys: 0,
|
|
2297
|
+ WarehousingOrder: "",
|
|
2298
|
+ WarehouseOutId: 0,
|
|
2299
|
+ WarehouseOutOrderNumber: "",
|
|
2300
|
+ IsEdit: 0,
|
|
2301
|
+ CancelStockId: cancel.ID,
|
|
2302
|
+ CancelOrderNumber: cancel.OrderNumber,
|
|
2303
|
+ Manufacturer: manufacturer.ID,
|
|
2304
|
+ Dealer: 0,
|
|
2305
|
+ Creator: adminInfo.AdminUser.Id,
|
|
2306
|
+ UpdateCreator: 0,
|
|
2307
|
+ Status: 1,
|
|
2308
|
+ Ctime: time.Now().Unix(),
|
|
2309
|
+ Mtime: 0,
|
|
2310
|
+ Price: info.Price,
|
|
2311
|
+ WarehousingDetailId: info.WarehouseInfotId,
|
|
2312
|
+ WarehouseOutDetailId: 0,
|
|
2313
|
+ CancelOutDetailId: cancelInfo.ID,
|
|
2314
|
+ ProductDate: info.ProductDate,
|
|
2315
|
+ ExpireDate: info.ExpiryDate,
|
|
2316
|
+ }
|
|
2317
|
+ service.CreateStockFlowOne(flow)
|
|
2318
|
+
|
|
2319
|
+ //删除出库表
|
|
2320
|
+ service.DeleteAutoRedeceDetailTen(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId)
|
|
2321
|
+
|
|
2322
|
+ //回退库存
|
|
2323
|
+ service.UpDateWarehouseInfoByStockDelete(info.WarehouseInfotId, prescribingNumber)
|
|
2324
|
+ }
|
1790
|
2325
|
}
|
1791
|
2326
|
}
|
1792
|
|
- if consumable.ID > 0 {
|
1793
|
|
- consumable.Count = 0
|
1794
|
|
- service.UpdateConsumables(&consumable)
|
1795
|
|
- }
|
|
2327
|
+ //if consumable.ID > 0 {
|
|
2328
|
+ // consumable.Count = 0
|
|
2329
|
+ // service.UpdateConsumables(&consumable)
|
|
2330
|
+ //}
|
1796
|
2331
|
|
1797
|
2332
|
c.ServeSuccessJSON(map[string]interface{}{
|
1798
|
2333
|
"msg": "删除成功",
|
|
@@ -6067,3 +6602,13 @@ func DeleteDrugWarehosueInfo(advice models.HisDoctorAdviceInfo) (err error) {
|
6067
|
6602
|
}
|
6068
|
6603
|
return err
|
6069
|
6604
|
}
|
|
6605
|
+
|
|
6606
|
+func (c *HisApiController) GetHisDoctorAdviceInfo() {
|
|
6607
|
+
|
|
6608
|
+ id, _ := c.GetInt64("id")
|
|
6609
|
+ advice, _ := service.GetHisDoctorAdviceInfo(id)
|
|
6610
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
6611
|
+ "advice": advice,
|
|
6612
|
+ })
|
|
6613
|
+ return
|
|
6614
|
+}
|