|
@@ -6,6 +6,8 @@ import (
|
6
|
6
|
"XT_New/service"
|
7
|
7
|
"XT_New/utils"
|
8
|
8
|
"encoding/json"
|
|
9
|
+ "github.com/jinzhu/gorm"
|
|
10
|
+
|
9
|
11
|
//"github.com/jinzhu/gorm"
|
10
|
12
|
"math"
|
11
|
13
|
"math/rand"
|
|
@@ -1881,9 +1883,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
1881
|
1883
|
|
1882
|
1884
|
theTimes := theTime.Format("2006-01-02")
|
1883
|
1885
|
|
1884
|
|
- fmt.Println("theTIME", theTime)
|
1885
|
1886
|
keyFour := "scheduals_" + theTimes + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
|
1886
|
|
- fmt.Println("keyFour323223323232323232", keyFour)
|
|
1887
|
+
|
1887
|
1888
|
redis.Set(keyFour, "", time.Second)
|
1888
|
1889
|
keyFive := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":his_advices_list_all"
|
1889
|
1890
|
redis.Set(keyFive, "", time.Second)
|
|
@@ -1904,7 +1905,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
1904
|
1905
|
|
1905
|
1906
|
fmt.Println("theTIME", theTime)
|
1906
|
1907
|
keyFour := "scheduals_" + theTimes + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
|
1907
|
|
- fmt.Println("keyFour323223323232323232", keyFour)
|
|
1908
|
+
|
1908
|
1909
|
redis.Set(keyFour, "", time.Second)
|
1909
|
1910
|
keyFive := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":his_advices_list_all"
|
1910
|
1911
|
redis.Set(keyFive, "", time.Second)
|
|
@@ -1927,7 +1928,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
1927
|
1928
|
|
1928
|
1929
|
//药品管理信息
|
1929
|
1930
|
_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(adminUserInfo.CurrentOrgId)
|
1930
|
|
- fmt.Println("000000000000000000000000000000000000", drugStockConfig.IsOpen)
|
|
1931
|
+
|
1931
|
1932
|
if drugStockConfig.IsOpen == 1 {
|
1932
|
1933
|
//查询已经执行的医嘱
|
1933
|
1934
|
advices, _ := service.GetHisExecutionDoctors(adminUserInfo.CurrentOrgId, patient, id)
|
|
@@ -1947,9 +1948,9 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
1947
|
1948
|
total = list.Count*medical.MinNumber + list.StockMinNumber
|
1948
|
1949
|
prescribing_number_total = count * medical.MinNumber
|
1949
|
1950
|
}
|
1950
|
|
- fmt.Println("单位1", medical.MinUnit)
|
1951
|
|
- fmt.Println("d单位23", advice.PrescribingNumberUnit)
|
1952
|
|
- fmt.Println("hhhhhhh", list.Count)
|
|
1951
|
+ //fmt.Println("单位1", medical.MinUnit)
|
|
1952
|
+ //fmt.Println("d单位23", advice.PrescribingNumberUnit)
|
|
1953
|
+ //fmt.Println("hhhhhhh", list.Count)
|
1953
|
1954
|
if medical.MinUnit == advice.PrescribingNumberUnit {
|
1954
|
1955
|
prescribingNumber_temp := strconv.FormatFloat(math.Abs(advice.PrescribingNumber), 'f', 0, 64)
|
1955
|
1956
|
count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
|
|
@@ -1959,8 +1960,48 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
1959
|
1960
|
|
1960
|
1961
|
}
|
1961
|
1962
|
|
1962
|
|
- fmt.Println("数量一", prescribing_number_total)
|
1963
|
|
- fmt.Println("数量二", total)
|
|
1963
|
+ //fmt.Println("要出库的数量", prescribing_number_total)
|
|
1964
|
+ //fmt.Println("库存", total)
|
|
1965
|
+
|
|
1966
|
+ //查询该药品的医嘱记录
|
|
1967
|
+ //advicelist, _ := service.GetHisAdviceListByDrugId(advice.DrugId, advice.PatientId, advice.AdviceDate)
|
|
1968
|
+ //
|
|
1969
|
+ //if(advicelist.ID > 0){
|
|
1970
|
+ // //获取上一次的出库记录
|
|
1971
|
+ // record, _ := service.GetDrugAutoReduceRecordOne(advice.DrugId, advice.PatientId, advice.AdviceDate)
|
|
1972
|
+ // var out_count int64
|
|
1973
|
+ // for _, res := range record {
|
|
1974
|
+ // if(res.CountUnit == medical.MaxUnit){
|
|
1975
|
+ // res.Count = res.Count * medical.MinNumber
|
|
1976
|
+ // }
|
|
1977
|
+ // if(res.CountUnit == medical.MinUnit){
|
|
1978
|
+ // res.Count = res.Count
|
|
1979
|
+ // }
|
|
1980
|
+ // out_count += res.Count
|
|
1981
|
+ // }
|
|
1982
|
+ // fmt.Println("上次",out_count)
|
|
1983
|
+ // fmt.Println("这次出库",prescribing_number_total)
|
|
1984
|
+ // fmt.Println("总库存",total)
|
|
1985
|
+ // fmt.Println("差2332332323232232323",prescribing_number_total - out_count)
|
|
1986
|
+ // //判断库存
|
|
1987
|
+ // if((prescribing_number_total - out_count) > 0){
|
|
1988
|
+ //
|
|
1989
|
+ // if((prescribing_number_total - out_count) > total){
|
|
1990
|
+ // c.ServeSuccessJSON(map[string]interface{}{
|
|
1991
|
+ // "msg": "2",
|
|
1992
|
+ // "advice": advice,
|
|
1993
|
+ // })
|
|
1994
|
+ // return
|
|
1995
|
+ // }else{
|
|
1996
|
+ // service.HisDrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
|
|
1997
|
+ // break
|
|
1998
|
+ // }
|
|
1999
|
+ // }else{
|
|
2000
|
+ // service.HisDrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
|
|
2001
|
+ // break
|
|
2002
|
+ // }
|
|
2003
|
+ //
|
|
2004
|
+ //}
|
1964
|
2005
|
|
1965
|
2006
|
if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
|
1966
|
2007
|
c.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -1985,6 +2026,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
1985
|
2026
|
})
|
1986
|
2027
|
return
|
1987
|
2028
|
}
|
|
2029
|
+
|
1988
|
2030
|
}
|
1989
|
2031
|
|
1990
|
2032
|
}
|
|
@@ -4047,18 +4089,34 @@ func (c *PatientApiController) GetRemindPatientList() {
|
4047
|
4089
|
page, _ := c.GetInt64("page", 1)
|
4048
|
4090
|
limit, _ := c.GetInt64("limit", 10)
|
4049
|
4091
|
adminUserInfo := c.GetAdminUserInfo()
|
4050
|
|
- total, patients, err := service.GetAllWaitRemindPatient(adminUserInfo.CurrentOrgId, page, limit)
|
|
4092
|
+ total, patients, _ := service.GetAllWaitRemindPatient(adminUserInfo.CurrentOrgId, page, limit)
|
4051
|
4093
|
|
4052
|
|
- if err != nil {
|
4053
|
|
- utils.ErrorLog(err.Error())
|
4054
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
4055
|
|
- return
|
|
4094
|
+ _, errcode := service.GetOrgFollowIsExist(c.GetAdminUserInfo().CurrentOrgId)
|
|
4095
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
4096
|
+ information, err := service.GetAdminUserRoleInformation(0)
|
|
4097
|
+ if err != nil {
|
|
4098
|
+ utils.ErrorLog(err.Error())
|
|
4099
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
4100
|
+ return
|
|
4101
|
+ }
|
|
4102
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
4103
|
+ "total": total,
|
|
4104
|
+ "patients": patients,
|
|
4105
|
+ "information": information,
|
|
4106
|
+ })
|
|
4107
|
+ } else if errcode == nil {
|
|
4108
|
+ information, err := service.GetAdminUserRoleInformation(0)
|
|
4109
|
+ if err != nil {
|
|
4110
|
+ utils.ErrorLog(err.Error())
|
|
4111
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
4112
|
+ return
|
|
4113
|
+ }
|
|
4114
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
4115
|
+ "total": total,
|
|
4116
|
+ "patients": patients,
|
|
4117
|
+ "information": information,
|
|
4118
|
+ })
|
4056
|
4119
|
}
|
4057
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
4058
|
|
- "total": total,
|
4059
|
|
- "patients": patients,
|
4060
|
|
- })
|
4061
|
|
-
|
4062
|
4120
|
}
|
4063
|
4121
|
|
4064
|
4122
|
func (c *PatientApiController) PostIsOpenRemind() {
|